Class AbstractIdmFactory<T extends AbstractIdm>
java.lang.Object
org.opentrafficsim.road.gtu.lane.tactical.following.AbstractIdmFactory<T>
- Type Parameters:
T
- IDM class
- All Implemented Interfaces:
CarFollowingModelFactory<T>
,ModelComponentFactory
- Direct Known Subclasses:
IdmFactory
,IdmPlusFactory
,IdmPlusMultiFactory
public class AbstractIdmFactory<T extends AbstractIdm>
extends Object
implements CarFollowingModelFactory<T>
Factory for IDM types.
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
ConstructorDescriptionAbstractIdmFactory
(T idm, nl.tudelft.simulation.jstats.streams.StreamInterface randomStream) Sets the idm model, which should be state-less. -
Method Summary
Modifier and TypeMethodDescriptionfinal T
Returns a new instance of a car-following model.org.opentrafficsim.base.parameters.Parameters
Returns parameters for the given component.
-
Constructor Details
-
AbstractIdmFactory
Sets the idm model, which should be state-less.- Parameters:
idm
- T; idm model, which should be state-lessrandomStream
- StreamInterface; random number stream
-
-
Method Details
-
generateCarFollowingModel
Returns a new instance of a car-following model.- Specified by:
generateCarFollowingModel
in interfaceCarFollowingModelFactory<T extends AbstractIdm>
- Returns:
- new instance of a car-following model
-
getParameters
public org.opentrafficsim.base.parameters.Parameters getParameters() throws org.opentrafficsim.base.parameters.ParameterExceptionReturns parameters for the given component. These parameters should contain, and possibly overwrite, parameters from sub-components. A parameter factory at the highest level (strategical planner) may overwrite any parameter. This combination allows that for sub-components, default factories can be used, while the parameter factory only overwrites parameters different for specific GTU types. The default implementation returns all default parameter values declared at the class.
Conventional use is:
Parameters parameters = this.subComponent1Factory.getParameters(); this.subComponent2Factory.getParameters().setAllIn(parameters); parameters.setDefaultParameters(componentClass); parameters.setDefaultParameters(staticUtilityClass); return parameters;
where all parameters used incomponentClass
are defined or forwarded incomponentClass
.
// forwarded public static final ParameterTypeAcceleration A = ParameterTypes.A; // defined public static final ParameterTypeDouble FACTOR = new ParameterTypeDouble("factor", "factor on response", 1.0);
The same holds for static utilities that are used. Parameters should be defined at the utility class, and parameters of used utilities should be included.
- Specified by:
getParameters
in interfaceModelComponentFactory
- Returns:
- Parameters; parameters for the given component
- Throws:
org.opentrafficsim.base.parameters.ParameterException
- on parameter exception
-