public abstract class AbstractGTU extends nl.tudelft.simulation.event.EventProducer implements GTU
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
DESTROY_EVENT, INIT_EVENT, MOVE_EVENT
Constructor and Description |
---|
AbstractGTU(IdGenerator idGenerator,
GTUType gtuType,
OTSDEVSSimulatorInterface simulator,
PerceivableContext perceivableContext) |
AbstractGTU(String id,
GTUType gtuType,
OTSDEVSSimulatorInterface simulator,
PerceivableContext perceivableContext) |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destructor.
|
org.djunits.value.vdouble.scalar.Acceleration |
getAcceleration() |
Color |
getBaseColor()
Return the base color of the GTU (not the state-based color).
|
GTUType |
getGTUType() |
String |
getId() |
nl.tudelft.simulation.language.d3.DirectedPoint |
getLocation() |
org.djunits.value.vdouble.scalar.Acceleration |
getMaximumAcceleration() |
org.djunits.value.vdouble.scalar.Acceleration |
getMaximumDeceleration() |
org.djunits.value.vdouble.scalar.Length |
getOdometer() |
OperationalPlan |
getOperationalPlan() |
PerceivableContext |
getPerceivableContext() |
RelativePosition |
getReference() |
OTSDEVSSimulatorInterface |
getSimulator() |
org.djunits.value.vdouble.scalar.Speed |
getSpeed() |
StrategicalPlanner |
getStrategicalPlanner() |
TacticalPlanner |
getTacticalPlanner() |
TurnIndicatorStatus |
getTurnIndicatorStatus() |
void |
init(StrategicalPlanner strategicalPlanner,
nl.tudelft.simulation.language.d3.DirectedPoint initialLocation,
org.djunits.value.vdouble.scalar.Speed initialSpeed)
Initialize the GTU at a location and speed, and give it a mission to fulfill through the strategical planner.
|
protected void |
interruptMove()
Interrupt the move and ask for a new plan.
|
boolean |
isDestroyed() |
protected void |
move(nl.tudelft.simulation.language.d3.DirectedPoint fromLocation)
Move from the current location according to an operational plan to a location that will bring us nearer to reaching the
location provided by the strategical planner.
|
void |
setMaximumAcceleration(org.djunits.value.vdouble.scalar.Acceleration maximumAcceleration) |
void |
setMaximumDeceleration(org.djunits.value.vdouble.scalar.Acceleration maximumDeceleration) |
void |
setTurnIndicatorStatus(TurnIndicatorStatus turnIndicatorStatus)
Set the status of the turn indicator.
|
addListener, addListener, addListener, addListener, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, removeAllListeners, removeAllListeners, removeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBehavioralCharacteristics, getCenter, getContourPoints, getFront, getLength, getMaximumSpeed, getRear, getRelativePositions, getWidth
public AbstractGTU(String id, GTUType gtuType, OTSDEVSSimulatorInterface simulator, PerceivableContext perceivableContext) throws GTUException
id
- String; the id of the GTUgtuType
- GTUType; the type of GTU, e.g. TruckType, CarType, BusTypesimulator
- OTSDEVSSimulatorInterface; the simulator to schedule plan changes onperceivableContext
- PerceivableContext; the perceivable context in which this GTU will be registeredGTUException
- when the preconditions of the constructor are not metpublic AbstractGTU(IdGenerator idGenerator, GTUType gtuType, OTSDEVSSimulatorInterface simulator, PerceivableContext perceivableContext) throws GTUException
idGenerator
- IdGenerator; the generator that will produce a unique id of the GTUgtuType
- GTUType; the type of GTU, e.g. TruckType, CarType, BusTypesimulator
- OTSDEVSSimulatorInterface; the simulator to schedule plan changes onperceivableContext
- PerceivableContext; the perceivable context in which this GTU will be registeredGTUException
- when the preconditions of the constructor are not metpublic final void init(StrategicalPlanner strategicalPlanner, nl.tudelft.simulation.language.d3.DirectedPoint initialLocation, org.djunits.value.vdouble.scalar.Speed initialSpeed) throws nl.tudelft.simulation.dsol.SimRuntimeException, GTUException
strategicalPlanner
- StrategicalPlanner; the strategical planner responsible for the overall 'mission' of the GTU,
usually indicating where it needs to go. It operates by instantiating tactical planners to do the work.initialLocation
- DirectedPoint; the initial location (and direction) of the GTUinitialSpeed
- Speed; the initial speed of the GTUnl.tudelft.simulation.dsol.SimRuntimeException
- when scheduling after the first move failsGTUException
- when the preconditions of the parameters are not met or when the construction of the original
waiting path failspublic void destroy()
protected void move(nl.tudelft.simulation.language.d3.DirectedPoint fromLocation) throws nl.tudelft.simulation.dsol.SimRuntimeException, OperationalPlanException, GTUException, NetworkException, ParameterException
fromLocation
- the last known location (initial location, or end location of the previous operational plan)nl.tudelft.simulation.dsol.SimRuntimeException
- when scheduling of the next move failsOperationalPlanException
- when there is a problem creating a good path for the GTUGTUException
- when there is a problem with the state of the GTU when planning a pathNetworkException
- in case of a problem with the network, e.g., a dead end where it is not expectedParameterException
- in there is a parameter problemprotected void interruptMove() throws nl.tudelft.simulation.dsol.SimRuntimeException, OperationalPlanException, GTUException, NetworkException, ParameterException
OperationalPlanException
- when there was a problem retrieving the location from the running plannl.tudelft.simulation.dsol.SimRuntimeException
- when scheduling of the next move failsOperationalPlanException
- when there is a problem creating a good path for the GTUGTUException
- when there is a problem with the state of the GTU when planning a pathNetworkException
- in case of a problem with the network, e.g., unreachability of a certain pointParameterException
- when there is a problem with a parameterpublic GTUType getGTUType()
getGTUType
in interface GTU
public final RelativePosition getReference()
getReference
in interface GTU
public final OTSDEVSSimulatorInterface getSimulator()
getSimulator
in interface GTU
public StrategicalPlanner getStrategicalPlanner()
getStrategicalPlanner
in interface GTU
public TacticalPlanner getTacticalPlanner()
getTacticalPlanner
in interface GTU
public final OperationalPlan getOperationalPlan()
getOperationalPlan
in interface GTU
public final org.djunits.value.vdouble.scalar.Length getOdometer()
getOdometer
in interface GTU
public final org.djunits.value.vdouble.scalar.Speed getSpeed()
public final org.djunits.value.vdouble.scalar.Acceleration getAcceleration()
getAcceleration
in interface GTU
public final org.djunits.value.vdouble.scalar.Acceleration getMaximumAcceleration()
getMaximumAcceleration
in interface GTU
public final void setMaximumAcceleration(org.djunits.value.vdouble.scalar.Acceleration maximumAcceleration)
maximumAcceleration
- set maximumAccelerationpublic final org.djunits.value.vdouble.scalar.Acceleration getMaximumDeceleration()
getMaximumDeceleration
in interface GTU
public final void setMaximumDeceleration(org.djunits.value.vdouble.scalar.Acceleration maximumDeceleration)
maximumDeceleration
- set maximumDeceleration, stored as a negative numberpublic nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
getLocation
in interface nl.tudelft.simulation.dsol.animation.Locatable
public final TurnIndicatorStatus getTurnIndicatorStatus()
getTurnIndicatorStatus
in interface GTU
public final void setTurnIndicatorStatus(TurnIndicatorStatus turnIndicatorStatus)
setTurnIndicatorStatus
in interface GTU
turnIndicatorStatus
- the new status of the turn indicator.public Color getBaseColor()
getBaseColor
in interface GTU
public final boolean isDestroyed()
public final PerceivableContext getPerceivableContext()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.