Making delay in secod traffic light (LAD programming language)

mangustas

Member
Join Date
Apr 2014
Location
Panevezys
Posts
3
Hi all. I'm here, again, with traffic lights program. I write this question earlier and I get one really good answers with it, but now I really need to make this program in Cx Programmer with LD programming language. What I need to make is to create a delay from the first traffic light to the second traffic light (for about 20 seconds). What I got at the moment:


image.png



image.png


I got two traffic lights, but I need to make a transition delay from the first one to the second one with a delay of 20 seconds. I just don't know what to do. Thank you for any help :)
 
You really should have added to your first post #86767:
http://www.plctalk.net/qanda/showthread.php?t=86767
I got two traffic lights, but I need to make a transition delay from the first one to the second one with a delay of 20 seconds.
You have used 5 or 6 timers, when you should only use 1 timer for each light. Using many timers will make it more complicated for no good reason, and will also make it more difficult to coordinate the 20-second offset between the two lights. Some of your timers are set for 50 seconds, and others are set for 200. (It is impossible to know which timer does WHAT, because like most students, you have not added any symbol descriptions or rung comments).

This is not correct. Use one timer set for 50 seconds, which (best I can tell) should be the cycle time of your traffic lights. In other words, each light should go from Green to Yellow to Red and then back to Green in a 50-second cycle.

You actually do not need a delay, but an offset. Traffic light #2 Timer current value = Traffic Light #1 Timer + 20 seconds. Then Traffic Light #2 will do what Traffic Light #1 did 20 seconds ago. This principle is used in some main artery city traffic lights where the lights need to be coordianted to keep traffic moving. By the time the traffic arrives at #2, the light changes from red to green, so the traffic keeps moving without a stop.

All you need to do is to use logic (comparison instruction) so that the timer for traffic light #2 does not start running until Traffic Light #1 Timer = 20 seconds. After starting, it runs as it normally would, but always 20 seconds behind Timer #1.

If you must start Light #2 when you start Light #1, then simply subtract 20 from the Light #2 Timer Preset value. For example, if the light cycle is 50 seconds, then for Traffic Light #2 Timer #2, set its current starting value at 50 - 20 = 30 seconds. Then it will start at the same time as Light #1, but always 20 seconds behind.
 
Last edited:
Lancie1 pretty much summed it up. I think though to make this even simpler all you need is one timer. Using >=,<=, >,<, == instructions have the necessary lights come on when the timers accumulator value is equal to what you want, then setup an offset from one traffic light to another then have the next one do the same thing.

***EDIT if you do decide to take this approach, just make sure your timers accumulator can count as high as your telling it to.

And please add comments/symbols to your code, not only is it easier for you to follow your own code, but for others to easily understand what you have written.
 
Last edited:
You need to get one light programmed correctly, then add the 2nd light. Here is a program for the first Light #1. Rungs 1 to 6 can then be copied and added as new Rungs 9 to 14. Then edit these new rungs to change Timer TTIM0001 to TTIM0002, and Outputs 1 to 5 to new Outputs 6 to 11 for Light #2.
 
Many of you saw the errors in the MOV instruction. Here is a correction for the 20-second offset. TTIM 0001 must be advanced by 20 seconds on the first PLC scan, not TTIM 0002.
 
Last edited:

Similar Topics

Hi, I have seen a few post with similar topics and I have tried contacting the authors however I have not had any luck so I am posting this new...
Replies
14
Views
1,029
Hi everyone I've created an FC that includes the blocks TCON, TDISCON, TSEND and TRCV. This block has to be as generic as possible across...
Replies
15
Views
1,556
Hi all, I have been working on a tool for my company that handles a specific task our company runs into often related to PLC's. This is a tool I...
Replies
15
Views
2,906
Hi, i need to make: 1- A PLC Program on Omron PLC CP2E-N using high speed counter E6C3-AG5B 360P/R 2M(Absolute) ,to Reject bottles on Conveyor...
Replies
4
Views
890
I was taught to go to Combined > Make Change > go to Offline > will prompt to save > Save > Exit out of program > will prompt to save again >...
Replies
0
Views
685
Back
Top Bottom