atomic_robo

Recover machine after power up

3 posts in this topic

Hello, 

I am using an NX1P2 for a prototype. I'd like to detect when the power fails so I can resume the state of the machine. I thought of energizing a retentive bit using P_First_Run. I am not sure how to go about this. Any suggestions are appreciated. 

Thank you in advance 

 

Share this post


Link to post
Share on other sites

Check the list of system variables.  There may be one that suits your needs.

Also, you can set a bit on the first scan flag to know its powered on, then don't make it retentive so you can see it is off after a power cycle.

Share this post


Link to post
Share on other sites

I'm quite new to PLC programming, but I have been hardwiring state machines for years. Now I'm programming one in Mitsubishi PLCs, and this has been my approach:

  1.  Split the machine in simple interconnected modules for a better error handling and simpler state diagrams.
  2.  Have a global state machine for the whole automation that handles general errors, but have each module handling its own errors internally.
  3.  Non-critical modules may have errors that allow the rest of the machine to keep running, and can be solved during execution.
  4.  Critical module errors send the global state machine into error state.
  5. On the first scan, I reset all the machine module states into an "init" state. there, I send each module into manual mode or standby depending on the key setting. Some PLCs have special programs that are executed when the machine powers up, before the main scan. If yours is one of these, you can use that. If not, Crossbow's suggestion of having a non-persistant flag that is set to true on the first scan can work well.
  6.  The machine can't self-start after a power cut, so it will wait for the operator to press the start button.
  7.  When the start button is pressed, the global state goes into the "startup" state.
  8.  Modules which require a startup procedure will execute it at this point (for instance, conveyors will run for 3 seconds to see if there's any material on them). The ones which do not require startup have a blank state where nothing happens.
  9.  After startup, each module checks the current situation with the sensors, and will jump into the state that matches the situation.
  10.  When all the modules are out of startup, the machine goes into "run" state, with every module picking up in the correct spot in the state diagram.

This method has two main advantages:

First, you do not depend on persistent variables that can be deleted if there's a power cut and the internal battery of the PLC (if any) is depleted.

Second, if something has changed (the operator takes a workpiece out of the machine to prevent it from falling, and so on) the machine will proceed with the program at the right execution point, instead of following the steps and generating errors because a workpiece is missing, for instance.

hope this helps.

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