The Operation procedure execute the phase that make up the unit procedure.
NOTE: Phase aliases must be redirected from the default PH_APIs to the phase interface iPHs in order to use them with unit/operation procedures.
Programming the Procedure requires these 4+ rungs:
Examine all starting permissives and set the .Perm tag
Seal in the master .Mstr when start is pressed; cancel when stopped, aborted or tripped.
OK to Start
The initial step is 0 which should validate everything and request Advance to start. Latching the .StateCplt tag is how the firmware knows to advance to the next state.
The state step is in 5 branches (parts):
Branch 1 – Acquire
After verifying this is the active state step check to make sure the sequence is in Auto or Semi-Auto and not paused. Then if acquire the necessary phases by calling the PH_ACQUIRE AOI. Once all phases are acquired seal in the .Sacqrd.n tag where n is the state number. Note that the 1st state step is 10. State steps increment by 10. The PH_ACQUIRE has 2 options: AutoRelease and StopPhase.
AutoRelease: When true will cause the phase to Stop, Reset and be Released before going to the next state. If this is not true then you must also provide that logic. This should be false when doing a transition of control up and until the final phase is used.
Stop Phase: When true will stop a running phase before starting it otherwise a phase error will be raised. The phase cannot be stopped if it is acquired by another procedure regardless of this option.
Branch 2 – Apply Parameters
Parameters are applied with the PH_PARAM AOI after the phase is acquired. This should be called continuously if you want to all the user to change the run time parameters. This AOI only allows the 1st 2 CP of the phase to be set. If there are others then they need to be handled manually or an expanded AOI needs to be created.
Branch 3 – Start Phases
Wait until the PH_PARAM AOI is done, .DN, which means that the parameters have been written and confirmed. Then Start the phases using the CMD_SET AOI. You may add additional logic to sequence the phases on if they are dependent on each other.
Branch 4 – Report
Report back any desired phase parameters to the Unit Procedure report parameters with a simple move.
Branch 5 – Complete
The final branch looks for the phase(s) to be complete and then sets the .StateCplt tag to inform the firmware to advance to the next state. Abnormal completions, such as stop or abort, must also be check and latch the .WaitAdv tag to display the Advance button and wait for the .Advance signal before setting the .StateCplt. A message may also be displayed to inform the user of the abnormal completion using the .SubMsg.
The state steps are repeated for each step of the procedure, each time incrementing the initial check by 10.
Here is an example of using a timer within a step. Note each step has a timer reserved for it in the UNIT_PROC UDT but unused timers may be combined on other steps. This includes the rounded time value in the phase message area via the .SubMsg tag.