Traffic Light 2 Directions

You still need to re-evaluate the purpose of your timer, and when it needs to run.
What is your INITIAL STATE? (i.e. no cars present on crossing street). What is the state of each output (lights) and what is the state of your lone input (I:1/8, the traffic sensor)? In this state, do you want the timer to run, or lights to change?

After you have answered these questions, ask yourself what happens when a car approaches the intersection from the crossing street. What IMMEDIATELY happens to the state of the traffic input? What do you want to IMMEDIATELY happen to the lights? If nothing, how long before changes occur?

Answering these questions on paper should get you well on your way to writing a program that will solve the word problems from your lab sheet.
Hint: You do only need one timer. You just have to decide when to run it, off of what condition, and whether you need some type of "memory" on that condition.



I hate to say it, but it's ALWAYS going to be "learn as you go with that." Don't count on any instructor being able to teach you how to problem-solve. Don't blame an instructor for inability to do that, either, if you ever want to be an effective programmer/troubleshooter. It's a skill that just takes lots of practice. You're on the right track.

Post back when you've made some more progress.

Cheers,
Dustin

🍻
Hey thanks for the explanation. I guess I still don't understand timers fully and should brush up on them again. The logic end is definitely the main thing I am struggling with as you can tell. I certainly didn't intend for that to sound like I wanted to blame my instructor either I just thought there was maybe some basics that could of been better covered on how to evaluate scenarios like this where you need to think them out. But yes you are correct it is something I need to learn and teach myself and it will take time. I guess I am more frustrated and stressed out because I "need" to understand this because I desperately need a "job". But you are correct regardless.

You are making progress. I would change the timer to a TON because if there is no cross-street traffic, the timer will not run at all. If there is cross-street traffic (I:1/8 on for 10 seconds), then the timer must run for 1 cycle then reset and stop if there is no more traffic. If there is still cross-street traffic, then the timer repeats the cycle. Therefore, because you do not need to start in the middle of a previous cycle, then you do not need to retain the value of the timer from one cycle to the next (RTO-type timer not needed).

I have it solved using LogixPro, and will post it later. Struggle on for awhile. You can create a relay to indicate "CROSS TRAFFIC FOR >10 SECONDS", but as noted in instructions: "no latch is required to enable this circuit." I think this is a hint to just use the one timer, bits from I:1/8, and Timer Comparison instructions to completly solve the problem.

that was a clear explanation. I originally thought a TON would work but I was confused on how to get it to control both lights with just one timer. The timer should control the main traffic only until the loop is completed for 10 seconds then switch over to the other set of lights and reset once that cycle is complete. hopefully I understood that right.

Gave up? Here is "a" solution, not necessarily the best for you. You can run it on the LogixPro Traffic Light Simulator if you change the I:1/8 Sensor Input to I:1/3 everywhere it occurs, then "unpark" the Cross Street traffic.

It works, but has the occasional crash due to drivers running the yellow lights. This can be prevented by adding the "delayed green" feature (both red lights on at same time for 2 second overlap).

No sir I never give up. I will tackle this problem until I understand it. Just had to do some house duties for a little while. I will throw that into logixpro later to see what you mean. I am still working on mine on paper right now. I wanna learn to work it out that way like you guys suggested.

Lancie,

Code:
BST XIC I:1/8 NXB GEQ T4:0.ACC 100 BND
Neat solution for avoiding a latch/unlatch instruction. But I think you let Raydog off too easily. Hopefully he arrives at a similar (or other working) solution before he comes back and sees what you posted.

I will say that he was at least working to solve the problem, and that's the important thing.

I did see his solution before i finished mine but I am not going to change mine to try to make his work im gonna see if I can find one on the path I was headed first. I do hope I can figure something out with all the tips you all offered too me. Thanks again to everyone that has went out of their way to help me it is much appreciated.

Maybe I did. It is always a toss-up between giving away too much information and driving the students away to other sites.

Trying to remember how I felt 35 years ago (I can barely remember that far back) after struggling with a few of these seemingly obtuse, aggravating, frustrating logic problems, many times I gave up thinking that there was no solution, or that I would never find it so why bother. I tend to help too much, but life is short.

I understand that reasoning all too clear. there has been times that I just wanna walk away because it gets so frustrating but quitting doesn't help anyone. You give good details but you also explain it clearly so by doing so I am learning at the same time and i certainly don't want the answers just handed too me I want to learn it too because its all important information.
 
I think I found one issue that was hanging me up. When I read that we couldn't use a latch or unlatch logic I assumed that that meant I couldnt use a seal in circuit either but I see in your example that you did and that is how you are able to keep the red light on the cross street red and the green light on the main street green until the car come to the intersection which then resets the timer on the first rung. very very interesting. If i figured out that mistake earlier it prolly would of been a lot simpler...

also your example doesn't crash my logixrpo or anything it seems to run find non-stop
 
The timer should control the main traffic only until the loop is completed for 10 seconds then switch over to the other set of lights and reset once that cycle is complete. hopefully I understood that right.
Yes, you did understand.

It helped me to first assume that there was NO cross traffic at all. How would the light outputs for Main Green and Cross Red look in that situation? (1)Get that logic working, (2)then add all other light outputs around those two outputs. For example, you need to start your Main Green in the first 10 seconds of Timer T4:0 to make the logic simpler. (3)You're done (except for the "delayed green" feature coming soon to a site near you!
I assumed that that meant I couldnt use a seal in circuit either but I see in your example that you did and that is how you are able to keep the red light on the cross street red and the green light on the main street green until the car come to the intersection which then resets the timer on the first rung.
Yes I did use seal-in logic, but only on the first Rung 000 for the timer. When the cross-street sensor is on, and the timer passes 10 seconds, it seals itself ON because we know it has to complete at least 1 full cycle (per the instructions). On the other hand, we must have logic to stop it after one cycle if the cross traffic goes away. The series combination of I:1/8 XIC and T4:0/DN XIO does that function.

Rungs 003 and 004 appear to have seal-in logic, but if you look closely, it is only parallel (A OR B) logic. For example, on Rung 003, I started out with "If I:1/8 is OFF and T4:0.ACC is Less or Equal to 10, then turn on Main Green Light". But if I:1/8 is ON and T4:0.ACC is Greater than or Equal to 0, AND Less or Equal to 10, then ALSO turn on the Main Green Light". Simplifying the expression and reducing it to the least complex Boolean expression, I came up with what you see on Rung 003, a paralleled A OR B logic function.
 
Last edited:
It's great to see an "assignment" thread where the OP has obviously put considerable effort into solving the problems.

raydog26, I commend your attitude "No sir I never give up. I will tackle this problem until I understand it.".

Most people would tackle the problem until they get it (sort-of) working, enough to hand in for assessment, and give up at that.

Stick with that dogmatic determination to understand the logic you, and others, produce, and you're more likely to stay in gainful employment...(y)
 
So 1 timer can control many outputs if you setup the instructions properly to turn on and off at different times while the timer is active ?

which would be the purpose of the GEQ and LEQ functions (which we just covered last monday) so its still sinking in lol
 
It's great to see an "assignment" thread where the OP has obviously put considerable effort into solving the problems.

raydog26, I commend your attitude "No sir I never give up. I will tackle this problem until I understand it.".

Most people would tackle the problem until they get it (sort-of) working, enough to hand in for assessment, and give up at that.

Stick with that dogmatic determination to understand the logic you, and others, produce, and you're more likely to stay in gainful employment...(y)

Thank you !

I never turn in anything half done (nor does the teacher accept it unless it works fully). But being an electrician I know the risk of not doing things right the first time. I never want to make a mistake I know that can be avoided. I just hope someday this stuff will click so easily like you guys understand 🤞🏻
 
Yes, but also consider the use of the LIM (Limit) instruction, as it does GEQ and LEQ in one.....

PS... perhaps leave it until you've covered it !
 
I never turn in anything half done (nor does the teacher accept it unless it works fully). But being an electrician I know the risk of not doing things right the first time.
Hmm...an experienced, serious student. Will miracles never cease! I think you have a big advantage already over many who come here.

So 1 timer can control many outputs if you setup the instructions properly to turn on and off at different times while the timer is active ?
Exactly right. That method is useful where you have a bunch of stuff happening in series or in a sequence.

I use it a lot for plant start-ups, where 20 or 30 motors have to start in a short time. You usually don't want all of them starting at once (to reduce the plant electrcal demand load, and for material-handling coveyors, they ususally need to start in a certain sequence, downstream conveyors first, then working back upstream to preven dumping material onto a stopped belt). Using an "Auto-Start Timer" (and the LIM instruction), I can give each motor a 2-second start pulse when it comes time for it to start, then wait some seconds for it to get its load moving, then on to the next motor.
 
Last edited:
I just wish that the people who program traffic lights in the UK would adopt the "forever" principle, and work off the road sensors.

At quiet times, you can approach a junction, have the lights turn red against you, so you stop and wait for.... nothing! 30 seconds later they let you go - you just have to wonder why they changed to let nobody through ! aggravating :mad:
 
Daba,
It used to be that way all over the US too! Several years ago on this site I created a "Smart Light" which used traffic sensors to determine the most efficient way to pass more cars. I see this idea being adopted now by many city traffic control departments. I don't know where they got the idea, but I am grateful to finally have some sanity in this area.
Yes, but also consider the use of the LIM (Limit) instruction, as it does GEQ and LEQ in one.....
LIMs are probably in the next lesson. Raydog should have no trouble swapping one LIM for each set of LEQs and GEQs.
 
Last edited:
I just hope someday this stuff will click so easily like you guys understand 🤞🏻

and i'm certain it will, providing you never, ever, forget the basic principle of how the controller "scans" your program sequentially and continuously, without waiting for anything to happen.

It seems to be a recurring theme in so many threads... "my program has stuck on rung XXX". The idea that a program "gets stuck" can be a hard one to overcome with some students, but once dealt with a lot of their "problems" go away....
 
Daba,
It used to be that way all over the US too! Several years ago on this site I created a "Smart Light" which used traffic sensor to determine the most efficient way to pass more cars. I see this idea being adopted now by many city traffic control departments. I don't know where they got the idea, but I am grateful to finally have some sanity in this area.

If it was down to you, then :geek:

I have worked out that lights changing uses more electricity (=fuel) than if they don't, so ecological savings are up for grabs too.

On the continent (Europe, that is), it is common for traffic lights to have flashing amber in all directions, during low flow times - this alone saves 50% energy against a steady red or green light. It means "Proceed with Caution", which is exactly what you do when the lights break down !

100 yards from my house is a T-Junction with traffic-lights. At peak times there are queues of cars from all directions. When they broke a couple months ago - for 3 days - there were no queues, and NO ACCIDENTS either... go figure !
 
Daba,

I think there is an old copy of my SmartLight program in the Downloads section. EDIT: Yes, first posted in 2006 and still there. I take little credit, because it is only sensible to make smart traffic lights as the technology becomes available. I am sure that many other people have had the same thought while waiting at traffic lights with no other vehicle visible in any direction. That is when I thought of it, after working on student traffic light programs.

Now I see that the I:1/8 instruction is NOT needed on either Rung 003 or Rung 004 of RayDog's program - just extra instructions that are not needed, but do not prevent the program from running. I:1/8 only has to be in Rung 000 for the program to work correctly! An old dog can always learn better ways....
 
Last edited:
Bravo!

I would just like to say that I personally am proud to have been involved with this thread because of statements like this:

No sir I never give up. I will tackle this problem until I understand it. Just had to do some house duties for a little while. I will throw that into logixpro later to see what you mean. I am still working on mine on paper right now. I wanna learn to work it out that way like you guys suggested.
and:

I did see his solution before i finished mine but I am not going to change mine to try to make his work im gonna see if I can find one on the path I was headed first. I do hope I can figure something out with all the tips you all offered too me. Thanks again to everyone that has went out of their way to help me it is much appreciated.
Now that's the kind of pig-headed determination that will make you a good programmer! :D
That's also the kind of attitude I was trying to promote by not directly answering your questions, but trying to get you to answer them yourself. Seeing that even when an answer was put in front of you, you still wanted to find your own tells me that you will do just fine in this career path you've chosen for yourself.

I also think that you see now that once you got over the hurdle of understanding that your timer didn't need to run all the time, and that the traffic sensor was the catalyst in the system, the rest is really not that complicated. Writing your ideas out in sketch form on paper will help you tackle a big problem (like an entire new program) by understanding that even big problems are usually just a series of smaller ones.

The logic end is definitely the main thing I am struggling with as you can tell. I certainly didn't intend for that to sound like I wanted to blame my instructor either I just thought there was maybe some basics that could of been better covered on how to evaluate scenarios like this where you need to think them out. But yes you are correct it is something I need to learn and teach myself and it will take time. I guess I am more frustrated and stressed out because I "need" to understand this because I desperately need a "job".
I didn't think you were trying to blame your instructor, only warning you against that pitfall. Hopefully you will have good instructors, but you will almost surely also have bad, apathetic, cynical, burnt-out ones. The point is to not let the bad ones give you an excuse to half-a** anything, but I can see now that my fears about that were unfounded.
Just a couple of years ago, I was right where you are now, feeling like PLC programming was a secret language that I would never understand, and I was mostly teaching myself and getting very frustrated, going in circles around simple problems, over-complicating them. I went to a few tech classes, tried to get tips from a few guys at work, but mostly the instructors just wanted you to get a passing grade and move on, and the older techs I worked with knew just enough to get by and were afraid of any new methods or techniques and just wanted you to do things exactly like them, whether you understood why or not. It wasn't until I worked with a guy that found a couple of projects for me that I could work on without destroying critical equipment, and without someone hovering over my shoulder, that things really "clicked". He allowed me to make mistakes, and then encouraged me to work my way out of them. That made all the difference. But the point is, I had to PUSH to get that kind of work. I think an ounce of determination is worth a pound of education, most of the time.

Anyway, I'll get off my soapbox now. Suffice it to say, if you keep working with the same determination that you've shown on this problem, someone will recognize that quality in you, and you will take off in this field.

Cheers,
Dustin

🍻
 
Yes, but also consider the use of the LIM (Limit) instruction, as it does GEQ and LEQ in one.....

PS... perhaps leave it until you've covered it !

I actually am working on that method right now and I think it might work I have to type it into logixpro and try it out. we just covered limits last week so they are fairly new but I find those easier to understand then LEQ or GEQ. odd I know lol

I use it a lot for plant start-ups, where 20 or 30 motors have to start in a short time. You usually don't want all of them starting at once (to reduce the plant electrcal demand load, and for material-handling coveyors, they ususally need to start in a certain sequence, downstream conveyors first, then working back upstream to preven dumping material onto a stopped belt). Using an "Auto-Start Timer" (and the LIM instruction), I can give each motor a 2-second start pulse when it comes time for it to start, then wait some seconds for it to get its load moving, then on to the next motor.

that sounds fairly complicated to write but for you im sure its not since you understand it better. things like that do you learn working at a company or is it something i should know before i look for a job ? i assume every company will want their equipment running differently.

I just wish that the people who program traffic lights in the UK would adopt the "forever" principle, and work off the road sensors.

At quiet times, you can approach a junction, have the lights turn red against you, so you stop and wait for.... nothing! 30 seconds later they let you go - you just have to wonder why they changed to let nobody through ! aggravating :mad:

I know the feeling there are still roads near my house that are like that mostly at night tho. but you can sit at a light for 10 minutes before it decides to change. drives me nuts. or during high traffic time one road will have green for a few minutes and we get a few seconds.

and riding a motorcycle don't trip the sensors so I sometimes gotta jump off and hit crosswalk signal lol

I would just like to say that I personally am proud to have been involved with this thread because of statements like this:

and:

Now that's the kind of pig-headed determination that will make you a good programmer! :D
That's also the kind of attitude I was trying to promote by not directly answering your questions, but trying to get you to answer them yourself. Seeing that even when an answer was put in front of you, you still wanted to find your own tells me that you will do just fine in this career path you've chosen for yourself.

I also think that you see now that once you got over the hurdle of understanding that your timer didn't need to run all the time, and that the traffic sensor was the catalyst in the system, the rest is really not that complicated. Writing your ideas out in sketch form on paper will help you tackle a big problem (like an entire new program) by understanding that even big problems are usually just a series of smaller ones.

I didn't think you were trying to blame your instructor, only warning you against that pitfall. Hopefully you will have good instructors, but you will almost surely also have bad, apathetic, cynical, burnt-out ones. The point is to not let the bad ones give you an excuse to half-a** anything, but I can see now that my fears about that were unfounded.
Just a couple of years ago, I was right where you are now, feeling like PLC programming was a secret language that I would never understand, and I was mostly teaching myself and getting very frustrated, going in circles around simple problems, over-complicating them. I went to a few tech classes, tried to get tips from a few guys at work, but mostly the instructors just wanted you to get a passing grade and move on, and the older techs I worked with knew just enough to get by and were afraid of any new methods or techniques and just wanted you to do things exactly like them, whether you understood why or not. It wasn't until I worked with a guy that found a couple of projects for me that I could work on without destroying critical equipment, and without someone hovering over my shoulder, that things really "clicked". He allowed me to make mistakes, and then encouraged me to work my way out of them. That made all the difference. But the point is, I had to PUSH to get that kind of work. I think an ounce of determination is worth a pound of education, most of the time.

Anyway, I'll get off my soapbox now. Suffice it to say, if you keep working with the same determination that you've shown on this problem, someone will recognize that quality in you, and you will take off in this field.

Cheers,
Dustin

🍻

Thank you Dustin. Truly words of wisdom. I appreciate everyone welcoming me in and offering help with no criticism at all. I been on many car forums and such where people are smart asses right out the gate and don't wanna help at all. certainly not the case here. you guys have been great and are making things so much easier for me to learn. It certainly is a step in the other direction from the work I did before. House wiring is so much easier that is for sure. everything you described you felt and went though is me right now. I try to offer help to my classmates once i understand from you guys helping me. I gave a few guys the link for the ron beaufort videos i was given on here and it helped them a lot also. I am seriously considering that class in the future to further my education


this is what i came up with using limits off of what was shown earlier.
 
Last edited:

Similar Topics

I am a complete newbie to this stuff and wanted to try this out and was looking for any information on how I can complete this by Wednesday...
Replies
19
Views
12,791
Hey Folks I've done some browsing along the forum for some help in a matter. It would seem the question has been asked many times but it just...
Replies
41
Views
16,901
I'm looking for a simple, cost-effective way to control traffic lights from a central location. The lights are actually mounted on signs next to...
Replies
2
Views
1,881
Hey guys, I'm fairly new to PLC and RSLogix5000, as I am currently a student. I am doing a traffic light project, which is only running off of...
Replies
8
Views
1,978
Hi all, I am having a problem programming a single traffic light, one red, one green, and one yellow light. I am not a student needing home work...
Replies
12
Views
3,433
Back
Top Bottom