LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI Traffic Light CLD Soln vs mine

Ahhh Altenbach,
 
I will definitely try your suggestion! My light bulb just went off.
 
Once again the code was the fastest for me to slap together with minimal func on the block diagram. I simply used 2 cases and duplicated the others, that was left. This left me with tedious settings of booleans that I got bored with quickly. This particular practice exam is quite repeatable in coding. I'll do something not so repeatable next time.
 
But have the idea now, use xcontrols whenever the controls is repeated repeated repeated....
0 Kudos
Message 21 of 85
(2,367 Views)


altenbach wrote:

 Have you ever seen a light where the red and green are on at the same time?


You know what? I have.  Some places in PA near where my in-laws live have these lights that have a solid red and a green left turn arrow on the same time.  Even though the green arrow comes on, the light stays red.  I don't know precisely what that means.  Does that mean you have to stop before you make a left?  These are on a 3 light traffic light.  I think it may be just a cheaper way of having the 5 position light, where you have red at the top, yellow and green arrow on the left, and yellow and green solids on the right.  But yet when the traffic is straight through, the green arrow goes out and the red solid stays red for the left turn lane which means you can't turn left yielding to oncoming traffic like you can with the 5 position light.  But I've always said that PA is a little backwards.Smiley Wink  Sorry, Ben.Smiley Very Happy


Message Edited by Ravens Fan on 04-15-2008 05:43 PM
0 Kudos
Message 22 of 85
(2,337 Views)
When I was in England I saw that the traffic lights there have a state before changing from red to green. The amber light is turned on before the red goes out and the green goes on. I think that's to get people to rev up their engines. Smiley Very Happy

http://en.wikipedia.org/wiki/Traffic_light
0 Kudos
Message 23 of 85
(2,327 Views)
Yes, there could be more than 3 states and that would be easy to expand.
 
Still, it is unlikely that we ever need all possible 2^3 states of the three booleans. 😄
0 Kudos
Message 24 of 85
(2,324 Views)

@Ravens Fan wrote:
But I've always said that PA is a little backwards.Smiley Wink  Sorry, Ben.Smiley Very Happy


(You must have put this in after my post).

Hey! I'm originally from Philly.

Oh, wait. I see your point. Smiley Very Happy
0 Kudos
Message 25 of 85
(2,321 Views)
Let's say I use an Xcontrol for the traffic light CLD example, my Xctrl has a cluster with the 6 lights indicators and outside the cluster on its own is the "left turn detector" boolean dub the "vehicle indicator". Now I need 2 pairs of lights always working in pairs and the other intersecting pair to work different.
 
Do I create two Xctrl, one for North-South and one for East-West. I see its easy to make them all work the same, in this case I need two pairs to work opposite the other pair. Any verbal suggestions?
 
 
 
Btw, VA also has those dumb lights like PA. If you were speeding from afar approaching the lights, the red and green were both glaring so until you got right up on the traffic signal (braking) was when you could tell you had the light. Here in NJ we have traffic egineering, jughandles and left lanes are NOT for turning left but for going straight.Smiley Very Happy
0 Kudos
Message 26 of 85
(2,312 Views)


richjoh wrote:
Btw, VA also has those dumb lights like PA. If you were speeding from afar approaching the lights, the red and green were both glaring so until you got right up on the traffic signal (braking) was when you could tell you had the light. Here in NJ we have traffic egineering, jughandles and left lanes are NOT for turning left but for going straight.Smiley Very Happy


Oh yes.  I forgot about those Jersey jug handles.  The only state where you can't make a left.  You have to make a half a dozen right turns and take 10 minutes to do it.  I didn't realize VA had those lights as well.  One of the things that trips me is I when I've sitting there waiting for the red light to go away and never notice that the green arrow lit up because it isn't has bright and noticeable.  Hopefully there is no one behind me (like a local) blowing their horn.  And since I have Ravens plates in Steelers country, they blow their horn a little louder.Smiley Very Happy
0 Kudos
Message 27 of 85
(2,286 Views)
If you are old enough you may remember when traffic lights had only red and green, no yellow. The red came on with the green for a few seconds before the green went off. Those were horrible for color blind people like me, because sometimes you did not know the red was on until the green went off - no advanced warning. Yellow is so much more user friendly.

Lynn
0 Kudos
Message 28 of 85
(2,256 Views)

OK officially here is the final soln to the Traffic Light sample CLD exam. I replaced all those booleans const with Bundle by Name and now its a little easier to read or debug. Currently my soln's North-South (default) state has all the booleans correctly set, you need to go through the rest and set red, yellow green whatever or red+green if you live in those States like....mentioned above.

Once again, for those planning to take the CLD, you need to add a few things, a subVI, comments and maybe 1 error handler (but stop lights should not ERROR or someone's life could be in danger! Just 1 case where poping up an error in the face is not the best idea, but maybe something smarter would do justice. But, its only a test...

Xctrl: works great for controls on the front panel but I'm using indicators. The facade VI events need to be fired. I have not yet work out how to make an xctrl indicator in my stoplight soln work for simple block diagram. Could be that its more work using xctrl but not sure at this time.

The attached includes the *.ctrls I forgot to include from the thread post.



Message Edited by richjoh on 04-16-2008 11:31 AM
0 Kudos
Message 30 of 85
(2,231 Views)