PLC Help traffic light controller

Draw a chart like the pic I attached above. Make your traffic light work smooth. After you can add start up red and night functions. Think total cycle time (ex. 2 sec) Red overlaps (2 sec). Red on (30 sec). Green on (15 sec). Yellow on (15 sec). In case of failure you may want to think of always Red if no other lights are on.
Your work was close, just draw it out. Once you get the basic overview, the rest comes easily.
 
Noob Question. What do you mean by BST. I'm kind of lost at what your saying. Rungs 10 and 12 I did change that with the GEQ and the LES respectively and like that. Much cleaner. I can agree to cleanup rungs 12 through 14 but the statement BST is completely loosing me. Not to mention adding the Less and GEQ now leaves my GREEN_2 on in night time but that may change cleaning up the night time stuff. I just didn't know what BST meant.
If you double click on the rung number (e.g. 0011), or single click and hit [Enter], it will bring up a text box with a mnemonic representation of the rung. You can also click on the left terminal of a branch rung to get the mnemonics for that branch rung. It's pretty handy; once you get hang of it can be a faster way to enter a branch because your hands are not switching between keyboard and mouse.

Once in that mnemonic mode, BST means branch start, and it keeps track of multiple levels; NXB means next branch and starts the next rung of the current branch; BND means branch end and terminates the current branch level.

So [BST XIO B3/0 NXB XIO B3/1 BND BST OTE O:0.0/0 NXB CLR N7:0 BND] would look like this:


B3/0 O:0.0/0
---+-----] [-----+--+----( )---+---
| | | |
| B3/1 | | |
+-----] [-----+ +--[CLR ]-+
[ N7:0]

 
Draw a chart like the pic I attached above. Make your traffic light work smooth. After you can add start up red and night functions. Think total cycle time (ex. 2 sec) Red overlaps (2 sec). Red on (30 sec). Green on (15 sec). Yellow on (15 sec). In case of failure you may want to think of always Red if no other lights are on.
Your work was close, just draw it out. Once you get the basic overview, the rest comes easily.

@sharkyh2o, @parky and I are all on the same wavelength here: a serial sequence of six TON timers, representing each of the six unique combinations of lights in the sequence from @sharkyh2o's diagram: Green1(25s); Yellow1(5s); Overlap1(3s); Green2(25s); Yellow2(5s); Overlap2(3s). The overlap timers run when both red light should be lit. The four non-red lights each need only the /TT bit of one timer.

OP does something similar, as @sharkyh2o notes, also using six TONs, but the concurrently-running RED and GREEN_2 TONs muddy the waters for anyone trying to understand the logic.

I still think this should be done with one timer, or none as demonstrated earlier, which cuts the number of rungs roughly in half.

But to make the case for clarity (and comments) I added working examples of a couple of six-TON approaches to the Github repo here; cf. specifically the PDFs traffic_light_6TON and traffic_light_6TON_orig. Those are not the only possible paths using this approach, but I think they do maximize clarity and minimize complexity. Those programs also eliminate the duplicate destructive bits of OP's nighttime subroutine by integrating nighttime operation in the main program via two small, easily understood, OR branches.
 
@sharkyh2o, @parky and I are all on the same wavelength here: a serial sequence of six TON timers, representing each of the six unique combinations of lights in the sequence from @sharkyh2o's diagram: Green1(25s); Yellow1(5s); Overlap1(3s); Green2(25s); Yellow2(5s); Overlap2(3s). The overlap timers run when both red light should be lit. The four non-red lights each need only the /TT bit of one timer.

OP does something similar, as @sharkyh2o notes, also using six TONs, but the concurrently-running RED and GREEN_2 TONs muddy the waters for anyone trying to understand the logic.

I still think this should be done with one timer, or none as demonstrated earlier, which cuts the number of rungs roughly in half.

But to make the case for clarity (and comments) I added working examples of a couple of six-TON approaches to the Github repo here; cf. specifically the PDFs traffic_light_6TON and traffic_light_6TON_orig. Those are not the only possible paths using this approach, but I think they do maximize clarity and minimize complexity. Those programs also eliminate the duplicate destructive bits of OP's nighttime subroutine by integrating nighttime operation in the main program via two small, easily understood, OR branches.

I can't open your PDF files. I don't know if it's protected but they won't open.
 
Geae Liska,

Multiple timers are a great starting point and will work, but now it is time to consider a single timer like DBB suggests.

If you use the chart and set a time base of 64 seconds and assign 34 seconds to red, 30 to green, and 30 to yellow for simplicity you will see that there are 7 different states. First step for 30 sec is North South Red and East West Geen True. Second step Is 30 seconds N S Red and E W Yellow. Third step is 2 Sec N S Red and E W Red and so on.

Now your just plugging in compare values. Stay basic and expand later.

Add blinkers by inserting a step column, crosswalks buy adding a row.
Keep going and post your work. Eventually you can write a value to the output word on each step to trigger any lights in the step. Evolve it then to a sequencer.

Your on the right track and have fun
 
I want to thank everyone that has given me suggestions and some good pointers. I really appreciate it.

I removed the second lad program and the jump instruction and brought the night time mode into the main program. I also removed the redundant enable night time thing and I now only have two comparisons for the RTC that are in parallel. I also created an emergency stop function that when I estop the system it faults to an all red light condition. I personally didn't want these flashing. So no flashing system there just a simple all red. However, when the emergency is gone (pull the estop) it delays for 5 seconds before going to the original program.

I also removed the duplicated outputs and only using bits to enable the lights. I made the outputs the last thing in the program. Its cleaner and functions better IMO. When I get some more time I will be adding comments explaining all the functions and what they do. Once these comments are done I will upload my final project.

I'm also going to be taking the other programs people have shared and playing with them to learn a ton more. This has been a very fun hobby project for me and I can't wait till I have a house and can build my traffic light and train signal flower garden.

In the mean time I'm going to keep learning as much as I can about PLCs. I find them fascinating and how they make automation so much simpler.

In other news I found out that my county has some completely abandoned railroad crossings that still have the old signals sitting there rusting away. I might try contacting the road commission to see what it would take for me to actually get a hold of these things. Or I might just wait till I move in a year once I have my degree and can start a new career.

Again I can't thank you all enough. It has opened me up to more possibilities.
 
Last edited:
Geae Liska,

30 to green, and 30 to yellow for simplicity you will see that there are 7 different states. First step for 30 sec is North South Red and East West Geen True. Second step Is 30 seconds N S Red and E W Yellow.

On My phone without a chart.lol
15 not 30
 
Hey folks. Its been sometime since I posted this thread. I finally managed to add all the comments and what not that I needed to do to my program. Sorry the last few weeks have been tough. Started a new position at work so it has taking some time. I went ahead and uploaded a file of my completed code. I still have to play with other peoples codes to try them out.
 
Last edited:

Similar Topics

hello everyone i was thinking about starting on a new project on my RSLogix 500, i was going to be doing a traffic project! however, i am a little...
Replies
3
Views
1,805
I am trying to simplify my program to not use the GEQ and LES functions. Can I substitute timers for this?
Replies
8
Views
5,093
I have a network with 4 PLCs PLC1 is controllogix and PLCs 2-4 are compactlogix and they all need to communicate. The current way I have this...
Replies
8
Views
266
So to start off: I have no experience with PLC's, but I'm good at figuring stuff out, but I need some help to know if my PLC is just dead in the...
Replies
2
Views
118
Back
Top Bottom