SFC-Feature Request

This is where I encountered several issues that made working with SFC considerably more difficult for me.

There is no simple way to jump to a specific step within an SFC when a certain condition occurs, regardless of which step is currently active. For example, I would like to jump directly to a defined step when a variable gets a rising edge, no matter where the SFC currently is.

To achieve this, I had to develop an external controller using PRESET_OPERATING_MODE, STEP_ID, ACTIVATE_STEP, and DEACTIVATE_STEP. This took quite a lot of time and made debugging considerably more difficult.

Another issue was the behaviour of InOut variables in Actions. They are written on every call. This means that a pulse does not only set the variable to TRUE when the corresponding step is active, but also writes FALSE when it is not active. As soon as multiple SFCs work with the same variable, this becomes problematic. I had to build a relatively complicated workaround using an array.

Debugging inside Actions is also difficult, as no current values are displayed when inspecting the program.

It would also be useful to be able to directly assign values other than TRUE/FALSE inline within an Action.

I am aware that some of these suggestions go beyond the IEC 61131-3 standard.

In the end, I rewrote all of my SFC function blocks as state machines in ST. Unfortunately, the limitations mentioned above caused more additional work in my project than the SFC programming was able to save.

Hi syrto_roman,

Jumping to steps:

PreExecute method with code like this:
IF Condition THEN
THIS.DO_ACTIVATE_STEP(StepId,true);
END_IF;

might solve the problem to set a step whenever the condition is true. Pre/Post Execute methods are always execute before or after the SFC code (see help for more details)

InOut:

Dunno anything about that. Sorry.

Debugging in Actions:

Do you mean code within actions? Then you can enable “Debug in Functions” in the cockpit to get an instance with online values for your actions, transitions etc.

Assign values other than TRUE/FALSE:
I guess that’s what coded actions and their access to the FBs variables are for.

BR
DivisionByZero

Hi all,

what helps in case of the In/out might be the option “Evalaute all transitions”.
this forces that all transitions are evaluated each cycle. This was neccessary to be compatible with PC WORX project execution.
If you switch that off, the transitions and actiosn which were not active are not executed in each cycle.
Kind regards

Carsten

Hi Carsten

The point is that when you send a global variable via the SFC’s InOut. An example:

Outside the SFC:

IF xSometimes THEN
  xTest := TRUE;
ELSE_IF

Inside SFC:
[P] xTest

The SFC will always set this variable to FALSE, unless the action is currently being executed.

Will your suggestion affect this behaviour?