Traffic light sequence, cross roads

IMRAN

Member
Join Date
May 2002
Location
LONDON
Posts
4
Hello all. I am stuck and require help as soon as possible. I need to write a simple ladder diagram to control a traffic light sequence for a UK cross road. So we go green / amber / red / red and amber/ green.


This had to be done using one plc, and maximum four timers. If anyone has any ideas please e-mail me at [email protected].
Thank you all!
 
I have several ideas.

First, do a search on this site. Traffic light problems abound, as they appear to be the most common application for PLCs, far exceeding slicing pickles, for example.

Second, you need to make a list of all of the inputs and outputs for the system - that is, a detailed list of everything that the PLC is turning on (outputs like Green North, Amber South, etc.) and signals it is receiving (penguin at south east crosswalk, for example.)

Then, you need to go to your text, and find out what makes a timer time, and an output turn on, and a contact close.

Then you need to write a detailed description of each step in the cycle.

Then you need to read the tutorial on this site.

Then you need to replace each event in your description with the corresponding ladder logic command (on = contact closed, for example).

Then you need to come back to the site and explain the educational value to you (and the monetary value to me) if I e-mail you the complete program.

I guess summer school is now in session, folks!
 
THAT'S IT !!!

ENOUGH !!!

I'm sick of you students demanding the "difficult" answer to the traffic light problem. So I'm going to break rank with my collegues, go against policy, and let you have it!

Here's what you do:

First, the East-West street is going to be the dominant direction of traffic. Therefore it's ON when nothing else is ON. Coded, that looks like this:

E-W E-W N-S N-S E-W
RED YELLOW GREEN YELLOW GREEN
----|/|------|/|------|/|------|/|---------+---( )
|
| N-S
| RED
+---( )



Next, When it's time to change the flow of traffic, the E-W GREEN light goes OFF. So you run the E-W YELLOW for 5 seconds (The timer resets itself after it is done so it will work the next time):

E-W +-- TMR --+
GREEN | | 10001
---|/|--------| V100 |-----( )
| |
10001 | 5 sec |
---| |--------| |
+---------+




Next, when that's done, the N-S traffic is set to go, so Set it to Green and make E-W Red.

E-W +---------- TON --+
YELLOW 10001 | Timer: T5:0 |
----|/|------| |-----+----| Time base: 1.0 |
| | Preset: 5 |
| | Accum: 0 |
| +-----------------+
|
| N-S
| T5:0 GREEN
+---|/|------+-----(SET}
DN |
| E-W
| RED
+-----(RST)


Don't worry about the different type of timer - no reset is needed here. Both timers are IEC 61131-3 complient.


Next, you would repeat the E-W YELLOW code for the N-S YELLOW, which goes ON only when N-S GREEN goes OFF.


Finally, All that's left is to return the system back to N-S Red, and E-W Green. I'll leave it to you to work out the Karnaugh map (it's in your text book), but that logic should be this:


E-W E-W N-S N-S E-W
RED YELLOW GREEN YELLOW GREEN
-----|/|-----+-----|/|-----+-----| |-----+-----| |-----+-----+-----( )
| | | | |
E-W | N-S | | E-W | | N-S
RED | YELLOW | | GREEN | | RED
-----| |-----+-----|/|-----+- +-----| |-----+ +-----( )
| | | |
E-W | N-S | N-S | E-W |
YELLOW | YELLOW | RED | GREEN |
-----| |-----+-----| |-----+-----| |-----+-----| |-----+





Now all you have to do is shove it up your PLC, and watch it go.

Now, a couple of warnings:
  1. I don't want to have to do this EVER again. Don't tell anyone about this site!!!.
  2. I don't know the PLC you are using, so I made this rather generic. You may have to adjust a few thing depending on your PLC.
  3. This is off the top of my head. You may need to debug it (probably not - I get paid for my ability to bang out code).
  4. Everything here is a lie and won't work

That's the "big problem"!!! 5 lines of code!!! I can't figure out why students make such a big deal about it!
Good Luck You'll need it!!

©¿©¬
 
Last edited:
I'm amazed! :eek: Since Phil opened the new forum, it took over a month before we got the first traffic light question! I figured it would only take a few days...:rolleyes:

-Eric
 
Programming Style

I would use tables to do this. I would have the light sequence divided into states with a table of bits representing the 6 lights that must be turn on and off and a table of timer values to before going to the next state. The index register would represent the state number.

The advantage tables have:
1. The light patterns and time delays can easily be changed from a HMI.
2. One can insert, move, or delete states easily.
3. They are very efficient. Less code but more data.

One may have to add a left turn lane later. The above technique makes this easy and easier to understand later.
 
Its a nice new forum. But what about the elevator on the 40th floor where is the Zebra crossing.

Can we get degree's in breakfast cerial packs:D
 
Gerry said:
Allen:

Can you also post the dynamic Karnaugh map?



DO THE WORK ....LEARN THE JOB..... MAKE YOUR OWN FUTURE

YOU CAN NOT RELY ON OTHERS FOR YOUR ANSWERS:(
 
Allen,

I can't decide whether you should be stripped of your credentials or awarded an honorary doctorate in compassionate PLC programming. While I understand (and share) your frustration with the students who seem unwilling to attempt their own solution to the traffic light problem, posting such an elegant solution on a public forum such as this could lead to hordes of new graduates descending upon the intersections of the world, and reprogramming the light sequences. Consider the potentially catastrophic ramifications of a simple typo such as inserting a XIC instead of the XIO for the timer done bit in the third rung.

I think as penance, you should be required to write a 1500-word essay on the difference between unitary, modular, and rack-mounted PLCs.
 
re:traffic lights

Just want to thank every one who has tried to help, thank you all.

Thanks for the Program, (i liked the 'hidden' comments in the diferent colour text-amusing) Ill be stydying it carefully.

Thanks for the 'tables' idea, but
This program had to be in Ladder diagram form.

Also this program will never see a PLC, it simply has to be seen running by the lecturer on a PC based simulator, that lights up the outputs as the program runs, etc.

I have found an Aus. traffic light sequence, which was helpfull, but as they miss out the sequence: RED / RED AND AMBER / GREEN, and go from RED - GREEN directly, (and it used an extra timer) i couldnt see how to modify it to work on the UK based light sequence.

Any more ideas from anyone are most welcom.


Imran.
 
Steve B.-
I think as penance, you should be required to write a 1500-word essay on the difference between unitary, modular, and rack-mounted PLCs.

Hey, what about embeded smoke?
 
"Any more ideas from anyone are most welcom."

Imran, ole pardner, you is clueless! You will never be a good engineer until ya recognize sarcasm! Allen wuz jist tryin' to stop the flow of questions from students whut wants us to do their homework fer them, instead of askin' fer help on doin' it themselves!

"i couldnt see how to modify it to work on the UK based light sequence."

Thet is 'zactly my point. The objective of the instructor wasn't to git a program - it wuz to teach you how to analyze a problem and learn and apply problem solvin' skills to findin' a solution. After all, I is in great doubt thet the instructor is buildin' traffic lights in his basement!

Engineers is not guys thet know the answers to specific problems. REAL engineers is guys whut know how to analyze problems and apply the principles of science and logic to developin' the solution to ANY problem.

Lessons learned hardest is learned best!
 
Eric-

The reason it took so long to get a traffic light question on the new forum is because the geniuses are still posting those questions on the old forum - you know ... the one that says
Please post ALL NEW questions in the NEW forum
in big red letters on the top of the page.

Does that tell you anything?bonkhead
 
A Darwin Award

Steve -
I am unrepentant.
I will pay no such penance.
My reply was a Darwinian thing - a matter of survival....

Gerry-
I left the creation of the Karnaugh map (which, in dealing with traffic lights, must, by nature, be dynamic. I mean - who ever heard of STATIC traffic lights?)

IMRAN -
You private messaged me, which is fine, but all discussions pertaining to posted material should be kept public, so that other lurkers may benefit. (As you can gather, the Traffic Light Problem has come up before, and not just from your school. But you also have classmates who may also wish to use my code.God help them. So please, feel free to post again with any lingering questions.

PhilRey -
Yes, they've been posting at the old site - but the conversation in Vietnamese(?) is fascinating.
 
Last edited:
Engineer?

Ok friends, ive had enough of this. Ive tried to be respectfull and humble to you all in my questions and all i get is this 'student asking questions' bull.

Ive just come home from a 12 hour night shift, so excuse my typing. But i feel some points have to be made here......

I understand that good engineers are about problem solving. I understand this and respect this. I have a job which involves these principles.

But it would be nice for people to take note that i am no PLC engineer (as i sure some of you have guessed), nither do i wish to be. As nice as they are, i have no intention of programing PLCs for a living, so all those of you worried that i may be causing motor way (or freeway) 'pile ups' may calm down.

Also, and i hope ur still reading this, i have already solved all other assingment, from a central heating system, to a metal/plastic sorting machine, and i have just done my exam, which at my level was bloody easy.

But this darn trafficlight sequence has got me bloody well fussed and rather pissed off- mainly cos i cant find the solution to this relativly simple task.

All I wanted, well......not even wanted. All i asked was for some help in this assingment of mine. So i could put PLCs behind me and continue in my HNC and make my prospects in finding a job within the railway (not PLCs or signaling) a better one.

Insted all i have (with the exception of a few) is snubby nosed 'engineers' talking down to a 'student'. Now i dont want to sound rude, but i am quite sure those snubby nosed 'engineers' couldnt do my 'engineering' job to save ur wage cheque.

Now, if someone from a computer based or PLC based engineering background had a question for me, on locomotive traction or mechanical engineering, I WOULD GLADLY HELP THEM.

Now ill leave you 'engineers' with this thought. You all have fine PLC jobs, or so it seems. But remember how you got there.
BY ASKING THE RIGHT PEOPLE THE RIGHT QUESTIONS AND LEARNING FROM THEM.


Have a nice day :)
 

Similar Topics

i was working on a light sequencer or a four way intersection traffic light. I've designed my own light sequence using 2 SQO sequencers, and a...
Replies
3
Views
24,144
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,714
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,826
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,865
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,952
Back
Top Bottom