Class TtcRoomChecker

java.lang.Object
org.opentrafficsim.road.gtu.generator.TtcRoomChecker
All Implemented Interfaces:
LaneBasedGtuGenerator.RoomChecker

public class TtcRoomChecker extends Object implements LaneBasedGtuGenerator.RoomChecker
Room checker based on time-to-collision. The room is considered ok if:
  1. The headway is larger than speed*1.0s + 3m
  2. time-to-collision < value
where 'value' is a given value in the constructor.

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

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • TtcRoomChecker

      public TtcRoomChecker(org.djunits.value.vdouble.scalar.Duration ttc)
      Constructor.
      Parameters:
      ttc - Duration; time to collision
  • Method Details

    • canPlace

      public final LaneBasedGtuGenerator.Placement canPlace(SortedSet<HeadwayGtu> leaders, LaneBasedGtuCharacteristics characteristics, org.djunits.value.vdouble.scalar.Duration since, LanePosition 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 - LanePosition; 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
    • getTtc

      public final org.djunits.value.vdouble.scalar.Duration getTtc()
      Returns the TTC value.
      Returns:
      Duration; TTC value
    • toString

      public final String toString()
      Overrides:
      toString in class Object