Class CFRoomChecker

  • All Implemented Interfaces:
    LaneBasedGTUGenerator.RoomChecker
    Direct Known Subclasses:
    CFBARoomChecker

    public class CFRoomChecker
    extends Object
    implements LaneBasedGTUGenerator.RoomChecker
    This class places GTU's behind the leader at the desired headway (i.e. CF, car-following) and the speed of the leader, but no further than the GTU could have traveled at the desired speed during the time since the desired arrival. With multiple leaders, the leader that causes the most upstream following position is used.

    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 12 jan. 2018
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    • Constructor Detail

      • CFRoomChecker

        public CFRoomChecker()
    • Method Detail

      • canPlace

        public LaneBasedGTUGenerator.Placement canPlace​(SortedSet<HeadwayGTU> leaders,
                                                        LaneBasedGTUCharacteristics characteristics,
                                                        Duration since,
                                                        Set<DirectedLanePosition> initialPosition)
                                                 throws NetworkException,
                                                        GTUException
        Return the maximum safe speed and position for a new GTU with the specified characteristics. Returns Placement.NO if there is no safe speed and position. This method might be called with an empty leader set such that the desired speed can be implemented.
        Specified by:
        canPlace in interface LaneBasedGTUGenerator.RoomChecker
        Parameters:
        leaders - SortedSet<HeadwayGTU>; leaders, usually 1, possibly more after a branch
        characteristics - LaneBasedGTUCharacteristics; characteristics of the proposed new GTU
        since - Duration; time since the GTU wanted to arrive
        initialPosition - Set<DirectedLanePosition>; initial position
        Returns:
        Speed; maximum safe speed, or null if a GTU with the specified characteristics cannot be placed at the current time
        Throws:
        NetworkException - this method may throw a NetworkException if it encounters an error in the network structure
        GTUException - on parameter exception
      • headwayFactor

        protected double headwayFactor​(Speed desiredSpeed,
                                       Length desiredHeadway,
                                       Speed generationSpeed,
                                       Length generationHeadway,
                                       Length leaderLength)
        Returns a situation dependent headway factor to deal with spillback.
        Parameters:
        desiredSpeed - Speed; desired speed
        desiredHeadway - Length; desired headway at desired speed
        generationSpeed - Speed; generation speed
        generationHeadway - Length; desired headway at generation speed
        leaderLength - Length; length of the leader
        Returns:
        situation dependent headway factor to deal with spillback