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:
LmrsFactoryOld
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 Summary
ConstructorsConstructorDescriptionAbstractLaneBasedTacticalPlannerFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final StringReturns aStringrepresentation of the car-following model factory.protected final ParametersgetCarFollowingParameters(GtuType gtuType) Returns the parameters for the car-following model using the factory.Returns the perception factory.protected final CarFollowingModelReturns the next car following model.peekDesiredHeadway(GtuType gtuType, Speed speed, Parameters parameters) Peek to see the desired headway of the next GTU to be generated at the given speed.peekDesiredSpeed(GtuType gtuType, Speed speedLimit, Speed maxGtuSpeed, Parameters parameters) Peek to see the desired speed of the next GTU to be generated at the given location.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlannerFactory
createMethods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.ModelComponentFactory
getParameters
-
Constructor Details
-
AbstractLaneBasedTacticalPlannerFactory
public AbstractLaneBasedTacticalPlannerFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory) Constructor.- Parameters:
carFollowingModelFactory- car-following model factoryperceptionFactory- perception factory
-
-
Method Details
-
nextCarFollowingModel
Returns the next car following model.- Parameters:
gtu- gtu- Returns:
- next car following model
-
getCarFollowingParameters
Returns the parameters for the car-following model using the factory. This method should be used in thegetParameters()method of implementing sub-classes.- Parameters:
gtuType- GTU type- Returns:
- parameters for the car-following model using the factory
- Throws:
ParameterException- on illegal parameter value
-
getCarFollowingModelFactoryString
Returns aStringrepresentation of the car-following model factory. This method may be used in thetoString()method of implementing sub-classes.- Returns:
- representation of the car-following model factory
-
peekDesiredSpeed
public final Optional<Speed> peekDesiredSpeed(GtuType gtuType, Speed speedLimit, Speed maxGtuSpeed, Parameters parameters) throws GtuException Description copied from interface:LaneBasedTacticalPlannerFactoryPeek to see the desired speed of the next GTU to be generated at the given location. The default implementation returnsnull, at which point the GTU generator will use some other speed.- Specified by:
peekDesiredSpeedin interfaceLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>- Parameters:
gtuType- GTU typespeedLimit- speed limitmaxGtuSpeed- maximum GTU speedparameters- parameters for the next GTU- Returns:
- desired speed of the next GTU to be generated at the given location, may be empty at which point the GTU generator will use some other speed
- Throws:
GtuException- on any exception
-
peekDesiredHeadway
public final Optional<Length> peekDesiredHeadway(GtuType gtuType, Speed speed, Parameters parameters) throws GtuException Description copied from interface:LaneBasedTacticalPlannerFactoryPeek to see the desired headway of the next GTU to be generated at the given speed. The default implementation returnsnull, at which point the GTU generator will only generate GTU's at fixed locations.- Specified by:
peekDesiredHeadwayin interfaceLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>- Parameters:
gtuType- GTU typespeed- speed the GTU might be generated atparameters- parameters for the next GTU- Returns:
- desired headway of the next GTU to be generated at the given speed, may be empty at which point the GTU generator will only generate GTU's at fixed locations
- Throws:
GtuException- on any exception
-
getPerceptionFactory
Returns the perception factory.- Returns:
- perception factory
-