Class TrafficLightSensor

    • Constructor Detail

      • TrafficLightSensor

        public TrafficLightSensor​(java.lang.String id,
                                  Lane laneA,
                                  Length positionA,
                                  Lane laneB,
                                  Length positionB,
                                  java.util.List<Lane> intermediateLanes,
                                  RelativePosition.TYPE entryPosition,
                                  RelativePosition.TYPE exitPosition,
                                  DEVSSimulatorInterface.TimeDoubleUnit simulator,
                                  Compatible compatible)
                           throws NetworkException
        Construct a new traffic light sensor.
        TODO Possibly provide the GTUTypes that trigger the sensor as an argument for the constructor
        Parameters:
        id - String; id of this sensor
        laneA - Lane; the lane of the A detection point of this traffic light sensor
        positionA - Length; the position of the A detection point of this traffic light sensor
        laneB - Lane; the lane of the B detection point of this traffic light sensor
        positionB - Length; the position of the B detection point of this traffic light sensor
        intermediateLanes - List<Lane>; list of intermediate lanes
        entryPosition - TYPE; the position on the GTUs that trigger the entry events
        exitPosition - TYPE; the position on the GTUs that trigger the exit events
        simulator - DEVSSimulatorInterface.TimeDoubleUnit; the simulator
        compatible - Compatible; object that checks that the detector detects a GTU.
        Throws:
        NetworkException - when the network is inconsistent.
    • Method Detail

      • addGTU

        protected final void addGTU​(LaneBasedGTU gtu)
        Add a GTU to the set.
        Parameters:
        gtu - LaneBasedGTU; the GTU that must be added
      • removeGTU

        protected final void removeGTU​(LaneBasedGTU gtu)
        Remove a GTU from the set.
        Parameters:
        gtu - LaneBasedGTU; the GTU that must be removed
      • getLanePositionA

        public final Length getLanePositionA()
        Return the A position of this NonDirectionalOccupancySensor.
        Specified by:
        getLanePositionA in interface NonDirectionalOccupancySensor
        Returns:
        Length; the lane and position on the lane where GTU entry is detected
      • getLanePositionB

        public final Length getLanePositionB()
        Return the B position of this NonDirectionalOccupancySensor.
        Specified by:
        getLanePositionB in interface NonDirectionalOccupancySensor
        Returns:
        Length; the lane and position on the lane where GTU exit is detected
      • signalDetection

        public final void signalDetection​(FlankSensor sensor,
                                          LaneBasedGTU gtu)
        One of our flank sensors has triggered.
        Parameters:
        sensor - FlankSensor; the sensor that was triggered
        gtu - LaneBasedGTU; the gtu that triggered the flank sensor
      • getLocation

        public final DirectedPoint getLocation()
                                        throws java.rmi.RemoteException
        Specified by:
        getLocation in interface Locatable
        Throws:
        java.rmi.RemoteException
      • getBounds

        public final javax.media.j3d.Bounds getBounds()
                                               throws java.rmi.RemoteException
        Specified by:
        getBounds in interface Locatable
        Throws:
        java.rmi.RemoteException
      • getPath

        public final OTSLine3D getPath()
        Return the path of this traffic light sensor.
        Returns:
        OTSLine3D; the path of this traffic light sensor
      • getOccupancy

        public final boolean getOccupancy()
        Return the state of this traffic light sensor.
        Returns:
        boolean; true if one or more GTUs are currently detected; false of no GTUs are currently detected
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object