Class 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.

    Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version 21 feb. 2019
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • SignalGroup

        public SignalGroup​(String id,
                           Set<String> trafficLightIds,
                           Duration offset,
                           Duration green,
                           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,
                           Duration offset,
                           Duration preGreen,
                           Duration green,
                           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 Detail

      • getId

        public String getId()
        Retrieve the id of this signal group.
        Specified by:
        getId in interface org.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()
        Overrides:
        hashCode in class Object
      • getRed

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

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

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

        public final Duration getPreGreen()
        Returns:
        preGreen.
      • getGreen

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

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

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