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 callsnextCarFollowingModel()
to generate a new tactical planner. Implementations should also usegetCarFollowingParameters()
in thegetParameters()
method to include the parameters a car-following model requires.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 16 jan. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description AbstractLaneBasedTacticalPlannerFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getCarFollowingModelFactoryString()
Returns aString
representation of the car-following model factory.protected Parameters
getCarFollowingParameters()
Returns the parameters for the car-following model using the factory.PerceptionFactory
getPerceptionFactory()
Returns the perception factory.protected CarFollowingModel
nextCarFollowingModel(LaneBasedGTU gtu)
Returns the next car following model.Length
peekDesiredHeadway(GTUType gtuType, Speed speed, Parameters parameters)
Peek to see the desired headway of the next GTU to be generated at the given speed.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, 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 Detail
-
AbstractLaneBasedTacticalPlannerFactory
public AbstractLaneBasedTacticalPlannerFactory(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory, PerceptionFactory perceptionFactory)
Constructor.- Parameters:
carFollowingModelFactory
- CarFollowingModelFactory<? extends CarFollowingModel>; car-following model factoryperceptionFactory
- PerceptionFactory; perception factory
-
-
Method Detail
-
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 Parameters getCarFollowingParameters() throws ParameterException
Returns 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:
ParameterException
- on illegal parameter value
-
getCarFollowingModelFactoryString
protected final String 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 Speed peekDesiredSpeed(GTUType gtuType, Speed speedLimit, Speed maxGtuSpeed, 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 Length peekDesiredHeadway(GTUType gtuType, Speed speed, 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
public PerceptionFactory getPerceptionFactory()
Returns the perception factory.- Returns:
- PerceptionFactory; perception factory
-
-