Class FixedTimeController.SignalGroup

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

public static class FixedTimeController.SignalGroup extends Object implements org.djutils.base.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 Summary

    Constructors
    Constructor
    Description
    SignalGroup(String id, Set<String> trafficLightIds, org.djunits.value.vdouble.scalar.Duration offset, org.djunits.value.vdouble.scalar.Duration green, org.djunits.value.vdouble.scalar.Duration yellow)
    Constructor without pre-green duration.
    SignalGroup(String id, Set<String> trafficLightIds, org.djunits.value.vdouble.scalar.Duration offset, org.djunits.value.vdouble.scalar.Duration preGreen, org.djunits.value.vdouble.scalar.Duration green, org.djunits.value.vdouble.scalar.Duration yellow)
    Constructor with pre-green duration.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Retrieve the current color of this SignalGroup.
    final org.djunits.value.vdouble.scalar.Duration
     
    Retrieve the id of this signal group.
    final org.djunits.value.vdouble.scalar.Duration
     
    final org.djunits.value.vdouble.scalar.Duration
     
    final org.djunits.value.vdouble.scalar.Duration
     
    final org.djutils.immutablecollections.ImmutableSet<String>
     
    final org.djutils.immutablecollections.ImmutableList<TrafficLight>
     
    final org.djunits.value.vdouble.scalar.Duration
     
    int
    void
    startup(org.djunits.value.vdouble.scalar.Duration controllerOffset, org.djunits.value.vdouble.scalar.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.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SignalGroup

      public SignalGroup(String id, Set<String> trafficLightIds, org.djunits.value.vdouble.scalar.Duration offset, org.djunits.value.vdouble.scalar.Duration green, org.djunits.value.vdouble.scalar.Duration yellow)
      Constructor without pre-green duration.
      Parameters:
      id - String; id
      trafficLightIds - Set<String>; traffic light ids
      offset - Duration; offset from start of cycle
      green - Duration; green duration
      yellow - Duration; yellow duration
    • SignalGroup

      public SignalGroup(String id, Set<String> trafficLightIds, org.djunits.value.vdouble.scalar.Duration offset, org.djunits.value.vdouble.scalar.Duration preGreen, org.djunits.value.vdouble.scalar.Duration green, org.djunits.value.vdouble.scalar.Duration yellow)
      Constructor with pre-green duration.
      Parameters:
      id - String; id
      trafficLightIds - Set<String>; traffic light ids
      offset - Duration; offset from start of cycle
      preGreen - Duration; pre-green duration
      green - Duration; green duration
      yellow - Duration; yellow duration
  • Method Details

    • getId

      public String getId()
      Retrieve the id of this signal group.
      Specified by:
      getId in interface org.djutils.base.Identifiable
      Returns:
      String
    • startup

      public void startup(org.djunits.value.vdouble.scalar.Duration controllerOffset, org.djunits.value.vdouble.scalar.Duration cycleTime, org.opentrafficsim.core.dsol.OtsSimulatorInterface theSimulator, org.opentrafficsim.core.network.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 - Duration;
      cycleTime - Duration;
      theSimulator - OtsSimulatorInterface;
      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 org.djutils.immutablecollections.ImmutableList<TrafficLight> getTrafficLights()
      Returns:
      trafficLights.
    • getRed

      public final org.djunits.value.vdouble.scalar.Duration getRed()
      Returns:
      red.
    • getTrafficLightIds

      public final org.djutils.immutablecollections.ImmutableSet<String> getTrafficLightIds()
      Returns:
      trafficLightIds.
    • getOffset

      public final org.djunits.value.vdouble.scalar.Duration getOffset()
      Returns:
      offset.
    • getPreGreen

      public final org.djunits.value.vdouble.scalar.Duration getPreGreen()
      Returns:
      preGreen.
    • getGreen

      public final org.djunits.value.vdouble.scalar.Duration getGreen()
      Returns:
      green.
    • getYellow

      public final org.djunits.value.vdouble.scalar.Duration getYellow()
      Returns:
      yellow.
    • getCurrentColor

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

      public String toString()
      Overrides:
      toString in class Object