Evaluating SFC elements
Each cycle (when executing the application), Neuron Power Engineer checks whether the SFC elements of →SFC network can be evaluated – this check is done in the order as the SFC elements are textually specified within the ST-editor or they are graphically arranged within the FBD-editor (and as indicated by the shown execution order within the FBD-editor).
However, there are rules of evolution vital in the decision whether the SFC element is evaluated in fact. Here are these rules of evolution:
-
The evolution of the SFC network follows the direct links from the initial →step via one/several →transitions to the successor steps via more transitions to the next successor steps etc.
-
Moreover, the evolution of the SFC network is regulated as follows:
1.
At the beginning of each cycle, transitions are cleared, if those transitions are enabled and their transition condition is true (see under 3.). The clearing of a transition causes the activation of all the immediate successor steps of this transition.
Mind that no transitions are cleared, if it is the first cycle after a →cold restart. In this case the initial step of the SFC network is active.2.
For each →action that is associated to an active steps, Neuron Power Engineer sets an internal input variable
action_ACB.action-qualifier
to the valueTRUE
. The name of the input variable depends on the action and the used action qualifier.
If an action qualifier with a duration literal is used, the internal input variableaction_ACB.T
is set to the value of the duration literal.3.
Depending on the behavior of the action qualifier, an internal output variable
action_ACB.Q
is set to the valueTRUE
. Only if this internal output variableaction_ACB.Q
is set to valueTRUE
, the statements of the actions are evaluated.If the statements of several actions can be evaluated at the same time, the actions are evaluated in the order as the actions have been textually specified or graphically arranged.
Applied to the ST- and FBD-editor, this means that the actions are ordered from top to bottom – see the following example 1.
In case of several action blocks that can be evaluated and that are arranged at the same height within the FBD-editor, these action blocks are ordered from left to right.
Show the execution order within the FBD-editor in order to see the order of the elements.4.
At the end of the cycle, Neuron Power Engineer determines the transitions to be cleared. All the immediate predecessor steps of such a transition are deactivated at once.
For each action that is associated to these predecessor steps, Neuron Power Engineer sets an internal input variableaction_ACB.action-qualifier
to the valueFALSE
. Depending on the behavior of the action qualifier, an internal output variableaction_ACB.Q
is set to the valueFALSE
. If this internal output variableaction_ACB.Q
is set to valueFALSE
, the statements of the actions are not evaluated any longer.The determination of the transitions to be cleared is done in the order as the transitions have been textually specified or graphically arranged.
Applied to the ST- and FBD-editor, this means that the elements are ordered from top to bottom – see the following example 2.
In case of several transitions to be cleared that are arranged at the same height within the FBD-editor, these elements are ordered from left to right.Show the execution order within the FBD-editor in order to see the order of the elements.
Which conditions must be met for the clearing of a transition?
-
The transition must be enabled.
A transition is enabled, if all predecessor steps of the transition are active. -
The transition condition of the transition must be true, i.e., it must be evaluated with the value
TRUE
(or an equivalent).
-
Mind the following special cases:
-
If the instance of the POE with SFC network is declared as →retentive (using the keyword
RETAIN
), the states for the steps and transitions are conserved. Subsequently, it might be possible that transitions are cleared at the beginning of the cycle after a →warm restart because at the end of the cycle (from the previous execution) Neuron Power Engineer determined the transitions to be cleared and this information is applied for the warm restart. -
If there are several SFC networks within the editor, the above rules are applied for each SFC network. These SFC networks are ordered as follows:
-
Within the ST-editor, the order of the defined SFC networks is applied, i.e., from top to bottom.
-
Within the FBD-editor, Neuron Power Engineer determines a network to be evaluated. See "Order of networks in FBD".
-
The following conclusions arise for the evaluation of the SFC elements:
-
Any activated step is active for at least one cycle.
-
If a step has zero associated actions, this step waits for a successor transition condition to become true.
-
If a transition condition for an enabled transition becomes true in one cycle, the associated transition switches only in the following cycle.
-
An SFC network is not necessarily evaluated completely, before the evaluation of the next SFC network within the editor is started.
The ST-code for the following examples do not quote the complete SFC network. Each SFC network is only created to an extent that is needed to explain the above rules.
Example 1: Determining the active steps in case of simultaneous divergence
A simultaneous divergence exists, when the clearing of a transition leads to the activation of several steps at the same time.
ST-code |
|
|
FBD-logic |
|
Explaining the evaluation:
-
If step
S0
is active, transitiont0
is enabled. The FBD-logic shows the execution order2
for this transition. -
At the end of the cycle, Neuron Power Engineer determines the transition to be cleared. If
condition_0
is true,t0
is the transition to be cleared andS0
is deactivated. -
In the next cycle,
t0
is cleared and subsequentlyS2
as well asS1
are activated. The evaluation of the actions associated toS1
orS2
depends an the action qualifier. Due to the action qualifierN
, the internal input variablesact1_ACB.N
andact2_ACB.N
have the valueTRUE
and subsequently the internal output variablesact1_ACB.Q
andact2_ACB.Q
have the valueTRUE
. This means thatact1
as well asact2
can be evaluated at the same time. Now the same order is caused in the ST-editor as well as to the FBD-editor because of the rule "from top to bottom".-
In the ST-code,
ACTION act2: ... END_ACTION
is specified aboveACTION act1: ... END_ACTION
. -
In the FBD-logic,
act2
is more top thanact1
.
-
Example 2 for determining the clearing transition in case of divergence
A divergence exists, when several transitions follow one step. The determination of the transitions to be cleared is done because of the order within the ST-code or the FBD-logic.
ST-code |
|
|
FBD-logic |
|
Explaining the evaluation:
-
If step
S0
is active, transitionst0
andt1
are enabled. The FBD-logic shows the execution order2
for transitiont0
and execution order3
for transitiont1
. -
At the end of the cycle, Neuron Power Engineer determines the transitions to be cleared.
t0
has priority overt1
. Reason: In the ST-code,TRANSITION t0 ... END_TRANSITION
is specified aboveTRANSITION t1 ... END_TRANSITION
. In the FBD-logic, the transitions are arranged at the same height – hence, the rule "from left to right" is applied.-
If
condition_0
is true,t0
is the transition to be cleared and subsequentlyS0
is deactivated. Then,condition_1
fort1
is not checked anymore becauseS0
has been deactivated andt1
is not enabled any longer.
In the next cycle,t0
is cleared and subsequentlyS1
is activated. -
Only if
condition_0
is not true andcondition_1
is true,t1
is the transition to be cleared and subsequentlyS0
is deactivated. In the next cycle,t1
is cleared and subsequentlyS2
is activated.
-