Interface Synchronization

    • Field Detail

      • DEADEND

        static final Synchronization DEADEND
        Synchronization that only includes stopping for a dead-end.
      • PASSIVE

        static final Synchronization PASSIVE
        Synchronization where current leaders are taken.
      • ALIGN_GAP

        static final Synchronization ALIGN_GAP
        Synchronization by following the adjacent leader or aligning with the middle of the gap, whichever allows the largest acceleration. Note that aligning with the middle of the gap then means the gap is too small, as following would cause lower acceleration. Aligning with the middle of the gap will however provide a better starting point for the rest of the process. Mainly, the adjacent follower can decelerate less, allowing more smooth merging.
      • PASSIVE_MOVING

        static final Synchronization PASSIVE_MOVING
        Synchronization where current leaders are taken. Synchronization is disabled for d_sync<d<d_coop at low speeds.
      • ACTIVE

        static final Synchronization ACTIVE
        Synchronization where a suitable leader is actively targeted, in relation to infrastructure.
    • Method Detail

      • getMergeDistance

        static Length getMergeDistance​(LanePerception perception,
                                       LateralDirectionality lat)
                                throws OperationalPlanException
        Returns the distance to the next merge, stopping within this distance is futile for a lane change.
        Parameters:
        perception - LanePerception; perception
        lat - LateralDirectionality; lateral direction
        Returns:
        Length; distance to the next merge
        Throws:
        OperationalPlanException - if there is no infrastructure perception
      • synchronize

        Acceleration synchronize​(LanePerception perception,
                                 org.opentrafficsim.base.parameters.Parameters params,
                                 SpeedLimitInfo sli,
                                 CarFollowingModel cfm,
                                 double desire,
                                 LateralDirectionality lat,
                                 LmrsData lmrsData,
                                 LaneChange laneChange,
                                 LateralDirectionality initiatedLaneChange)
                          throws org.opentrafficsim.base.parameters.ParameterException,
                                 OperationalPlanException
        Determine acceleration for synchronization.
        Parameters:
        perception - LanePerception; perception
        params - Parameters; parameters
        sli - SpeedLimitInfo; speed limit info
        cfm - CarFollowingModel; car-following model
        desire - double; level of lane change desire
        lat - LateralDirectionality; lateral direction for synchronization
        lmrsData - LmrsData; LMRS data
        laneChange - LaneChange; lane change
        initiatedLaneChange - LateralDirectionality; lateral direction of initiated lane change
        Returns:
        acceleration for synchronization
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - if a parameter is not defined
        OperationalPlanException - perception exception
      • headwayWithLcSpace

        static Length headwayWithLcSpace​(Headway headway,
                                         org.opentrafficsim.base.parameters.Parameters parameters,
                                         LaneChange laneChange)
                                  throws org.opentrafficsim.base.parameters.ParameterException
        Returns a headway (length) to allow space to perform a lane change at low speeds.
        Parameters:
        headway - Headway; headway
        parameters - Parameters; parameters
        laneChange - LaneChange; lane change
        Returns:
        Length; distance to allow space to perform a lane change at low speeds
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - if parameter VCONG is not available
      • gentleUrgency

        static Acceleration gentleUrgency​(Acceleration a,
                                          double desire,
                                          org.opentrafficsim.base.parameters.Parameters params)
                                   throws org.opentrafficsim.base.parameters.ParameterException
        Return limited deceleration. Deceleration is limited to b for d < dCoop. Beyond dCoop the limit is a linear interpolation between b and bCrit.
        Parameters:
        a - Acceleration; acceleration to limit
        desire - double; lane change desire
        params - Parameters; parameters
        Returns:
        limited deceleration
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - when parameter is no available or value out of range
      • getFollower

        static HeadwayGTU getFollower​(HeadwayGTU gtu,
                                      PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> leaders,
                                      HeadwayGTU follower,
                                      Length ownLength)
        Returns the upstream gtu of the given gtu.
        Parameters:
        gtu - HeadwayGTU; gtu
        leaders - PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leaders of own vehicle
        follower - HeadwayGTU; following vehicle of own vehicle
        ownLength - Length; own vehicle length
        Returns:
        upstream gtu of the given gtu
      • tagAlongAcceleration

        static Acceleration tagAlongAcceleration​(HeadwayGTU leader,
                                                 Speed followerSpeed,
                                                 Length followerLength,
                                                 Speed tagSpeed,
                                                 double desire,
                                                 org.opentrafficsim.base.parameters.Parameters params,
                                                 SpeedLimitInfo sli,
                                                 CarFollowingModel cfm)
                                          throws org.opentrafficsim.base.parameters.ParameterException
        Calculates acceleration by following an adjacent vehicle, with tagging along if desire is not very high and speed is low.
        Parameters:
        leader - HeadwayGTU; leader
        followerSpeed - Speed; follower speed
        followerLength - Length; follower length
        tagSpeed - Speed; maximum tag along speed
        desire - double; lane change desire
        params - Parameters; parameters
        sli - SpeedLimitInfo; speed limit info
        cfm - CarFollowingModel; car-following model
        Returns:
        acceleration by following an adjacent vehicle including tagging along
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - if a parameter is not present
      • canBeAhead

        static boolean canBeAhead​(HeadwayGTU adjacentVehicle,
                                  Length xCur,
                                  int nCur,
                                  Speed ownSpeed,
                                  Length ownLength,
                                  Speed tagSpeed,
                                  double dCoop,
                                  Acceleration b,
                                  Duration tMin,
                                  Duration tMax,
                                  Length x0,
                                  Duration t0,
                                  Duration lc,
                                  double desire)
                           throws org.opentrafficsim.base.parameters.ParameterException
        Returns whether a driver estimates it can be ahead of an adjacent vehicle for merging.
        Parameters:
        adjacentVehicle - HeadwayGTU; adjacent vehicle
        xCur - Length; remaining distance
        nCur - int; number of lane changes to perform
        ownSpeed - Speed; own speed
        ownLength - Length; own length
        tagSpeed - Speed; maximum tag along speed
        dCoop - double; cooperation threshold
        b - Acceleration; critical deceleration
        tMin - Duration; minimum headway
        tMax - Duration; normal headway
        x0 - Length; anticipation distance
        t0 - Duration; anticipation time
        lc - Duration; lane change duration
        desire - double; lane change desire
        Returns:
        whether a driver estimates it can be ahead of an adjacent vehicle for merging
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined
      • requiredBufferSpace

        static Length requiredBufferSpace​(Speed speed,
                                          int nCur,
                                          Length x0,
                                          Duration t0,
                                          Duration lc,
                                          double dCoop)
        Returns the required buffer space to perform a lane change and further lane changes.
        Parameters:
        speed - Speed; representative speed
        nCur - int; number of required lane changes
        x0 - Length; anticipation distance
        t0 - Duration; anticipation time
        lc - Duration; lane change duration
        dCoop - double; cooperation threshold
        Returns:
        required buffer space to perform a lane change and further lane changes
      • stopForEnd

        static Acceleration stopForEnd​(Length xCur,
                                       Length xMerge,
                                       org.opentrafficsim.base.parameters.Parameters params,
                                       Speed ownSpeed,
                                       CarFollowingModel cfm,
                                       SpeedLimitInfo sli)
                                throws org.opentrafficsim.base.parameters.ParameterException
        Calculates acceleration to stop for a split or dead-end, accounting for infrastructure.
        Parameters:
        xCur - Length; remaining distance to end
        xMerge - Length; distance until merge point
        params - Parameters; parameters
        ownSpeed - Speed; own speed
        cfm - CarFollowingModel; car-following model
        sli - SpeedLimitInfo; speed limit info
        Returns:
        acceleration to stop for a split or dead-end, accounting for infrastructure
        Throws:
        org.opentrafficsim.base.parameters.ParameterException - if parameter is not defined
      • getTargetLeader

        static HeadwayGTU getTargetLeader​(HeadwayGTU gtu,
                                          SortedSet<HeadwayGTU> leaders)
        Returns the leader of one gtu from a set.
        Parameters:
        gtu - HeadwayGTU; gtu
        leaders - SortedSet<HeadwayGTU>; leaders
        Returns:
        leader of one gtu from a set