Class FixedTimeController.SignalGroup
java.lang.Object
org.opentrafficsim.trafficcontrol.FixedTimeController.SignalGroup
- All Implemented Interfaces:
org.opentrafficsim.base.Identifiable
- Enclosing class:
- FixedTimeController
public static class FixedTimeController.SignalGroup
extends Object
implements org.opentrafficsim.base.Identifiable
Fixed time signal group. A group of traffic lights who's colors change simultaneously.
Copyright (c) 2013-2023 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 TypeMethodDescriptionboolean
Retrieve the current color of this SignalGroup.final Duration
getGreen()
getId()
Retrieve the id of this signal group.final Duration
final Duration
final Duration
getRed()
final org.djutils.immutablecollections.ImmutableSet<String>
final org.djutils.immutablecollections.ImmutableList<TrafficLight>
final Duration
int
hashCode()
void
startup
(Duration controllerOffset, Duration cycleTime, org.opentrafficsim.core.dsol.OtsSimulatorInterface theSimulator, org.opentrafficsim.core.network.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
- String; idtrafficLightIds
- Set<String>; traffic light idsoffset
- Duration; offset from start of cyclegreen
- Duration; green durationyellow
- Duration; 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
- String; idtrafficLightIds
- Set<String>; traffic light idsoffset
- Duration; offset from start of cyclepreGreen
- Duration; pre-green durationgreen
- Duration; green durationyellow
- Duration; yellow duration
-
-
Method Details
-
getId
Retrieve the id of this signal group.- Specified by:
getId
in interfaceorg.opentrafficsim.base.Identifiable
- Returns:
- String
-
startup
public void startup(Duration controllerOffset, Duration cycleTime, org.opentrafficsim.core.dsol.OtsSimulatorInterface theSimulator, org.opentrafficsim.core.network.Network network) throws SimRuntimeException Connect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.- Parameters:
controllerOffset
- Duration;cycleTime
- Duration;theSimulator
- OtsSimulatorInterface;network
- Network;- Throws:
SimRuntimeException
- when traffic light does not exist in the network
-
hashCode
public int hashCode() -
equals
-
getTrafficLights
- Returns:
- trafficLights.
-
getRed
- Returns:
- red.
-
getTrafficLightIds
- Returns:
- trafficLightIds.
-
getOffset
- Returns:
- offset.
-
getPreGreen
- Returns:
- preGreen.
-
getGreen
- Returns:
- green.
-
getYellow
- Returns:
- yellow.
-
getCurrentColor
Retrieve the current color of this SignalGroup.- Returns:
- TrafficLightColor; the current color of this signal group.
-
toString
-