Class AbstractLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>

java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.AbstractLaneBasedTacticalPlannerFactory<T>
Type Parameters:
T - class of the tactical planner generated
All Implemented Interfaces:
LaneBasedTacticalPlannerFactory<T>, ModelComponentFactory
Direct Known Subclasses:
LmrsFactory

public abstract class AbstractLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner> extends Object implements LaneBasedTacticalPlannerFactory<T>
Abstract tactical planner factory which uses a car-following model factory for supplying peeked desired speed and headway. To this end the next car-following model is created and used throughout all peek invocations until an implementation of this class calls nextCarFollowingModel() to generate a new tactical planner. Implementations should also use getCarFollowingParameters() in the getParameters() method to include the parameters a car-following model requires.

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

    • AbstractLaneBasedTacticalPlannerFactory

      public AbstractLaneBasedTacticalPlannerFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory)
      Constructor.
      Parameters:
      carFollowingModelFactory - CarFollowingModelFactory<? extends CarFollowingModel>; car-following model factory
      perceptionFactory - PerceptionFactory; perception factory
  • Method Details

    • nextCarFollowingModel

      protected final CarFollowingModel nextCarFollowingModel(LaneBasedGtu gtu)
      Returns the next car following model.
      Parameters:
      gtu - LaneBasedGtu; gtu
      Returns:
      CarFollowingModel; next car following model
    • getCarFollowingParameters

      protected final org.opentrafficsim.base.parameters.Parameters getCarFollowingParameters() throws org.opentrafficsim.base.parameters.ParameterException
      Returns the parameters for the car-following model using the factory. This method should be used in the getParameters() method of implementing sub-classes.
      Returns:
      Parameters; parameters for the car-following model using the factory
      Throws:
      org.opentrafficsim.base.parameters.ParameterException - on illegal parameter value
    • getCarFollowingModelFactoryString

      protected final String getCarFollowingModelFactoryString()
      Returns a String representation of the car-following model factory. This method may be used in the toString() method of implementing sub-classes.
      Returns:
      String; representation of the car-following model factory
    • peekDesiredSpeed

      public final org.djunits.value.vdouble.scalar.Speed peekDesiredSpeed(GtuType gtuType, org.djunits.value.vdouble.scalar.Speed speedLimit, org.djunits.value.vdouble.scalar.Speed maxGtuSpeed, org.opentrafficsim.base.parameters.Parameters parameters) throws GtuException
      Peek to see the desired speed of the next GTU to be generated at the given location. The default implementation returns null, at which point the GTU generator will use some other speed.
      Specified by:
      peekDesiredSpeed in interface LaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>
      Parameters:
      gtuType - GtuType; GTU type
      speedLimit - Speed; speed limit
      maxGtuSpeed - Speed; maximum GTU speed
      parameters - Parameters; parameters for the next GTU
      Returns:
      desired speed of the next GTU to be generated at the given location, may be null at which point the GTU generator will use some other speed
      Throws:
      GtuException - on any exception
    • peekDesiredHeadway

      public final org.djunits.value.vdouble.scalar.Length peekDesiredHeadway(GtuType gtuType, org.djunits.value.vdouble.scalar.Speed speed, org.opentrafficsim.base.parameters.Parameters parameters) throws GtuException
      Peek to see the desired headway of the next GTU to be generated at the given speed. The default implementation returns null, at which point the GTU generator will only generate GTU's at fixed locations.
      Specified by:
      peekDesiredHeadway in interface LaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>
      Parameters:
      gtuType - GtuType; GTU type
      speed - Speed; speed the GTU might be generated at
      parameters - Parameters; parameters for the next GTU
      Returns:
      Length; desired headway of the next GTU to be generated at the given speed, may be null at which point the GTU generator will only generate GTU's at fixed locations
      Throws:
      GtuException - on any exception
    • getPerceptionFactory

      public PerceptionFactory getPerceptionFactory()
      Returns the perception factory.
      Returns:
      PerceptionFactory; perception factory