Tuesday, March 13, 2012

Managing traffic lights

Imagine the situation - you're having to shut down one lane of a road. It doesn't see a lot of traffic, but it joins up with another at the point you're working at. In order to allow traffic to pass along it safely you need to make sure there'll be no traffic turning into it and so you place pair of traffic lights.

To ensure a smooth  flow of traffic the lights have sensors to detect traffic waiting so they can switch when needed; however being automated the possibility of error needs to be taken into account and so every so often they switch even if there is no traffic waiting.

Sadly the road you're not working on is very busy and even this short delay is causing tailbacks. It has therefore been decided that at peak times the sensors will be overridden by a manual control. Namely someone sitting in a van and pressing the button to change the lights.

The question is - how do you organise this?

Looking at this with a programmer's eye it seems simple. I can declare the busy road traffic to be an invariable - that is there will always be traffic on it; sure that won't always be the case, but in simplified terms it works. The road being worked on is a variable - there is sometimes traffic on it. The lights only need to switch when the variable changes i.e. when there's traffic waiting at the closed-down road.

Logically therefore I would place someone to monitor the variable; keep the busy road light at green and press the button when traffic appears at the closed-down road.

It seems, though, that I'm not privy to certain information. That must be the case as to why the Tesco contractors have set-up someone to sit at the busy road in a position where they cannot see the closed-down road's queue and to change the lights every so often even when nothing is coming out of the closed-down road. i.e. doing pretty much what the sensors would do.

Otherwise my conclusions is - they're pillocks.

0 comments: