Class ConflictUtil


  • public final class ConflictUtil
    extends Object
    This class implements default behavior for intersection conflicts for use in tactical planners.

    Copyright (c) 2013-2020 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 Jun 3, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Method Detail

      • approachConflicts

        public static Acceleration approachConflicts​(Parameters parameters,
                                                     Iterable<HeadwayConflict> conflicts,
                                                     PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> leaders,
                                                     CarFollowingModel carFollowingModel,
                                                     Length vehicleLength,
                                                     Length vehicleWidth,
                                                     Speed speed,
                                                     Acceleration acceleration,
                                                     SpeedLimitInfo speedLimitInfo,
                                                     ConflictUtil.ConflictPlans conflictPlans,
                                                     LaneBasedGTU gtu,
                                                     RelativeLane lane)
                                              throws GTUException,
                                                     ParameterException
        Approach conflicts by applying appropriate acceleration (or deceleration). The model may yield for a vehicle even while having priority. Such a 'yield plan' is remembered in YieldPlans. By forwarding the same YieldPlans for a GTU consistency of such plans is provided. If any conflict is not accepted to pass, stopping before a more upstream conflict is applied if there not sufficient stopping length in between conflicts.
        Parameters:
        parameters - Parameters; parameters
        conflicts - PerceptionCollectable<HeadwayConflict,Conflict>; set of conflicts to approach
        leaders - PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leading vehicles
        carFollowingModel - CarFollowingModel; car-following model
        vehicleLength - Length; length of vehicle
        vehicleWidth - Length; width of vehicle
        speed - Speed; current speed
        acceleration - Acceleration; current acceleration
        speedLimitInfo - SpeedLimitInfo; speed limit info
        conflictPlans - ConflictPlans; set of plans for conflict
        gtu - LaneBasedGTU; gtu
        lane - RelativeLane; lane
        Returns:
        acceleration appropriate for approaching the conflicts
        Throws:
        GTUException - in case of an unsupported conflict rule
        ParameterException - if a parameter is not defined or out of bounds
      • stopForPriorityConflict

        public static boolean stopForPriorityConflict​(HeadwayConflict conflict,
                                                      PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> leaders,
                                                      Speed speed,
                                                      Length vehicleLength,
                                                      Parameters parameters,
                                                      Length prevEnd)
                                               throws ParameterException
        Approach a priority conflict. Stopping is applied to give way to conflicting traffic in case congestion is present on the own lane. This is courtesy yielding.
        Parameters:
        conflict - HeadwayConflict; conflict to approach
        leaders - PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leading vehicles in own lane
        speed - Speed; current speed
        vehicleLength - Length; vehicle length
        parameters - Parameters; parameters
        prevEnd - Length; distance to end of previous conflict that should not be blocked, null if none
        Returns:
        whether to stop for this conflict
        Throws:
        ParameterException - if parameter B is not defined
      • stopForGiveWayConflict

        public static boolean stopForGiveWayConflict​(HeadwayConflict conflict,
                                                     PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> leaders,
                                                     Speed speed,
                                                     Acceleration acceleration,
                                                     Length vehicleLength,
                                                     Parameters parameters,
                                                     SpeedLimitInfo speedLimitInfo,
                                                     CarFollowingModel carFollowingModel,
                                                     ParameterTypeAcceleration bType,
                                                     Length prevEnd)
                                              throws ParameterException
        Approach a give-way conflict.
        Parameters:
        conflict - HeadwayConflict; conflict
        leaders - PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leaders
        speed - Speed; current speed
        acceleration - Acceleration; current acceleration
        vehicleLength - Length; vehicle length
        parameters - Parameters; parameters
        speedLimitInfo - SpeedLimitInfo; speed limit info
        carFollowingModel - CarFollowingModel; car-following model
        bType - ParameterTypeAcceleration; parameter type for considered deceleration
        prevEnd - Length; distance to end of previous conflict that should not be blocked, null if none
        Returns:
        whether to stop for this conflict
        Throws:
        ParameterException - if a parameter is not defined
      • stopForStopConflict

        public static boolean stopForStopConflict​(HeadwayConflict conflict,
                                                  PerceptionCollectable<HeadwayGTU,​LaneBasedGTU> leaders,
                                                  Speed speed,
                                                  Acceleration acceleration,
                                                  Length vehicleLength,
                                                  Parameters parameters,
                                                  SpeedLimitInfo speedLimitInfo,
                                                  CarFollowingModel carFollowingModel,
                                                  ParameterTypeAcceleration bType,
                                                  Length prevEnd)
                                           throws ParameterException
        Approach a stop conflict. Currently this is equal to approaching a give-way conflict.
        Parameters:
        conflict - HeadwayConflict; conflict
        leaders - PerceptionCollectable<HeadwayGTU,LaneBasedGTU>; leaders
        speed - Speed; current speed
        acceleration - Acceleration; current acceleration
        vehicleLength - Length; vehicle length
        parameters - Parameters; parameters
        speedLimitInfo - SpeedLimitInfo; speed limit info
        carFollowingModel - CarFollowingModel; car-following model
        bType - ParameterTypeAcceleration; parameter type for considered deceleration
        prevEnd - Length; distance to end of previous conflict that should not be blocked, null if none
        Returns:
        whether to stop for this conflict
        Throws:
        ParameterException - if a parameter is not defined
      • stopForAllStopConflict

        public static boolean stopForAllStopConflict​(HeadwayConflict conflict,
                                                     ConflictUtil.ConflictPlans conflictPlans)
        Approach an all-stop conflict.
        Parameters:
        conflict - HeadwayConflict; conflict to approach
        conflictPlans - ConflictPlans; set of plans for conflict
        Returns:
        whether to stop for this conflict