Professional Documents
Culture Documents
Anexo 09 Grafcet Using Sequential Funtion Chart Language
Anexo 09 Grafcet Using Sequential Funtion Chart Language
Initial Steps Steps Transitions Expressions (Transition Statements) Actions Branches Comments
Individual SFC elements are detailed in Sequential Function Chart (document number CG39-27).
Initial Step Step Non-boolean Action Boolean Action
Branch
Transistion
July 2001
15-1
CG39-20
Execution of a sequential function chart begins by determining which transitions are ready to be cleared. A transition can be cleared if all of the steps that flow into the top of the transition are active. After gathering the list of transitions that are ready to be cleared, each transition is tested to determine if the associated transition condition is TRUE. When a TRUE transition is encountered, all steps that flow into the transition are de-activated and all steps that the transition flows into are activated. If a cleared transition is one of several that represent a Divergence of Sequence Selection (see section 15.2.2), any remaining untested transitions, also within that Divergence of Sequence Selection, are removed from the list of transitions to be tested. After all transitions in the list have either been tested or discarded, actions are executed. As with the function block diagram language, actions that have been de-activated during a scan are executed first, followed by those actions that are still active.
15.2 RULES OF EVOLUTION
The following subsections describe the rules of evolution for an SFC. When you read these descriptions, note that the following guidelines apply:
There must always be alternating steps and transitions so that two transitions will never be linked. They must always be separated by a step. There are two different types of SFCs. These are the looped SFC and the terminated SFC. In a looped SFC, control evolves from the last transition back to the initial step. The looped SFC executes STEP1 again if the first transition condition is TRUE. The loop can be created by wiring the signal from the last transition back to the input of the initial step as shown in Figure 15-2. The loop can also be made by either adding a last step with a non-boolean action that pulses the charts reset variable to TRUE, or by using stubs to replace wiring. A terminated SFC ends with the last step as shown in Figure 15-3. A terminated SFC is not automatically reset like the looped SFC. Instead, it is reset by setting the charts reset variable from outside of the chart.
15-2
July 2001
CG39-20
CHART01
STEP1
ACTION1
: = TRANS2
STEP2
ACTION2
00001059
CHART02
STEP1
ACTION1
: = TRANS2
STEP2
ACTION2
00001060
The following subsections defines allowable combinations of steps and transitions within an SFC. For viewing clarity, the actions associated with each step are not shown in illustrations.
July 2001
15-3
CG39-20
In a Single Sequence, as shown in Figure 15-4, the evolution from STEP1 to STEP2 takes place only if STEP1 is active and the transition condition is TRUE. Steps and transitions are alternated in series.
STEP1
STEP2
. .
00001061
Figure 154 Single Sequence Steps in an SFC 15.2.2 Divergence of Sequence Selection
In a Divergence of Sequence Selection, as shown in Figure 15-5, only one branch is taken. An evolution from STEP2 to STEP3 will only take place if STEP2 is active and the transition condition C is TRUE. An evolution from STEP2 to STEP4 will take place only if STEP2 is active, transition C is FALSE, and transition D is TRUE. Note that a divergence is represented by transitions under the horizontal line. The transitions are evaluated from left to right.
. .
STEP2
C STEP3 STEP4
. .
. .
00001062
In a Convergence of Sequence Selection, as shown in Figure 15-6, an evolution from STEP3 to STEP5 occurs only if STEP3 is active and the transition condition E is TRUE. An evolution from STEP4 to STEP5 occurs only if STEP4 is active and transition F is TRUE. A convergence is represented by transitions above the horizontal line.
15-4
July 2001
CG39-20
. .
. .
STEP3 E
STEP4 F
STEP5
. .
00001063
In a Simultaneous Divergence of Sequence, as shown in Figure 15-7, an evolution from STEP5 to STEP6 and STEP7 occurs only if STEP5 is active and the transition condition G is TRUE. After the simultaneous activation of STEP6 and STEP7, the evolution of each sequence proceeds independently. Only one common transition symbol is possible and it must be immediately above the double horizontal line. To emphasize the special nature of such transitions, the divergence of a simultaneous sequence is indicated by a double horizontal line.
. .
STEP5 G
STEP6
STEP7
. .
. .
00001064
An SFC using a Simultaneous Divergence of Sequence must also contain a matching Simultaneous Convergence of Sequence as described in the next section.
July 2001
15-5
CG39-20
In a Simultaneous Convergence of Sequence, as shown in Figure 15-8, an evolution from STEP6 or STEP7 to STEP8 occurs only if both STEP6 and STEP7 are active and the transition condition H is TRUE. Only one common transition symbol is possible, and it must be immediately below the double horizontal line. To emphasize the special nature of such transitions, the convergence of a simultaneous sequence is indicated by a double horizontal line.
. . . .
STEP6
STEP7
H STEP8 . .
00001065
An SFC using a Simultaneous Convergence of Sequence must also contain a preceding Simultaneous Divergence of Sequence as described in the previous section.
15.2.6 Skip Sequence
In a Skip Sequence, as shown in Figure 15-9, an evolution takes place directly from STEP30 to STEP33, skipping STEP 31 and STEP 32, if transition A is FALSE and D is TRUE. A sequence skip is when one or more of the branches contain zero steps
15-6
July 2001
CG39-20
. .
STEP30
A STEP31 B STEP32 C
STEP33
. .
00001066
In a Sequence Loop, as shown in Figure 15-10, an evolution takes place from STEP32 back to STEP31 if transition C is FALSE and D is TRUE. STEP31 and STEP32 are repeated. Note the careful placement of the T-connections so that no two transitions are in sequence. Also note that evolution through the D transition is in the down direction. The directed wire elements are provided to assist you in determining flow but they do not guarantee a direction of evolution. A Sequence Loop is when one or more of the branches returns to a preceding step.
4-mation has a built-in feature to detect unsafe or unreachable SFCs. Such charts are considered invalid. Examples of invalid charts are:
An SFC with no initial step An SFC that does not end with a step.
An invalid SFC is not be executed by the control module, but 4-mation displays it as it would display any valid SFC. In 4-mations on-line mode, no steps or actions are highlighted (shown as active) on an invalid chart. On a valid chart, every transition must have a preceding step and a successor step. (An exception is the steps in a terminated chart, where the initial step does not have a preceding transition, and the final step does not have a successor transition.)
July 2001
15-7
CG39-20
. .
STEP30 A
STEP31 B STEP32
C STEP33
. .
00001067
CG39-20
MODE
No Yes No No No
For each SFC, there are four variables that can be used to monitor its execution state.
Mode - This variable is accessed by appending a .M to the SFC name (e.g. ChartName.M). It is an INT value from 0 to 4.
where: 0 = Off 1 = Automatic mode 2 = Manual mode 3 = Hold mode 4 = Trace mode
Reset - This variable is accessed by appending a .R to the SFC (e.g. ChartName.R). It is a BOOL value that is TRUE when the SFC is to be reset. Action State - This variable is accessed by appending a .Q to the action name (e.g. ActionName.Q). It is a BOOL value that is TRUE whenever input to the action is TRUE. Step State - This variable is accessed by appending a .X to the step name (e.g. StepName.X). It is a BOOL value that is TRUE whenever input to the step is TRUE.
These variables are available anywhere on the SFC network . A network consists of all the sheets in which the same local variables are available. For example, if the SFC is contained in a Derived Function Block, the variables are available on the Derived Function Block sheet that contains the SFC as well as on the actions within that SFC. However, if the SFC is contained inside of a non-boolean action that resides in a Derived Function Block, the variables are available on the sheet that contains the SFC, the actions
July 2001 15-9
CG39-20
within that SFC, and the function block sheet containing the non-boolean action. Note that these sheets make up the SFC network. For example an SFC, CHART22, is contained in the body of a non-boolean action, ACTION22, located in a function block network. Due to the placement of the SFC, the mode and reset variables are available on the function block sheet. This accessibility is shown in Figure 15-11 and Figure 15-12. Note that the ChartName.M and ChartName.R variables can be assigned to other variables (MODE and RESET in the examples) so that the values can be displayed in 4-mation.
TRUE
EN
ACTION 22
MANUAL MSG
00001068
15-10
July 2001
CG39-20
TRUE EN
ACTION 22
FALSE RESET
00001069
Figure 15-13 shows the body of ACTION22. Note that the mode is also displayed by the initial step of the SFC as well as by the ChartName.M variable.
July 2001
15-11
CG39-20
TRUE
00001070
Figure 1513 Body of ACTION22 15.3.2 Changing Chart Mode and Chart Reset
The mode and reset status of a SFC can be changed by either of two methods:
The Chart Control dialog box The CHRTMOD (Chart Mode) function block.
The Chart Control dialog box, shown in Figure 15-14, is used to change the mode or reset status of a single SFC while on-line in 4-mation.
To change a variable using the Chart Control dialog box:
1. From the Main Menu Bar, select On-line, Display Real-Time Data. Observe as the on-line data appears on the SFC. 2. From the Main Menu Bar, select On-line, SFC Control. This opens the Chart Control dialog box. 3. Place the cursor on a step within the SFC to be controlled. The full path name of the desired SFC is then displayed in the Chart area of the dialog box.
15-12
July 2001
CG39-20
00001071
Figure 1514 Chart Control Dialog Box Table 152 SFC Chart Control Command Button Availability
MODES
TRACE
Set Cancel Reset Disable Enable Enable All Allow Step Transition Forcing
X X X
X X
X X
X X
X X X
X X X X
X X X X
Use the Chart Control dialog box to perform any of the following operations as needed:
July 2001
15-13
CG39-20
1. Place the cursor on the SFC 2. Select the Off option button 3. Press the Set button
1. Place the cursor on the SFC 2. Select the Auto option button 3. Press the Set button
To place an SFC in HOLD:
1. Place the cursor on the SFC 2. Select the Hold option button 3. Press the Set command button
To place an SFC in MANUAL:
1. Place cursor on the SFC 2. Select the Manual option button 3. Press the Set button To allow the toggling of steps on and off (i.e. make the steps active and inactive), check the Allow Steps/Transition Forcing check box, shown in the lower left corner of the dialog box. As long as the box is checked, the SFCs steps can be activated or deactivated manually. While in the Manual mode, steps can also be enabled and disabled individually using the Disable/Enable or Enable All buttons.
NOTE
The SFC Chart Control dialog box is used to change the one mode of a single chart. To modify more than one chart, use the Chart Mode (CHRTMOD) function block as described below. Refer to Sequential Function Chart (document number CG39-27), for more information.
15-14
July 2001
CG39-20
The Chart Mode (CHRTMOD) function block is used to change the mode or reset status of several SFCs using logic or an operator interface such as APACS ProcessSuite. The CHRTMOD block is extensible, accommodating up to 12 SFCs as inputs. As long as the blocks EN input is TRUE, the (MODE) input integer is written to the mode variable of each SFC that is input to the block. At the same time, if the R input is TRUE, each SFC is reset. The SFCs are accessed by their address. That is, the relative position of the SFC to the CHRTMOD function block is used in string form (enclosed in single quotes) as an input to the block. The example shown in Figure 15-15 shows the relative address of CHART22 applied to input CHART01 is .CHART22. Note that the leading period (.) character signifies that the addressing begins with the current sheet. Since CHART22 is in ACTION22, and actions are extensions to the sheet on which they reside. The SFC is considered to reside on the current sheet. This example shows the CHRTMOD block placed on the same effective sheet as the SFC, but, this is not mandatory. The CHRTMOD block can be placed anywhere in the configuration. However, the relative addresses must change accordingly. For example, the second input to the CHRTMOD block in Figure 15-25 is .SFC2.CHART11. This input is referencing CHART11 that resides on the Derived Function Block with the instance name of SFC2. It is also known that the DFB SFC2 resides on the current sheet because the address begins with a leading period character.
TRUE EN
ACTION 22
FALSE FALSE 0 2 1
00001072
July 2001
15-15
CG39-20
When 4-mation is in the on-line mode, it maintains a list of active steps for each SFC. The active steps are listed in the Active Step List dialog box as shown in Figure 15-16. To view the list (when on-line) from the Main Menu Bar, select On-line, Active Step List to open the dialog box. The box displays the active steps from a single chart, or for all charts within a network.
00001073
Figure 1516 Active Step List Dialog Box 15.4 SFC ON-LINE DATA DISPLAY
When 4-mation is on-line, the SFC mode (Off, Auto, Manual, Hold or Trace) is displayed on the initial step. In the on-line mode, the active steps and actions are displayed in the configured ON color. To define the ON and OFF color, see section 3.4, Screen Colors. The state of the step (X) is determined by the previous transition condition, while the state of the action block (Q) is determined by the state of the step and the action qualifier. This explains why an action may be active, while a step is inactive, and vice versa. For example, the transition previous to the step changes from FALSE to TRUE and the action qualifier is P (pulse). The on-line mode shows the state of the step as ON; however, because of the pulse action qualifier, the action block is only be in the ON state for two (minimum) control module scans. Due to the speed of the pulse, you may not be able to see the action turn green on the screen. The step remains in the ON state until the successor transition turns TRUE, and the step is no longer active.
15-16
July 2001
CG39-20
The ChartName.M and ChartName.R variables are not shown with their current values in the on-line mode. To display the on-line data value, the .M or .R variables must be assigned to another variable. In Figure 15-16, the on-line value of CHART22.R is not shown (no value shown) above the variable, but is instead shown above the global |CH22RESET| variable.
15.5 CREATING A SEQUENTIAL FUNCTION CHART
To begin creating an SFC, you must first be in a sheet defined to be configured in the SFC language. Any program block, derived function block or user-defined function block can be defined as an SFC sheet. First, the program block, DFB, or UDFB must be created and placed on a sheet (see section 5). Once this is accomplished, the language can be selected.
To define a sheet for SFC configuration:
1. Open the program block, derived or user-defined function block by placing the cursor on the block and double-clicking the left mouse button. This opens the Sheet Type dialog box as shown in Figure 15-17. 2. Select the Sequential Function Chart option button. 3. Click the OK button to close the dialog box and open a new sheet that is ready for configuration in the Sequential Function Chart language. When an SFC Sheet opens, a multi-level icon bar, for choosing SFC configuration elements, is displayed on the bottom of the screen as shown in Figure 15-18.
00001049
July 2001
15-17
CG39-20
Icon Bar
Icon Bar
Icon Bar
Icon Bar
00001075
While in an SFC, whether it is within a program block, a DFB, or a UDFB, the same method of configuration applies.
To create an SFC in the MULTIPLE selection mode:
1. Click on the icon of the desired SFC element (step, action, transition, wire, branch, etc.) to be configured. 2. Click on the cell where the element is to be placed on the sheet. 3. Change the default name for the step and transition (optional). The following additional information is provided to make SFC creation easier.
STEPS - The default name of a step or chart can be changed by placing the cursor on the step or initial step (the initial step name is the chart name), typing the new name, and pressing [Enter]. For additional information on steps, refer to Sequential Function Chart (document number CG39-27).
15-18
July 2001
CG39-20
TRANSITIONS - Transitions can be simple structured text statements or additional network sheets. For additional information on transitions refer to Sequential Function Chart (document number CG39-27).
The method used to create an SFC depends on the icon bar selection. Selection options include Multiple Selection and Single Selection (see section 3.2 for more information on these options). If in the Multiple Selection (default) mode, the selected icon remains active after each placement, then every click of the pointing device on a new cell places an element in that cell. To deactivate the icon, click on it again. In Single Select mode, the icon is deactivated after each placement so that an icon (even the same icon) must be selected before each cell placement.
CHART CONNECTIONS - SFCs contain additional connection elements not available in function block diagrams or ladder logic diagrams. These connection elements, also called wires, are displayed by selecting the WIRE icon shown in Figure 15-18.
Selecting WIRE provides access to the three additional icon bars, as shown in Figure 15-19. These Wire icon bars are displayed one at a time. Clicking the NEXT icon toggles the display to reveal the other bars in sequence. Directed wire elements are Wire symbols with arrows ([F5] and [F6] of the second icon bar). They can be used in place of [F1] (from first icon bar) to more clearly show the charts direction of flow. For example, Figure 15-10 shows how these direction wires are used. A series of double-line wires are utilized to represent simultaneous sequences (either divergence or convergence). These special wires are available from the last icon bar shown in Figure 15-18. See Figure 15-8 for an example of how the simultaneous sequence wires are used. Another set of special wires is represented by [F7] and [F8] of the second icon bar. This is also shown in Figure 15-18. These wires represent stubs. Stubs can be used in the sequential function chart language to pass control from one cell to another without having to connect wires. This feature is helpful on complicated looped charts when the signal from the last transition is to be passed back to the initial step. Rather than wiring the bottom output all the way back to the top of the chart, simply pass the last transitions signal to a stub using the [F8] symbol, then place another [F8] stub symbol (with the same name) in the cell above the initial step.
15.6 CHART VALIDITY
The rules of evolution (see section 15.2) place constraints on how SFC elements can be connected. However, following these constraints is not sufficient to create an SFC that can be safely executed. An SFC is considered valid if it is possible to evolve the SFC so that each step can be activated. When an attempt is made to place an SFC element on a sheet, some initial checking is performed to verify whether the individual element is valid at its location. 4-mation performs the following tests whenever an SFC element is placed on a sheet:
Test for convergence from dissimilar objects Test for divergence into dissimilar objects Test for one step passing control to another step Test for a transition passing control to another transition
15-19
July 2001
CG39-20
Test for an attempt to selectively diverge or converge with multiple steps Test for an attempt to simultaneously diverge or converge with multiple transitions Test for more than one initial step in a chart Test for duplicate step names within a chart
If any of the above situations occur, the element is not valid and is not placed on the sheet. When an element is successfully placed, some validity checking of the chart takes place. A validity flag inside the chart is set based on the results. This flag is used to inform the control module whether the chart should be executed. Only valid charts are executed. To determine if a particular chart is valid in the on-line or off-line mode, place the cursor on an element in the chart. From the Main Menu Bar, select View, Chart Validity. A dialog box opens and displays a message indicating whether the chart is valid or invalid. If the chart is invalid, one of the following diagnostic messages is displayed:
Missing Initial Step. Cause: A chart must have one, and only one, Initial Step. Dangling Transition Following StepName. Cause: A non-looped chart must not end in a transition. (Refer to example in Figure 15-19) Step Stepname Never Converged From A Simultaneous Divergence. Cause: A simultaneous divergence must be followed by a matching simultaneous convergence. (Refer to example in Figure 15-20) Unreachable: Transition Following Step StepName Can Never Be Reached. Cause: The preceding steps can never simultaneously be active. A simultaneous convergence must occur with a simultaneous divergence. (Refer to example in Figure 15-21) Unsafe: Uncontrolled Proliferation Of Control With Step StepName. Cause: A branch from a simultaneous divergence occurs. The last step in the chart can never be reached if the branch becomes active. This error also occurs if a portion of a simultaneous convergence line is not present. (Refer to example in Figure 15-22)
15-20
July 2001
CG39-20
StepName
00001077
StepName
00001078
July 2001
15-21
CG39-20
A simplified batch process is used to demonstrate the configuration of Sequential Function Charts using function blocks and structured text. Please note that this example is for illustrative purposes only and does not represent an actual process. The solutions do not include alarms, communication to an operator console, configuration of I/O modules, or a means for the operator to abort the batch sequence. The process, shown in Figure 15-23, utilizes a recipe that combines ingredients A and B in a reactor, heats the mixture, cools the mixture, and finally dumps the finished product.
15-22
July 2001
CG39-20
VLV101
VLV102
PMP202
AGIT222
PMP201
TIC 201
TT 222
This example process requires the following operations: 1. Initialize reactor if the batch has been started by the operator (if SW222 is high). Initialization involves pre-setting the state of all of the pumps and valves before any ingredients are added to the reactor. Close the reactors drain valves VLV200 and VLV222, ensure the ingredient valves and pumps are closed/off (VLV101, VLV102, PMP201, PMP202), close the heating and cooling water valves (VLV201, VLV202), stop the agitator (AGIT222) and circulation pump (PMP222). Although each step in the batch sequence changes the state of pumps and valves as required, initialization of each variable is still being performed here. 2. Simultaneously charge the reactor with ingredients A and B if the initialization step has been completed. Charging involves opening solenoid valves VLV101 and VLV102 for ingredients A and B, turning on pumps PMP201 and PMP202 after a delay of 1 second. Allow the ingredients to charge for 50.0 seconds, close both valves and turn both pumps off.
July 2001 15-23
CG39-20
3. After both ingredients have been charged, start the agitator (AGIT222). Remain agitating until the temperature input reaches 90C. PID logic in another portion of the PROGRAM handles actual PID control to heat 4. After heating is finished, the cooling step begins. Keep agitating until the temperature input reaches 20C. PID logic in another portion of the PROGRAM handles actual PID control to cool. 5. Dump the contents after the ingredients have been cooled. This step involves opening the valve VLV222 on the reactor to drain the product, opening the valve VLV200 to drain the water out of the reactors jacket, stopping the agitator AGIT222, closing both heating and cooling water valves VLV201 and VLV202, and stopping the circulation pump PMP222. The batch must be prohibited from restarting until the reactor has been drained to below 2.0 inches. Use the level transmitter LT222. Typically, an emergency stop type function would be used to place the chart in the OFF mode. That would allow an operator to fix the problem and restart the chart from the last state. The emergency stop function could be placed within another chart in the same SFC sheet. This chart would contain an initial step, a transition to handle the emergency stop signal, a step and action block to place the chart in the OFF mode, and finally a transition that is always true and that loops back to the initial step. There is more than one correct way to create a Sequential Function Chart for the process described above. Solution A, illustrated in Figures 15-24 to 15-29, show the most organized way to create a medium to large sized chart. In Solution A, each step in the chart represents a key operation in the process (initialize, charge, heat, cool, and, dump). Since the heating operation in this example is too complex to be performed by a boolean action alone, an action body is defined. The language of the action body is that which is most appropriate for the process.
15-24
July 2001
CG39-20
Solution:
Local V ariable Standard FunctionB lock Passed Variable as a reference V ariable as a reference
C oil
C ontact
S hunt
D erivedFunctionB lock
00001055
July 2001
15-25
CG39-20
Solution: (continued)
EMERG_CHT4
: = EMERGSTOP_CH4
STOP
CHART4_OFF
: = TRUE
00001082
00001083
15-26
July 2001
CG39-20
Solution: (continued)
STEP1
%VLV101
STEP2
A_DONE
DO_CHRG_A
: = A_DONE
00001084
July 2001
15-27
CG39-20
Solution: (continued)
STEP1
%VLV102
STEP2
B_DONE
DO_CHRG_B
: = B_DONE
00001085
15-28
July 2001