B OOLEAN A CTIONS

B OOLEAN A CTIONS

A Boolean action assigns a Boolean value (i.e., TRUE/FALSE) to a variable during the step’s action. A Boolean variable may be a real output or an internal output. The instruction simply reflects the state (ON/OFF) of the corresponding variable with respect to the state of its action. Let’s take, for example, the action shown in Figure 10-64. Once step 20 is active (X20 is ON), the variable Bool_Var_1 will be turned ON as long as the step is active. The variable /Bool_Var_2—i.e., NOT Bool_Var_2 (/ = NOT)—is the NOT value of the active step X20 and, accordingly, of the variable Bool_Var_2. The variables Bool_Var_3 and Bool_Var_4, followed by (S) and (R) respectively, indicate set and reset instructions to the variable. The set (S) parameter becomes active when the step becomes active, setting the variable to TRUE. The set variable stays active until it is reset in the same step

Y19

19 X20 1

20 (Boolean_Action)

Bool_Var_1

Bool_Var_1; 20 /Bool_Var_2;

Bool_Var_2

Bool_Var_3(S); Bool_Var_4(R);

Bool_Var_3

Bool_Var_4

Y20

Figure 10-64. Example of a Boolean action.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

or in another step; however, it keeps the variable as TRUE, even when the step is deactivated. Conversely, the reset (R) parameter resets the variable to FALSE when the step activity is TRUE. The reset action remains FALSE until the variable is set. Figure 10-65 shows a similar example with different variables. Note that the Solenoid_2(R) instruction resets the variable Sole- noid_2, which was set to ON in a previous action.

Y19

19 X20 1

20 (Boolean_Action)

Motor_1

Motor_1; 20 /Motor_2;

Motor_2

Solenoid_1(S);

Solenoid_2(R);

Figure 10-65. Example of a Boolean action controlling a motor and a solenoid.

E X AM PLE 1 0 -6

Using SFC Boolean actions, implement a chart that will turn ON and OFF two pilot lights according to the timing diagram shown in Figure 10-66. In the timing diagram, PLight_1 is ON for one second while PLight_2 is OFF, then PLight_1 is OFF for one second while PLight_2 is ON. Assume that a normally open push button labeled as Start initiates the pilot light sequence and that a normally open push button labeled as Reset resets the whole operation, turning both pilot lights OFF. Include a light enable (Light_EN) pilot light indicator that is ON at the start of the operation and OFF when the operation is reset.

1 sec Figure 10-66. Timing diagrams for two pilot lights.

1 sec

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

S OLU T I ON

Figure 10-67 illustrates the desired timing diagram of the two inputs (Start and Reset) and the three pilot lights (PLight_1, PLight_2, and Light_EN). Figure 10-68 depicts the SFC implementation of this timing diagram, where the initial step sets both PLight_1 and PLight_2 to an OFF (FALSE) state. Once the Start push button is pushed, the token passes to step 2, which has no action, and continues to the

Start

Reset

Light_EN

Figure 10-67. Timing diagram for the SFC implementation in Example 10-6.

1 (Initialize) PLight_1:=False PLight_2:=False

1 Start 2

2 Reset

4 Not_Reset

3 (Reset)

10 (ON1_OFF2)

Light_En(R);

PLight_1; /PLight_2; Light_EN(S);

3 True

10 TMR/X10/1 sec 11 (OFF1_ON2)

/PLight_1; PLight_2;

11 TMR/X11/1 sec

Figure 10-68. SFC implementation of the two pilot lights in Figure 10-66.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

OR divergence. At the OR divergence, control goes to step 10 (ON1_OFF2) if the Reset push button is not pressed (Not_Reset), thereby turning ON PLight_1, keeping PLight_2 OFF (opposite state of the step activity), and turning ON Light_EN using a set parameter. The timer transition Y10 is triggered one second after step X10 is activated, passing control to step X11, which reverses the state of the pilot lights using Boolean actions. Like the Y10 transition, the Y11 transition also allows one second of activation before it turns OFF the step and passes the token to step 2, where the sequence is repeated.

Conversely, if the Reset push button is pressed (Reset), the program activates step 3, which resets the light enable output and transitions the sequence to step 1, where the program will wait until the Start push button is pressed. Note that this SFC program requires the operator to depress the Reset push button input at transition 2 for at least two seconds in order to reset the lights to OFF. The reason for this is that the program may be at the opposite OR divergence (transition 4), which will last for two seconds before the reset signal can be scanned at transition 2.

The implementation of the previous example could have been done many different ways using Boolean actions. For instance, instead of using the /PLight_2 and /PLight_1 instructions in steps 10 and 11, the program could have specified only the ON conditions of PLight_1 and PLight_2 in steps

10 and 11, respectively, letting the transition trigger turn OFF the variables.

A stand-alone action could also have been programmed to detect the reset function and send the program back to step 1 in the main chart. Figure 10-69

Chart 1 1 (Initialize)

PLight_1:=False

If Reset Then F/Chart_1;X1

PLight_2:=False

1 Start

Stand–Alone Action

2 (ON1_OFF2) PLight_1;

2 TMR/X2/1 sec

3 (OFF1_ON2) PLight_2;

3 TMR/X3/1 sec

Figure 10-69. Implementation of the process in Example 10-6 using a stand-alone action.

Industrial Text & Video Company 1-800-752-8398

www.industrialtext.com

S ECTION PLC The IEC 1131 Standard and C HAPTER 3 Programming

Programming Language 10

shows this stand-alone configuration, along with an alternative set of Boolean actions for this program. Although a stand-alone action is not linked to the program, it will direct a transition move to a specified step if its logical conditions are satisfied. A stand-alone action basically acts as an interrupt jump to instruction, specifying the chart program and the step to go to. Note that a stand-alone action is active at all times, ready to force the program to the specified step. If the Reset push button in Figure 10-69 is pressed, the stand-alone action will force the program to go to step 1 of the Chart_1 program, regardless of where it is in the execution of the Chart_1 program. Also, in this configuration, the Reset push button may be pushed momentarily, so it does not require a two-second push like it did before.