Class TaskHeadwayBased
java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.mental.AbstractTask
org.opentrafficsim.road.gtu.lane.perception.mental.TaskHeadwayBased
- All Implemented Interfaces:
org.djutils.base.Identifiable
,Task
- Direct Known Subclasses:
TaskCarFollowing
,TaskLaneChanging
Task class that translates a (composite) headway in to a task demand.
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
calculateTaskDemand
(LanePerception perception, LaneBasedGtu gtu, org.opentrafficsim.base.parameters.Parameters parameters) Returns the gross task demand to be managed by a task manager.protected abstract org.djunits.value.vdouble.scalar.Duration
getHeadway
(LanePerception perception, LaneBasedGtu gtu, org.opentrafficsim.base.parameters.Parameters parameters) Returns a collector for the task demand.protected org.djunits.value.vdouble.scalar.Speed
getSpeed()
Returns the current speed to translate a distance headway to a time headway.Methods inherited from class org.opentrafficsim.road.gtu.lane.perception.mental.AbstractTask
getAnticipationReliance, getId, getTaskDemand, setAnticipationReliance, setTaskDemand, toString
-
Constructor Details
-
TaskHeadwayBased
Constructor.- Parameters:
id
- String; id
-
-
Method Details
-
calculateTaskDemand
public double calculateTaskDemand(LanePerception perception, LaneBasedGtu gtu, org.opentrafficsim.base.parameters.Parameters parameters) throws org.opentrafficsim.base.parameters.ParameterException Returns the gross task demand to be managed by a task manager.- Parameters:
perception
- LanePerception; perceptiongtu
- LaneBasedGtu; gtuparameters
- Parameters; parameters- Returns:
- double; gross task demand
- Throws:
org.opentrafficsim.base.parameters.ParameterException
- if a parameter is missing or out of bounds
-
getSpeed
protected org.djunits.value.vdouble.scalar.Speed getSpeed()Returns the current speed to translate a distance headway to a time headway.- Returns:
- Speed; speed
-
getHeadway
protected abstract org.djunits.value.vdouble.scalar.Duration getHeadway(LanePerception perception, LaneBasedGtu gtu, org.opentrafficsim.base.parameters.Parameters parameters) throws org.opentrafficsim.base.parameters.ParameterException Returns a collector for the task demand.- Parameters:
perception
- LanePerception; perceptiongtu
- LaneBasedGtu; gtuparameters
- Parameters; parameters- Returns:
- Duration; headway,
null
of none. - Throws:
org.opentrafficsim.base.parameters.ParameterException
- on invalid parameter
-