49 into.push_back(device);
59 myAmContainer(isContainer),
61 myStopped(holder.isStopped()),
62 myOriginalType(&holder.getVehicleType()),
63 myLoadedType(nullptr) {
64 const std::string key =
"device." +
deviceName() +
".loadedType";
66 if (loadedTypeID !=
"") {
69 throw InvalidArgument(
TLF(
"Vehicle type '%' in parameter '%' of vehicle '%' is not known.", loadedTypeID, key, holder.
getID()));
82 if (stage !=
nullptr) {
100 const double travelledDistanceFrontOnLane,
165 transportable->setDeparted(currentTime - freeFlowTimeCorrection);
186 if (timeForNext -
DELTA_T > currentTime) {
201 if (timeForNext > currentTime -
DELTA_T) {
202 timeForNext += boardingTime;
204 timeForNext = currentTime + boardingTime;
212 if (taxiDevice !=
nullptr) {
234 if (numUnloaded != 0) {
248 transportable->setDeparted(currentTime);
267 WRITE_WARNINGF(
"Teleporting % '%' from vehicle destination edge '%' to intended destination edge '%' time=%",
273 tc.
erase(transportable);
296 if (taxiDevice !=
nullptr) {
316 if (taxiDevice !=
nullptr) {
328 if (perAttached > 0) {
332 if (numAttached > 0.) {
357 std::vector<std::string> internals;
373 if (key ==
"IDList") {
374 std::vector<std::string> ids;
376 ids.push_back(t->getID());
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
The base class for microscopic and mesoscopic vehicles.
virtual void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
bool reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false, const MSEdge *sink=nullptr)
Performs a rerouting using the given router.
A device which collects info on the vehicle trip (mainly on departure and arrival)
void customerArrived(const MSTransportable *person)
called by MSDevice_Transportable upon unloading a person
void customerEntered(const MSTransportable *t)
called by MSDevice_Transportable upon loading a person
MSVehicleType * myLoadedType
the type to consult if loading/unloading changes vehicle properties
~MSDevice_Transportable()
Destructor.
void saveState(OutputDevice &out) const
Saves the state of the device.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle is at a stop and transportable action is needed.
const MSVehicleType * myOriginalType
the original type to set when nothing is being transported
static bool willTransferAtJoin(const MSTransportable *t, const MSBaseVehicle *joinVeh)
check if boardingDuration should be applied
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
void changeAttached()
modifiy vehicle properties when loading/unloading (optional)
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Passengers leaving on arrival.
bool anyLeavingAtStop(const MSStop &stop) const
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into, const bool isContainer)
Build devices for the given vehicle, if needed.
void transferAtSplitOrJoin(MSBaseVehicle *otherVeh)
transfers transportables that want to continue in the other train part (without boarding/loading dela...
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Adds passengers on vehicle insertion.
MSDevice_Transportable(SUMOVehicle &holder, const std::string &id, const bool isContainer)
Constructor.
std::vector< MSTransportable * > myTransportables
The passengers of the vehicle.
void notifyMoveInternal(const SUMOTrafficObject &veh, const double frontOnLane, const double timeOnLane, const double meanSpeedFrontOnLane, const double meanSpeedVehicleOnLane, const double travelledDistanceFrontOnLane, const double travelledDistanceVehicleOnLane, const double meanLengthOnLane)
Internal notification about the vehicle moves, see MSMoveReminder::notifyMoveInternal()
void addTransportable(MSTransportable *transportable)
Add a passenger.
const bool myAmContainer
Whether it is a container device.
const std::string deviceName() const
return the name for this type of device
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
void removeTransportable(MSTransportable *transportable)
Remove a passenger (TraCI)
static SumoRNG * getEquipmentRNG()
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the maximum speed the vehicle may use on this edge.
virtual void removeTransportable(MSTransportable *t) const
Representation of a lane in the micro simulation.
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getContainerControl()
Returns the container control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool canLeaveVehicle(const MSTransportable *t, const SUMOVehicle &veh, const MSStop &stop)
checks whether the person may exit at the current vehicle position
bool isWaitingFor(const SUMOVehicle *vehicle) const
Whether the person waits for the given vehicle.
void setVehicle(SUMOVehicle *v)
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
SUMOTime duration
The stopping duration.
const SUMOVehicleParameter::Stop pars
The stop parameter.
void loadedContainers(const SUMOVehicle *veh, int n)
void unloadedPersons(const SUMOVehicle *veh, int n)
static MSStopOut * getInstance()
void unloadedContainers(const SUMOVehicle *veh, int n)
void loadedPersons(const SUMOVehicle *veh, int n)
bool addTransportable(const MSTransportable *p)
adds a transportable to this stop
void abortWaitingForVehicle(MSTransportable *t)
let the given transportable abort waiting for a vehicle (when removing stage via TraCI)
void registerTeleportWrongDest()
register a teleport to the final destination
virtual void erase(MSTransportable *transportable)
removes a single transportable
const MSEdge * getDestination() const
Returns the current destination.
MSStage * getNextStage(int offset) const
Return the next (or previous) stage denoted by the offset.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
MSStage * getCurrentStage() const
Return the current stage.
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
bool isPerson() const
Whether it is a person.
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
const MSEdge * getEdge() const
Returns the current edge.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
Abstract in-vehicle device.
SUMOVehicle & myHolder
The vehicle that stores the device.
Representation of a vehicle in the micro simulation.
The car-following model and parameter.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void setGUIShape(SUMOVehicleShape shape)
Set a new value for this type's gui shape.
int getPersonCapacity() const
Get this vehicle type's person capacity.
SUMOTime getLoadingDuration(const bool isPerson) const
Get this vehicle type's loading duration.
void setLength(const double &length)
Set a new value for this type's length.
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
double getLength() const
Get vehicle's length [m].
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
void setMass(double mass)
Set a new value for this type's mass.
double getMass() const
Get this vehicle type's mass.
double getBoardingFactor() const
Get this person type's factor for loading/boarding duration.
const SUMOVTypeParameter & getParameter() const
int getContainerCapacity() const
Get this vehicle type's container capacity.
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
Representation of a vehicle, person, or container.
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
std::string getStringParam(const std::string ¶mName, const bool required=false, const std::string &deflt="") const
Retrieve a string parameter for the traffic object.
virtual void replaceVehicleType(const MSVehicleType *type)=0
Replaces the current vehicle type by the one given.
virtual MSDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or nullptr if not.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual const MSEdge * getEdge() const =0
Returns the edge the object is currently at.
Structure representing possible vehicle parameter.
double locomotiveLength
the length of the locomotive
double carriageLength
the length of train carriages
double carriageGap
the length of the gap between carriages
Representation of a vehicle.
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop and waiting for a person or container to continue.
virtual const MSStop & getNextStop() const =0
virtual MSStop & getNextStopMutable()=0
SUMOTime started
the time at which this stop was reached
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime duration
The stopping duration.