Class LaneBasedGTUGenerator
- java.lang.Object
- 
- org.djutils.event.EventProducer
- 
- org.opentrafficsim.road.gtu.generator.LaneBasedGTUGenerator
 
 
- 
- All Implemented Interfaces:
- Serializable,- Locatable,- EventProducerInterface,- org.opentrafficsim.base.Identifiable,- GtuGeneratorQueue
 
 public class LaneBasedGTUGenerator extends EventProducer implements Serializable, org.opentrafficsim.base.Identifiable, GtuGeneratorQueue Lane based GTU generator. This generator generates lane based GTUs using a LaneBasedTemplateGTUType. The template is used to generate a set of GTU characteristics at the times implied by the headway generator. These sets are queued until there is sufficient room to construct a GTU at the specified lane locations. The speed of a construction GTU may be reduced to ensure it does not run into its immediate leader GTU.Copyright (c) 2013-2022 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 Mar 8, 2016 
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classLaneBasedGTUGenerator.PlacementPlacement contains the information that aRoomCheckerreturns.static interfaceLaneBasedGTUGenerator.RoomCheckerInterface for class that checks that there is sufficient room for a proposed new GTU and returns the maximum safe speed and position for the proposed new GTU.
 - 
Field SummaryFields Modifier and Type Field Description static EventTypeGTU_GENERATED_EVENTEvent of a generated GTU.- 
Fields inherited from class org.djutils.event.EventProducereventProducerImpl
 - 
Fields inherited from interface org.djutils.event.EventProducerInterfaceFIRST_POSITION, LAST_POSITION
 
- 
 - 
Constructor SummaryConstructors Constructor Description LaneBasedGTUGenerator(String id, Generator<Duration> interarrivelTimeGenerator, LaneBasedGTUCharacteristicsGenerator laneBasedGTUCharacteristicsGenerator, GeneratorPositions generatorPositions, OTSRoadNetwork network, OTSSimulatorInterface simulator, LaneBasedGTUGenerator.RoomChecker roomChecker, IdGenerator idGenerator)Construct a new lane base GTU generator.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisable(Time start, Time end, Set<LaneDirection> laneDirections)Disable the vehicle generator during the specific time.BoundsgetBounds()longgetGeneratedGTUs()StringgetId()Retrieve the id of this LaneBasedGTUGenerator.DirectedPointgetLocation()Map<DirectedPoint,Integer>getQueueLengths()Returns the locations and lengths of generation queues.SerializablegetSourceId()voidplaceGtu(LaneBasedGTUCharacteristics characteristics, Set<DirectedLanePosition> position, Speed speed)Places a GTU, regardless of whether it has room.voidqueueGtu(LaneBasedGTUCharacteristics characteristics, Set<LaneDirection> position)Adds a GTU to the generation queue.voidsetErrorHandler(GTUErrorHandler gtuErrorHandler)Sets the GTU error handler.voidsetInstantaneousLaneChange(boolean instantaneous)Sets whether GTUs will change lane instantaneously.voidsetNoLaneChangeDistance(Length noLaneChangeDistance)Sets the initial distance over which lane changes shouldn't be performed.StringtoString()- 
Methods inherited from class org.djutils.event.EventProduceraddListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
GTU_GENERATED_EVENTpublic static final EventType GTU_GENERATED_EVENT Event of a generated GTU. Payload: LaneBasedIndividualGTU
 
- 
 - 
Constructor Detail- 
LaneBasedGTUGeneratorpublic LaneBasedGTUGenerator(String id, Generator<Duration> interarrivelTimeGenerator, LaneBasedGTUCharacteristicsGenerator laneBasedGTUCharacteristicsGenerator, GeneratorPositions generatorPositions, OTSRoadNetwork network, OTSSimulatorInterface simulator, LaneBasedGTUGenerator.RoomChecker roomChecker, IdGenerator idGenerator) throws SimRuntimeException, ProbabilityException, org.opentrafficsim.base.parameters.ParameterException Construct a new lane base GTU generator.- Parameters:
- id- String; name of the new GTU generator
- interarrivelTimeGenerator- Generator<Duration>; generator for the interval times between GTUs
- laneBasedGTUCharacteristicsGenerator- LaneBasedGTUCharacteristicsGenerator; generator of the characteristics of each GTU
- generatorPositions- GeneratorPositions; location and initial direction provider for all generated GTUs
- network- OTSRoadNetwork; the OTS network that owns the generated GTUs
- simulator- OTSSimulatorInterface; simulator
- roomChecker- RoomChecker; the way that this generator checks that there is sufficient room to place a new GTU
- idGenerator- IdGenerator; id generator
- Throws:
- SimRuntimeException- when startTime lies before the current simulation time
- ProbabilityException- pe
- org.opentrafficsim.base.parameters.ParameterException- if drawing from the interarrival generator fails
 
 
- 
 - 
Method Detail- 
setNoLaneChangeDistancepublic void setNoLaneChangeDistance(Length noLaneChangeDistance) Sets the initial distance over which lane changes shouldn't be performed.- Parameters:
- noLaneChangeDistance- Length; initial distance over which lane changes shouldn't be performed
 
 - 
setInstantaneousLaneChangepublic void setInstantaneousLaneChange(boolean instantaneous) Sets whether GTUs will change lane instantaneously.- Parameters:
- instantaneous- boolean; whether GTUs will change lane instantaneously
 
 - 
setErrorHandlerpublic void setErrorHandler(GTUErrorHandler gtuErrorHandler) Sets the GTU error handler.- Parameters:
- gtuErrorHandler- GTUErrorHandler; GTU error handler
 
 - 
queueGtupublic final void queueGtu(LaneBasedGTUCharacteristics characteristics, Set<LaneDirection> position) Adds a GTU to the generation queue. This method ignores whether vehicle generation is enabled at the location. This allows an external party to govern (over some time) what vehicles are generated.- Parameters:
- characteristics- LaneBasedGTUCharacteristics; characteristics of GTU to add to the queue
- position- Set<LaneDirection>; position to generate the GTU at
 
 - 
placeGtupublic final void placeGtu(LaneBasedGTUCharacteristics characteristics, Set<DirectedLanePosition> position, Speed speed) throws NamingException, GTUException, NetworkException, SimRuntimeException, OTSGeometryException Places a GTU, regardless of whether it has room. The user of this method should verify this is the case.- Parameters:
- characteristics- LaneBasedGTUCharacteristics; characteristics
- position- Set<DirectedLanePosition>; position
- speed- Speed; speed
- Throws:
- NamingException- on exception
- GTUException- on exception
- NetworkException- on exception
- SimRuntimeException- on exception
- OTSGeometryException- on exception
 
 - 
getGeneratedGTUspublic final long getGeneratedGTUs() - Returns:
- generatedGTUs.
 
 - 
getIdpublic final String getId() Retrieve the id of this LaneBasedGTUGenerator.- Specified by:
- getIdin interface- org.opentrafficsim.base.Identifiable
- Returns:
- String; the id of this LaneBasedGTUGenerator
 
 - 
disablepublic void disable(Time start, Time end, Set<LaneDirection> laneDirections) throws SimRuntimeException Disable the vehicle generator during the specific time. Underlying processes such as drawing characteristics and headways are continued, but simply will not result in the queuing of the GTU.- Parameters:
- start- Time; start time
- end- Time; end time
- laneDirections- Set<LaneDirection>; lanes to disable generation on
- Throws:
- SimRuntimeException- if time is incorrect
 
 - 
getLocationpublic DirectedPoint getLocation() - Specified by:
- getLocationin interface- Locatable
 
 - 
getBoundspublic Bounds getBounds() throws RemoteException - Specified by:
- getBoundsin interface- Locatable
- Throws:
- RemoteException
 
 - 
getQueueLengthspublic Map<DirectedPoint,Integer> getQueueLengths() Returns the locations and lengths of generation queues. Note that the provided location may differ from the generator location, as one generator may generate GTU's at different points.- Specified by:
- getQueueLengthsin interface- GtuGeneratorQueue
- Returns:
- Map<DirectedPoint, Integer>; locations and lengths of generation queues
 
 - 
getSourceIdpublic Serializable getSourceId() - Specified by:
- getSourceIdin interface- EventProducerInterface
- Specified by:
- getSourceIdin class- EventProducer
 
 
- 
 
-