Steps in ST

Syntax
STEP name_1 :
action_1();
action_2();
action_3(AQ); (* with an optional action qualifier; 'AQ' is just a replacement for this. *)
action_4(AQ,T#0s); (* with an optional action qualifier and a duration literal *)
...
action_n();
END_STEP

Meaning

a →step within the →SFC network, name_1 must be an →IEC-identifier
Several steps are allowed per SFC network. See the notes under "SFC elements in ST" how to create/use SFC networks efficiently and correctly.

One or several actions can be associated to the step: action_1(); ... action_n();The control of these actions is expressed by the optional action qualifier.

See "Evaluating the ST-code including the SFC networks" for information on when a step or initial step is active or inactive and the results of this.

The usage of the step is only possible within the current POU.

Example
STEP step1 :
act1();
act2(N);
act3(L,T#10s);
END_STEP
STEP step2 :
act2(R);
END_STEP

Using step flag and step times

It is possible to use the following properties of a step in the current POU. This usage is similar to the usage of a →constant variable.
(The following descriptions are valid for a step with the name name_1.)

  • Step flag: The active or inactive state of a step can be represented by the logic value of a Boolean structure element name_1.X. If the step is active, X has the value TRUE (or an equivalent). In case of an inactive step, X has the value FALSE (or an equivalent). An example for the usage of the step flag is to check the state of one SFC network within a different SFC network.

  • Step time: The time elapsed since the initiation of a step can be represented by a structure element name_1.T of data type TIME: When the step is activated, the value for name_1.T is reset to t#0s. When the step is deactivated, the value for name_1.T remains at the value it had when the step was deactivated.

  • Moment in time of activation: The moment in time when the step has been activated can be represented by a structure element name_1.S of data type TIME.

Example
ACTION act3 :
IF step1.T < t#5s THEN (* Up to 5 seconds after the step 'step1' is active, the variable 'cntStep0' is counted up. *)
cntStep0 := cntStep0 + 1;
ELSE
cntStep0 := cntStep0 - 1;
END_IF;
END_ACTION
 
(* faulty usage *)
step1.X := BOOL#1;
step1.T := t#100ms; 
step1.S := t#100s;