Class FixedTimeController.SignalGroup

java.lang.Object
org.opentrafficsim.trafficcontrol.FixedTimeController.SignalGroup
All Implemented Interfaces:
Identifiable
Enclosing class:
FixedTimeController

public static class FixedTimeController.SignalGroup extends Object implements Identifiable
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 Details

    • SignalGroup

      public SignalGroup(String id, Set<String> trafficLightIds, Duration offset, Duration green, Duration yellow)
      Constructor without pre-green duration.
      Parameters:
      id - id
      trafficLightIds - traffic light ids
      offset - offset from start of cycle
      green - green duration
      yellow - 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 - id
      trafficLightIds - traffic light ids
      offset - offset from start of cycle
      preGreen - pre-green duration
      green - green duration
      yellow - yellow duration
  • Method Details

    • getId

      public String getId()
      Retrieve the id of this signal group.
      Specified by:
      getId in interface Identifiable
      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 offset
      cycleTime - cycle time
      theSimulator - simulator
      network - network
      Throws:
      nl.tudelft.simulation.dsol.SimRuntimeException - when traffic light does not exist in the network
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getTrafficLights

      public final ImmutableList<TrafficLight> getTrafficLights()
      Returns traffic lights.
      Returns:
      trafficLights.
    • getRed

      public final Duration getRed()
      Returns red duration.
      Returns:
      red.
    • getTrafficLightIds

      public final ImmutableSet<String> getTrafficLightIds()
      Returns traffic light ids.
      Returns:
      trafficLightIds.
    • getOffset

      public final Duration getOffset()
      Returns offset duration.
      Returns:
      offset.
    • getPreGreen

      public final Duration getPreGreen()
      Returns pre-green duration.
      Returns:
      preGreen.
    • getGreen

      public final Duration getGreen()
      Returns green duration.
      Returns:
      green.
    • getYellow

      public final Duration getYellow()
      Returns yellow duration.
      Returns:
      yellow.
    • getCurrentColor

      public TrafficLightColor getCurrentColor()
      Retrieve the current color of this SignalGroup.
      Returns:
      the current color of this signal group.
    • toString

      public String toString()
      Overrides:
      toString in class Object