public class TrafficLightControllerFixedDuration extends Object implements TrafficLightController
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
TrafficLightControllerFixedDuration(String id,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator)
Create a fixed time controller.
|
Modifier and Type | Method and Description |
---|---|
void |
addPhase(int phaseId,
org.djunits.value.vdouble.scalar.Duration yellowDuration,
org.djunits.value.vdouble.scalar.Duration greenDuration)
Add a new phase.
|
void |
addTrafficLightToPhase(int phaseId,
TrafficLight trafficLight)
Add a traffic light to a phase.
|
protected void |
changePhase()
Change the phase and/or color of the traffic lights.
|
org.djunits.value.vdouble.scalar.Duration |
getClearanceDurationToNextPhase() |
int |
getCurrentPhase() |
String |
getId() |
int |
getNumberOfPhases() |
void |
setClearanceDuration(org.djunits.value.vdouble.scalar.Duration clearanceDuration) |
String |
toString() |
public TrafficLightControllerFixedDuration(String id, org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator) throws TrafficLightException
id
- String; the controller idsimulator
- OTSDEVSSimulatorInterface; the simulatorTrafficLightException
- when scheduling of thhe start event failsprotected final void changePhase() throws TrafficLightException
TrafficLightException
- when scheduling of thhe start event failspublic final int getNumberOfPhases()
getNumberOfPhases
in interface TrafficLightController
public final int getCurrentPhase()
getCurrentPhase
in interface TrafficLightController
public final org.djunits.value.vdouble.scalar.Duration getClearanceDurationToNextPhase()
getClearanceDurationToNextPhase
in interface TrafficLightController
public final void addPhase(int phaseId, org.djunits.value.vdouble.scalar.Duration yellowDuration, org.djunits.value.vdouble.scalar.Duration greenDuration) throws TrafficLightException
phaseId
- int; the id of the phase to be added.yellowDuration
- Duration; the yellow timegreenDuration
- Duration; the green timeTrafficLightException
- when the phase already existedpublic final void addTrafficLightToPhase(int phaseId, TrafficLight trafficLight) throws TrafficLightException
addTrafficLightToPhase
in interface TrafficLightController
phaseId
- int; the id of the phase.trafficLight
- TrafficLight; the traffic light to addTrafficLightException
- when the phase was not createdpublic final String getId()
getId
in interface TrafficLightController
public final void setClearanceDuration(org.djunits.value.vdouble.scalar.Duration clearanceDuration)
clearanceDuration
- set clearanceDurationCopyright © 2014–2016 Delft University of Technology. All rights reserved.