Class TaskHeadwayBased

java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.mental.AbstractTask
org.opentrafficsim.road.gtu.lane.perception.mental.TaskHeadwayBased
All Implemented Interfaces:
Identifiable, Task
Direct Known Subclasses:
TaskCarFollowing, TaskLaneChanging

public abstract class TaskHeadwayBased
extends AbstractTask
Task class that translates a (composite) headway in to a task demand.

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 25 jun. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • TaskHeadwayBased

      public TaskHeadwayBased​(java.lang.String id)
      Constructor.
      Parameters:
      id - String; id
  • Method Details

    • calculateTaskDemand

      public double calculateTaskDemand​(LanePerception perception, LaneBasedGTU gtu, Parameters parameters) throws ParameterException
      Returns the gross task demand to be managed by a task manager.
      Parameters:
      perception - LanePerception; perception
      gtu - LaneBasedGTU; gtu
      parameters - Parameters; parameters
      Returns:
      double; gross task demand
      Throws:
      ParameterException - if a parameter is missing or out of bounds
    • getSpeed

      protected Speed getSpeed()
      Returns the current speed to translate a distance headway to a time headway.
      Returns:
      Speed; speed
    • getHeadway

      protected abstract Duration getHeadway​(LanePerception perception, LaneBasedGTU gtu, Parameters parameters) throws ParameterException
      Returns a collector for the task demand.
      Parameters:
      perception - LanePerception; perception
      gtu - LaneBasedGTU; gtu
      parameters - Parameters; parameters
      Returns:
      Duration; headway, null of none.
      Throws:
      ParameterException - on invalid parameter