public abstract class AbstractGTUGenerator extends EventProducer implements Serializable, GTUGenerator
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
protected long |
numberGTUs
Number of generated GTUs.
|
listeners
FIRST_POSITION, LAST_POSITION
Constructor and Description |
---|
AbstractGTUGenerator(String name,
DEVSSimulatorInterface.TimeDoubleUnit simulator,
GTUType gtuType,
Class<?> gtuClass,
ContinuousDistDoubleScalar.Rel<Speed,SpeedUnit> initialSpeedDist,
ContinuousDistDoubleScalar.Rel<Duration,DurationUnit> interarrivelTimeDist,
long maxGTUs,
Time startTime,
Time endTime,
Lane lane,
Length position,
GTUDirectionality direction,
LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner> strategicalPlannerFactory,
RouteGenerator routeGenerator,
OTSNetwork network) |
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
public AbstractGTUGenerator(String name, DEVSSimulatorInterface.TimeDoubleUnit simulator, GTUType gtuType, Class<?> gtuClass, ContinuousDistDoubleScalar.Rel<Speed,SpeedUnit> initialSpeedDist, ContinuousDistDoubleScalar.Rel<Duration,DurationUnit> interarrivelTimeDist, long maxGTUs, Time startTime, Time endTime, Lane lane, Length position, GTUDirectionality direction, LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner> strategicalPlannerFactory, RouteGenerator routeGenerator, OTSNetwork network) throws SimRuntimeException
name
- String; the name of the generatorsimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulator to schedule the start of the generationgtuType
- GTUType; the type of GTU to generategtuClass
- Class<?>; the GTU class to instantiateinitialSpeedDist
- ContinuousDistDoubleScalar.Rel<Speed,SpeedUnit>; distribution of the initial speed of the
GTUinterarrivelTimeDist
- ContinuousDistDoubleScalar.Rel<Duration,DurationUnit>; distribution of the interarrival
timemaxGTUs
- long; maximum number of GTUs to generatestartTime
- Time; start time of generation (delayed start)endTime
- Time; end time of generationlane
- Lane; the lane to generate the GTU onposition
- Length; position on the lane, relative to the design line of the linkdirection
- GTUDirectionality; the direction on the lane in which the GTU has to be generated (DIR_PLUS, or
DIR_MINUS)strategicalPlannerFactory
- LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner>; the
lane-based strategical planner factory to userouteGenerator
- RouteGenerator; route generatornetwork
- OTSNetwork; the network to register the generated GTUs intoSimRuntimeException
- when simulation scheduling failsprotected final void generate() throws Exception
Exception
- when something in the generation fails.protected final boolean enoughSpace(LaneBasedIndividualGTU.LaneBasedIndividualCarBuilder carBuilder) throws NetworkException, GTUException
carBuilder
- LaneBasedIndividualCarBuilder; the car to be generatedNetworkException
- when the speed limit of the lane is not knownGTUException
- if GTU does not have a position on the lane where it is registeredpublic final Headway headway(Length maxDistance, Lane generatorLane) throws GTUException
maxDistance
- Length; the maximum distance to look for a leadergeneratorLane
- Lane; the lane on which the GTU is generatedGTUException
- on network inconsistencyprotected final void checkCarBuilderList() throws Exception
Exception
- on any problempublic abstract OTSSimulatorInterface getSimulator()
public abstract ContinuousDistDoubleScalar.Rel<Length,LengthUnit> getLengthDist()
public abstract ContinuousDistDoubleScalar.Rel<Length,LengthUnit> getWidthDist()
public abstract ContinuousDistDoubleScalar.Rel<Speed,SpeedUnit> getMaximumSpeedDist()
public final String getName()
public final GTUType getGtuType()
public final Class<?> getGtuClass()
public final ContinuousDistDoubleScalar.Rel<Speed,SpeedUnit> getInitialSpeedDist()
public final ContinuousDistDoubleScalar.Rel<Duration,DurationUnit> getInterarrivelTimeDist()
public final long getMaxGTUs()
public final Time getStartTime()
public final Time getEndTime()
public final LaneBasedStrategicalPlannerFactory<? extends LaneBasedStrategicalPlanner> getStrategicalPlannerFactory()
public DirectedPoint getLocation() throws RemoteException
getLocation
in interface Locatable
RemoteException
public javax.media.j3d.Bounds getBounds() throws RemoteException
getBounds
in interface Locatable
RemoteException
public Map<DirectedPoint,Integer> getQueueLengths()
getQueueLengths
in interface GTUGenerator
Copyright © 2014–2019 Delft University of Technology. All rights reserved.