73#define DEBUG_COND (isSelected())
81std::set<std::string> MSBaseVehicle::myShallTraceMoveReminders;
98 throw ProcessError(
"getPreviousSpeed() is not available for non-MSVehicles.");
127 , myTraceMoveReminders(myShallTraceMoveReminders.count(pars->id) > 0)
130 if ((*
myRoute->begin())->isTazConnector() ||
myRoute->getLastEdge()->isTazConnector()) {
232const std::set<SUMOTrafficObject::NumericalID>
234 std::set<SUMOTrafficObject::NumericalID> result;
236 result.insert((*e)->getNumericalID());
244 if (stop ==
nullptr) {
248 if (s.busstop == stop
249 || s.containerstop == stop
250 || s.parkingarea == stop
251 || s.chargingStation == stop) {
261 if (&s.lane->getEdge() == edge) {
265 return myRoute->getLastEdge() == edge;
272 const MSEdge* source =
nullptr;
276 if (source ==
nullptr) {
277 source =
myRoute->getEdges().front();
280 source =
myRoute->getEdges().front();
285 if (sink ==
nullptr) {
287 if (sink ==
nullptr) {
294 if (source != sink || !sink->
prohibits(
this)) {
295 edges.push_back(source);
297 std::vector<StopEdgeInfo> stops;
317 if (stops.size() > 0) {
325 const bool skipFirst = stops.front().edge == source && (source !=
getEdge() || sourcePos <= firstPos + NUMERICAL_EPS);
329 <<
" source=" << source->
getID() <<
" sourcePos=" << sourcePos <<
" firstPos=" << firstPos <<
" arrivalPos=" <<
myArrivalPos <<
" lastPos=" << lastPos
330 <<
" route=" <<
toString(
myRoute->getEdges()) <<
" skipFirst=" << skipFirst <<
"\n";
333 if (stops.size() == 1 && skipFirst) {
335 }
else if (skipFirst) {
336 sourcePos = stops.front().pos;
337 stops.erase(stops.begin());
341 std::set<const MSEdge*> jumpEdges;
342 std::map<const MSEdge*, StopEdgeInfo> stopsOnVia;
344 if (stop.pars.jump >= 0) {
345 jumpEdges.insert(*stop.edge);
347 auto itsov = stopsOnVia.find(*stop.edge);
348 if (itsov == stopsOnVia.end()) {
349 stopsOnVia.insert({*stop.edge,
StopEdgeInfo(*stop.edge, stop.pars.priority, stop.getArrivalFallback(), stop.getEndPos(*
this))});
351 itsov->second.priority =
addStopPriority(itsov->second.priority, stop.pars.priority);
361 assert(viaEdge != 0);
365 auto itsov = stopsOnVia.find(viaEdge);
366 const double priority = (itsov == stopsOnVia.end() ? -1 : itsov->second.priority);
367 const SUMOTime arrival = (itsov == stopsOnVia.end() ? -1 : itsov->second.arrival);
368 const double pos = (itsov == stopsOnVia.end() ? 0 : itsov->second.pos);
369 stops.push_back(
StopEdgeInfo(viaEdge, priority, arrival, pos));
371 if (jumpEdges.count(viaEdge) != 0) {
372 jumps.insert((
int)stops.size());
376 if ((stops.size() == 0 && (source != sink || sourcePos >
myArrivalPos))
377 || ((stops.size() != 0) && (stops.back().edge != sink ||
myArrivalPos < stops.back().pos))) {
382 std::cout <<
SIMTIME <<
" reroute veh=" <<
getID() <<
" onInit=" << onInit <<
" source=" << source->
getID() <<
" sink=" << sink->
getID() <<
" sourcePos=" << sourcePos <<
" arrivalPos=" <<
myArrivalPos <<
" stops:\n";
383 for (
auto item : stops) {
384 std::cout <<
" e=" << item.edge->getID() <<
" pos=" << item.pos <<
" isSink=" << item.isSink <<
"\n";
391 bool hasSkipped =
false;
392 const double origSourcePos = sourcePos;
393 const MSEdge* origSource = source;
395 for (
auto& stopEdgeInfo : stops) {
396 const MSEdge*
const stopEdge = stopEdgeInfo.edge;
397 const double priority = stopEdgeInfo.priority;
400 if (jumps.count(stopIndex) != 0) {
401 edges.push_back(stopEdge);
406 router.
compute(source, sourcePos, stopEdge, stopEdgeInfo.pos,
this, t, into, silent || priority >= 0);
409 std::cout <<
SIMTIME <<
" reroute veh=" <<
getID() <<
" source=" << source->
getID() <<
" sourcePos=" << sourcePos <<
" target=" << stopEdgeInfo.edge->getID() <<
" targetPos=" << stopEdgeInfo.pos <<
" edges=" <<
toString(into) <<
"\n";
412 if (into.size() > 0) {
414 while (stopIt !=
myStops.end() && stopIt->lane->getNextNormal()->getID() != stopEdge->
getID()) {
420 if (stopIt->pars.priority >= 0 && info !=
"device.rerouting") {
423 SUMOTime arrival = stopEdgeInfo.arrival;
425 SUMOTime delay = startTime - arrival;
430 if (delay > maxDelay) {
431 stopEdgeInfo.skipped =
true;
432 stopEdgeInfo.delay = delay;
440 sourcePos = stopEdgeInfo.pos;
441 startTime += stopIt->getMinDuration(startTime);
444 edges.insert(edges.end(), into.begin(), into.end());
445 if (edges.back()->isTazConnector()) {
448 source = edges.back();
449 stopEdgeInfo.routeIndex = (int)edges.size() - 1;
452 stopEdgeInfo.skipped =
true;
455 }
else if (stopEdgeInfo.isSink) {
458 if (source == stopEdge && stops.size() == 1 && sourcePos >
myArrivalPos) {
459 edges.push_back(stopEdge);
460 WRITE_WARNING(
TLF(
"Vehicle '%' ignores arrivalPos % when driving from edge '%' to edge '%' with departPos %.",
463 }
else if (source == stopEdge && stopEdgeInfo.stopPar !=
nullptr && stopEdgeInfo.stopPar->endPos >= sourcePos) {
467 std::string error =
TLF(
"Vehicle '%' has no valid route from edge '%' to stop edge '%'.",
getID(), source->
getID(), stopEdge->
getID());
472 edges.push_back(source);
481 for (
auto stop : stops) {
482 if (stop.skipped || stop.origEdge !=
nullptr) {
483 const MSEdge* origEdge = stop.origEdge ==
nullptr ? stop.edge : stop.origEdge;
484 if (stop.delay > 0) {
486 }
else if (stop.backtracked) {
496 if (edges.empty() && silent) {
499 if (!edges.empty() && edges.front()->isTazConnector()) {
500 edges.erase(edges.begin());
502 if (!edges.empty() && edges.back()->isTazConnector()) {
508 const double previousCost = isTripInit ? routeCost : router.
recomputeCosts(oldEdgesRemaining,
this, t);
509 const double savings = previousCost - routeCost;
513 assert(routingDevice != 0);
516 std::string dummyMsg;
517 if (!
hasValidRoute(dummyMsg, oldEdgesRemaining.begin(), oldEdgesRemaining.end(),
true)) {
545 return !edges.empty();
553 if (msgReturn !=
nullptr) {
554 *msgReturn =
"No route found";
559 std::string
id =
getID();
563 const std::string idSuffix =
id +
"!var#";
567 id = idSuffix +
toString(++varIndex);
569 int oldSize = (int)edges.size();
572 if (origin != *
myCurrEdge && edges.front() == origin) {
574 oldSize = (int)edges.size();
589 if (msgReturn !=
nullptr) {
590 *msgReturn =
"duplicate routeID '" +
id +
"'";
599 if (msgReturn !=
nullptr) {
605 if (!
replaceRoute(constRoute, info, onInit, (
int)edges.size() - oldSize,
false, removeStops, msgReturn)) {
620 if (newCurrEdge == edges.end()) {
621 if (msgReturn !=
nullptr) {
622 *msgReturn =
TLF(
"current edge '%' not found in new route", (*myCurrEdge)->getID());
624#ifdef DEBUG_REPLACE_ROUTE
626 std::cout <<
" newCurrEdge not found\n";
633 (newCurrEdge + 1) == edges.end() || (*(newCurrEdge + 1)) != &(
getLane()->getOutgoingViaLanes().front().first->
getEdge()))) {
634 if (msgReturn !=
nullptr) {
635 *msgReturn =
TL(
"Vehicle is on junction-internal edge leading elsewhere");
637#ifdef DEBUG_REPLACE_ROUTE
639 std::cout <<
" Vehicle is on junction-internal edge leading elsewhere\n";
645 && (newCurrEdge + 1) != edges.end()
647 if (msgReturn !=
nullptr) {
648 *msgReturn =
TL(
"Vehicle is moving past junction and committed to move to another successor edge");
650#ifdef DEBUG_REPLACE_ROUTE
652 std::cout <<
" Vehicle is moving past junction and committed to move to another successor edge\n";
660 const bool stopsFromScratch = onInit &&
myRoute->getStops().empty();
686#ifdef DEBUG_REPLACE_ROUTE
688 std::cout <<
SIMTIME <<
" veh=" <<
getID() <<
" replaceRoute info=" << info <<
" on " << (*myCurrEdge)->getID()
690 <<
" stopsFromScratch=" << stopsFromScratch
691 <<
" newSize=" << newRoute->getEdges().size()
692 <<
" newIndex=" << (
myCurrEdge - newRoute->begin())
693 <<
" edges=" <<
toString(newRoute->getEdges())
707 if (stopsFromScratch) {
718 lastPos += (*myCurrEdge)->getLength();
721 for (std::list<MSStop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
723 double endPos = iter->getEndPos(*
this);
724#ifdef DEBUG_REPLACE_ROUTE
726 std::cout <<
" stopEdge=" << iter->lane->getEdge().getID() <<
" start=" << (searchStart -
myCurrEdge) <<
" endPos=" << endPos <<
" lastPos=" << lastPos <<
"\n";
729 if (*searchStart != &iter->lane->getEdge()
731 || endPos + NUMERICAL_EPS < lastPos
735 || (iter->pars.index > (
int)
myPastStops.size() + stopIndex
737 && lastToSkip < (int)iter->skips.size()
738 && searchStart -
myRoute->begin() <= iter->skips[lastToSkip])) {
739 if (searchStart != edges.end() && !iter->reached) {
740#ifdef DEBUG_REPLACE_ROUTE
742 std::cout <<
" skip " << (*searchStart)->getID() <<
"\n";
751 iter->edge = std::find(searchStart, edges.end(), &iter->lane->getEdge());
752#ifdef DEBUG_REPLACE_ROUTE
754 std::cout <<
" foundIndex=" << (iter->edge -
myCurrEdge) <<
" end=" << (edges.end() -
myCurrEdge) <<
"\n";
757 if (iter->edge == edges.end() && iter->pars.priority >= 0) {
758 const std::string oldEdge = iter->pars.edge;
759 const std::string oldName = iter->getStoppingPlaceName().first;
761 WRITE_WARNINGF(
TL(
"Vehicle '%' replaced stop on edge '%' (named '%') and now stops at '%' instead; after rerouting (%) at time=%."),
765 if (iter->edge == edges.end()) {
773 searchStart = iter->edge;
780 for (StopParVector::const_iterator i = newRoute->getStops().begin(); i != newRoute->getStops().end(); ++i) {
795 std::pair<std::string, SumoXMLTag> nameTag = iter->getStoppingPlaceName();
796 if (!nameTag.first.empty()) {
800 if (&alt->getLane().getEdge() == &iter->lane->getEdge()
801 || !alt->getLane().allowsVehicleClass(
getVClass())) {
804 iter->edge = std::find(searchStart, end, &alt->getLane().getEdge());
805 if (iter->edge != end) {
806 iter->replaceStoppingPlace(alt);
882 &&
myStops.begin()->pars.permitted.count(t->
getID()) == 0) {
886 if (taxiDevice !=
nullptr) {
933 if (stop.edge == it && stop.pars.jump >= 0) {
935 }
else if (stop.edge > it) {
946 if (route ==
nullptr) {
949 start = route->begin();
951 const bool checkJumps = route ==
myRoute;
961 const MSEdge& next = **(e + 1);
963 if (!checkJumps || !
hasJump(e)) {
966 msg =
TLF(
"No connection between edge '%' and edge '%'.", (*e)->getID(), (*(e + 1))->getID());
974 if ((*e)->prohibits(
this)) {
975 msg =
TLF(
"Edge '%' prohibits.", (*e)->getID());
985 if (!(*myCurrEdge)->isTazConnector()) {
987 msg =
TLF(
"Departure speed for vehicle '%' is too high for the vehicle type '%'.",
getID(),
myType->
getID());
992 if (
myRoute->getEdges().size() > 0 && !(*myCurrEdge)->prohibits(
this)) {
996 msg =
TLF(
"Vehicle '%' is not allowed to depart on any lane of edge '%'.",
getID(), (*myCurrEdge)->getID());
1013 }
else if (!silent) {
1016 }
else if (msgReturn !=
nullptr) {
1037 if (item.first == rem) {
1048 if (myTraceMoveReminders) {
1049 traceMoveReminder(
"add", rem, pos,
true);
1059 if (r->first == rem) {
1061 if (myTraceMoveReminders) {
1062 traceMoveReminder(
"remove", rem, 0,
false);
1079 if (rem->
getLane() !=
nullptr && remPos > 0.) {
1081 if (myTraceMoveReminders) {
1082 traceMoveReminder(
"notifyEnter_skipped", rem, remPos,
true);
1087 if (rem->
notifyEnter(*
this, reason, enteredLane)) {
1089 if (myTraceMoveReminders) {
1090 traceMoveReminder(
"notifyEnter", rem, remPos,
true);
1096 if (myTraceMoveReminders) {
1097 traceMoveReminder(
"notifyEnter", rem, remPos,
false);
1114 if (
myRoute->getLastEdge()->isTazConnector()) {
1120 WRITE_WARNINGF(
TL(
"Vehicle '%' ignores attribute arrivalEdge=% after rerouting at time=% (routeLength=%)"),
1126 arrivalEdge =
myRoute->getLastEdge();
1130 const std::vector<MSLane*>& lanes = arrivalEdge->
getLanes();
1131 const double lastLaneLength = lanes[0]->getLength();
1160 for (
MSLane* lane : lanes) {
1172 std::vector<MSLane*> usable;
1173 for (
MSLane* lane : lanes) {
1175 usable.push_back(lane);
1178 if (usable.empty()) {
1186 for (std::vector<MSLane*>::const_iterator l = lanes.begin(); l != lanes.end(); ++l) {
1199 const int routeEdges = (int)
myRoute->getEdges().size();
1213 const int routeEdges = (int)
myRoute->getEdges().size();
1248 if (
typeid(*dev) == type) {
1263 std::ostringstream os;
1304 && (
myStops.begin()->parkingarea ==
nullptr || !
myStops.begin()->parkingarea->parkOnRoad())
1339 if (parkingArea == 0) {
1340 errorMsg =
"new parkingArea is NULL";
1344 errorMsg =
"vehicle has no stops";
1347 if (
myStops.front().parkingarea == 0) {
1348 errorMsg =
"first stop is not at parkingArea";
1355 for (std::list<MSStop>::iterator iter = ++
myStops.begin(); iter !=
myStops.end();) {
1356 if (iter->parkingarea == parkingArea) {
1357 stopPar.
duration += iter->duration;
1394 return nextParkingArea;
1402 currentParkingArea =
myStops.begin()->parkingarea;
1404 return currentParkingArea;
1408const std::vector<std::string>&
1423 && (&
myStops.front().lane->getEdge()) == *
myStops.front().edge) {
1434 if (edge ==
nullptr || edge->
getOppositeEdge() ==
nullptr || stop.
lane.find(
"_") == std::string::npos) {
1451 if (stopPar.
lane ==
"") {
1454 if (stop.
lane ==
nullptr) {
1455 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on any lane of edge '" + stopPar.
edge +
"'.";
1460 if (stop.
lane ==
nullptr) {
1464 assert(stop.
lane !=
nullptr);
1467 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
1474 errorMsg =
"Mesoscopic simulation does not allow stopping on internal edge '" + stopPar.
edge +
"' for vehicle '" +
myParameter->
id +
"'.";
1479 if (stopPar.
until != -1) {
1486 std::string stopType =
"stop";
1487 std::string stopID =
"";
1489 if (stop.
busstop !=
nullptr) {
1494 stopType =
"containerStop";
1498 stopType =
"chargingStation";
1502 stopType =
"overheadWireSegment";
1506 stopType =
"parkingArea";
1509 const std::string errorMsgStart = stopID ==
"" ? stopType : stopType +
" '" + stopID +
"'";
1512 errorMsg = errorMsgStart +
" for vehicle '" +
myParameter->
id +
"' on lane '" + stop.
lane->
getID() +
"' has an invalid position.";
1515 if (stopType !=
"stop" && stopType !=
"parkingArea" &&
myType->
getLength() / 2. > parkingLength
1517 && parkingLength < stop.lane->
getLength()
1520 errorMsg = errorMsgStart +
" on lane '" + stop.
lane->
getID() +
"' is too short for vehicle '" +
myParameter->
id +
"'.";
1524 errorMsg = errorMsgStart +
"on lane '" + stop.
lane->
getID() +
"' forbids access because vehicle '" +
myParameter->
id +
"' does not provide any valid badge.";
1538 if (searchStart ==
nullptr) {
1542 searchStart = ≻
1545#ifdef DEBUG_ADD_STOP
1547 std::cout <<
"addStop desc=" << stop.
getDescription() <<
" stopEdge=" << stopEdge->
getID()
1548 <<
" searchStart=" << ((*searchStart) ==
myRoute->end() ?
"END" : (**searchStart)->getID())
1550 <<
" stopParIndex=" << stopPar.
index
1554 stop.
edge = std::find(*searchStart,
myRoute->end(), stopEdge);
1559 std::list<MSStop>::iterator iter =
myStops.begin();
1563 prevStopEdge =
myStops.back().edge;
1564 prevEdge = &
myStops.back().lane->getEdge();
1565 prevStopPos =
myStops.back().pars.endPos;
1566 stop.
edge = std::find(prevStopEdge,
myRoute->end(), stopEdge);
1567 if (prevStopEdge == stop.
edge
1571 stop.
edge = std::find(prevStopEdge + 1,
myRoute->end(), stopEdge);
1573#ifdef DEBUG_ADD_STOP
1575 std::cout <<
" (@end) prevStopEdge=" << (*prevStopEdge)->getID() <<
" prevStopPos=" << prevStopPos <<
" index=" << (int)(prevStopEdge -
myRoute->begin())
1581 int skipLooped = stopPar.
index -
static_cast<int>(
myStops.size());
1582 for (
int j = 0; j < skipLooped; j++) {
1583 auto nextIt = std::find(stop.
edge + 1,
myRoute->end(), stopEdge);
1584 if (nextIt ==
myRoute->end()) {
1587 errorMsg = errorMsgStart +
" for vehicle '" +
myParameter->
id +
"' could not skip " +
toString(skipLooped) +
" occurences of stop edge '" + stopEdge->
getID() +
"' in looped route.";
1596 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
1597 (iter->pars.endPos < stop.
pars.
endPos && iter->edge == stop.
edge) ||
1599 prevStopEdge = iter->edge;
1600 prevStopPos = iter->pars.endPos;
1604 int index = stopPar.
index;
1606 prevStopEdge = iter->edge;
1607 prevStopPos = iter->pars.endPos;
1611#ifdef DEBUG_ADD_STOP
1613 std::cout <<
" (@fit) prevStopEdge=" << (*prevStopEdge)->getID() <<
" index=" << (int)(prevStopEdge -
myRoute->begin()) <<
"\n";
1616 stop.
edge = std::find(prevStopEdge,
myRoute->end(), stopEdge);
1619 const bool wasTooClose = errorMsg !=
"" && errorMsg.find(
"too close") != std::string::npos;
1622 errorMsg = errorMsgStart +
" for vehicle '" +
myParameter->
id +
"' on lane '" + stop.
lane->
getID() +
"' is not downstream the current route.";
1627 const bool tooClose = (prevStopEdge == stop.
edge && prevEdge == &stop.
lane->
getEdge() &&
1630 if (prevStopEdge > stop.
edge ||
1637 if (tooClose && prevStopPos <= stop.
pars.
endPos + POSITION_EPS) {
1638 errorMsg = errorMsgStart +
" for vehicle '" +
myParameter->
id +
"' on lane '" + stop.
pars.
lane +
"' is too close to brake.";
1641 return addStop(stopPar, errorMsg, untilOffset, &next);
1655 pos += (*myCurrEdge)->getLength();
1665 return addStop(stopPar, errorMsg, untilOffset, &next);
1667 errorMsg = errorMsgStart +
" for vehicle '" +
myParameter->
id +
"' on lane '" + stop.
lane->
getID() +
"' is before departPos.";
1671 if (iter !=
myStops.begin()) {
1672 std::list<MSStop>::iterator iter2 = iter;
1678 +
" earlier than previous stop at " +
time2string(iter2->getUntil()) +
".";
1683 +
" earlier than previous stop end at " +
time2string(iter2->getUntil()) +
".";
1688 +
" earlier than previous stop arrival at " +
time2string(iter2->pars.arrival) +
".";
1705 if (stopPar.
tripId !=
"") {
1708#ifdef DEBUG_ADD_STOP
1710 std::cout <<
" added stop " << errorMsgStart <<
" totalStops=" <<
myStops.size()
1711 <<
" routeIndex=" << (stop.
edge -
myRoute->begin())
1712 <<
" stopIndex=" << std::distance(
myStops.begin(), iter)
1730 if (prevActiveStops > 0) {
1731 assert((
int)
myStops.size() >= prevActiveStops);
1732 auto prevStopIt =
myStops.begin();
1733 std::advance(prevStopIt, prevActiveStops - 1);
1734 const MSStop& prev = *prevStopIt;
1749 while (itPrev < stop.
edge) {
1750 if (*itPrev == *stop.
edge) {
1751 stop.
skips.push_back((
int)(itPrev -
myRoute->begin()));
1756 if (!stop.
skips.empty()) {
1764 newIndex = (int)
myPastStops.size() + prevActiveStops + (int)stop.
skips.size();
1775 if (rem->first->notifyReroute(*
this)) {
1777 if (myTraceMoveReminders) {
1778 traceMoveReminder(
"notifyReroute", rem->first, rem->second,
true);
1784 if (myTraceMoveReminders) {
1785 traceMoveReminder(
"notifyReroute", rem->first, rem->second,
false);
1799 if (addRouteStops) {
1801 std::string errorMsg;
1805 if (errorMsg !=
"") {
1812 std::string errorMsg;
1813 if (!
addStop(stop, errorMsg, untilOffset, searchStart) && !ignoreStopErrors) {
1816 if (errorMsg !=
"") {
1830 if (stop.lane->isInternal()) {
1833 it = std::find(start,
myRoute->end(), stop.lane->getEdge().getNormalBefore());
1835 it + 1 ==
myRoute->end() || *(it + 1) != stop.lane->getEdge().getNormalSuccessor())) {
1839 it = std::find(start,
myRoute->end(), &stop.lane->getEdge());
1843 WRITE_ERRORF(
"Stop % on edge '%' is not found after edge '%' (% after current) for vehicle '%' at time=%.",
1850 if (it2 == stop.edge) {
1856 WRITE_ERRORF(
"Stop % on edge '%' used invalid route index for vehicle '%' at time=%.",
1860 }
else if (it2 < start) {
1862 WRITE_ERRORF(
"Stop % on edge '%' used invalid (relative) route index % expected after % for vehicle '%' at time=%.",
1876std::vector<MSBaseVehicle::StopEdgeInfo>
1879 std::vector<StopEdgeInfo> result;
1880 const MSStop* prev =
nullptr;
1881 const MSEdge* internalSuccessor =
nullptr;
1884 if (stop.pars.jump >= 0) {
1885 jumps.insert((
int)result.size());
1889 double stopPos = stop.getEndPos(*
this);
1890 if ((prev ==
nullptr
1891 || prev->
edge != stop.edge
1892 || (prev->
lane == stop.lane && prev->
getEndPos(*
this) > stopPos))
1893 && *stop.edge != internalSuccessor) {
1894 if (stop.lane->isInternal()) {
1897 result.push_back(
StopEdgeInfo(*stop.edge, stop.pars.priority, stop.getArrivalFallback(), stopPos));
1898 result.back().nameTag = stop.getStoppingPlaceName();
1899 result.back().stopPar = &stop.pars;
1900 if (stop.lane->isInternal()) {
1901 internalSuccessor = stop.lane->getNextNormal();
1902 result.push_back(
StopEdgeInfo(internalSuccessor, stop.pars.priority, stop.getArrivalFallback(), 0));
1904 internalSuccessor =
nullptr;
1906 }
else if (prev !=
nullptr && prev->
edge == stop.edge) {
1907 result.back().priority =
addStopPriority(result.back().priority, stop.pars.priority);
1911 if (stop.parkingarea !=
nullptr) {
1912 firstPos =
MAX2(0., stopPos);
1918 if (stop.pars.jump >= 0) {
1919 jumps.insert((
int)result.size() - 1);
1932 if (p1 < 0 || p2 < 0) {
1938std::vector<std::pair<int, double> >
1940 std::vector<std::pair<int, double> > result;
1941 for (std::list<MSStop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1942 result.push_back(std::make_pair(
1943 (
int)(iter->edge -
myRoute->begin()),
1944 iter->getEndPos(*
this)));
1965 return myStops.front().duration;
1974 if (nextStopIndex < 0 || (
int)
myStops.size() <= nextStopIndex) {
1977 auto stopIt =
myStops.begin();
1978 std::advance(stopIt, nextStopIndex);
1995 for (std::list<MSStop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
1996 if (iter->lane->getID() == stop.
lane && fabs(iter->pars.endPos - stop.
endPos) < POSITION_EPS) {
1998 if (stop.
duration == 0 && stop.
until < 0 && !iter->reached) {
2010 const bool result =
addStop(stop, errorMsg);
2031 if (nextStopIndex == 0 &&
isStopped()) {
2034 auto stopIt =
myStops.begin();
2035 std::advance(stopIt, nextStopIndex);
2036 if (stopIt->parkingarea !=
nullptr && stopIt->parkingarea->isReservable()) {
2037 stopIt->parkingarea->removeSpaceReservation(
this);
2044 std::advance(stopIt2, nextStopIndex);
2056 const int n = (int)
myStops.size();
2057 if (nextStopIndex < 0 || nextStopIndex >= n) {
2058 errorMsg =
TLF(
"invalid nextStopIndex % for % remaining stops", nextStopIndex, n);
2061 if (nextStopIndex == 0 &&
isStopped()) {
2062 errorMsg =
TL(
"cannot replace reached stop");
2069 auto itStop =
myStops.begin();
2070 std::advance(itStop, nextStopIndex);
2071 MSStop& replacedStop = *itStop;
2076 if (pa !=
nullptr && !pa->
accepts(
this)) {
2077 errorMsg =
TLF(
"vehicle '%' does not have the right badge to access parkingArea '%'",
getID(), stop.
parkingarea);
2090 errorMsg =
TLF(
"disallowed stop lane '%'", stopLane->
getID());
2098 double startPos = nextStopIndex == 0 ?
getPositionOnLane() : stops[nextStopIndex - 1].pars.endPos;
2099 MSRouteIterator itEnd = nextStopIndex == n - 1 ? oldEdges.end() - 1 : stops[nextStopIndex + 1].edge;
2100 auto endPos = nextStopIndex == n - 1 ?
getArrivalPos() : stops[nextStopIndex + 1].pars.endPos;
2103 bool newDestination = nextStopIndex == n - 1 && stops[nextStopIndex].edge == oldEdges.end() - 1;
2107 router.
compute(*itStart, startPos, stopEdge, stop.
endPos,
this, t, toNewStop,
true);
2108 if (toNewStop.size() == 0) {
2109 errorMsg =
TLF(
"no route found from edge '%' to stop edge '%'", (*itStart)->getID(), stopEdge->
getID());
2115 if (!newDestination) {
2116 router.
compute(stopEdge, stop.
endPos, *itEnd, endPos,
this, t, fromNewStop,
true);
2117 if (fromNewStop.size() == 0) {
2118 errorMsg =
TLF(
"no route found from stop edge '%' to edge '%'", stopEdge->
getID(), (*itEnd)->getID());
2127 replacedStop.
lane = stopLane;
2131 errorMsg =
TLF(
"Mesoscopic simulation does not allow stopping on internal edge '%' for vehicle '%'.", stop.
edge,
getID());
2138 newEdges.insert(newEdges.end(),
myCurrEdge, itStart);
2140 newEdges.insert(newEdges.end(), toNewStop.begin(), toNewStop.end() - 1);
2142 newEdges.push_back(*itStart);
2144 if (!newDestination) {
2145 newEdges.insert(newEdges.end(), fromNewStop.begin(), fromNewStop.end() - 1);
2146 newEdges.insert(newEdges.end(), itEnd, oldEdges.end());
2148 newEdges.push_back(stopEdge);
2159 const double routeCost = router.
recomputeCosts(newEdges,
this, t);
2160 const double previousCost = router.
recomputeCosts(oldRemainingEdges,
this, t);
2161 const double savings = previousCost - routeCost;
2170 if (!
insertJump(nextStopIndex, itStart, errorMsg)) {
2180 const int n = (int)
myStops.size();
2181 if (nextStopIndex < 0 || nextStopIndex > n) {
2182 errorMsg =
TLF(
"invalid nextStopIndex % for % remaining stops", nextStopIndex, n);
2185 if (nextStopIndex == 0 &&
isStopped()) {
2186 errorMsg =
TL(
"cannot reroute towards reached stop");
2195 double startPos = nextStopIndex == 0 ?
getPositionOnLane() : stops[nextStopIndex - 1].pars.endPos;
2196 MSRouteIterator itEnd = nextStopIndex == n ? oldEdges.end() - 1 : stops[nextStopIndex].edge;
2197 auto endPos = nextStopIndex == n ?
getArrivalPos() : stops[nextStopIndex].pars.endPos;
2202 router.
compute(*itStart, startPos, *itEnd, endPos,
this, t, newBetween,
true);
2203 if (newBetween.size() == 0) {
2204 errorMsg =
TLF(
"no route found from edge '%' to stop edge '%'", (*itStart)->getID(), (*itEnd)->getID());
2211 newEdges.insert(newEdges.end(),
myCurrEdge, itStart);
2213 newEdges.insert(newEdges.end(), newBetween.begin(), newBetween.end() - 1);
2215 newEdges.push_back(*itStart);
2217 newEdges.insert(newEdges.end(), itEnd, oldEdges.end());
2225 const double routeCost = router.
recomputeCosts(newEdges,
this, t);
2226 const double previousCost = router.
recomputeCosts(oldRemainingEdges,
this, t);
2227 const double savings = previousCost - routeCost;
2233 if (!
insertJump(nextStopIndex, itStart, errorMsg)) {
2243 bool needJump =
true;
2244 if (nextStopIndex > 0) {
2245 auto itPriorStop =
myStops.begin();
2246 std::advance(itPriorStop, nextStopIndex - 1);
2247 const MSStop& priorStop = *itPriorStop;
2254 jumpStopPars.
endPos = (*itStart)->getLength();
2255 jumpStopPars.
speed = 1000;
2256 jumpStopPars.
jump = 0;
2257 jumpStopPars.
edge = (*itStart)->getID();
2259 MSLane* jumpStopLane =
nullptr;
2260 for (
MSLane* cand : (*itStart)->getLanes()) {
2261 if (cand->allowsVehicleClass(
getVClass())) {
2262 jumpStopLane = cand;
2266 if (jumpStopLane ==
nullptr) {
2267 errorMsg =
TL(
"unable to replace stop with teleporting");
2270 auto itStop =
myStops.begin();
2271 std::advance(itStop, nextStopIndex);
2272 MSStop jumpStop(jumpStopPars);
2274 jumpStop.
lane = jumpStopLane;
2276 myStops.insert(itStop, jumpStop);
2289 const int n = (int)
myStops.size();
2290 if (nextStopIndex < 0 || nextStopIndex > n) {
2291 errorMsg =
TLF(
"invalid nextStopIndex % for % remaining stops", nextStopIndex, n);
2294 if (nextStopIndex == 0 &&
isStopped()) {
2295 errorMsg =
TL(
"cannot insert stop before the currently reached stop");
2303 errorMsg =
TLF(
"disallowed stop lane '%'", stopLane->
getID());
2310 if (pa !=
nullptr && !pa->
accepts(
this)) {
2311 errorMsg =
TLF(
"Vehicle '%' does not have the right badge to access parkingArea '%'.",
getID(), stop.
parkingarea);
2321 double startPos = nextStopIndex == 0 ?
getPositionOnLane() : stops[nextStopIndex - 1].pars.endPos;
2322 MSRouteIterator itEnd = nextStopIndex == n ? oldEdges.end() - 1 : stops[nextStopIndex].edge;
2323 auto endPos = nextStopIndex == n ?
getArrivalPos() : stops[nextStopIndex].pars.endPos;
2326 const bool newDestination = nextStopIndex == n && stopEdge == oldEdges.back();
2327 const bool needLoop = nextStopIndex > 0 && *itStart == stopEdge && startPos >= stop.
endPos;
2328 if (needLoop && startPos == stop.
endPos) {
2330 startPos += POSITION_EPS;
2338 const bool onRoute = std::find(onRouteStart, itSentintel, stopEdge) != itSentintel;
2345 const bool ok =
addStop(stop, errorMsg, 0, &onRouteStart);
2354 router.
compute(*itStart, startPos, stopEdge, stop.
endPos,
this, t, toNewStop,
true);
2355 if (toNewStop.size() == 0) {
2356 errorMsg =
TLF(
"no route found from edge '%' to stop edge '%'", (*itStart)->getID(), stopEdge->
getID());
2362 if (!newDestination) {
2363 router.
compute(stopEdge, stop.
endPos, *itEnd, endPos,
this, t, fromNewStop,
true);
2364 if (fromNewStop.size() == 0) {
2365 errorMsg =
TLF(
"no route found from stop edge '%' to edge '%'", stopEdge->
getID(), (*itEnd)->getID());
2370 auto itStop =
myStops.begin();
2371 std::advance(itStop, nextStopIndex);
2375 newStop.
lane = stopLane;
2379 errorMsg =
TLF(
"Mesoscopic simulation does not allow stopping on internal edge '%' for vehicle '%'.", stop.
edge,
getID());
2383 myStops.insert(itStop, newStop);
2387 newEdges.insert(newEdges.end(),
myCurrEdge, itStart);
2389 newEdges.insert(newEdges.end(), toNewStop.begin(), toNewStop.end() - 1);
2391 newEdges.push_back(*itStart);
2393 if (!newDestination) {
2394 newEdges.insert(newEdges.end(), fromNewStop.begin(), fromNewStop.end() - 1);
2395 newEdges.insert(newEdges.end(), itEnd, oldEdges.end());
2397 newEdges.push_back(stopEdge);
2408 const double routeCost = router.
recomputeCosts(newEdges,
this, t);
2409 const double previousCost = router.
recomputeCosts(oldRemainingEdges,
this, t);
2410 const double savings = previousCost - routeCost;
2428 tMass += t->getVehicleType().getMass();
2433 tMass += t->getVehicleType().getMass();
2548 int leavingPersonNumber = 0;
2549 const std::vector<MSTransportable*>& persons =
getPersons();
2550 for (std::vector<MSTransportable*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) {
2555 leavingPersonNumber++;
2558 return leavingPersonNumber;
2561std::vector<std::string>
2563 std::vector<std::string> ret;
2564 const std::vector<MSTransportable*>& persons =
getPersons();
2565 for (std::vector<MSTransportable*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) {
2566 ret.push_back((*it_p)->getID());
2601const std::vector<MSTransportable*>&
2611const std::vector<MSTransportable*>&
2628 if (stop.startPos <= position && position <= stop.endPos) {
2633 if (stop.startPos <= position && position <= stop.endPos) {
2644 if (dev->deviceName() == deviceName) {
2655 if (deviceName ==
"rerouting") {
2661 assert(routingDevice != 0);
2665 throw InvalidArgument(
TLF(
"creating device of type '%' is not supported", deviceName));
2674 if (dev->deviceName() == deviceName) {
2675 return dev->getParameter(key);
2685 if (dev->deviceName() == deviceName) {
2686 dev->setParameter(key, value);
2717 const std::string attrName = key.substr(15);
2739 const std::string routingModeStr =
getStringParam(
"device.rerouting.mode");
2753 throw ProcessError(
TLF(
"could not interpret routing.mode '%'", routingModeStr));
2770 assert(type !=
nullptr);
2812 if (lane ==
nullptr) {
2823 if (lane ==
nullptr) {
2835 if (tok.
size() < 3) {
2836 error =
TLF(
"Invalid device parameter '%' for vehicle '%'.", key,
getID());
2842 error =
TLF(
"Vehicle '%' does not support device parameter '%' (%).",
getID(), key, e.what());
2846 if (microVeh ==
nullptr) {
2847 error =
TLF(
"Mesoscopic vehicle '%' does not support laneChangeModel parameters.",
getID());
2850 const std::string attrName = key.substr(16);
2854 error =
TLF(
"Vehicle '%' does not support laneChangeModel parameter '%' (%).",
getID(), key, e.what());
2858 if (microVeh ==
nullptr) {
2859 error =
TLF(
"Mesoscopic vehicle '%' does not support carFollowModel parameters.",
getID());
2862 const std::string attrName = key.substr(15);
2866 error =
TLF(
"Vehicle '%' does not support carFollowModel parameter '%' (%).",
getID(), key, e.what());
2871 if (tok.
size() != 3) {
2872 error =
TL(
"Invalid check for device. Expected format is 'has.DEVICENAME.device'.");
2877 }
else if (key ==
"parking.rerouteCount") {
2880 std::vector<std::string> values;
2882 if (key ==
"parking.memory.IDList") {
2884 values.push_back(item.first->getID());
2886 }
else if (key ==
"parking.memory.score") {
2888 values.push_back(item.second.score);
2890 }
else if (key ==
"parking.memory.blockedAtTime") {
2894 }
else if (key ==
"parking.memory.blockedAtTimeLocal") {
2899 error =
TLF(
"Unsupported parking parameter '%' for vehicle '%'.", key,
getID());
2981 if (
hasStops() &&
myStops.front().parkingarea !=
nullptr &&
myStops.front().parkingarea->isReservable()) {
2982 myStops.front().parkingarea->removeSpaceReservation(
this);
2989MSBaseVehicle::initMoveReminderOutput(
const OptionsCont& oc) {
2990 if (oc.
isSet(
"movereminder-output.vehicles")) {
2991 const std::vector<std::string> vehicles = oc.
getStringVector(
"movereminder-output.vehicles");
2992 myShallTraceMoveReminders.insert(vehicles.begin(), vehicles.end());
2998MSBaseVehicle::traceMoveReminder(
const std::string& type,
MSMoveReminder* rem,
double pos,
bool keep)
const {
std::vector< const MSEdge * > ConstMSEdgeVector
ConstMSEdgeVector::const_iterator MSRouteIterator
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
std::shared_ptr< const MSRoute > ConstMSRoutePtr
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
constexpr SUMOTime TIME2STEPS(double x)
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a (exclusive) railway edge.
@ RANDOM
The edge is chosen randomly.
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const long long int VEHPARS_FORCE_REROUTE
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ GIVEN
The speed is given.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ BASE
Back-at-zero position.
const long long int VEHPARS_CFMODEL_PARAMS_SET
@ RANDOM
The lane is chosen randomly.
@ GIVEN
The arrival lane is given.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
std::vector< SUMOVehicleParameter::Stop > StopParVector
@ GIVEN
The speed is given.
const int STOP_INDEX_REPEAT
const long long int VEHPARS_PARKING_BADGES_SET
const long long int VEHPARS_JUNCTIONMODEL_PARAMS_SET
const long long int VEHPARS_SPEEDFACTOR_SET
@ RANDOM
The arrival position is chosen randomly.
@ GIVEN
The arrival position is given.
@ CENTER
Half the road length.
const long long int VEHPARS_LINE_SET
const long long int VEHPARS_INSERTION_CHECKS_SET
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_VEHICLE
description of a vehicle
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_ATTR_CF_IGNORE_IDS
@ SUMO_ATTR_JM_IGNORE_IDS
@ SUMO_ATTR_JM_IGNORE_TYPES
@ SUMO_ATTR_CF_IGNORE_TYPES
@ SUMO_ATTR_ARRIVALPOS_RANDOMIZED
@ SUMO_ATTR_TIME
trigger: the time of the step
double gWeightsRandomFactor
const double INVALID_DOUBLE
invalid double
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double getMax() const
Returns the maximum value of this distribution.
double getMin() const
Returns the minimum value of this distribution.
double getParameter(const int index) const
Returns the nth parameter of this distribution.
An upper class for objects with additional parameters.
double getTransportableMass() const
Returns the mass of all transportables in the vehicle.
void setSecondary(const EnergyParams *secondaryParams)
Set secondary params.
void setTransportableMass(const double mass)
Sets the mass of all transportables in the vehicle.
static double computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key
BaseInfluencer()
Constructor.
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and technical maximum speed)
bool haveValidStopEdges(bool silent=false) const
check whether all stop.edge MSRouteIterators are valid and in order
int myRoutingMode
routing mode (see TraCIConstants.h)
bool hasJump(const MSRouteIterator &it) const
check whether the vehicle has jump at the given part of its route
bool hasReminder(MSMoveReminder *rem) const
Checks whether the vehicle has the given MoveReminder.
static double addStopPriority(double p1, double p2)
std::list< MSStop > myStops
The vehicle's list of stops.
StoppingPlaceMemory * myParkingMemory
memory for parking search
double getImpatience() const
Returns this vehicles impatience.
void setSkips(MSStop &stop, int prevActiveStops)
patch stop.pars.index to record the number of skipped candidate edges before stop....
virtual ConstMSEdgeVector::const_iterator getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const StoppingPlaceMemory * getParkingMemory() const
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
virtual void initDevices()
void rememberParkingAreaScore(const MSStoppingPlace *pa, const std::string &score)
score only needed when running with gui
const long long int myRandomSeed
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
int getDepartEdge() const
Returns the edge on which this vehicle shall depart.
void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure)
reset index of edge within route
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
StoppingPlaceMemory * myChargingMemory
bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
int getLeavingPersonNumber() const
Returns the number of leaving persons.
MSBaseVehicle(SUMOVehicleParameter *pars, ConstMSRoutePtr route, MSVehicleType *type, const double speedFactor)
Constructor.
void calculateArrivalParams(bool onInit)
(Re-)Calculates the arrival position and lane from the vehicle parameters
virtual double getArrivalPos() const
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
void setCarFollowModelParameter(const std::string &key, const std::string &value)
set individual carFollow model parameters (not type related)
void setRoutingMode(int value)
Sets routing behavior.
void resetParkingAreaScores()
static NumericalID myCurrentNumericalIndex
bool rerouteBetweenStops(int nextStopIndex, const std::string &info, bool teleport, std::string &errorMsg)
MoveReminderCont myMoveReminders
Currently relevant move reminders.
void rememberChargingStationScore(const MSStoppingPlace *cs, const std::string &score)
int getInsertionChecks() const
double myDepartPos
The real depart position.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
double getMaxChargeRate() const
Returns the maximum charge rate allowed by the battery in the current time step (W)
void replaceParameter(const SUMOVehicleParameter *newParameter)
replace the vehicle parameter (deleting the old one)
void rememberBlockedParkingArea(const MSStoppingPlace *pa, bool local)
int getNumberParkingReroutes() const
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
virtual const MSEdge * getCurrentEdge() const
Returns the edge the vehicle is currently at (possibly an internal edge)
double getPreviousSpeed() const
Returns the vehicle's previous speed.
void removeTransportableMass(MSTransportable *t)
removes a person or containers mass
MSStop & getNextStopMutable()
virtual void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
virtual void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
virtual BaseInfluencer & getBaseInfluencer()=0
Returns the velocity/lane influencer.
const SUMOVehicleParameter::Stop * getNextStopParameter() const
return parameters for the next stop (SUMOVehicle Interface)
void rememberBlockedChargingStation(const MSStoppingPlace *cs, bool local)
virtual bool replaceRoute(ConstMSRoutePtr route, const std::string &info, bool onInit=false, int offset=0, bool addRouteStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
SUMOTime activateRemindersOnReroute(SUMOTime currentTime)
remove outdated driveways on reroute
int getNumRemainingEdges() const
return the number of edges remaining in the route (include the current)
double getOdometer() const
Returns the distance that was already driven by this vehicle.
virtual bool hasArrived() const
Returns whether this vehicle has already arrived (by default this is true if the vehicle has reached ...
const NumericalID myNumericalID
bool isStoppedInRange(const double pos, const double tolerance, bool checkFuture=false) const
return whether the given position is within range of the current stop
bool isJumping() const
Returns whether the vehicle is perform a jump.
void checkRouteRemoval()
remove route at the end of the simulation
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
const MSVehicleType * myType
This vehicle's type.
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
bool isStoppedParking() const
Returns whether the vehicle is on a parking stop.
void unregisterWaiting()
mark vehicle as active
bool hasValidRoute(std::string &msg, ConstMSRoutePtr route=0) const
Validates the current or given route.
void cleanupParkingReservation()
unregisters from a parking reservation when changing or skipping stops
double getLength() const
Returns the vehicle's length.
bool isParking() const
Returns whether the vehicle is parking.
MSParkingArea * getCurrentParkingArea()
get the current parking area stop or nullptr
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
int getPersonNumber() const
Returns the number of persons.
double getRelativeStateOfCharge() const
Returns actual relative state of charge of battery (-)
void setJunctionModelParameter(const std::string &key, const std::string &value)
set individual junction model parameter (not type related)
void setDepartAndArrivalEdge()
apply departEdge and arrivalEdge attributes
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for vehicles)
MSRouteIterator myCurrEdge
Iterator to current route-edge.
static MSLane * interpretOppositeStop(SUMOVehicleParameter::Stop &stop)
interpret stop lane on opposite side of the road
StopParVector myPastStops
The list of stops that the vehicle has already reached.
static std::vector< MSTransportable * > myEmptyTransportableVector
const std::vector< std::string > & getParkingBadges() const
get the valid parking access rights (vehicle settings override vehicle type settings)
bool hasDeparted() const
Returns whether this vehicle has already departed.
bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
virtual void resetApproachOnReroute()
reset rail signal approach information
ConstMSRoutePtr myRoute
This vehicle's route.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
void resetChargingStationScores()
bool allowsBoarding(const MSTransportable *t) const
whether the given transportable is allowed to board this vehicle
double getStateOfCharge() const
Returns actual state of charge of battery (Wh) RICE_CHECK: This may be a misnomer,...
MSEdgeWeightsStorage & _getWeightsStorage() const
virtual bool handleCollisionStop(MSStop &stop, const double distToStop)
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equipped with a device of the given name
void addReminder(MSMoveReminder *rem, double pos=0)
Adds a MoveReminder dynamically.
SUMOTime getDeparture() const
Returns this vehicle's real departure time.
SUMOTime sawBlockedChargingStation(const MSStoppingPlace *cs, bool local) const
EnergyParams * getEmissionParameters() const
retrieve parameters for the energy consumption model
double basePos(const MSEdge *edge) const
departure position where the vehicle fits fully onto the edge (if possible)
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
std::string getFlowID() const
reconstruct flow id from vehicle id
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
bool isLineStop(double position) const
returns whether the vehicle serves a public transport line that serves the given stop
double myChosenSpeedFactor
A precomputed factor by which the driver wants to be faster than the speed limit.
const MSStop & getNextStop() const
@ ROUTE_INVALID
route was checked and is valid
@ ROUTE_START_INVALID_LANE
@ ROUTE_START_INVALID_PERMISSIONS
std::string getPrefixedParameter(const std::string &key, std::string &error) const
retrieve parameters of devices, models and the vehicle itself
bool replaceWithAlternative(std::list< MSStop >::iterator iter, const MSRouteIterator searchStart, const MSRouteIterator end)
replace stop with a same-name alternative that is on the route and return success
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr, bool addRouteStops=true)
Adds stops to the built vehicle.
void removeTransportable(MSTransportable *t)
removes a person or container
SUMOTime sawBlockedParkingArea(const MSStoppingPlace *pa, bool local) const
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
MSParkingArea * getNextParkingArea()
get the upcoming parking area stop or nullptr
int myArrivalLane
The destination lane where the vehicle stops.
int getRouteValidity(bool update=true, bool silent=false, std::string *msgReturn=nullptr)
check for route validity at first insertion attempt
MSStop & getStop(int nextStopIndex)
virtual ~MSBaseVehicle()
Destructor.
bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
virtual bool instantStopping() const
whether instant stopping is permitted
SUMOTime myDeparture
The real departure time.
std::vector< std::string > getPersonIDList() const
Returns the list of persons.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
virtual bool resumeFromStopping()=0
virtual bool hasInfluencer() const =0
whether the vehicle is individually influenced (via TraCI or special parameters)
const std::set< SUMOTrafficObject::NumericalID > getUpcomingEdgeIDs() const
returns the numerical ids of edges to travel
void initTransportableDevice(bool isPerson)
init device during state loading
bool stopsAtEdge(const MSEdge *edge) const
Returns whether the vehicle stops at the given edge.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, MSRouteIterator *searchStart=nullptr)
Adds a stop.
double getChargedEnergy() const
Returns the energy charged to the battery in the current time step (Wh)
void onDepart()
Called when the vehicle is inserted into the network.
void removeReminder(MSMoveReminder *rem)
Removes a MoveReminder dynamically.
SUMOTime getStopDuration() const
get remaining stop duration or 0 if the vehicle isn't stopped
virtual double getAcceleration() const
Returns the vehicle's acceleration.
virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
const MSRoute & getRoute() const
Returns the current route.
int getRoutingMode() const
return routing mode (configures router choice but also handling of transient permission changes)
int getRoutePosition() const
return index of edge within route
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
static const SUMOTime NOT_YET_DEPARTED
SUMOTime getDepartDelay() const
Returns the depart delay.
double getElecHybridCurrent() const
Returns actual current (A) of ElecHybrid device RICE_CHECK: Is this the current consumed from the ove...
bool myAmRegisteredAsWaiting
Whether this vehicle is registered as waiting for a person or container (for deadlock-recognition)
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
returns the router according to the current routing mode of the vehicle
EnergyParams * myEnergyParams
The emission parameters this vehicle may have.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
virtual bool hasValidRouteStart(std::string &msg)
checks whether the vehicle can depart on the first edge
int myRouteValidity
status of the current vehicle route
std::vector< std::pair< int, double > > getStopIndices() const
return list of route indices for the remaining stops
SUMOTime myStopUntilOffset
The offset when adding route stops with 'until' on route replacement.
virtual bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
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.
bool stopsAt(MSStoppingPlace *stop) const
Returns whether the vehicle stops at the given stopping place.
MSEdgeWeightsStorage * myEdgeWeights
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void createDevice(const std::string &deviceName)
create device of the given type
bool isStopped() const
Returns whether the vehicle is at a stop.
MSDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists, nullptr otherwise.
bool abortNextStop(int nextStopIndex=0)
deletes the next stop at the given index if it exists
int myNumberReroutes
The number of reroutings.
double myArrivalPos
The position on the destination lane where the vehicle stops.
bool insertJump(int nextStopIndex, MSRouteIterator itStart, std::string &errorMsg)
helper function
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
virtual void replaceVehicleType(const MSVehicleType *type)
Replaces the current vehicle type by the one given.
std::vector< StopEdgeInfo > getStopEdges(double &firstPos, double &lastPos, std::set< int > &jumps) const
Returns the list of still pending stop edges also returns the first and last stop position.
double myOdometer
A simple odometer to keep track of the length of the route already driven.
void initTransientModelParams()
init model parameters from generic params
int getContainerNumber() const
Returns the number of containers.
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)
Replaces the current route by the given edges.
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
Battery device for electric vehicles.
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in Wh.
double getMaximumChargeRate() const
Get current charge rate in W depending on the state of charge.
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in Wh.
double getEnergyCharged() const
Get charged energy.
A device which collects info on the vehicle trip (mainly on departure and arrival)
double getMaximumBatteryCapacity() const
Get the total vehicle's Battery Capacity in kWh.
double getCurrentFromOverheadWire() const
Get actual current in the overhead wire segment.
double getEnergyCharged() const
Get charged energy.
double getActualBatteryCapacity() const
Get the actual vehicle's Battery Capacity in kWh.
A device that performs vehicle rerouting based on current edge speeds.
bool sufficientSaving(double oldCost, double newCost)
whether the change in saving is enough to trigger rerouting
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Computes a new route on vehicle insertion.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
A device which collects info on the vehicle trip (mainly on departure and arrival)
bool allowsBoarding(const MSTransportable *t) const
whether the given person is allowed to board this taxi
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
static bool willTransferAtJoin(const MSTransportable *t, const MSBaseVehicle *joinVeh)
check if boardingDuration should be applied
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into, const bool isContainer)
Build devices for the given vehicle, if needed.
int size() const
Return the number of passengers / containers.
void addTransportable(MSTransportable *transportable)
Add a passenger.
void removeTransportable(MSTransportable *transportable)
Remove a passenger (TraCI)
Abstract in-vehicle / in-person device.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
A road/street connecting two junctions.
static void clear()
Clears the dictionary.
bool hasTransientPermissions() const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSEdge * getOppositeEdge() const
Returns the opposite direction edge if on exists else a nullptr.
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.
bool isNormal() const
return whether this edge is an internal edge
bool isTazConnector() const
bool isInternal() const
return whether this edge is an internal edge
bool prohibits(const SUMOVehicle *const vehicle) const
Returns whether the vehicle (class) is not allowed on the edge.
double getMinLength() const
return the minimum length of all lanes (only differs from getLength for curved internal lanes)
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
MSLane * getFirstAllowed(SUMOVehicleClass vClass, bool defaultFirst=false, int routingMode=0) const
A storage for edge travel times and efforts.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
static int gInsertionChecks
The default value for insertion checks.
static SUMOTime gTimeToImpatience
static bool gHaveEmissions
Whether emission output of some type is needed (files or GUI)
static bool gUseStopEnded
whether the simulation should replay previous stop times
void descheduleDeparture(const SUMOVehicle *veh)
stops trying to emit the given vehicle (and delete it)
Representation of a lane in the micro simulation.
int getRNGIndex() const
returns the associated RNG index
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
double getLength() const
Returns the lane's length.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
SumoRNG * getRNG() const
return the associated RNG
MSEdge & getEdge() const
Returns the lane's edge.
Something on a lane to be noticed about vehicle movement.
virtual bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane)
Checks whether the reminder is activated by a vehicle entering the lane.
const std::string & getDescription() const
Notification
Definition of a vehicle state.
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
const MSLane * getLane() const
Returns the lane the reminder works on.
@ NEWROUTE
The vehicle got a new route.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
const std::vector< MSStoppingPlace * > & getStoppingPlaceAlternatives(const std::string &name, SumoXMLTag category) const
MSVehicleRouter & getRouterTT(int rngIndex, const Prohibitions &prohibited={}) const
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static bool hasInstance()
Returns whether the network was already constructed.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
A lane area vehicles can halt at.
bool accepts(SUMOVehicle *veh) const override
Return the parking accepts the vehicle (due to its given badges)
static void storeTripId(const std::string &tripId, const std::string &vehID)
static bool hasInstance()
const ConstMSEdgeVector & getEdges() const
void setCosts(double costs)
Sets the costs of the route.
static bool hasRoute(const std::string &id)
returns whether a route with the given id exists
static bool dictionary(const std::string &id, ConstMSRoutePtr route)
Adds a route to the dictionary.
static void checkDist(const std::string &id)
Checks the distribution whether it is permanent and deletes it if not.
void setSavings(double savings)
Sets the savings of the route.
static void initEdgeWeights(SUMOVehicleClass svc, SUMOTime lastAdaption=-1, int index=-1)
initialize the edge weights if not done before
static void initWeightUpdate(SUMOTime lastAdaption=- 1)
intialize period edge weight update
static MSVehicleRouter & getRouterTT(const int rngIndex, SUMOVehicleClass svc, const Prohibitions &prohibited={})
return the vehicle router instance
bool canLeaveVehicle(const MSTransportable *t, const SUMOVehicle &veh, const MSStop &stop)
checks whether the person may exit at the current vehicle position
const MSLane * lane
The lane to stop at (microsim only)
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
std::string getDescription(bool nameOnly=false) const
get a short description for showing in the gui
bool isOpposite
whether this an opposite-direction stop
void initPars(const SUMOVehicleParameter::Stop &stopPar)
initialize attributes from the given stop parameters
const MESegment * segment
The segment to stop at (mesosim only)
bool reached
Information whether the stop has been reached.
MSRouteIterator edge
The edge in the route to stop at.
std::vector< int > skips
route indices on looped route that were skipped before this stop (after pior stop or depart edge)
double getEndPos(const SUMOVehicle &veh) const
return halting position for upcoming stop;
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
SUMOTime getUntil() const
return until / ended time
SUMOTime getArrival() const
return arrival / started time
const SUMOVehicleParameter::Stop pars
The stop parameter.
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
MSStoppingPlace * overheadWireSegment
(Optional) overhead wire segment if one is assigned to the stop
Finds a sequence of skips and stop alternatives to maximize priority of reached stops.
ConstMSEdgeVector optimizeSkipped(const MSEdge *source, double sourcePos, std::vector< StopEdgeInfo > &stops, ConstMSEdgeVector edges) const
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getParkingLength() const
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.
bool isPerson() const override
Whether it is a person.
const MSVehicleType & getVehicleType() const override
Returns the object's "vehicle" type.
static const double DEFAULT_MAXDELAY
void vehicleDeparted(const SUMOVehicle &v)
Informs this control about a vehicle's departure.
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void removeVType(const MSVehicleType *vehType)
void unregisterOneWaiting()
decreases the count of vehicles waiting for a transport to allow recognition of person / container re...
Abstract in-vehicle device.
Representation of a vehicle in the micro simulation.
MSAbstractLaneChangeModel & getLaneChangeModel()
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
The car-following model and parameter.
const EnergyParams * getEmissionParameters() const
retrieve parameters for the energy consumption model
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
double getDesiredMaxSpeed() const
Returns the vehicles's desired maximum speed.
const std::string & getID() const
Returns the name of the vehicle type.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
double getLength() const
Get vehicle's length [m].
double getMass() const
Get this vehicle type's mass.
double computeChosenSpeedDeviation(double speedFactorOverride, SumoRNG *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
const std::vector< std::string > & getParkingBadges() const
Returns the parking access rights of this type.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
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
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
int getPrecision()
Returns the precision of the underlying stream.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
Utility functions for using a global, resetable random number generator.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
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...
virtual double recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
double recomputeCostsPos(const std::vector< const E * > &edges, const V *const v, double fromPos, double toPos, SUMOTime msTime, double *lengthp=nullptr) const
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.
long long int NumericalID
virtual double getSpeed() const =0
Returns the object's current speed.
virtual SUMOTime getWaitingTime(const bool accumulated=false) const =0
virtual bool isPerson() const
Whether it is a person.
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 double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
virtual bool isIdling() const =0
Returns whether the vehicle is idling (waiting to re-enter the net.
virtual double getBrakeGap(bool delayed=false) const =0
get distance for coming to a stop (used for rerouting checks)
Definition of vehicle stop (position and duration)
std::string edge
The edge to stop at.
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
double startPos
The stopping position start.
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
SUMOTime until
The time at which the vehicle may continue its journey.
bool triggered
whether an arriving person lets the vehicle continue
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
std::string tripId
id of the trip within a cyclical public transport route
bool containerTriggered
whether an arriving container lets the vehicle continue
bool collision
Whether this stop was triggered by a collision.
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
std::string vtypeid
The vehicle's type id.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
long long int repetitionsDone
The number of times the vehicle was already inserted.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
long long int repetitionNumber
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
double arrivalPos
(optional) The position the vehicle shall arrive on
std::string routeid
The vehicle's route id.
std::string id
The vehicle's id.
std::vector< std::string > parkingBadges
The parking access rights.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
int departEdge
(optional) The initial edge within the route of the vehicle
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string toTaz
The vehicle's destination zone (district)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
int insertionChecks
bitset of InsertionCheck
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
static int getIndexFromLane(const std::string laneID)
return lane index when given the lane ID
void resetStoppingPlaceScores()
SUMOTime sawBlockedStoppingPlace(const MSStoppingPlace *stoppingPlace, bool local) const
Get the time the StoppingPlace was confirmed to be blocked.
void rememberStoppingPlaceScore(const MSStoppingPlace *stoppingPlace, const std::string &score)
score only needed when running with gui
void rememberBlockedStoppingPlace(const MSStoppingPlace *stoppingPlace, bool local)
Store the time the StoppingPlace was confirmed to be blocked.
int size() const
returns the number of existing substrings
std::string get(int pos) const
returns the item at the given position
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
A wrapper for a Command function.
#define UNUSED_PARAMETER(x)
TRACI_CONST int ROUTING_MODE_AGGREGATED
TRACI_CONST int ROUTING_MODE_DEFAULT
TRACI_CONST int ROUTING_MODE_AGGREGATED_CUSTOM
TRACI_CONST int ROUTING_MODE_IGNORE_TRANSIENT_PERMISSIONS