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 Summary
ConstructorDescriptionAbstractLaneBasedTacticalPlannerFactory
(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected final String
Returns aString
representation of the car-following model factory.protected final org.opentrafficsim.base.parameters.Parameters
Returns the parameters for the car-following model using the factory.Returns the perception factory.protected final CarFollowingModel
Returns the next car following model.final org.djunits.value.vdouble.scalar.Length
peekDesiredHeadway
(GtuType gtuType, org.djunits.value.vdouble.scalar.Speed speed, org.opentrafficsim.base.parameters.Parameters parameters) Peek to see the desired headway of the next GTU to be generated at the given speed.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) 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, wait
Methods inherited from interface org.opentrafficsim.road.gtu.lane.tactical.LaneBasedTacticalPlannerFactory
create
Methods 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
- CarFollowingModelFactory<? extends CarFollowingModel>; car-following model factoryperceptionFactory
- PerceptionFactory; perception factory
-
-
Method Details
-
nextCarFollowingModel
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.ParameterExceptionReturns the parameters for the car-following model using the factory. This method should be used in thegetParameters()
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
Returns aString
representation of the car-following model factory. This method may be used in thetoString()
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 returnsnull
, at which point the GTU generator will use some other speed.- Specified by:
peekDesiredSpeed
in interfaceLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>
- Parameters:
gtuType
- GtuType; GTU typespeedLimit
- Speed; speed limitmaxGtuSpeed
- Speed; maximum GTU speedparameters
- 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 returnsnull
, at which point the GTU generator will only generate GTU's at fixed locations.- Specified by:
peekDesiredHeadway
in interfaceLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>
- Parameters:
gtuType
- GtuType; GTU typespeed
- Speed; speed the GTU might be generated atparameters
- 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
Returns the perception factory.- Returns:
- PerceptionFactory; perception factory
-