public abstract class AbstractGTUGenerator extends Object
Copyright (c) 2013-2015 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.
|
| Constructor and Description |
|---|
AbstractGTUGenerator(String name,
OTSDEVSSimulatorInterface simulator,
GTUType gtuType,
Class<?> gtuClass,
GTUFollowingModel gtuFollowingModel,
LaneChangeModel laneChangeModel,
DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> initialSpeedDist,
DistContinuousDoubleScalar.Rel<org.djunits.unit.TimeUnit> interarrivelTimeDist,
long maxGTUs,
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> startTime,
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> endTime,
Lane lane,
org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position,
LaneBasedRouteGenerator routeGenerator,
GTUColorer gtuColorer) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkCarBuilderList()
Check if car can be generated.
|
protected boolean |
enoughSpace(LaneBasedIndividualCar.LaneBasedIndividualCarBuilder carBuilder)
Check if the car to be built is not overlapping with another GTU on the same lane, and if it has enough headway to be
generated safely.
|
protected void |
generate()
Generate a GTU.
|
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> |
getEndTime() |
Class<?> |
getGtuClass() |
GTUColorer |
getGtuColorer() |
GTUFollowingModel |
getGtuFollowingModel() |
GTUType |
getGtuType() |
DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> |
getInitialSpeedDist() |
DistContinuousDoubleScalar.Rel<org.djunits.unit.TimeUnit> |
getInterarrivelTimeDist() |
LaneChangeModel |
getLaneChangeModel() |
abstract DistContinuousDoubleScalar.Rel<org.djunits.unit.LengthUnit> |
getLengthDist() |
long |
getMaxGTUs() |
abstract DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> |
getMaximumSpeedDist() |
String |
getName() |
RouteGenerator |
getRouteGenerator() |
abstract OTSDEVSSimulatorInterface |
getSimulator() |
org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> |
getStartTime() |
abstract DistContinuousDoubleScalar.Rel<org.djunits.unit.LengthUnit> |
getWidthDist() |
HeadwayGTU |
headway(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> maxDistance,
LaneBasedRouteNavigator routeNavigator,
Lane generatorLane)
Check the available headway for GTU that is about to be constructed.
|
void |
setRouteGenerator(LaneBasedRouteGenerator routeGenerator) |
public AbstractGTUGenerator(String name, OTSDEVSSimulatorInterface simulator, GTUType gtuType, Class<?> gtuClass, GTUFollowingModel gtuFollowingModel, LaneChangeModel laneChangeModel, DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> initialSpeedDist, DistContinuousDoubleScalar.Rel<org.djunits.unit.TimeUnit> interarrivelTimeDist, long maxGTUs, org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> startTime, org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> endTime, Lane lane, org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> position, LaneBasedRouteGenerator routeGenerator, GTUColorer gtuColorer) throws RemoteException, SimRuntimeException
name - the name of the generatorsimulator - the simulator to schedule the start of the generationgtuType - the type of GTU to generategtuClass - the GTU class to instantiategtuFollowingModel - the GTU following model to uselaneChangeModel - the lane change model to useinitialSpeedDist - distribution of the initial speed of the GTUinterarrivelTimeDist - distribution of the interarrival timemaxGTUs - maximum number of GTUs to generatestartTime - start time of generation (delayed start)endTime - end time of generationlane - the lane to generate the GTU onposition - position on the lane, relative to the design line of the linkrouteGenerator - RouteGenerator; the route generator that will create a route for each generated GTUgtuColorer - the GTUColorer to useSimRuntimeException - when simulation scheduling failsRemoteException - when remote simulator cannot be reachedprotected final void generate()
throws Exception
Exception - when something in the generation fails.protected final boolean enoughSpace(LaneBasedIndividualCar.LaneBasedIndividualCarBuilder carBuilder) throws RemoteException, NetworkException
carBuilder - the car to be generatedRemoteException - if simulator cannot be reached to calculate current positionNetworkException - if GTU does not have a position on the lane where it is registeredpublic final HeadwayGTU headway(org.djunits.value.vdouble.scalar.DoubleScalar.Rel<org.djunits.unit.LengthUnit> maxDistance, LaneBasedRouteNavigator routeNavigator, Lane generatorLane) throws RemoteException, NetworkException
maxDistance - DoubleScalar.Rel<LengthUnit>; the maximum distance to look for a leaderrouteNavigator - RouteNavigator; the route that this GTU intends to takegeneratorLane - Lane; the lane on which the GTU is generatedRemoteException - on communications failureNetworkException - on network inconsistencyprotected final void checkCarBuilderList()
throws Exception
Exception - on any problempublic abstract OTSDEVSSimulatorInterface getSimulator()
public abstract DistContinuousDoubleScalar.Rel<org.djunits.unit.LengthUnit> getLengthDist()
public abstract DistContinuousDoubleScalar.Rel<org.djunits.unit.LengthUnit> getWidthDist()
public abstract DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> getMaximumSpeedDist()
public final String getName()
public final GTUType getGtuType()
public final Class<?> getGtuClass()
public final GTUFollowingModel getGtuFollowingModel()
public final DistContinuousDoubleScalar.Abs<org.djunits.unit.SpeedUnit> getInitialSpeedDist()
public final DistContinuousDoubleScalar.Rel<org.djunits.unit.TimeUnit> getInterarrivelTimeDist()
public final long getMaxGTUs()
public final org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> getStartTime()
public final org.djunits.value.vdouble.scalar.DoubleScalar.Abs<org.djunits.unit.TimeUnit> getEndTime()
public final RouteGenerator getRouteGenerator()
public final void setRouteGenerator(LaneBasedRouteGenerator routeGenerator)
routeGenerator - set routeGenerator.public final LaneChangeModel getLaneChangeModel()
public final GTUColorer getGtuColorer()
Copyright © 2014–2015 Delft University of Technology. All rights reserved.