NAMUR
5.7 Modes and States
to preempt the solvent charge in progress, obtain what it needs, and return control to the charge in progress. Other examples require that the batch in progress be pumped to storage so that the preempting batch may use that unit.
In the discussion that follows, modes and states are applied to basic control instead of equipment entities and to procedural control instead of procedural elements.
5.7.1 Modes
88.01 does not define the behavior of modes or limit their number. The intent is to define the names of two or three common modes and provide examples of how they have been used in practice. The users in SP88 wanted standard mode behavior, but the vendors had user bases to protect. Even the method for selecting a mode differs among vendors.
If the mode of a controller is automatic, then the controller may change its mode as required by conditions. If the mode is manual, then the controller is not allowed to change to an automatic mode.
Basic Control
Basic control has at least two modes: automatic and manual. Other modes will be present if the controller can be set by another controller or a remote computer.
Modes select the behaviors of basic control. Automatic mode causes outputs to the equipment to be determined by the control algorithm. Manual mode causes outputs to hold their last values.
Modes also select the commands that will be accepted by a controller. Automatic mode causes control to accept only commands to change the setpoint or mode.
Manual mode adds the possibility of changing the output.
Basic control logic may be used to propagate a mode change to other associated con- trollers. This makes it possible to lock a set of controllers into automatic mode if one controller is set to automatic. A set of controllers may be locked or unlocked by pro- cedural control, so that the mode of procedural control may be propagated to basic control. Other logic signals, like interlocks, may affect modes as well as states.
The examples so far have been specific, but they are a small subset of the behaviors that a mode can select in different kinds of basic control. It pays to read the manual of an unfamiliar device.
Procedural Control
This type of control requires a control entity that executes procedural elements according to the active paths in the procedure. One way to choose a path is by transi- tion conditions such as “procedural element complete,” meaning that the procedure defined by the element is done. When a transition condition associated with an active procedural element is true, then the next procedural element in the path is started and the previous element becomes inactive. This is commonly expressed with a Sequential Function Chart (SFC), as specified in IEC 60848 or 61131.3.
The procedural modes, with example behavior and command limitations, follow:
• Automatic—Active and true transitions cause a change from one procedural ele- ment to the next. An operator can not force a transition to be true.
• Semiautomatic—Active and true transitions do not cause a change. An operator may be able to enable a change or may be able to turn off the active element and turn on another somewhere else in the path. Direct control of the elements can cause serious problems if the operator did not understand all of the training.
• Manual—Active and true transitions do not cause a change. An operator can force transitions to be true. When a transition is forced, it forces a change to the next active element. Direct control of the elements may be possible.
Again, these are examples of a wider range of possible behaviors. You will find proce- dural control that replaces Semi-automatic with Single Step mode. Transitions do not cause a change until the Start command is given. Some people call Hold a mode.
Hold causes active elements to go to a safe state right now. Single and Semi modes wait for active elements to finish. SP88 treated Hold as a state, as discussed below.
5.7.2 States
Basic control and procedural control may have states. A control state defines the desired condition of an equipment entity. States are changed by commands or by the completion of a process function. Each control state has an algorithm that runs while the state is active. The algorithm is independent of other states’ algorithms, but may depend upon other states to set up the conditions for it to run properly. In the drill press example, the Drilling state will fail to perform its function if previous states did not include Running and Lowering.
The entity that causes states to change along directed paths and executes the active state algorithms is usually modeled as a finite state machine. The machine has states, transitions, transition conditions, paths, inputs, outputs, and commands. Each state has one entrance path and one exit path that leads to one or more transitions. There is only one transition that controls the path between two states. The active state may have several algorithms, but only one of them is active. The algorithm may use a subset of inputs or simply set the outputs. The outputs are a subset of all of the machine’s outputs. The transition condition is either true or false. Its value may be calculated from a subset of inputs and commands. If the state that precedes the tran- sition is active and the transition condition is true, then the preceding state becomes inactive and the following state becomes active. More than one state may be active in the machine at one time on parallel paths. More detail may be found in IEC 60848, which standardizes the rules for an SFC.
Basic Control
Figure 9-1a shows the two most simple basic control states with an SFC.
Figure 9-1a Simple Basic Control
The figure shows the control function for a simple switch. There are only two states, On and Off. There are just two commands, ON and OFF. The double box that con- tains Off shows that this is the initial condition that will be used when the sequence controller starts up. If the ON command becomes true then the state will transition from Off to On. Further ON commands will be ignored because the state above the transition is no longer active. The OFF command will transition the state from On to Off. An arrowhead is shown on this path to show that the path is not in the default downward direction. This example is shown primarily to show how the SFC works.
Figure 9-1b Transfer Header
Figure 9-1b shows a simple sequence for a transfer header from one unit to one of three destinations. The header is clean and closed when the state machine is in the Idle state.
The command OPEN A or OPEN B or OPEN C will transition the state from Idle to the state matching the first command received. After the transition, the Idle state is inactive, and the commands are disabled. If the commands are simultaneous, they are evaluated from left to right and the first one wins. If OPEN A and OPEN C arrive at the controller at the same time, OPEN A will win. A common CLOSE command transitions whichever state was active (there can only be one) to its Wash state. The SFC has levels so that a
state like Wash A can have a level below it that cycles through the wash sequence. The Wash A state transitions to Idle when the lower level is done.
Figure 9-2 shows the sequence that is required to run a motor with a heavy load (like an elevator car) in two directions. A FWD or REV command will transition the initial Off state to either the Forward or Reverse state. From either of those states, com- mands may reverse direction or stop the motor. In any event, the motor must be braked to a stop before entering a new state.
Figure 9-2 Sequence for Two Directions
An SFC can describe any kind of sequential control and a state machine can perform the state transitions. Something like them may be used to describe and do procedural control, where the boxes represent procedural elements and the transition conditions are mostly “Done.” The SFC-like display is covered in Section 6 Procedure Function Charts in ANSI/ISA-88.00.02-2001.
Procedural Control
Procedural control uses states in two ways. Procedural elements may be either active or inactive. The active/inactive states of procedural elements and the conditions for changing those states determine the path that a procedure will take through its logic.
Procedural control itself has a state machine that evaluates the transition conditions and changes the states of the procedural elements.
The state of procedural control is determined by a state-transition diagram in the example used in Figure 18 of 88.01. This diagram has an enclosed symbol for each
state and a directed line (arrow) that shows each possible path between states. The lines are labeled with commands or other events. (The line from Pausing to Paused is missing in some published versions of 88.01.)
This book uses an SFC to describe exactly the same thing, as shown in Figure 9-3. Like Figure 18, this figure does not show that you can STOP or ABORT from any active state because that would require a three-dimensional model.
The following is a description of the behavior associated with the states as used in Figure 9-3:
• Idle—Procedural control is waiting for a Start command. This is the initial state for procedural control. A new recipe procedure or element may be loaded into memory or put on the operator’s clipboard during the Idle state.
• Running—Procedural control is executing procedural elements on the normal exe- cution path.
• Pausing—A Pause command has been received. Procedural elements continue to run on their normal path until there is a transition to the next procedural element, when the state changes to Paused. The transitions in the lowest-level recipe proce- dural element in each active path are monitored. An element may prohibit pause in order to finish a critical sequence. If parallel phases are running, no transitions are made, and the Paused state is entered when all parallel paths have stopped at transitions. For Pause to be safe, the steps that open a valve and close it when the fill is complete must be built into the equipment. See Holding.
• Paused—The execution of procedural elements has been stopped at points between procedural elements so that a clean restart is possible, provided that the mode isn’t changed to manual. The duration of a pause is up to the operator. A Resume command will restart execution where it left off. This seems to duplicate the function of the semiautomatic mode, except that it is intended for short dura- tions to allow the operator to investigate something suspicious without seriously disturbing the process. Most of the time there is no problem and execution is resumed. Other responses are possible, although the diagram doesn’t show them.
There should be paths from Pausing and Paused to Hold, Stop, and Abort. Suppose the rattle gets worse or the noisy bearing starts screaming while Pausing is still waiting for all active procedural elements to finish.
• Holding—A Hold command has been received by procedural control. The com- mand may have come from exception handling or from an operator. Execution immediately changes from the normal algorithm to the hold algorithm. Hold is intended to bring the process to a relatively safe state and give the operator time to deal with some problem. Some procedural element logic may delay the hold if what it is doing is not interruptible. When all hold paths are complete, the state changes to Held.
Chapter 9
Figure 9-3 State Transition Diagram
• Held—The hold path normally stops all material and energy inputs to the process, so that things don’t get worse. It also does things that are specific to the procedural element that was interrupted. Maximum cooling may be started and left that way, if it doesn’t ruin the batch. Exception logic may issue the Stop or Abort commands.
• Restarting—A Restart command has been entered by an operator that has deter- mined that it is time to start the execution of the restart path. This path has procedural elements that determine if it is reasonable to restart and, if so, restore the material and energy flows to the process and possibly restart the agitator. When the restarting paths are complete, then the state changes to Running.
• Stopping—Procedural control has received a Stop command from an operator or from exception logic. The request is to stop batch processing quickly without endangering people or equipment. The batch may not survive. Execution immedi- ately changes from the normal algorithm to the stop algorithm. If you want to stop batch processing and resume again then use Hold. Stop is intended for situations like a contaminated batch. Each procedural element has a path through its logic that will bring its part of the procedure to a permanent stop. Part of the procedure may be to transfer the unit contents to storage or recovery or waste. When all stop paths are complete, the state changes to Stopped.
• Stopped—Execution of procedural elements is complete for the stop path. If or when the unit is capable of starting another batch, then an operator is required to check out the equipment before giving a Reset command to enter the Idle state.
• Aborting—Procedural control has been given an Abort (or Emergency Stop) com- mand, usually because there is imminent danger of something bad happening to equipment or people, like a cracked vessel or pipe. It doesn’t matter if the batch survives and there is no orderly shutdown. Execution immediately changes from the normal algorithm to the abort algorithm. Inputs of material and energy are stopped abruptly. Some material may be added that kills the reaction, especially if it is exothermic. When all abort paths are complete, the state changes to Aborted.
• Aborted—Execution of procedural elements is complete for the abort path. An operator is required to check out the equipment before giving a Reset command to enter the Idle state, which means that the unit is capable of starting another batch.
There may be a lengthy delay while Maintenance fixes damaged equipment.
• Complete—There are no more procedural elements to execute on the normal path.
The Reset command returns the state to Idle.
The following is a list of commands that may cause the changes of state shown in the diagram of Figure 9-3:
• Start—Enter the Running state. Ignored in any state except Idle.
• Pause—Enter the Pausing state. Ignored in any state except Running.
• Resume—Enter the Running state. Ignored in any state except Paused.
• Hold—Enter the Holding state. Valid only in Running, Pausing or Paused.
• Restart—Enter the Restarting state. Ignored in any state except Held.
• Stop—Enter the Stopping state. Valid in any state except Idle, Completed, Stopping, Stopped, Aborting, and Aborted.
• Abort—Enter the Aborting state. Valid in any state except Idle, Completed, Stopped, Aborting, and Aborted.
• Reset—Enters the Idle state. Signifies human approval of readiness to start another batch. Valid only in Completed, Stopped, and Aborted.