Sign in to follow this  
Followers 0
DLB

Structured Logic - Step Sequencing Question

2 posts in this topic

I have put together a program with a 3 routines which steps through them using bits of a DINT tag to indicate stages/steps of the process. Starting at step 1, everything should work fine but I am now starting to think about the possibility of the PLC being powered up at other stages of the process. My step bits are latched/unlatched so will keep their state even if the power were to die (correct?). However, if the PLC was power down and be reprogrammed, then I guess it would lose it's latched states? In which case it would need to figure out where abouts in the process it is so that it can resume control. There are probably other scenarios that I haven't thought of which would result in the same need, to calculate where to resume (or which Step tag needs to be latched). How is this normally done? I was thinking of using a power up handler program to execute CLR to clear the DINT containing the sequence indicator bits then scan the status of the IO and latch the step bit. Is this the usual way to do things or is there a better way? I was also thinking of using the S:FS bit but am unsure whether this would be better than a PUH? Any help would be great :)

Share this post


Link to post
Share on other sites
1. I usually use an integer rather than bits. Using bits for sequencing usually encourages more mistakes being made. The step number is identical to the numbers you put on your state machine diagram. Keep that diagram on file! It is invaluable for troubleshooting later. 2. With an integer, obviously nothing "changes" through a power cycle. 3. ANY time that the PLC is offline (whether because of programming changes, or due to power down), there is a very high likelihood that the "environment" may change in an arbitrary way around it. There are several ways to deal with this: A. Go into a special "homing" state. The PLC intentionally moves actuators and such to "home" positions before doing anything. Basically, this is a "reset". Once reset, go to the "starting" state. B. Go into a "where am I?" state. Carefully analyze the environment and then move directly to the appropriate state. Usually the only states used will be those that are "stable", not "transition" states. These are also "fail safe" states. C. Go to a "manual/lockup" state and make an operator choose. Usually, B is the one I prefer. However, there are frequently cases where there are "unstable" states. For example, most of the time it is common to have limit switches on valves indicating "fully open" and "fully closed". If the valve is in neither state, then you have two choices. You can lock up, error out, and make the operator move the valve to a known state. Or you can simply move the valve towards the stable (and fail safe) position. This is a "homing" function. Once in the fail safe position, then jump to the stable, known state before going back into automatic control. Either way, remember that it is a violation of NFPA 79 (and not really all that safe) to have equipment go directly into an "automatic/run" state without operator control. Always include a "wait" state before going back into automatic control so that no one is surprised by a machine that suddenly lurches into motion without operators taking action to start it up, even if it's a useless "wait" state.

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
Sign in to follow this  
Followers 0