Class GtuSpawner
java.lang.Object
org.opentrafficsim.road.gtu.generator.GtuSpawner
Simple class to spawn GTUs.
Copyright (c) 2024-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel, Christoph Thees
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionsetErrorHandler(GtuErrorHandler errorHandler) Sets the error handler.setInstantaneousLaneChanges(boolean instantaneousLaneChanges) Sets instantaneous lane changes.setNoLaneChangeDistance(org.djunits.value.vdouble.scalar.Length noLaneChangeDistance) Sets no lane change distance.setStream(nl.tudelft.simulation.jstats.streams.StreamInterface stream) Sets random stream.setUseDefaultGtuTemplate(boolean useDefaultGtuTemplate) Sets the use of default NL GTU templates.voidspawnGtu(String id, LaneBasedGtuCharacteristics templateGtuType, RoadNetwork network, org.djunits.value.vdouble.scalar.Speed speed, LanePosition position) Create a single GTU.
-
Constructor Details
-
GtuSpawner
public GtuSpawner()
-
-
Method Details
-
setUseDefaultGtuTemplate
Sets the use of default NL GTU templates.- Parameters:
useDefaultGtuTemplate- boolean; use of default NL GTU templates.- Returns:
- this; for method chaining.
-
setStream
Sets random stream.- Parameters:
stream- StreamInterface; random stream.- Returns:
- this; for method chaining.
-
setNoLaneChangeDistance
public GtuSpawner setNoLaneChangeDistance(org.djunits.value.vdouble.scalar.Length noLaneChangeDistance) Sets no lane change distance.- Parameters:
noLaneChangeDistance- Length; no lane change distance.- Returns:
- this; for method chaining.
-
setInstantaneousLaneChanges
Sets instantaneous lane changes.- Parameters:
instantaneousLaneChanges- boolean; instantaneous lane changes.- Returns:
- this; for method chaining.
-
setErrorHandler
Sets the error handler.- Parameters:
errorHandler- GtuErrorHandler; error handler.- Returns:
- this; for method chaining.
-
spawnGtu
public void spawnGtu(String id, LaneBasedGtuCharacteristics templateGtuType, RoadNetwork network, org.djunits.value.vdouble.scalar.Speed speed, LanePosition position) throws GtuException, OtsGeometryException, NetworkException Create a single GTU.- Parameters:
id- String; id.templateGtuType- LaneBasedGtuCharacteristics; characteristics.network- RoadNetwork; network.speed- Speed; speed.position- LanePosition; position.- Throws:
GtuException- when initial GTU values are not correctOtsGeometryException- when the initial path is wrongNetworkException- when the GTU cannot be placed on the given lane
-