SFC programming

Just a heads up for all that want to use SFC programming in PLC Next Engineer: There is a small bug in the SFC programming feature and the development team is aware of that and will work on a solution. The issue is, that if you set a global variable in on SFC function block via an action and try to reset the same variable in a different SFC function block via an action; this variable will always be set FALSE (in case of a bolan variable). My way of working around this is: use a local variable in the SFC function to write to the global variable. I have done that by adding a additional Code sheet in the program where the SFC function block is executed (ST code) and modify my global variables from there. The local variable has to be configured as an OUTPUT. In the SFC action use the correct qualifier for the local variable! I have used an SL to be sure that my local variable is read long enough to write to the global variable. On a general note: Please post your findings of bugs and issues in the forum, so that we all can learn from them and avoid those in our work. Peter - Paul

Dear Peter, dear forum members, the actual result from the investigation is: The application uses one variable, type BOOL and usage Global in two seperate SFC charts. In the two different charts, the variable is marked as EXTERNAL. Inside both charts, there is an ACTION declared as exactly that variable. The IEC 61131-3 Standard states in section 6.7.4.6: If the action is declared as a Boolean variable, the Q output of this block shall be the state of this Boolean variable. (this applies regardless of whether the action is processed) This statement results in two write accesses on the same variable in one application. The first chart writes a TRUE on the variable, the secon chart writes FALSE → at the end, the second chart wins. A solution in the application can be: I propose to Set/Reset the Variable in an Action Method: - Instead of the S(et)-Action use an Action (with Qualifier P1) with a method which sets the Variable Empty_A to true; - Instead of the R(eset)-Action use an Action (with Qualifier P1) with a method which sets the Variable Empty_A to false; Best regards Carsten.