Traffic Light 2 Directions

raydog26

Member
Join Date
Nov 2011
Location
NJ
Posts
51
Hey guys I am back for round 2 lol

I have been working on this new assignment and I almost have it done but I kinda hit a road block. I have found some examples that helped me but I don't think I am on the same path. I have it setup right now to run the lights in a loop using a RTO timer and limits. But I am stuck on the 10 second delay part for the side street. I am assuming that will require a separate timer in parallel.

Image (4).jpg Image (5).jpg
 
Last edited:
You should post what you have done so far so we can see where you may be hung up.

It's been said before but it bears repeating: when writing a new program, draw up a flow-chart. What is the initial state of the inputs and outputs? What will happen next? What will be the sequence of events once the normal (main street) traffic sequence is interrupted?
Sketching this out on paper will help out immensely in answering your own questions.

Cheers,
Dustin
 
hrm that sounds like a good method... The issue I am currently having is the teacher hasn't really taught how to trouble shoot he taught the basic then threw labs at us and I haven't been able to properly figure out how to tackle them yet. I have been lucky so far and got help on here otherwise I would be worse off then I am now lol

But back on to what you originally asked, this is what i have so far. I got the lights to cycle on the timers. but one way doesn't stay green like I need until a car approaches intersection. I was going to write my program in logixpro using their inputs and outputs but then i would need to re-write it anyway because i can use all them in my lab.
 
Well you have a good start there, but the glaring error is, where is the input from the traffic sensor for the side street? This input will be the major catalyst for change in this system. The way your program is written now, the lights are just on a constant loop, regardless of the traffic situation.

Actually, they are not going to loop, unless there is something else we're not seeing in your program that is resetting your RTO. Remember, an RTO .ACC doesn't reset on a false execution of the rung like a TON instruction.

At this point you really should get out pencil and paper and sketch out a flow-chart before trying to write any more code. You'll be glad you did, I promise you.

HINT: you can do this with one timer. Just think about what needs to trigger your timer
 
Ok thanks, I get some paper and sit and try to sort it out again. I been trying to teach my self to trouble shoot but without proper knowledge its getting tricky. I appreciate the help.

Ill post another solution tomorrow when i get it typed into rslogix.

I think i am going to go back to my original method and use a TON timer.
 
Sequential:

if you covered the theme you should use grafcet aka SFC (sequential flow chart)

If you did not, than you will have to do it wiithout of course.

SFC is ideal for solving and trouble shooting seguential problems. This problem is simple enough to do it without. But even for this problem grafcet will make it very simple for you, maybe a little bit more 'typing' but for the rest :)
 
Raydog,

Comparing your Lab 4 instructions to your Lab 4 PDF file, you need to work on your ability to translate word descriptions into PLC logic. This is something that has to be learned along with all the terms that describe how electrical devices operate.

Now, look how the Main Street green light is described: "Green forever unless loop has been tripped" and the Crossing Streets red light: "Red forever unless loop has been tripped."

Alarm bells and lights should be flashing in your brain about now. Look at the word "forever". Does that sound like a timer-controlled light (as you have programmed)? How can a timer be used to time up to "forever"? That would be like creating a timer that counts up to infinity. Well, maybe it can be done because that is what clocks do, but they never reach "forever".

Hint: You do not need a timer to control the main part of the PLC logic for this traffic control system. The key is this phrase: '..."trips the loop" of an inductive sensor buried underground in the crossing streets.' Apparently the "loop" used here made you think that the traffic light used some type of logic loop (repeating timer) for control, but what is being desribed is a type of sensor, literally a loop of wire that serves as an inductive pickup coil (antenna) to detect a large chunk of metal above (vehicle).

You should think of this inductive sensor as a switch: On when a vehicle is sitting on or near the loop, off when no vehicle is present.

EDIT: Reading Page 2, now they threw in a monkey wrench. It appears that if the Crossing Street sensor I:1/8 is tripped, then the light DOES run in a repeating 24-second loop, so you will need your timer after all. However, you should adjust the times for each light to match the Lab 4 instructions: green 10, yellow 2, and red 12 seconds in each direction ONLY WHEN I:1/8 is ON.
 
Last edited:
Raydog,

Comparing your Lab 4 instructions to your Lab 4 PDF file, you need to work on your ability to translate word descriptions into PLC logic. This is something that has to be learned along with all the terms that describe how electrical devices operate.

Indeed, I wish that was something they spent more time teaching because right now its learn as you go with that.


I expanded on my idea from my previous attempt to make this problem work. I think I am closer now although it still confuses me some but I guess practice will make things easier. I should make notes on what each rung does so I can better understand it that way. lemme know what you guys think of it. I think I need to adjust some time values still.
 
actually I was going over the problem again and I think I found a mistake already. I don't have a way to keep traffic flowing on the main street if the loop doesn't remain closed for less then 10 seconds. Im thinking add another timer. hrm
 
Right, you have to adjust your thinking. Now the primary control is the cross street sensor, and when it is OFF, green light on main street is always on.
 
I expanded on my idea from my previous attempt to make this problem work. I think I am closer now although it still confuses me some but I guess practice will make things easier. I should make notes on what each rung does so I can better understand it that way. lemme know what you guys think of it. I think I need to adjust some time values still.

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.

raydog26 said:
Indeed, I wish that was something they spent more time teaching because right now its learn as you go with that.

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

🍻
 
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.
 
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).

RAYDOG LAB 4- REV 1.jpg
 

Attachments

  • RAYDOG LAB 4- REV 1.ZIP
    509 bytes · Views: 31
  • RAYDOG LAB 4- REV 1.pdf
    204.8 KB · Views: 78
Last edited:
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.
 
Last edited:
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.
 

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,742
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,851
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,868
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,960
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,412
Back
Top Bottom