Here is Traffic Light project....Hope There are no fatalities.....lol

Lancie I seen where you had uploaded one for RSLogix but i couldnt open it cause it was an rss file
Well, why not download this one. It is a LogixPro program, just as promised in the Downloads section:
http://www.plcs.net/downloads/fileop.php?action=rename&filename=TRAFFIC%20LIGHT%20WC%20EX%203%20SMARTLIGHT.rsl&directory=Allen_Bradley&

I also have 4 or 5 other versions in LogixPro. I can post one if you want it. I have posted some in past posts about Traffic Lights. I will make a few comments.

You are on the right track. The first method used on the student traffic light problem is always wiith timers, then later you do it with ONE timer and several comparison statements, then finally with a sequencer.

1. You only need 7 rungs in LogixPro to do the basic East/West and North/South Red-Yellow-Green traffic light. I see now that you are also adding the "Delayed Green" which does take two more timers. Please add symbols and comments, and you will get more feedback. It is difficult to understand what anyone's logic is doing, without labels.

2. It is not necessary to use Latch and Unlatch. Only Timer DN and Timer TT bits are needed, along with the Output lights. The timers provide all the actions that you need. You only need to figure out how to simplify your logic by thinking about when each light needs to go on and off, and what combination of timer functions will provide those actions.

3. A timing diagram is very helpful. Remember, while one direction East/West is Red, the other direction North/South is Yellow and Green, and vice versa. Therefore, you only need Yellow, Green, and Delayed Green Timers for each directon.
Sorry guys, I know it needs some cleanng up and I havent put rung comments yet, I apologize for that also.
Without rung labels and comments, no real programmer would even submit it, even for review. The labels are for your benefit as well. If you cannot explain what each rung is doing with a short, to-the-point comment, then it may be that you don't actually KNOW what each rung is doing. When I received a student program without comments, the grade was always a big red "I" for INCOMPLETE. It is truly incomplete, both as a student exercise and also for any real-world PLC program. Good programmers know what the comment should say before they ever write the rung. I write the comment first. If you can't do this, then you do not have a clear picture of the program steps, and perhaps not even a clear picture of the problem.

Here is how I write a rung of logic.

A. Insert a new blank rung,
B. Write a comment that describes what the rung Output is going to do,
C. Insert the Output on the right side of the rung, and label it,
D. Ask myself, "What Inputs are needed to make this Output work?"
E. Add Inputs on the left side, in parallel and series combinations, labeling as I go, until I am satisfied that the Output will work as I described in the rung comment.

Most of the time I put in all the outputs (that I know about) first, then go back to the first rung and start adding the inputs. This requires some thought about how the program is going to work before starting the first rung.

I group with Outputs not only the real PLC outputs, but also the internal outputs such as timers, counters, and other PLC functions. These also are types of outputs (that cause an action) when considering each rung as a self-contained logic step.
 
Last edited:
Thank you all, But Lancie Hats Off to you. Your Reply really helped a lot, and I apologize for posting this logic without Comments I understand its poor habit and, well not so much laziness but getting ahead of myself, I vow to try and never post any more logic without comments. Im going to work on this project and i'll get back soon with a better example.
 
Bryan,
I am glad it helped. Remember, leaving off the comments is a sure sign that you don't know how to write a program. It is not laziness, it is ignorance about what will work.

Learn to use the comments and rungs-with-outputs-but-no-inputs as a basic program outline. This outline will guide you and keep you on track, if you learn to use it. Without a plan, you will find yourself floundering around, using the trial-and-error method, resulting in mostly errors.

Think of programming this way. For any task, there may be 4 or 5 ways that will work. There are thousands, maybe millions of ways that will not work. You have to find a fast way of weeeding out most of the ways that will not work, before you write the first line of logic. In programming, it is the infinite number of incorrect methods that come back to bite you on the behind. A lot is experience with what worked for past programs.
 
Ok Guys Here is the documented version, and I have also added part 2 of this project, which states that between the Hours of 12:30am and 5:30 am that the e/w bound lanes will flow steady until a car approaches from the n/s bound lanes at which time, the lights will cycle one complete time, then return back to a steady e/w bound flow, any other times the lights cycle red, green yellow, in both directions with a 2 sec delay when both directions are red.

The 12:300-5:30am time frame is just to controlled by a switch for this project. Hope i'm close, It works but maybe more complex than needed, yall tell me. and thanks in advance

Image4.jpg




**** Dont know where it went but up on rung 5 that unidentified XIO is suppose to be T4:6/TT
Sorry
 
Bryan,

Your one-cycle program does not work. There are several errors. The first big one is that the I:1/0 switch is a "momentary contact" switch - it does not stay on when triggered. Your first task is to create a "seal-in relay" so that you will be able to lock in one cycle. More later.
 
Last edited:
actually I have found a major error myself, during the one cycle, i did not have my delayed green so i changed some stuff around, actually by making the n/s bound lanes a constant flow after midnight(since the project doesnt state which direction has to constant flow after midnight)
was just an easier fix...lol and as far as the seal in for the one cycle You are correct and I will fix that. Thanks Lancie
 
"...between the Hours of 12:30am and 5:30 am that the e/w bound lanes will flow steady.." means that starting at 30 minutes past midnight, only the East/West lane will be green, while the North/ South will stay red.

"...until a car approaches from the n/s bound lanes at which time, the lights will cycle one complete time,.."

means that the first time a vehicle triggers the N/S vehicle sensor, then the light will cycle around to N/S Green 1 time only,

"...then return back to a steady e/w bound flow,.." means that after the 1-time cycle is finished (still during the 12:30 - 5:30 AM time period), the East/West light is set to Green Only, and North/South is Red only.

"...any other times the lights cycle red, green yellow, in both directions" means that from 5:30 AM until 12:30 AM (which does include Midnight and also Noon), the light works normally (with a 2-second Delayed Green in both directions).

Suggestion: It would be easier to do the 1-time cycle, if you change directions and re-program the traffic light using only 1 timer for the entire cycle.

Hint 1: Traffic lights are reprogrammed on a regular basis, to adjust for changing traffic patterns. If you use T4:6 as a one cycle timer, what happens if you need to adjust the times for T4:0, T4:1, and so on? You would also have to add up the new times and insert the new total in Timer T4:6, an unnesessary, inefficient extra step for our imaginary traffic technicians.

What I mean is it would be best not to use another timer for the 1-cycle period, but instead use an internal relay that is on during that 1 cycle, or even a counter that is on for 1 count.

Hint 2: You cannot simply change the light to red or green when the 12:30-5:30 AM Switch is flipped. If you do that, without going through a Yellow cycle, expect to have some vehicle crashes! You must cycle the light normally, then intercept and lock it in it at the proper time.
 
Last edited:
That is correct, except that the specs do not specify which direction stays red and which stays green. so before i get slammed for not giving the whole set of specs here it is word for word

Part One: Build a stop light circuit that has lights of red, green and yellow on each side. It operates in the following sequence. Each side goes from Red to green to yellow and Back to Red. there is a 2 sec overlap of the red lights on both sides for safety.

Part Two: During the hours from 12:00am to 5:30 am the light will cycle one complete time every time a car appraoches from b side.

Part three: When the Fire Truck approaches the intersection both sides a and b will turn Red Until the truck passes, then the light will return to the operation that was in effect before the fire truck entered the intersection.


I have not dealt with part three of the specs yet, and when I questioned about part 2 he told me that, between the hours of 12:00 midnight and 530am that one direction would remain red and one direction would remain green until a car approached from the direction that remains red.


Now that is the complete specs I promise, scouts honor.
 
LOL We were posting at the same time, I will examine what You are talking about and go from there, what I originally thought of doing was using just 2 timers for part one of the specs and then use comparison's to turn the lights on and off (not that it would work...olol but that was my thought)
But then i heard that the instructor wanted multiple timers. Couldnt this also be done using a Drum (sequencer)?
 
So the different operation is from 12:00 to 5:30 AM, not 12:30? It seems clear to me. It doesn't matter which direction you pick. The thing that does matter is that you be consistent - if you pick East/West to stay green during that time, then after the "1-cycle", you must return East/West to green, until 5:30 AM. Then you operate with normal cycles until Midnight.

This is similar to the way many lights, between side streets and major traffic arteries, really operate late at night.
 
Last edited:
Yes, you could use a sequencer, but it would be harder for you. Sequencers do not make the logic easier, they just combine many instructions into a few rungs. All the inputs (that trigger each step) must still be present. It is the inputs (that trigger the lights) where you are having problems.

If you must use multiple timers, I suggest you get organized. What will make your program easier to understand? One thing that helps me is to place the rungs in the order of the events.

In this case, timers first, in this order, starting with T4:0: E/W Green, E/W Yellow, N/S Delayed green, N/S Green, N/S Yellow, E/W Delayed Green.

Now add your Outputs in this order: E/W Red, Green, and Amber. N/S Red, Green, Amber. If I was starting from scratch, I would assign E/W Red to O:2/0, but because that is built into the simulator, you are stuck with the output assignment, but you can change the order they appear in your program. You can rearrange your existing rungs by copying and pasting.

The above would help you to visualize what is happening and make it easier to follow the action.
 
Last edited:
Yes Sir that is correct. Thanks again Lancie for your time, I know you have a lot better thing to do than try and guide a rookie in the right direction. I started about a year ago with logixpro trying to learn all i can on my own, and now get a whole 4 hours a week in a class room that is handing out the cart before the horse, but with what time I have, Im trying to cram all i can in, may take me 10 years but I'll get it............lol
 
Bryan,

I managed to start with your framework and get Part 2 to work.

LogixPro has an annoying habit of dropping symbols when the database gets large, so some of the symbols will be blank. Maybe you can figure them out from the comments. Use Switch I:1/0 to set the time to 12:00 AM, and I:1/1 to reset the cycle and start over.

UNZIP the attached file and load it into LogixPro, then test it out. It is fairly convoluted, because I did not attempt to simplify or organize your original logic. When you do Part 3, the fire truck, it will really get much worse, because of the poor original framework.

BIG USEFUL TIP: Always start these multi-part programming problems with the very LAST part, get it working, then work backwards, deleting the parts that are not needed for Part 2, saving with a new name, then Part 1, and so on. That way you will avoid nearly starting over for each part of the problem. The last part will not be any more difficult because you did it first, but the other parts will almost be free. You will have the correct framework in place to solve them quickly.
 
Last edited:
Thinking about your Part 3 (Firetruck), it will be much easier to shift over and use only 1 master RTO retentive timer to control the traffic light (using 1 timer and comparison functions). When the firetruck comes, simply stop the RTO timer, switch all lights to red, wait, then when firetruck gone, restart the retentive master timer.

This is why I said you must look down the road and anticipate what is coming up. Do the problem in reverse order, last part first, and you will eliminate a lot of headaches, such as re-engineering your program framework.

Also it would be easier on you (assuming you stick with the multiple timers) if you went back and fixed your timers into a proper "cascade" loop: Timer 0 times out and starts Timer 1, Timer 1 starts Timer 2 ...up to Timer 5 times out and resets Timer 0 and the cycle repeats. In your last program, Timer 5 is not part of the cascade. An Off Delay TOF is not needed here. Fix your timers where they cycle properly in order, temporarily forgetting about the lights. When you get the timers right, then work on the lights, working on each in turn.

Part 3: In real life you would NOT ever want to restart the light at the exact place it stopped. What if it is in the middle of a yellow light, or the green only has 2 seconds left in its cycle? Major pile-up! This is merely a student problem to help you learn different methods, and definately not a practical application.
 
Last edited:
Part three: When the Fire Truck approaches the intersection both sides a and b will turn Red Until the truck passes, then the light will return to the operation that was in effect before the fire truck entered the intersection.

Bryan,

With the proper method, the light can be done with 7 rungs. Adding the fire truck controls takes another 2 rungs. See how easy when you use the correct framework?
 

Similar Topics

I have an old Sentry Palletizer (S/O Number 3007 / Serial Number 1172) that has lost its program as the backup battery died years ago. I can...
Replies
0
Views
97
Hi All, Wondering if anyone has a source for information about products with problematic production runs from allen bradley/rockwell. Ive seen...
Replies
2
Views
128
I received an email from a student with the following code attached. This is supposed to control a floodgate system, and supposed to be written...
Replies
23
Views
836
I just converted an existing application from RSView32 to FactoryTalkView SE. In RSView32, the Datalog was made in a *.DBF file. There was...
Replies
2
Views
94
I am latching and unlatching "result_Data_latch" bit within same rung. Will This copy/move instruction execute correctly??
Replies
4
Views
203
Back
Top Bottom