Class AbstractLaneBasedTacticalPlannerFactory<T extends LaneBasedTacticalPlanner>

  • 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-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 Detail

      • AbstractLaneBasedTacticalPlannerFactory

        public AbstractLaneBasedTacticalPlannerFactory​(CarFollowingModelFactory<? extends CarFollowingModel> carFollowingModelFactory,
                                                       PerceptionFactory perceptionFactory)
        Constructor.
        Parameters:
        carFollowingModelFactory - CarFollowingModelFactory<? extends CarFollowingModel>; car-following model factory
        perceptionFactory - 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 the getParameters() 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 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 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 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 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 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