Which is the best procedure to reset a SFC finite state machine

2 posts in this topic

Hello, One thing that I constantly find hard to do when I program in SFC is to properly reset a FSM. If something goes wrong during the process I like to be able to reset the program. In Ladder this is quite simple to accomplish. Usually, I have a variable (non volatile) which is responsible for the step transition. If I want to reset the FSM I just use the function MOV to disable every step variable, which turn off the entire FSM. If I want to restart the program I use the MOV function again to enable only the first step. So my question is: how can we accomplish that in a SFC program? Lets not consider the option of having a reset transition in each step... Best regards, Paulo Edited by paulovedder

Share this post

Link to post
Share on other sites

I suggest you to use integers to track the current and next states. I would also do the variables volatile.

If there is an error, you can just send the machine to whatever standby state you have.

If there is a power cut, the machine can initialize the state machine to whatever integer you want on the first scan (even with ladder, you can achieve that with a function block). Personally, I have a special initialization state that is triggered after the machine powers up and that loads the hardware configuration. In this way, I do not rely on persistent variables that could be lost if there is a power cut and the battery in the PLC is depleted.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now