CHAPTER 4. CODING PROCESS
24
The traffic light controller is implemented in MorevtsOptimTLC. setInfrastruc-
ture searches the path from start till finish of the green wave, calculates the phase
differences and sets it in the junctions. decideTLs is the same as Marching control,
except the phase is calculated for every node.
This traffic light controller is tested with different maps, and everything works
properly.
Sotl-request control keeps a counter kappa which is set to zero when the light
turns red and then incremented at each time step by the number of cars that are
approaching. When kappa reaches a threshold theta, the light turns green. This
controller is implemented in the class M orevtsSotlRequest
The code in switchT raf ficLights, which chooses a random sign configuration
if all gains are zero, is removed. When the light is switched, the current cycle is
stored in Sign: cycleSwitched.
Every time kappa needs to be incremented, countRoadusers(Drivelane) is called,
which counts the number of vehicles within a number of blocks (meters) for a
given lane. This number of blocks is specified by V ISIBLE.
updateK appa() updates kappa for all inbound lanes of all nodes. When the
traffic light has been switched in the previous cycle, kappa is set to zero and
the K eepT LDF lag is set to true. This will keep the current T LDecision until
KeepT LDF lag is set to f alse.
decideT Ls() will decide what the traffic light should do. It first calls updateKappa()
which will reset kappa when needed. Then for all T LDecisions the counter
kappa is updated if the traffic light is red, by adding the count of cars. If kappa
exceeds the threshold theta, the q-value of the TLDecision is set to kappa and
the K eepT LDF lag is set to f alse which allows switching of the traffic lights.
When kappa has not reached theta, the Q-value of the T LDecision will be set to