I am writing a program in which the main sequence is controlled by a 'Main' POU written in SFC using IEC Steps. There is a step within the Main POU called 'Drive'. There is a (N)on-stored action associated with the Drive step called 'DriveToBay', which is written in SFC. I am finding that when the Main POU returns to the Drive step, the DriveToBay SFC action continues from the step that it was running previously (i.e., it does not start from the Init step). I would like it to start from the Init step. The documentation tells me this can be achieved by setting the SFCInit variable, but I do not know how to access the variable when the SFC resides within an SFC action.
Any help greatly appreciated.
Don.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, found a solution. I implemented the 'DriveToBay' SFC within a separate program POU. I declared SFCInit as a boolean input variable for the POU. I then called the DriveToBay POU from an action written in FBD within my Drive step. I set the SFCInit input variable to 'NOT Drive.x'. Seems to be working well. If there are any better solutions, please let me know.
Best regards,
Don.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am writing a program in which the main sequence is controlled by a 'Main' POU written in SFC using IEC Steps. There is a step within the Main POU called 'Drive'. There is a (N)on-stored action associated with the Drive step called 'DriveToBay', which is written in SFC. I am finding that when the Main POU returns to the Drive step, the DriveToBay SFC action continues from the step that it was running previously (i.e., it does not start from the Init step). I would like it to start from the Init step. The documentation tells me this can be achieved by setting the SFCInit variable, but I do not know how to access the variable when the SFC resides within an SFC action.
Any help greatly appreciated.
Don.
Ok, found a solution. I implemented the 'DriveToBay' SFC within a separate program POU. I declared SFCInit as a boolean input variable for the POU. I then called the DriveToBay POU from an action written in FBD within my Drive step. I set the SFCInit input variable to 'NOT Drive.x'. Seems to be working well. If there are any better solutions, please let me know.
Best regards,
Don.
As a tip is to read up on SFCReset as well, they work almost the same, the SFCReset will actually execute the Init step earlier than SFCInit.
/TorbjΓΆrn