57#define DEBUG_COND (true)
76#define TAXI_SERVICE "taxi"
77#define TAXI_SERVICE_PREFIX "taxi:"
78#define SWAP_THRESHOLD 5
92 oc.
addDescription(
"device.taxi.dispatch-algorithm",
"Taxi Device",
TL(
"The dispatch algorithm [greedy|greedyClosest|greedyShared|routeExtension|traci]"));
95 oc.
addDescription(
"device.taxi.dispatch-algorithm.output",
"Taxi Device",
TL(
"Write information from the dispatch algorithm to FILE"));
98 oc.
addDescription(
"device.taxi.dispatch-algorithm.params",
"Taxi Device",
TL(
"Load dispatch algorithm parameters in format KEY1:VALUE1[,KEY2:VALUE]"));
101 oc.
addDescription(
"device.taxi.dispatch-period",
"Taxi Device",
TL(
"The period between successive calls to the dispatcher"));
104 oc.
addDescription(
"device.taxi.dispatch-keep-unreachable",
"Taxi Device",
TL(
"The time before aborting unreachable reservations"));
107 oc.
addDescription(
"device.taxi.idle-algorithm",
"Taxi Device",
TL(
"The behavior of idle taxis [stop|randomCircling|taxistand]"));
110 oc.
addDescription(
"device.taxi.idle-algorithm.output",
"Taxi Device",
TL(
"Write information from the idling algorithm to FILE"));
113 oc.
addSynonyme(
"device.taxi.vclasses",
"taxi.vclasses");
114 oc.
addDescription(
"device.taxi.vclasses",
"Taxi Device",
TL(
"Network permissions that can be accessed by taxis"));
124 into.push_back(device);
142 if (personCapacity < 1 && containerCapacity < 1) {
158 std::string algo = oc.
getString(
"device.taxi.dispatch-algorithm");
161 if (algo ==
"greedy") {
163 }
else if (algo ==
"greedyClosest") {
165 }
else if (algo ==
"greedyShared") {
167 }
else if (algo ==
"routeExtension") {
169 }
else if (algo ==
"traci") {
188 return lines.size() == 1 && (
195 const std::set<std::string>& lines,
199 const MSEdge* from,
double fromPos,
201 const MSEdge* to,
double toPos,
203 const std::string& group) {
208 throw ProcessError(
"Cannot add taxi reservation for " + std::string(person->
isPerson() ?
"person" :
"container")
209 +
" '" + person->
getID() +
"' because destination edge '" + to->
getID() +
"'"
210 +
" does not permit taxi access");
213 throw ProcessError(
"Cannot add taxi reservation for " + std::string(person->
isPerson() ?
"person" :
"container")
214 +
" '" + person->
getID() +
"' because origin edge '" + from->
getID() +
"'"
215 +
" does not permit taxi access");
220 if (fromStop !=
nullptr && &fromStop->
getLane().
getEdge() == from) {
224 Reservation* res =
myDispatcher->
addReservation(person, reservationTime, pickupTime, earliestPickupTime, from, fromPos, fromStop, to, toPos, toStop, group, *lines.begin(),
myMaxCapacity,
myMaxContainerCapacity);
236 const std::set<std::string>& lines,
237 const MSEdge* from,
double fromPos,
238 const MSEdge* to,
double toPos,
239 const std::string& group) {
247 const std::set<std::string>& lines,
248 const MSEdge* from,
double fromPos,
249 const MSEdge* to,
double toPos,
250 const std::string& group,
double newFromPos) {
259 std::vector<MSDevice_Taxi*> active;
261 if (taxi->getHolder().hasDeparted()) {
262 active.push_back(taxi);
283 if (res->persons.empty()) {
286 const bool isPerson = (*res->persons.begin())->isPerson();
288 const int cap = isPerson
289 ? taxi->getHolder().getVehicleType().getPersonCapacity()
290 : taxi->getHolder().getVehicleType().getContainerCapacity();
291 if (cap >= (
int)res->persons.size() && taxi->compatibleLine(res)) {
314 taxi->myState =
EMPTY;
319const std::map<SUMOVehicleClass, std::string>&
362 std::string defaultServiceEnd =
toString(1e15);
363 const std::string algo = holder.
getStringParam(
"device.taxi.idle-algorithm");
364 if (algo ==
"stop") {
366 }
else if (algo ==
"randomCircling") {
373 }
else if (algo ==
"taxistand") {
374 const std::string rerouterID = holder.
getStringParam(
"device.taxi.stands-rerouter");
375 if (rerouterID.empty()) {
376 throw ProcessError(
"Idle algorithm '" + algo +
"' requires a rerouter id to be defined using device param 'stands-rerouter' for vehicle '" +
myHolder.
getID() +
"'");
379 throw ProcessError(
"Unknown rerouter '" + rerouterID +
"' when loading taxi stands for vehicle '" +
myHolder.
getID() +
"'");
422 std::cout <<
" res=" << res->getID();
423 std::cout <<
" persons=" <<
toString(res->persons) <<
"\n";
459 tmpEdges.push_back(rerouteOrigin);
464 std::map<const MSTransportable*, int> nOccur;
470 throw ProcessError(
TLF(
"Invalid Re-dispatch for existing customer '%' with a new reservation", person->getID()));
477 for (
auto item : nOccur) {
478 std::cout <<
" previousCustomer=" << item.first->getID() <<
" occurs=" << item.second <<
"\n";
482 if (nOccur.size() == 0) {
488 std::cout <<
" re-dispatch with route-extension\n";
493 std::set<const MSTransportable*> onBoard;
496 onBoard.insert(onBoardP.begin(), onBoardP.end());
497 onBoard.insert(onBoardC.begin(), onBoardC.end());
498 std::set<const MSTransportable*> redundantPickup;
499 for (
auto item : nOccur) {
500 if (item.second == 1) {
502 if (onBoard.count(item.first) == 0) {
503 throw ProcessError(
TLF(
"Re-dispatch did not mention pickup for existing customer '%'", item.first->getID()));
505 }
else if (item.second == 2) {
506 if (onBoard.count(item.first) == 0) {
511 redundantPickup.insert(item.first);
514 throw ProcessError(
"Re-dispatch mentions existing customer '" + item.first->getID() +
"' " +
toString(item.second) +
" times");
518 if (!redundantPickup.empty()) {
519 for (
auto it = reservations.begin(); it != reservations.end();) {
520 bool isRedundant =
false;
522 if (redundantPickup.count(person) != 0) {
529 redundantPickup.erase(person);
531 it = reservations.erase(it);
542 tmpEdges.push_back(rerouteOrigin);
546 std::cout <<
" re-dispatch from scratch\n";
551 std::vector<std::string> missing;
553 if (nOccur.count(c) == 0) {
554 missing.push_back(c->getID());
561 bool hasPickup =
false;
564 bool isPickup =
false;
573 prepareStop(tmpEdges, stops, lastPos, res->from, res->fromPos, res->fromStop,
"pickup " +
toString(res->persons) +
" (" + res->id +
")", res, isPickup);
575 if (transportable->isPerson()) {
576 stops.back().triggered =
true;
578 stops.back().containerTriggered =
true;
580 stops.back().permitted.insert(transportable->getID());
584 stops.back().awaitedPersons.insert(t->getID());
587 if (stops.back().duration == -1) {
592 prepareStop(tmpEdges, stops, lastPos, res->to, res->toPos, res->toStop,
"dropOff " +
toString(res->persons) +
" (" + res->id +
")", res, isPickup);
599 std::cout <<
" tmpEdges=" <<
toString(tmpEdges) <<
"\n";
638 std::set<const MSTransportable*> customersToBeRemoved;
639 std::set<const MSTransportable*> onBoard;
644 if (t->getID() == tID && onBoard.count(t) == 0) {
645 customersToBeRemoved.insert(t);
649 if (!customersToBeRemoved.empty()) {
653 for (
auto t : customersToBeRemoved) {
674 bool fulfilled =
false;
675 if ((*resIt)->persons.size() == 1 && (*resIt)->persons.count(t) != 0) {
729 if (*stop.edge == res->
from
735 }
else if (*stop.edge == res->
to
748 double& lastPos,
const MSEdge* stopEdge,
double stopPos,
750 const std::string& action,
const Reservation* res,
const bool isPickup) {
751 assert(!edges.empty());
752 if (stopPlace !=
nullptr && &stopPlace->
getLane().
getEdge() == stopEdge) {
755 if (stopPos < lastPos && stopPos + NUMERICAL_EPS >= lastPos) {
758 bool addedEdge =
false;
762 double distToStop = stopPos - lastPos;
767 if (stopEdge != edges.back()) {
768 distToStop += edges.back()->getLength();
769 if (distToStop < brakeGap) {
774 for (
int i = 1; i < (int)toFirstStop.size() - 1; i++) {
775 distToStop += toFirstStop[i]->getLength();
779 if (distToStop < brakeGap) {
782 edges.push_back(stopEdge);
787 if (stopEdge == edges.back() && !stops.empty()) {
788 if (stopPos >= lastPos && stopPos <= stops.back().endPos) {
790 stops.back().actType +=
"," + action;
796 stops.back().actType +=
"," + action;
800 if (!addedEdge && (stopEdge != edges.back() || stopPos < lastPos)) {
802 edges.push_back(stopEdge);
807 if (stopPlace !=
nullptr && &stopPlace->
getLane().
getEdge() == stopEdge) {
828 if (isPickup && earliestPickupTime >= 0) {
833 stops.push_back(stop);
840 if (allowedLanes ==
nullptr) {
843 return allowedLanes->front();
893 double newPos,
double ) {
902 const double timeOnLane,
905 const double travelledDistanceFrontOnLane,
945 WRITE_WARNINGF(
TL(
"All customers left vehicle '%' at time=% but there are % remaining stops"),
967 bool fulfilled =
true;
988 if (swapGroup !=
"") {
991 double maxSaving = 0;
994 if (taxi->getHolder().hasDeparted() && taxi->getState() ==
PICKUP
995 && taxi->getHolder().getStringParam(
"device.taxi.swapGroup",
false,
"") == swapGroup) {
1002 if (!toPickup2.empty()) {
1004 const double saving = cost - cost2 - stopTime;
1006 if (saving > maxSaving) {
1014#ifdef DEBUG_DISPATCH
1018 std::cout <<
toString(res->persons) <<
"; ";
1044 if (stop.pars.permitted.size() > 0) {
1053 if (tripinfoOut !=
nullptr) {
1064 if (key ==
"customers") {
1066 }
else if (key ==
"occupiedDistance") {
1068 }
else if (key ==
"occupiedTime") {
1070 }
else if (key ==
"state") {
1072 }
else if (key ==
"currentCustomers") {
1074 }
else if (key ==
"pickUpDuration") {
1076 }
else if (key ==
"dropOffDuration") {
1091 if (key ==
"pickUpDuration" || key ==
"dropOffDuration") {
1105 std::ostringstream internals;
1150 if (pc !=
nullptr) {
1151 t = pc->
get(item.first);
1153 if (t ==
nullptr && cc !=
nullptr) {
1154 t = cc->
get(item.first);
1157 WRITE_ERRORF(
"Could not find taxi customer '%'. Ensure state contains transportables", item.first);
1159 item.second->myCustomers.insert(t);
1165 std::map<std::string, const Reservation*> resLookup;
1167 resLookup[res->getID()] = res;
1170 resLookup[res->getID()] = res;
1173 auto it = resLookup.find(item.first);
1174 if (it == resLookup.end()) {
1175 WRITE_ERRORF(
"Could not find taxi reservation '%'.", item.first);
1177 item.second->myCurrentReservations.insert(it->second);
#define TAXI_SERVICE_PREFIX
std::vector< const MSEdge * > ConstMSEdgeVector
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
constexpr SUMOTime TIME2STEPS(double x)
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_RAILTYPE_ID
const std::string DEFAULT_VTYPE_ID
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
const std::string DEFAULT_BIKETYPE_ID
const int STOP_DURATION_SET
const int STOP_PARKING_SET
std::vector< SUMOVehicleParameter::Stop > StopParVector
const int STOP_PERMITTED_SET
const int STOP_TRIGGER_SET
@ GIVEN
The time is given.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_ATTR_STATE
The state of a link.
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::string joinNamedToStringSorting(const std::set< T * > &ns, const T_BETWEEN &between)
Base (microsim) event class.
The base class for microscopic and mesoscopic vehicles.
const std::list< MSStop > & getStops() const
A device that performs vehicle rerouting based on current edge speeds.
void setActive(bool active)
A device which collects info on the vehicle trip (mainly on departure and arrival)
void prepareStop(ConstMSEdgeVector &edges, StopParVector &stops, double &lastPos, const MSEdge *stopEdge, double stopPos, const MSStoppingPlace *stopPlace, const std::string &action, const Reservation *res, const bool isPickup)
prepare stop for the given action
void addCustomer(const MSTransportable *t, const Reservation *res)
add person after extending reservation
static Command * myDispatchCommand
The repeated call to the dispatcher.
void customerArrived(const MSTransportable *person)
called by MSDevice_Transportable upon unloading a person
static SUMOTime triggerDispatch(SUMOTime currentTime)
period command to trigger the dispatch algorithm
void dispatch(const Reservation &res)
service the given reservation
std::set< const MSTransportable * > myCustomers
the customer of the current reservation
SUMOTime myServiceEnd
the time at which the taxi service ends (end the vehicle may leave the simulation)
static void updateReservationFromPos(MSTransportable *person, const std::set< std::string > &lines, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group, double newFromPos)
update reservation's fromPos due to pre-booking
bool cancelCustomer(const MSTransportable *t)
remove person from reservations
void generateOutput(OutputDevice *tripinfoOut) const
Called on writing tripinfo output.
void dispatchShared(std::vector< const Reservation * > reservations)
service the given reservations
static void addReservation(MSTransportable *person, const std::set< std::string > &lines, SUMOTime reservationTime, SUMOTime pickupTime, SUMOTime earliestPickupTime, const MSEdge *from, double fromPos, const MSStoppingPlace *fromStop, const MSEdge *to, double toPos, const MSStoppingPlace *toStop, const std::string &group)
add new reservation
MSIdling * myIdleAlgorithm
algorithm for controlling idle behavior
std::set< const Reservation * > myCurrentReservations
reservations currently being served
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
bool hasFuturePickup()
whether the taxi has another pickup scheduled
void cancelCurrentCustomers()
remove the persons the taxi is currently waiting for from reservations
std::vector< const Reservation * > myLastDispatch
the last dispatch order
static MSDispatch * myDispatcher
the dispatch algorithm
int myCustomersServed
number of customers that were served
void updateMove(const SUMOTime traveltime, const double travelledDist)
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()
static int myMaxContainerCapacity
MSDevice_Routing * myRoutingDevice
routing device (if the vehicle has one)
bool isEmpty()
whether the taxi is empty
static std::map< std::string, MSDevice_Taxi * > myStateLoadedCustomers
ids of customers loaded from state
const std::string deviceName() const
return the name for this type of device
static std::vector< MSDevice_Taxi * > myFleet
static void removeReservation(MSTransportable *person, const std::set< std::string > &lines, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, const std::string &group)
retract reservation
static SUMOTime myDispatchPeriod
the time between successive calls to the dispatcher
static SUMOTime myNextDispatchTime
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
static void cleanup()
resets counters
static bool isReservation(const std::set< std::string > &lines)
whether the given lines description is a taxi call
double myOccupiedDistance
distance driven with customers
MSDevice_Taxi(SUMOVehicle &holder, const std::string &id)
Constructor.
static bool hasFleet()
returns whether taxis have been loaded
static void allCustomersErased()
signal the end of the simulation and the removal of all customers
bool allowsBoarding(const MSTransportable *t) const
whether the given person is allowed to board this taxi
static bool hasServableReservations()
check whether there are still (servable) reservations in the system
static const std::map< SUMOVehicleClass, std::string > & getTaxiTypes()
return all types that are known to carry a taxi device (or the default type if no devices are initial...
static SUMOTime getNextDispatchTime()
void saveState(OutputDevice &out) const
Saves the state of the device.
void customerEntered(const MSTransportable *t)
called by MSDevice_Transportable upon loading a person
bool compatibleLine(const Reservation *res)
whether the given reservation is compatible with the taxi line
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void finalizeLoadState()
call during state loading after all transportables are loaded
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Taxi-options.
bool myIsStopped
whether the vehicle is currently stopped
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
SUMOTime myOccupiedTime
time spent driving with customers
bool myReachedServiceEnd
whether the taxi has reached its schedule service end
~MSDevice_Taxi()
Destructor.
static std::map< std::string, MSDevice_Taxi * > myStateLoadedReservations
ids of reservations loaded from state
static std::map< SUMOVehicleClass, std::string > myTaxiTypes
storing only one type per vClass
MSLane * getStopLane(const MSEdge *edge, const std::string &action)
determine stopping lane for taxi
void checkTaskSwap()
optionally swap tasks when a taxi becomes idle
static void initDispatch(SUMOTime next=-1)
initialize the dispatch algorithm
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
A dispatch algorithm that services the reservations with the shortest traveltime-to-pickup first.
A dispatch algorithm that services customers in reservation order and always sends the closest availa...
A dispatch algorithm that services customers in reservation order and always sends the closest availa...
An algorithm that performs distpach for a taxi fleet.
void swappedRunning(const Reservation *res, MSDevice_Taxi *taxi)
virtual std::string removeReservation(MSTransportable *person, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, std::string group)
remove person from reservation. If the whole reservation is removed, return its id
virtual Reservation * updateReservationFromPos(MSTransportable *person, const MSEdge *from, double fromPos, const MSEdge *to, double toPos, std::string group, double newFromPos)
update fromPos of the person's reservation. TODO: if there is already a reservation with the newFromP...
std::vector< Reservation * > getReservations()
retrieve all reservations
virtual std::vector< const Reservation * > getRunningReservations()
retrieve all reservations that were already dispatched and are still active
virtual SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouter() const
virtual Reservation * addReservation(MSTransportable *person, SUMOTime reservationTime, SUMOTime pickupTime, SUMOTime earliestPickupTime, const MSEdge *from, double fromPos, const MSStoppingPlace *fromStop, const MSEdge *to, double toPos, const MSStoppingPlace *tostop, std::string group, const std::string &line, int maxCapacity, int maxContainerCapacity)
add a new reservation
bool hasServableReservations()
check whether there are still (servable) reservations in the system
virtual void fulfilledReservation(const Reservation *res)
erase reservation from storage
virtual void computeDispatch(SUMOTime now, const std::vector< MSDevice_Taxi * > &fleet)=0
computes dispatch and updates reservations
void servedReservation(const Reservation *res, MSDevice_Taxi *taxi)
A road/street connecting two junctions.
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Get the allowed lanes to reach the destination-edge.
double getLength() const
return the length of the edge
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
virtual void idle(MSDevice_Taxi *taxi)=0
computes Idling and updates reservations
int getPendingFlowCount() const
Returns the number of flows that are still active.
Representation of a lane in the micro simulation.
double getLength() const
Returns the lane's length.
MSEdge & getEdge() const
Returns the lane's edge.
Notification
Definition of a vehicle state.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getLoaderTime() const
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
void resetIntermodalRouter() const
force reconstruction of intermodal network
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool hasContainers() const
Returns whether containers are simulated.
bool hasPersons() const
Returns whether persons are simulated.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
const ConstMSEdgeVector & getEdges() const
static MSVehicleRouter & getRouterTT(const int rngIndex, SUMOVehicleClass svc, const Prohibitions &prohibited={})
return the vehicle router instance
bool triggered
whether an arriving person lets the vehicle continue
bool containerTriggered
whether an arriving container lets the vehicle continue
bool joinTriggered
whether coupling another vehicle (train) the vehicle continue
MSRouteIterator edge
The edge in the route to stop at.
SUMOTime endBoarding
the maximum time at which persons may board this vehicle
SUMOTime duration
The stopping duration.
const SUMOVehicleParameter::Stop pars
The stop parameter.
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
SumoXMLTag getElement() const
return the type of this stopping place
double getEndLanePosition() const
Returns the end position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
bool isPerson() const override
Whether it is a person.
Reroutes traffic objects passing an edge.
static const std::map< std::string, MSTriggeredRerouter * > & getInstances()
return all rerouter instances
The class responsible for building and deletion of vehicles.
bool hasVType(const std::string &id) const
Asks for existence of a vehicle type.
bool addVType(MSVehicleType *vehType)
Adds a vehicle type.
Abstract in-vehicle device.
SUMOVehicle & myHolder
The vehicle that stores the device.
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
The car-following model and parameter.
int getPersonCapacity() const
Get this vehicle type's person capacity.
const std::string & getID() const
Returns the name of the vehicle type.
static MSVehicleType * build(SUMOVTypeParameter &from, const std::string &fileName="")
Builds the microsim vehicle type described by the given parameter.
double getLength() const
Get vehicle's length [m].
int getContainerCapacity() const
Get this vehicle type's container capacity.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
double recomputeCostsPos(const std::vector< const E * > &edges, const V *const v, double fromPos, double toPos, SUMOTime msTime, double *lengthp=nullptr) const
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.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
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 const MSLane * getLane() const =0
Returns the lane the object is currently at.
virtual int getRNGIndex() const =0
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 const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
double getFloatParam(const std::string ¶mName, const bool required=false, const double deflt=INVALID_DOUBLE, bool checkDist=true) const
Retrieve a floating point parameter for the traffic object.
virtual const MSEdge * getEdge() const =0
Returns the (normal) route edge the object is currently at.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Structure representing possible vehicle parameter.
Representation of a vehicle.
virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const =0
Returns the starting point for reroutes (usually the current edge)
virtual 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)=0
Performs a rerouting using the given router.
virtual bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)=0
Replaces the current route by the given edges.
virtual const std::vector< MSTransportable * > & getContainers() const =0
retrieve riding containers
virtual bool isStopped() const =0
Returns whether the vehicle is at a stop and waiting for a person or container to continue.
virtual bool hasStops() const =0
Returns whether the vehicle has to stop somewhere.
virtual bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, ConstMSEdgeVector::const_iterator *searchStart=0)=0
Adds a stop.
virtual const std::list< MSStop > & getStops() const =0
virtual int getPersonNumber() const =0
Returns the number of persons.
virtual void unregisterWaiting()=0
mark vehicle as active
virtual bool isStoppedTriggered() const =0
Returns whether the vehicle is at a stop and waiting for a person or container to continue.
virtual const std::vector< MSTransportable * > & getPersons() const =0
retrieve riding persons
virtual int getContainerNumber() const =0
Returns the number of containers.
virtual const MSStop & getNextStop() const =0
virtual MSStop & getNextStopMutable()=0
virtual double getBrakeGap(bool delayed=false) const =0
get distance for coming to a stop (used for rerouting checks)
virtual bool isStoppedParking() const =0
Returns whether the vehicle is at a stop and parking.
virtual int getRoutePosition() const =0
return index of edge within route
virtual const ConstMSEdgeVector::const_iterator & getCurrentRouteEdge() const =0
Returns an iterator pointing to the current edge in this vehicles route.
virtual const SUMOVehicleParameter::Stop * getNextStopParameter() const =0
Returns parameters of the next stop or nullptr.
virtual const MSRoute & getRoute() const =0
Returns the current route.
virtual bool abortNextStop(int nextStopIndex=0)=0
deletes the next stop at the given index if it exists
Definition of vehicle stop (position and duration)
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
double startPos
The stopping position start.
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
std::string actType
act Type (only used by Persons) (used by netedit)
double endPos
The stopping position end.
SUMOTime waitUntil
The earliest pickup time for a taxi stop.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
std::string containerstop
(Optional) container stop if one is assigned to the stop
Structure representing possible vehicle parameter.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
std::string line
The vehicle's line (mainly for public transport)
static ParkingType parseParkingType(const std::string &value)
parses parking type value
A wrapper for a Command function.
static std::string to_upper_case(const std::string &str)
Transfers the content to upper case.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
#define UNUSED_PARAMETER(x)
SUMOTime earliestPickupTime