Class TTCRoomChecker
java.lang.Object
org.opentrafficsim.road.gtu.generator.TTCRoomChecker
- All Implemented Interfaces:
LaneBasedGTUGenerator.RoomChecker
public class TTCRoomChecker extends java.lang.Object implements LaneBasedGTUGenerator.RoomChecker
Room checker based on time-to-collision. The room is considered ok if:
- The headway is larger than speed*1.0s + 3m
- time-to-collision < value
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 17 nov. 2016
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors Constructor Description TTCRoomChecker(Duration ttc)
Constructor. -
Method Summary
Modifier and Type Method Description LaneBasedGTUGenerator.Placement
canPlace(java.util.SortedSet<HeadwayGTU> leaders, LaneBasedGTUCharacteristics characteristics, Duration since, java.util.Set<DirectedLanePosition> initialPosition)
Return the maximum safe speed and position for a new GTU with the specified characteristics.Duration
getTtc()
Returns the TTC value.java.lang.String
toString()
-
Constructor Details
-
TTCRoomChecker
Constructor.- Parameters:
ttc
- Duration; time to collision
-
-
Method Details
-
canPlace
public final LaneBasedGTUGenerator.Placement canPlace(java.util.SortedSet<HeadwayGTU> leaders, LaneBasedGTUCharacteristics characteristics, Duration since, java.util.Set<DirectedLanePosition> initialPosition) throws NetworkException, GTUExceptionReturn the maximum safe speed and position for a new GTU with the specified characteristics. ReturnsPlacement.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 interfaceLaneBasedGTUGenerator.RoomChecker
- Parameters:
leaders
- SortedSet<HeadwayGTU>; leaders, usually 1, possibly more after a branchcharacteristics
- LaneBasedGTUCharacteristics; characteristics of the proposed new GTUsince
- Duration; time since the GTU wanted to arriveinitialPosition
- 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 structureGTUException
- on parameter exception
-
getTtc
Returns the TTC value.- Returns:
- Duration; TTC value
-
toString
public final java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-