You are on page 1of 8

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
Try our online PLC Simulator- FREE. Click here now to try it. ---------->>>>>Get FREE PLC Programming Tips your first name your email address Get The PLC Tips Now! New Here? Please read this important info!!!

PLC S.net - Interactive Q & A > PLC S.net - Interactive Q & A > LIVE PLC Questions And Answers

User Name User Name Password

Remember Me? Log in

Traffic light sequence, cross roads


Register FAQ Calendar Downloads PLC Reviews

PLCS.net Store

Today's Posts

Search

Page 1 of 3 1 2 3 > Thread Tools May 28th, 2002, 04:29 PM Display Modes #1 Traffic light sequence, cross roads

IMRAN
Member

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 imran@shaikhsport.fsnet.co.uk. Thank you all!

Join Date: May 2002 Location: LONDON Posts: 4

May 28th, 2002, 04:52 PM

#2

I have ideas. You are not registered yet. Please click hereseveral to register!
Lifetime Supporting Member

Tom Jenkins

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.

http://www.plctalk.net/qanda/showthread.php?t=217

1/8

2/5/2014
Join Date: Apr 2002 Location: Milwaukee, WI Posts: 5,112

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

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!

May 28th, 2002, 08:52 PM

#3 THAT'S IT !!!

Allen Nelson
Member

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 R E D Y E L L O W G R E E N Y E L L O W G R E E N | / | | / | | / | | / | + () | | N S | R E D + ()

Join Date: Apr 2002 Location: West C hester, PA Posts: 1,368

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 + -T M R+ G R E E N | | 1 0 0 0 1 | / | | V 1 0 0 | () | | 1 0 0 0 1 | 5s e c | || | | + +

Next, when that's done, the N-S traffic is set to go, so Set it to Green and make EW Red.
E W + -T O N+ Y E L L O W 1 0 0 0 1 |T i m e r : T 5 : 0| | / | || + |T i m eb a s e : 1 . 0| | |P r e s e t : 5| | |A c c u m : 0| | + + | | N S | T 5 : 0 G R E E N + | / | + ( S E T } D N | | E W | R E D + ( R S T )

http://www.plctalk.net/qanda/showthread.php?t=217

2/8

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

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 R E D Y E L L O W G R E E N Y E L L O W G R E E N | / | + | / | + || + || + + () | | | | | E W | N S | | E W | | N S R E D | Y E L L O W | | G R E E N | | R E D || + | / | + + || + + () | | | | E W | N S | N S | E W | Y E L L O W | Y E L L O W | R E D | G R E E N | || + || + || + || +

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 by Allen Nelson; May 28th, 2002 at 09:00 PM.

May 28th, 2002, 09:00 PM

#4

Eric Nelson

Lifetime Supporting Member + Moderator

I'm amazed! 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... -Eric

Join Date: Apr 2002 Location: Randolph, NJ Posts: 4,199

http://www.plctalk.net/qanda/showthread.php?t=217

3/8

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

May 28th, 2002, 10:09 PM

#5 Programming Style

Peter Nachtwey
Member

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.

Join Date: Apr 2002 Location: Vancouver, WA, UMSA, United Marxist States of America Posts: 5,678

May 28th, 2002, 11:35 PM

#6

Gerry
Guest Posts: n/a

Allen: Can you also post the dynamic Karnaugh map?

May 29th, 2002, 04:26 AM

#7

iant

Lifetime Supporting Member + Moderator

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 __________________

Give all the answers - People seldom learn.


Join Date: May 2002 Location: Melbourne Posts: 3,017

Guide People to the posibilities - Their Answers will come easily. - Their Knowledge will grow. They will then teach others Regards Ian Trost

May 29th, 2002, 04:34 AM

#8 Quote:

iant

Lifetime Supporting Member + Moderator

Originally posted by Gerry Allen: Can you also post the dynamic Karnaugh map?

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


Join Date: May 2002

YOU CAN NOT RELY ON OTHERS FOR YOUR ANSWERS


4/8

http://www.plctalk.net/qanda/showthread.php?t=217

2/5/2014
Location: Melbourne Posts: 3,017

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

__________________

Give all the answers - People seldom learn. Guide People to the posibilities - Their Answers will come easily. - Their Knowledge will grow. They will then teach others Regards Ian Trost

May 29th, 2002, 06:33 AM

#9

Steve Bailey

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.

Lifetime Supporting Member + Moderator

Join Date: Apr 2002 Location: The boondocks of Western Massachusetts USA Posts: 4,807

May 29th, 2002, 06:39 AM

#10 re:traffic lights

IMRAN
Member

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

Join Date: May 2002 Location: LONDON Posts: 4

May 29th, 2002, 07:16 AM

#11

Pierre

Lifetime Supporting Member

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.
5/8

http://www.plctalk.net/qanda/showthread.php?t=217

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

Hey, what about embeded smoke? __________________ If it looks like a Cat...

Join Date: Apr 2002 Location: Montreal Posts: 1,663

May 29th, 2002, 08:42 AM

#12

Tom Jenkins

"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!

Lifetime Supporting Member

Join Date: Apr 2002 Location: Milwaukee, WI Posts: 5,112

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!

May 29th, 2002, 10:26 AM

#13

PhilRey
Member

EricThe 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
Join Date: Apr 2002 Posts: 57

May 29th, 2002, 04:27 PM

#14 A Darwin Award

Allen Nelson
Member

Join Date: Apr 2002 Location: West C hester, PA Posts: 1,368

Steve I am unrepentant. I will pay no such penance. My reply was a Darwinian thing - a matter of survival.... GerryI 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 -

http://www.plctalk.net/qanda/showthread.php?t=217

6/8

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A

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 by Allen Nelson; May 29th, 2002 at 04:33 PM.

May 30th, 2002, 03:12 AM

#15 Engineer?

IMRAN
Member

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 ****ed 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

Join Date: May 2002 Location: LONDON Posts: 4

Page 1 of 3 1 2 3 >

Jump to Live PLC Question and Answer Forum


Bookmarks Twitter Reddit Digg StumbleUpon del.icio.us Google

http://www.plctalk.net/qanda/showthread.php?t=217

7/8

2/5/2014

Traffic light sequence, cross roads - PLCS.net - Interactive Q & A


Previous Thread | Next Thread

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

Posting Rules You You You You may may may may not not not not post new threads post replies post attachments edit your posts

BB code is On Smilies are On [IMG] code is On HTML code is Off

Forum Jump LIVE PLC Questions And Answers Go

Similar Topics
Thread simple traffic light for zebra crossing please The ongoing traffic light dilemma... Looking for a traffic light control program SLC 500 Traffic Light Program Traffic Light With Walk Buttons Thread Starter razali 93lt1 rcmarket dpatto01 hoodedrat Forum LIVE PLC Questions And Answers LIVE PLC Questions And Answers LIVE PLC Questions And Answers LIVE PLC Questions And Answers LIVE PLC Questions And Answers Replies 8 17 38 58 10 Last Post September 8th, 2013 11:06 AM September 5th, 2009 09:04 AM May 10th, 2005 07:40 AM December 31st, 2004 11:23 PM December 23rd, 2004 08:16 PM

All times are GMT -5. The time now is 12:15 AM. Contact Us - PLCS.net - Text - Top .

http://www.plctalk.net/qanda/showthread.php?t=217

8/8

You might also like