Class FixedTimeController.SignalGroup
java.lang.Object
org.opentrafficsim.trafficcontrol.FixedTimeController.SignalGroup
- All Implemented Interfaces:
Identifiable
- Enclosing class:
- FixedTimeController
Fixed time signal group. A group of traffic lights who's colors change simultaneously.
Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
ConstructorsConstructorDescriptionSignalGroup(String id, Set<String> trafficLightIds, Duration offset, Duration green, Duration yellow) Constructor without pre-green duration.SignalGroup(String id, Set<String> trafficLightIds, Duration offset, Duration preGreen, Duration green, Duration yellow) Constructor with pre-green duration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRetrieve the current color of this SignalGroup.final DurationgetGreen()Returns green duration.getId()Retrieve the id of this signal group.final DurationReturns offset duration.final DurationReturns pre-green duration.final DurationgetRed()Returns red duration.final ImmutableSet<String>Returns traffic light ids.final ImmutableList<TrafficLight>Returns traffic lights.final DurationReturns yellow duration.inthashCode()voidstartup(Duration controllerOffset, Duration cycleTime, OtsSimulatorInterface theSimulator, Network network) Connect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.toString()
-
Constructor Details
-
SignalGroup
public SignalGroup(String id, Set<String> trafficLightIds, Duration offset, Duration green, Duration yellow) Constructor without pre-green duration.- Parameters:
id- idtrafficLightIds- traffic light idsoffset- offset from start of cyclegreen- green durationyellow- yellow duration
-
SignalGroup
public SignalGroup(String id, Set<String> trafficLightIds, Duration offset, Duration preGreen, Duration green, Duration yellow) Constructor with pre-green duration.- Parameters:
id- idtrafficLightIds- traffic light idsoffset- offset from start of cyclepreGreen- pre-green durationgreen- green durationyellow- yellow duration
-
-
Method Details
-
getId
Retrieve the id of this signal group.- Specified by:
getIdin interfaceIdentifiable- Returns:
- String
-
startup
public void startup(Duration controllerOffset, Duration cycleTime, OtsSimulatorInterface theSimulator, Network network) throws nl.tudelft.simulation.dsol.SimRuntimeException Connect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.- Parameters:
controllerOffset- controller offsetcycleTime- cycle timetheSimulator- simulatornetwork- network- Throws:
nl.tudelft.simulation.dsol.SimRuntimeException- when traffic light does not exist in the network
-
hashCode
public int hashCode() -
equals
-
getTrafficLights
Returns traffic lights.- Returns:
- trafficLights.
-
getRed
Returns red duration.- Returns:
- red.
-
getTrafficLightIds
Returns traffic light ids.- Returns:
- trafficLightIds.
-
getOffset
Returns offset duration.- Returns:
- offset.
-
getPreGreen
Returns pre-green duration.- Returns:
- preGreen.
-
getGreen
Returns green duration.- Returns:
- green.
-
getYellow
Returns yellow duration.- Returns:
- yellow.
-
getCurrentColor
Retrieve the current color of this SignalGroup.- Returns:
- the current color of this signal group.
-
toString
-