CHAPTER 4. CODING PROCESS
20
The stop-distance is implemented in moveRoaduserOnLane. For all road users
the method getStopDistance is added, which returns the stop-distance of the spe-
cific road user, calculated from the current speed and its stopforce. To see the
current stop-distance of a specific road user in the simulation, this data is added in
(gld.config) RoaduserPanel.
Adapting the speed happens also after a certain reaction-time, for example 1 sec-
ond. The first road user can do what he wants and probably he will speed up to
the maximum allowed speed on the road, except when he aproaches a traffic light.
The following road users have to adjust their speed to the road user close in front
of him.
Adjusting the speed is implemented in the method checkRoaduserSpeed which
takes a lane as argument. This method checks for every road user on the lane
if his speed has to be changed and it begins with the first road user on the lane.
If the road user is the first one on the lane, it can speed up to the maximum al-
lowed speed on the lane, except when he approaches a red traffic light, then he
has to slow down in function of his stop-distance. The following roadusers need
to check the speed of the previous road user. If there is enough space (2 times the
stop-distance) to the previous road user, it can speed up to the maximum allowed
speed on the road. If the distance to the previous is dangerous small, it has to de-
celerate at maximum rate. When he is at a good driving distance to the previous,
it takes the speed of the previous, and follows at the same distance. This method
checkRoaduserSpeed is called by moveLane. Testing this was successful.
4.3.3 Support for primary lanes
When a traffic control method is needed which supports the green wave, it has to
be able to specify where the green wave has to occur. It has to be possible to spec-
ify in the editor wich roads are primary and which are secondary when adding a
new road. When the roads are marked like this, it is easier to select the roads with
the major traffic flow in the nodes.