Tuesday 9 September 2008

Program your PLC to REMEMBER status

Imagine if you will, a relay that doesn't forget. Its memory lasts for months or even years. This relay is called a "retentive relay" because it "retains" its status after a power loss. Confused? Read on...

Here's a typical scene:
Our parts conveying center is operating as usual. At the end of the  day we shutdown the system BUT we don't want to remove all the parts currently in process. In other words, when we come back to the factory in the morning, we want to just power up the machine and continue where we left yesterday. We don't want to go through a reset cycle as that would take time away from our production. How can we do it? 

Well, we must remember the status of our conveying system... was it  moving up or down? Here's what our conveying system looks like:
  _
|  0      |{-}<--- limit switch (a)
| 0 0   |
|  0      |
|          |  
|          | <---conveying system  
|          |  
|          |  
|          |++++++ <--- tray moves up to (a), then back down to (b)
|          |  
|   0     |     
| 0o0  |<--- motor
|   0     |
|          | {-}<--- limit switch (b)  
-     
A tray starts at the bottom (limit switch b) and is loaded with parts. After the parts are placed, the motor spins and the tray moves until it hits the top (limit switch a). There the parts are unloaded. After they are unloaded, the motor spins in the opposite direction until the tray hits the bottom (limit switch b). Then the cycle repeats. Let's solve the project!  We'll first assign plc addresses to our physical inputs/outputs. INPUTS limit switch (a) = 0000 limit switch (b) = 0001 OUTPUTS motor spin up = 0500 motor spin down = 0501      The ladder logic will look like this: ((MOTOR SPIN UP SECTION))   0001       0000    0500 ---| |---|---|/|-----( )--                |   0500   | ---| |---+

((MOTOR SPIN DOWN SECTION))
  0000       0001    0501
---| |---|---|/|-----( )--
               |
  0501    |
---| |---+

If the tray starts at the bottom, limit switch b (0001) is physically on and limit switch a (0000) is physically off. So, logic flows to the motor (0500) and it spins, moving the tray up. Notice that 0500 is latched on now and the limit switch b (0001) becomes physically off.

Eventually the tray hits the top limit switch a (0000) which unlatches 0500 and forces (motor spin down) 0501 to turn on. When the tray goes down enough to hit limit switch b (0001), the cycle will repeat.

BUT, if we lose power and the tray is somewhere between limit switches a and b, the latch on either 0500 or 0501 will be lost when power to the PLC is returned. In that case we need a "homing button" to return the tray to a "home" position. What if we don't want the tray to return home, but rather we want it to continue in the direction it was going before we lost power? In that case we need to use "retentive relays". Retentive relays simply retain their status when when the plc powers off and then back on again. So, if the relay was off when the power was lost, it will be off when the power returns. And, if the relay was on when the power was lost then it will again be on when the power returns.

Typically, a plc has internal utility relays that can be made to be retentive or not. Most will not have a function to make the real world outputs retentive. So, let's then modify the program to include retentive internal utility relays. In our example, we'll use two and they'll be addressed as 1000 and 1001.

INTERNAL RELAYS
retentive relay (c) = 1000
retentive relay (d) = 1001
INPUTS
limit switch (a) = 0000
limit switch (b) = 0001
OUTPUTS
motor spin up = 0500
motor spin down = 0501 
   
The ladder logic will NOW look like this:

((MOTOR SPIN UP SECTION))
  0001       0000    1000
---| |---|---|/|-----( )--
               |
  1000   |
---| |---+
  1000                     0500
---| |---------------( )--  
   
((MOTOR SPIN DOWN SECTION))
  0000       0001    1001
---| |---|---|/|-----( )--
               |
  1001    |
---| |---+ 
  1001                     0501
---| |---------------( )--  
   
So, now if the power is lost and then returned, 1000 and 1001 will retain their status as just before power was lost. Then the motor will continue moving in the direction it was going before the power loss.

No comments: