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.void
spawnGtu
(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
- use of default NL GTU templates.- Returns:
- for method chaining.
-
setStream
Sets random stream.- Parameters:
stream
- random stream.- Returns:
- for method chaining.
-
setNoLaneChangeDistance
public GtuSpawner setNoLaneChangeDistance(org.djunits.value.vdouble.scalar.Length noLaneChangeDistance) Sets no lane change distance.- Parameters:
noLaneChangeDistance
- no lane change distance.- Returns:
- for method chaining.
-
setInstantaneousLaneChanges
Sets instantaneous lane changes.- Parameters:
instantaneousLaneChanges
- instantaneous lane changes.- Returns:
- for method chaining.
-
setErrorHandler
Sets the error handler.- Parameters:
errorHandler
- error handler.- Returns:
- for method chaining.
-
spawnGtu
public void spawnGtu(String id, LaneBasedGtuCharacteristics templateGtuType, RoadNetwork network, org.djunits.value.vdouble.scalar.Speed speed, LanePosition position) throws GtuException, NetworkException Create a single GTU.- Parameters:
id
- id.templateGtuType
- characteristics.network
- network.speed
- speed.position
- position.- Throws:
GtuException
- when initial GTU values are not correctNetworkException
- when the GTU cannot be placed on the given lane
-