two traffic lights
How can we coordinate two traffic lights in a particular application?
Let’s consider the following deployment:
So, we need two lights configured such that the east-west light has a left green arrow but the west-east light does not.
To be able to do that, we need to make the TrafficLight
into an abstraction and instantiate it twice with different options:
We group remaining options for the entire deployment:
Here’s the new version of the TrafficLight
concept.
Now, TrafficLight
is an abstraction, which has it’s own
local lamps and signals.
How can we coordinate the traffic lights? What are the rules?
Simple traffic light coordination could be done by pairing the lights
as opposites. From the point of view of
EastWest
, what should the opposite light show per signal in
our particular application?
proceed
: the sameprepareToStop
: the samestop
: the samewarning
: the sameprepareToGo
: the sameallStop
: the sameallYellow
: the sameadvancedLeft
:stop
extendedLeft
:stop
We can express these using rules:
Let’s check the allowed states of our system in our application:
|
|
Exercise 3
So far, we only covered the coordination of opposite lights in our
concrete two-light deployment example. The next step is to generalize
these coordination rules to arbitrary deployments. The
opposite relationship
can be modeled using
reference clafers
. See opposite traffic lights sketch. Then the
rules can be expressed using the opposite
reference instead
of the concrete WestEast
or EastWest
clafers.
Model the opposite light coordination according to the sketch.
Exercise 4
In a general, we must also coordinate crossing lights.
Elicit and express the crossing lights coordination rules. First, express the rules on the concrete example. Next, similarly to the opposite traffic lights sketch, generalize the rules.
Conclusion of Part III
In this part, we configured an example two light application and formulated traffic lights coordination rules. Now that the concepts and behavior of the individual traffic lights and various deployment configurations are understood, we can proceed towards the implementation.
This concludes the tutorial.
Back to Front Page.