91 #define DEBUG_COND (getID() == "disabled") 93 #define STOPPING_PLACE_OFFSET 0.5 95 #define CRLL_LOOK_AHEAD 5 98 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0 176 if (memorySpan == -1) {
181 if (i->second >= memorySpan) {
182 if (i->first >= memorySpan) {
185 totalWaitingTime += memorySpan - i->first;
188 totalWaitingTime += i->second - i->first;
191 return totalWaitingTime;
198 bool startNewInterval = i == end || (i->first != 0);
209 waitingIntervalList::iterator::difference_type d = std::distance(i, end);
217 }
else if (!startNewInterval) {
235 mySpeedAdaptationStarted(true),
236 myConsiderSafeVelocity(true),
237 myConsiderMaxAcceleration(true),
238 myConsiderMaxDeceleration(true),
239 myRespectJunctionPriority(true),
240 myEmergencyBrakeRedLight(true),
303 speed =
MIN2(speed, vSafe);
306 speed =
MIN2(speed, vMax);
309 speed =
MAX2(speed, vMin);
331 if (destinationLaneIndex < (
int)currentEdge.
getLanes().size()) {
332 if (currentLaneIndex > destinationLaneIndex) {
334 }
else if (currentLaneIndex < destinationLaneIndex) {
362 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
370 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
391 switch (changeRequest) {
460 const bool wasOnRoad = v->
isOnRoad();
557 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
558 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
562 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
567 "' is too high for the vehicle type '" + type->
getID() +
"'.");
578 (*i)->resetPartialOccupation(
this);
629 (newCurrEdge + 1) == edges.end() || (*(newCurrEdge + 1)) != &(
myLane->
getOutgoingLanes()[0]->getEdge()))) {
649 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
650 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
653 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
659 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
723 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second,
MAX2(0., newSpeed))) {
725 if (myTraceMoveReminders) {
726 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
732 if (myTraceMoveReminders) {
733 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
749 rem->second += oldLaneLength;
753 if (myTraceMoveReminders) {
754 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
787 if (
myStops.begin()->parkingarea != 0) {
788 return myStops.begin()->parkingarea->getVehiclePosition(*
this);
797 if (offset == 0. && !changingLanes) {
832 if (
myStops.begin()->parkingarea != 0) {
833 return myStops.begin()->parkingarea->getVehicleAngle(*
this);
854 double result = (p1 != p2 ? p2.
angleTo2D(p1) :
861 std::cout <<
SIMTIME <<
" computeAngle veh=" <<
getID() <<
" p1=" << p1 <<
" p2=" << p2 <<
" angle=" << result <<
"\n";
897 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
912 if (stop.
until != -1) {
913 stop.
until += untilOffset;
926 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
942 std::list<Stop>::iterator iter =
myStops.begin();
945 prevStopEdge =
myStops.back().edge;
946 prevStopPos =
myStops.back().endPos;
949 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
955 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
956 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
957 prevStopEdge = iter->edge;
958 prevStopPos = iter->endPos;
962 int index = stopPar.
index;
964 prevStopEdge = iter->edge;
965 prevStopPos = iter->endPos;
973 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos && !collision)) {
979 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
989 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
997 pos += (*myCurrEdge)->getLength();
1009 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
1013 if (iter !=
myStops.begin()) {
1014 std::list<Stop>::iterator iter2 = iter;
1016 if (stop.
until >= 0 && iter2->until > stop.
until) {
1022 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
1033 assert(parkingArea != 0);
1035 errorMsg =
"Vehicle '" +
myParameter->
id +
"' has no stops.";
1041 errorMsg =
"current stop already reached";
1045 errorMsg =
"current stop is not a parkingArea";
1049 errorMsg =
"current stop is the same as the new parking area";
1055 int removeStops = 0;
1058 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1059 if (duration == 0) {
1060 duration = iter->duration;
1063 if (iter->parkingarea != 0 && iter->parkingarea == parkingArea) {
1064 duration += iter->duration;
1088 while (removeStops > 0) {
1092 const bool result =
addStop(stopPar, errorMsg);
1110 return nextParkingArea;
1148 return currentVelocity;
1153 std::cout <<
"\nPROCESS_NEXT_STOP\n" <<
SIMTIME <<
" vehicle '" <<
getID() <<
"'" << std::endl;
1162 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' reached stop." << std::endl;
1176 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
1187 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for person." << std::endl;
1195 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
1206 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for container." << std::endl;
1214 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' resumes from stopping." << std::endl;
1221 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1229 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for person." << std::endl;
1235 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores container triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1243 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for container." << std::endl;
1262 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' hasn't reached next stop." << std::endl;
1269 double endPos = stop.
endPos;
1270 bool useStoppingPlace =
false;
1271 bool fitsOnStoppingPlace =
true;
1273 useStoppingPlace =
true;
1278 fitsOnStoppingPlace =
false;
1283 useStoppingPlace =
true;
1287 fitsOnStoppingPlace =
false;
1294 fitsOnStoppingPlace =
false;
1301 if (
myStops.empty() ||
myStops.front().parkingarea != oldParkingArea) {
1303 return currentVelocity;
1318 if (stop.
until >= 0) {
1348 return currentVelocity;
1355 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1356 result.push_back(*iter->edge);
1365 #ifdef DEBUG_PLAN_MOVE 1370 <<
" veh=" <<
getID()
1379 #ifdef DEBUG_PLAN_MOVE 1381 DriveItemVector::iterator i;
1384 <<
" vPass=" << (*i).myVLinkPass
1385 <<
" vWait=" << (*i).myVLinkWait
1386 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1387 <<
" request=" << (*i).mySetRequest
1393 #ifdef DEBUG_PLAN_MOVE 1395 std::cout <<
" after checkRewindLinkLanes\n";
1396 DriveItemVector::iterator i;
1399 <<
" vPass=" << (*i).myVLinkPass
1400 <<
" vWait=" << (*i).myVLinkWait
1401 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1402 <<
" request=" << (*i).mySetRequest
1403 <<
" atime=" << (*i).myArrivalTime
1404 <<
" atimeB=" << (*i).myArrivalTimeBraking
1415 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1432 double v =
MIN2(maxV, laneMaxV);
1444 #ifdef DEBUG_PLAN_MOVE 1446 std::cout <<
" bestLaneConts=" <<
toString(bestLaneConts) <<
"\n";
1449 assert(bestLaneConts.size() > 0);
1450 bool hadNonInternal =
false;
1452 double seenNonInternal = 0;
1456 bool slowedDownForMinor =
false;
1462 #pragma warning(push) 1463 #pragma warning(disable: 4127) // do not warn about constant conditional expression 1467 #pragma warning(pop) 1478 if (leader.first != 0 && leader.first->getLane() == leaderLane && leader.first->getLaneChangeModel().isOpposite()) {
1482 adaptToLeaders(ahead, 0, seen, lastLink, leaderLane, v, vLinkPass);
1483 #ifdef DEBUG_PLAN_MOVE 1485 std::cout <<
"\nv = " << v <<
"\n";
1493 if (shadowLane != 0) {
1497 seen, lastLink, shadowLane, v, vLinkPass);
1506 myStopDist = seen + endPos - lane->
getLength();
1508 if (lastLink != 0) {
1511 v =
MIN2(v, stopSpeed);
1514 #ifdef DEBUG_PLAN_MOVE 1516 std::cout <<
"\n" <<
SIMTIME <<
" next stop: distance = " << myStopDist <<
" requires stopSpeed = " << stopSpeed <<
"\n";
1526 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1535 if (lastLink != 0) {
1543 ((*link)->getViaLane() == 0
1553 if (lastLink != 0) {
1575 const double stopDist =
MAX2(0., seen - laneStopOffset);
1585 assert(timeRemaining != 0);
1588 #ifdef DEBUG_PLAN_MOVE 1589 if (
DEBUG_COND) std::cout <<
SIMTIME <<
" veh=" <<
getID() <<
" slowing down to finish continuous change before" 1590 <<
" link=" << (*link)->getViaLaneOrLane()->getID()
1591 <<
" timeRemaining=" << timeRemaining
1603 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1605 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1609 #ifdef DEBUG_PLAN_MOVE 1612 <<
" stopDist=" << stopDist
1613 <<
" vLinkWait=" << vLinkWait
1614 <<
" brakeDist=" << brakeDist
1626 checkLinkLeader(*link, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest);
1629 if (parallelLink != 0) {
1630 checkLinkLeader(parallelLink, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest);
1635 if (lastLink != 0) {
1638 double arrivalSpeed = vLinkPass;
1644 double visibilityDistance = (*link)->getFoeVisibilityDistance();
1645 double determinedFoePresence = seen < visibilityDistance;
1650 #ifdef DEBUG_PLAN_MOVE 1652 std::cout <<
" approaching link=" << (*link)->getViaLaneOrLane()->getID() <<
" prio=" << (*link)->havePriority() <<
" seen=" << seen <<
" visibilityDistance=" << visibilityDistance <<
" brakeDist=" << brakeDist <<
"\n";
1656 if (!(*link)->havePriority() && !determinedFoePresence && brakeDist < seen) {
1661 arrivalSpeed =
MIN2(vLinkPass, maxArrivalSpeed);
1662 slowedDownForMinor =
true;
1663 #ifdef DEBUG_PLAN_MOVE 1665 std::cout <<
" slowedDownForMinor maxArrivalSpeed=" << maxArrivalSpeed <<
" arrivalSpeed=" << arrivalSpeed <<
"\n";
1682 double arrivalSpeedBraking = 0;
1689 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1693 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1696 arrivalTime, arrivalSpeed,
1697 arrivalTimeBraking, arrivalSpeedBraking,
1700 if ((*link)->getViaLane() == 0) {
1701 hadNonInternal =
true;
1705 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1709 lane = (*link)->getViaLaneOrLane();
1718 leaderLane = opposite ? lane->
getOpposite() : lane;
1719 if (leaderLane == 0) {
1725 lastLink = &lfLinks.back();
1740 const MSLane*
const lane,
double& v,
double& vLinkPass)
const {
1743 ahead.
getSubLanes(
this, latOffset, rightmost, leftmost);
1744 #ifdef DEBUG_PLAN_MOVE 1746 <<
"\nADAPT_TO_LEADERS\nveh=" <<
getID()
1747 <<
" lane=" << lane->
getID()
1748 <<
" rm=" << rightmost
1749 <<
" lm=" << leftmost
1753 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
1758 const double gap = (lastLink == 0
1761 #ifdef DEBUG_PLAN_MOVE 1763 std::cout <<
" pred=" << pred->
getID() <<
" predLane=" << pred->
getLane()->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
" gap=" << gap <<
" predBack=" << predBack <<
" seen=" << seen <<
" lane=" << lane->
getID() <<
" myLane=" <<
myLane->
getID() <<
"\n";
1766 adaptToLeader(std::make_pair(pred, gap), seen, lastLink, lane, v, vLinkPass);
1775 const MSLane*
const lane,
double& v,
double& vLinkPass,
1776 double distToCrossing)
const {
1777 if (leaderInfo.first != 0) {
1778 const double vsafeLeader =
getSafeFollowSpeed(leaderInfo, seen, lane, distToCrossing);
1779 if (lastLink != 0) {
1782 v =
MIN2(v, vsafeLeader);
1783 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1785 #ifdef DEBUG_PLAN_MOVE 1789 <<
" veh=" <<
getID()
1790 <<
" lead=" << leaderInfo.first->getID()
1791 <<
" leadSpeed=" << leaderInfo.first->getSpeed()
1792 <<
" gap=" << leaderInfo.second
1793 <<
" leadLane=" << leaderInfo.first->getLane()->getID()
1794 <<
" predPos=" << leaderInfo.first->getPositionOnLane()
1796 <<
" lane=" << lane->
getID()
1798 <<
" dTC=" << distToCrossing
1800 <<
" vSafeLeader=" << vsafeLeader
1801 <<
" vLinkPass=" << vLinkPass
1810 DriveProcessItem*
const lastLink,
double& v,
double& vLinkPass,
double& vLinkWait,
bool& setRequest)
const {
1812 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1814 const MSVehicle* leader = (*it).vehAndGap.first;
1818 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1819 }
else if (link->
isLeader(
this, leader)) {
1820 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1821 if (lastLink != 0) {
1833 vLinkWait =
MIN2(vLinkWait, v);
1839 const double seen,
const MSLane*
const lane,
double distToCrossing)
const {
1840 assert(leaderInfo.first != 0);
1842 double vsafeLeader = 0;
1843 if (leaderInfo.second >= 0) {
1844 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1850 if (distToCrossing >= 0) {
1881 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1887 #ifdef DEBUG_EXEC_MOVE 1888 if (
DEBUG_COND) std::cout <<
"\nEXECUTE_MOVE\n" 1890 <<
" veh=" <<
getID()
1898 double vSafeMin = 0;
1901 double vSafeMinDist = 0;
1905 DriveItemVector::iterator i;
1907 MSLink* link = (*i).myLink;
1909 #ifdef DEBUG_EXEC_MOVE 1912 <<
" veh=" <<
getID()
1914 <<
" req=" << (*i).mySetRequest
1915 <<
" vP=" << (*i).myVLinkPass
1916 <<
" vW=" << (*i).myVLinkWait
1917 <<
" d=" << (*i).myDistance
1922 if (link != 0 && (*i).mySetRequest) {
1929 vSafe = (*i).myVLinkWait;
1931 link->removeApproaching(
this);
1936 const bool influencerPrio =
false;
1940 std::vector<const SUMOVehicle*> collectFoes;
1941 bool opened = yellow || influencerPrio ||
1942 link->opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1949 if (parallelLink != 0) {
1952 opened &= parallelLink->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1956 #ifdef DEBUG_EXEC_MOVE 1959 <<
" veh=" <<
getID()
1963 <<
" opened=" << opened
1969 if (opened && !influencerPrio && !link->havePriority() && !link->lastWasContMajor() && !link->isCont()) {
1970 double visibilityDistance = link->getFoeVisibilityDistance();
1971 double determinedFoePresence = i->myDistance <= visibilityDistance;
1972 if (!determinedFoePresence) {
1973 vSafe = (*i).myVLinkWait;
1976 link->removeApproaching(
this);
1996 vSafe = (*i).myVLinkPass;
2002 vSafeZipper =
MIN2(vSafeZipper,
2003 link->getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
2005 vSafe = (*i).myVLinkWait;
2008 link->removeApproaching(
this);
2010 #ifdef DEBUG_EXEC_MOVE 2012 std::cout <<
SIMTIME <<
" braking for closed link=" << link->getViaLaneOrLane()->getID() <<
"\n";
2019 vSafe = (*i).myVLinkWait;
2050 #ifdef DEBUG_EXEC_MOVE 2052 std::cout <<
"vSafeMin Problem?" << std::endl;
2063 vSafe =
MIN2(vSafe, vSafeZipper);
2084 if (vSafeMin == 0) {
2096 #ifdef DEBUG_EXEC_MOVE 2098 std::cout <<
SIMTIME <<
" moveHelper vSafe=" << vSafe <<
" vSafeMin=" << vSafeMin <<
" vNext=" << vNext <<
"\n";
2115 vNext =
MAX2(vNext, 0.);
2136 brakelightsOn =
true;
2142 if (brakelightsOn) {
2150 std::vector<MSLane*> passedLanes;
2152 passedLanes.push_back(*i);
2154 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
2155 passedLanes.push_back(
myLane);
2158 std::string emergencyReason =
" for unknown reasons";
2166 MSLink* link = (*i).myLink;
2177 emergencyReason =
" because of a red traffic light";
2187 emergencyReason =
" because there is no connection to the next edge";
2191 if (approachedLane !=
myLane && approachedLane != 0) {
2209 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
2220 passedLanes.push_back(approachedLane);
2236 +
"'" + emergencyReason
2246 passedLanes.clear();
2267 #ifdef DEBUG_EXEC_MOVE 2348 const std::vector<MSLane*>& passedLanes) {
2351 #ifdef DEBUG_FURTHER 2353 <<
" updateFurtherLanes oldFurther=" <<
toString(furtherLanes)
2354 <<
" oldFurtherPosLat=" <<
toString(furtherLanesPosLat)
2355 <<
" passed=" <<
toString(passedLanes)
2358 for (std::vector<MSLane*>::iterator i = furtherLanes.begin(); i != furtherLanes.end(); ++i) {
2359 (*i)->resetPartialOccupation(
this);
2361 const MSLane* firstOldFurther = furtherLanes.size() > 0 ? furtherLanes.front() : 0;
2362 bool newFurther =
true;
2365 furtherLanes.clear();
2366 if (passedLanes.size() > 0) {
2368 std::vector<MSLane*>::const_reverse_iterator i = passedLanes.rbegin() + 1;
2369 while (leftLength > 0 && i != passedLanes.rend()) {
2370 furtherLanes.push_back(*i);
2372 if (*i == firstOldFurther) {
2376 furtherLanesPosLat.insert(furtherLanesPosLat.begin(),
myState.
myPosLat);
2378 #ifdef DEBUG_FURTHER 2380 std::cout <<
SIMTIME <<
" updateFurtherLanes \n";
2383 leftLength -= (*i)->setPartialOccupation(
this);
2386 result = -leftLength;
2388 assert(furtherLanesPosLat.size() >= furtherLanes.size());
2389 furtherLanesPosLat.erase(furtherLanesPosLat.begin() + furtherLanes.size(), furtherLanesPosLat.end());
2390 assert(furtherLanesPosLat.size() == furtherLanes.size());
2391 #ifdef DEBUG_FURTHER 2393 <<
" newFurther=" <<
toString(furtherLanes)
2394 <<
" newFurtherPosLat=" <<
toString(furtherLanesPosLat)
2395 <<
" newBackPos=" << result
2404 #ifdef DEBUG_FURTHER 2432 leftLength -= (*i)->getLength();
2443 leftLength -= (*i)->getLength();
2474 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2478 && (*i)->isFrontOnLane(l)) {
2479 foundStopped =
true;
2480 const double ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
2484 lengths += (*i)->getVehicleType().getLengthWithGap();
2493 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2499 bool hadVehicle =
false;
2500 double seenSpace = -lengthsInFront;
2502 bool foundStopped =
false;
2505 for (
int i = 0; i < (int)lfLinks.size(); ++i) {
2508 if (item.
myLink == 0 || foundStopped) {
2515 if (approachedLane != 0) {
2519 if (approachedLane ==
myLane) {
2528 #ifdef DEBUG_PLAN_MOVE 2531 <<
" veh=" <<
getID()
2532 <<
" approached=" << approachedLane->
getID()
2535 <<
" seenSpace=" << seenSpace
2537 <<
" lengthsInFront=" << lengthsInFront
2544 if (last == 0 || last ==
this) {
2545 seenSpace += approachedLane->
getLength();
2556 foundStopped =
true;
2558 #ifdef DEBUG_PLAN_MOVE 2561 <<
" veh=" <<
getID()
2562 <<
" approached=" << approachedLane->
getID()
2563 <<
" lastPoc=" << last->
getID()
2565 <<
" seenSpace=" << seenSpace
2566 <<
" foundStopped=" << foundStopped
2583 foundStopped =
true;
2586 #ifdef DEBUG_PLAN_MOVE 2589 <<
" veh=" <<
getID()
2590 <<
" approached=" << approachedLane->
getID()
2591 <<
" last=" << last->
getID()
2593 <<
" seenSpace=" << seenSpace
2594 <<
" foundStopped=" << foundStopped
2602 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2608 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
2610 const bool canLeaveJunction = item.
myLink->
getViaLane() == 0 || lfLinks[i].mySetRequest;
2618 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
2619 if (!opened && item.
myLink != 0) {
2623 allowsContinuation =
true;
2627 if (allowsContinuation) {
2633 int removalBegin = -1;
2634 for (
int i = 0; hadVehicle && i < (int)lfLinks.size() && removalBegin < 0; ++i) {
2648 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
2649 double impatienceCorrection = 0;
2655 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
2663 while (removalBegin < (
int)(lfLinks.size())) {
2665 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
2667 lfLinks[removalBegin].mySetRequest =
false;
2673 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2674 if ((*i).myLink != 0) {
2678 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2679 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2684 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2685 if ((*i).myLink != 0) {
2687 if (parallelLink != 0) {
2688 parallelLink->
setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2689 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2702 if (rem->first->getLane() != 0 && rem->second > 0.) {
2704 if (myTraceMoveReminders) {
2705 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
2710 if (rem->first->notifyEnter(*
this, reason, enteredLane)) {
2712 if (myTraceMoveReminders) {
2713 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
2719 if (myTraceMoveReminders) {
2720 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
2752 if (!onTeleporting) {
2785 #ifdef DEBUG_FURTHER 2787 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2793 #ifdef DEBUG_FURTHER 2795 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2798 leftLength -= (lane)->setPartialOccupation(
this);
2806 #ifdef DEBUG_FURTHER 2837 MSLane* clane = enteredLane;
2838 while (leftLength > 0) {
2840 if (clane == 0 || clane ==
myLane) {
2845 leftLength -= (clane)->setPartialOccupation(
this);
2851 #ifdef DEBUG_FURTHER 2853 std::cout <<
SIMTIME <<
" enterLaneAtInsertion \n";
2856 (*i)->resetPartialOccupation(
this);
2874 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason, approachedLane)) {
2876 if (myTraceMoveReminders) {
2877 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
2883 if (myTraceMoveReminders) {
2884 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
2894 #ifdef DEBUG_FURTHER 2896 std::cout <<
SIMTIME <<
" leaveLane \n";
2899 (*i)->resetPartialOccupation(
this);
2932 const std::vector<MSVehicle::LaneQ>&
2940 #ifdef DEBUG_BESTLANES 2945 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2951 if (startLane == 0) {
2954 assert(startLane != 0);
2959 bool startLaneIsOpposite = (startLane->
isInternal()
2962 if (startLaneIsOpposite) {
2964 assert(startLane != 0);
2984 std::vector<LaneQ>& lanes = *it;
2985 assert(lanes.size() > 0);
2986 if (&(lanes[0].lane->getEdge()) == nextEdge) {
2988 std::vector<LaneQ> oldLanes = lanes;
2990 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
2991 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
2992 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
2993 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
2994 lanes.push_back(*it_lane);
3001 for (
int i = 0; i < (int)lanes.size(); ++i) {
3002 if (i + lanes[i].bestLaneOffset < 0) {
3003 lanes[i].bestLaneOffset = -i;
3005 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
3006 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
3008 assert(i + lanes[i].bestLaneOffset >= 0);
3009 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
3010 if (lanes[i].bestContinuations[0] != 0) {
3012 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
3014 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
3017 assert(&(lanes[i].lane->getEdge()) == nextEdge);
3030 myLastBestLanesEdge = &startLane->
getEdge();
3034 const MSEdge* nextStopEdge = 0;
3035 const MSLane* nextStopLane = 0;
3036 double nextStopPos = 0;
3039 nextStopLane = nextStop.
lane;
3040 nextStopEdge = &nextStopLane->
getEdge();
3048 if (nextStopEdge != 0) {
3056 double seenLength = 0;
3057 bool progress =
true;
3059 std::vector<LaneQ> currentLanes;
3060 const std::vector<MSLane*>* allowed = 0;
3061 const MSEdge* nextEdge = 0;
3063 nextEdge = *(ce + 1);
3066 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
3067 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
3075 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
3078 currentLanes.push_back(q);
3081 if (nextStopEdge == *ce) {
3083 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
3084 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
3085 (*q).allowsContinuation =
false;
3086 (*q).length = nextStopPos;
3087 (*q).currentLength = (*q).length;
3094 seenLength += currentLanes[0].lane->getLength();
3096 progress &= (seen <= 4 || seenLength < 3000);
3097 progress &= seen <= 8;
3108 double bestLength = -1;
3109 int bestThisIndex = 0;
3112 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
3113 if ((*j).length > bestLength) {
3114 bestLength = (*j).length;
3115 bestThisIndex = index;
3119 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
3120 if ((*j).length < bestLength) {
3121 (*j).bestLaneOffset = bestThisIndex - index;
3125 #ifdef DEBUG_BESTLANES 3127 std::cout <<
" last edge:\n";
3129 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
3130 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
3136 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
3137 std::vector<LaneQ>& nextLanes = (*(i - 1));
3138 std::vector<LaneQ>& clanes = (*i);
3139 MSEdge& cE = clanes[0].lane->getEdge();
3141 double bestConnectedLength = -1;
3142 double bestLength = -1;
3143 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
3144 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
3145 bestConnectedLength = (*j).length;
3147 if (bestLength < (*j).length) {
3148 bestLength = (*j).length;
3152 int bestThisIndex = 0;
3153 if (bestConnectedLength > 0) {
3155 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3156 LaneQ bestConnectedNext;
3157 bestConnectedNext.
length = -1;
3158 if ((*j).allowsContinuation) {
3159 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
3160 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
3161 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
3162 bestConnectedNext = *m;
3167 (*j).
length += bestLength;
3169 (*j).length += bestConnectedNext.
length;
3174 if (clanes[bestThisIndex].length < (*j).length
3175 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))
3176 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) ==
abs((*j).bestLaneOffset) &&
3179 bestThisIndex = index;
3182 #ifdef DEBUG_BESTLANES 3184 std::cout <<
" edge=" << cE.
getID() <<
"\n";
3185 std::vector<LaneQ>& laneQs = clanes;
3186 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
3187 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
3194 int bestNextIndex = 0;
3195 int bestDistToNeeded = (int) clanes.size();
3197 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3198 if ((*j).allowsContinuation) {
3200 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
3201 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
3202 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
3203 bestDistToNeeded =
abs((*m).bestLaneOffset);
3204 bestThisIndex = index;
3205 bestNextIndex = nextIndex;
3211 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
3212 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
3217 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3218 if ((*j).length < clanes[bestThisIndex].length
3219 || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))
3222 (*j).bestLaneOffset = bestThisIndex - index;
3225 (*j).length = (*j).currentLength;
3228 (*j).bestLaneOffset = 0;
3233 #ifdef DEBUG_BESTLANES 3244 if (conts.size() < 2) {
3260 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
3261 std::vector<LaneQ>::iterator i;
3262 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
3263 double nextOccupation = 0;
3264 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
3265 nextOccupation += (*j)->getBruttoVehLenSum();
3267 (*i).nextOccupation = nextOccupation;
3268 if ((*i).lane == startLane) {
3275 const std::vector<MSLane*>&
3280 return (*myCurrentLaneInBestLanes).bestContinuations;
3284 const std::vector<MSLane*>&
3296 if ((*i).lane == lane) {
3297 return (*i).bestContinuations;
3309 return (*myCurrentLaneInBestLanes).bestLaneOffset;
3316 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
3317 assert(laneIndex < (
int)preb.size());
3318 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
3333 if (
isOnRoad() && destEdge != NULL) {
3347 std::pair<const MSVehicle* const, double>
3350 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
3358 MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(),
this);
3359 if (it != vehs.end() && it + 1 != vehs.end()) {
3363 std::pair<const MSVehicle* const, double> result(
3379 std::pair<const MSVehicle* const, double> leaderInfo =
getLeader(-1);
3380 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
3443 int numExpected = (int)
myStops.front().awaitedPersons.size();
3444 if (numExpected != 0) {
3449 numExpected = (int)
myStops.front().awaitedPersons.size();
3451 if (numExpected == 0) {
3465 int numExpected = (int)
myStops.front().awaitedContainers.size();
3466 if (numExpected != 0) {
3467 myStops.front().awaitedContainers.erase(container->
getID());
3468 numExpected = (int)
myStops.front().awaitedContainers.size();
3470 if (numExpected == 0) {
3479 const bool isPerson =
dynamic_cast<MSPerson*
>(t) != 0;
3487 const std::vector<MSTransportable*>&
3497 const std::vector<MSTransportable*>&
3526 }
else if ((state &
LCA_RIGHT) != 0 && (state & LCA_SUBLANE) == 0) {
3538 switch ((*link)->getDirection()) {
3561 if (currentTime % 1000 == 0) {
3613 #ifdef DEBUG_FURTHER 3623 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3625 if (shadowFurther[i] == lane) {
3645 #ifdef DEBUG_FURTHER 3653 #ifdef DEBUG_FURTHER 3659 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3660 if (shadowFurther[i] == lane) {
3661 #ifdef DEBUG_FURTHER 3664 <<
" lane=" << lane->
getID()
3689 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
3690 if ((*i).myLink != 0) {
3691 (*i).myLink->removeApproaching(
this);
3711 while (!lane->
isLinkEnd(link) && seen <= dist) {
3714 || !(*link)->havePriority())) {
3718 if ((*di).myLink != 0) {
3719 const MSLane* diPredLane = (*di).myLink->getLaneBefore();
3720 if (diPredLane != 0) {
3731 const SUMOTime leaveTime = (*link)->getLeaveTime((*di).myArrivalTime, (*di).myArrivalSpeed,
3733 if ((*link)->hasApproachingFoe((*di).myArrivalTime, leaveTime, (*di).myArrivalSpeed,
getCarFollowModel().getMaxDecel())) {
3740 lane = (*link)->getViaLaneOrLane();
3783 result.push_back(line1[0]);
3784 result.push_back(line2[0]);
3785 result.push_back(line2[1]);
3786 result.push_back(line1[1]);
3789 result.push_back(line1[1]);
3790 result.push_back(line2[1]);
3791 result.push_back(line2[0]);
3792 result.push_back(line1[0]);
3804 if (&(*i)->getEdge() == edge) {
3815 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
3817 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3818 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
3819 if (duration == 0 && !iter->reached) {
3822 iter->duration = duration;
3833 newStop.
until = until;
3838 const bool result =
addStop(newStop, errorMsg);
3851 const bool triggered,
const bool containerTriggered,
const SumoXMLTag stoppingPlaceType, std::string& errorMsg) {
3853 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3855 switch (stoppingPlaceType) {
3857 stop = iter->busstop;
3860 stop = iter->containerstop;
3863 stop = iter->chargingStation;
3866 stop = iter->parkingarea;
3871 if (stop != 0 && stop->
getID() == stopId) {
3872 if (duration == 0 && !iter->reached) {
3875 iter->duration = duration;
3883 switch (stoppingPlaceType) {
3888 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3896 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3904 errorMsg =
"The charging station '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3912 errorMsg =
"The parking area '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3920 newStop.
until = until;
3928 const bool result =
addStop(newStop, errorMsg);
3951 if (
myStops.front().busstop != 0) {
3953 myStops.front().busstop->leaveFrom(
this);
3956 if (
myStops.front().containerstop != 0) {
3958 myStops.front().containerstop->leaveFrom(
this);
3960 if (
myStops.front().parkingarea != 0) {
3962 myStops.front().parkingarea->leaveFrom(
this);
4055 if (containerstop != 0) {
4058 if (busstop == 0 && containerstop == 0) {
4063 if (duration >= 0) {
4072 if (containerTriggered) {
4078 if (awaitedPersons.size() > 0) {
4081 if (awaitedContainers.size() > 0) {
4091 return busstop->getLastFreePos(veh);
4092 }
else if (containerstop != 0) {
4093 return containerstop->getLastFreePos(veh);
4094 }
else if (parkingarea != 0) {
4095 return parkingarea->getLastFreePos(veh);
4096 }
else if (chargingStation != 0) {
4097 return chargingStation->getLastFreePos(veh);
4107 std::vector<std::string> internals;
4117 for (std::list<Stop>::iterator it =
myStops.begin(); it !=
myStops.end(); ++it) {
4121 for (std::vector<MSDevice*>::const_iterator dev =
myDevices.begin(); dev !=
myDevices.end(); ++dev) {
4122 (*dev)->saveState(out);
4131 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
4141 myDeparture -= offset;
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
double myPos
the stored position
int getRoutePosition() const
bool gDebugFlag1
global utility flags for debugging
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
void adaptToLeader(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass, double distToCrossing=-1) const
double myLatDist
The requested lateral change.
A lane area vehicles can halt at.
void setAngle(double angle)
Set a custom vehicle angle in rad.
void adaptToLeaders(const MSLeaderInfo &ahead, double latOffset, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass) const
void checkLinkLeader(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest) const
checks for link leaders on the given link
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
double computeAngle() const
compute the current vehicle angle
static double gLateralResolution
double getFuelConsumption() const
Returns fuel consumption of the current state.
const std::vector< double > & getShadowFurtherLanesPosLat() const
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSVehicleType * myType
This Vehicle's type.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time, assuming that during...
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Adds a vehicle to the list of waiting vehiclse to a given edge.
double getNOxEmissions() const
Returns NOx emission of the current state.
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
MSEdge & getEdge() const
Returns the lane's edge.
double myAngle
the angle in radians (
Representation of a vehicle in the micro simulation.
SUMOTime getDeparture() const
Returns this vehicle's real departure time.
int size() const
Return the number of passengers / containers.
double getBeginLanePosition() const
Returns the begin position of this stop.
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
bool hasPersons() const
Returns whether persons are simulated.
double getElectricityConsumption() const
Returns electricity consumption of the current state.
virtual int addLeader(const MSVehicle *veh, bool beyond, double latOffset=0)
double backPos() const
back Position of this state
bool keepClear() const
whether the junction after this link must be kept clear
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Currently relevant move reminders.
The action is due to the default of keeping right "Rechtsfahrgebot".
PositionVector getBoundingPoly() const
get bounding polygon
const ConstMSEdgeVector & getEdges() const
The action is done to help someone else.
static int nextLinkPriority(const std::vector< MSLane *> &conts)
get a numerical value for the priority of the upcoming link
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
const MSEdge * myLastBestLanesEdge
std::string containerstop
(Optional) container stop if one is assigned to the stop
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
void enterLaneAtInsertion(MSLane *enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
MSAbstractLaneChangeModel * myLaneChangeModel
void append(const PositionVector &v, double sameThreshold=2.0)
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
LaneChangeMode myRightDriveLC
changing to the rightmost lane
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
std::vector< std::vector< LaneQ > > myBestLanes
bool parking
whether the vehicle is removed from the net while stopping
MSLane * getLane() const
Returns the connected lane.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
bool hasDeparted() const
Returns whether this vehicle has already departed.
double myOriginalSpeed
The velocity before influence.
void release() const
deletes the route if there are no further references to it
A lane area vehicles can halt at.
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
DriveItemVector myLFLinkLanes
bool resumeFromStopping()
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, std::vector< const SUMOVehicle *> *collectFoes=0) const
Returns the information whether the link may be passed.
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
MSLane * getLane() const
Returns the lane the vehicle is on.
SUMOTime duration
The stopping duration.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
void setBlinkerInformation()
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void addContainer(MSTransportable *container)
Adds a container.
SUMOTime getMemorySize() const
The vehicle arrived at a junction.
double implicitDeltaPosVTD(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new VTD position ...
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const =0
Computes the vehicle's follow speed (no dawdling)
int getShadowDirection() const
return the direction in which the current shadow lane lies
int getPersonNumber() const
Returns the number of persons.
bool isVTDAffected(SUMOTime t) const
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
LinkLeaders getLeaderInfo(const MSVehicle *ego, double dist, std::vector< const MSPerson *> *collectBlockers=0) const
Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase...
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
const double SUMO_const_laneWidth
void planMove(const SUMOTime t, const MSLeaderInfo &ahead, const double lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
The car-following model abstraction.
double getPositionOnLane() const
Get the vehicle's position along the lane.
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
double myPosLat
the stored lateral position
int getBestLaneOffset() const
double myArrivalPos
The position on the destination lane where the vehicle stops.
The link is a 180 degree turn.
virtual void clear()
discard all information
Notification
Definition of a vehicle state.
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
std::string time2string(SUMOTime t)
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
#define STOPPING_PLACE_OFFSET
Changes the wished vehicle speed / lanes.
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into, const bool isContainer)
Build devices for the given vehicle, if needed.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
bool reached
Information whether the stop has been reached.
double getLeaveSpeed() const
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
void registerEmergencyStop()
register emergency stop
static const double ZIPPER_ADAPT_DIST
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
bool isRoundabout() const
State & operator=(const State &state)
Assignment operator.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true)
Replaces the current route by the given one.
vehicle doesn't want to change
TraciLaneChangePriority
modes for prioritizing traci lane change requests
double getLength() const
Returns the lane's length.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const PositionVector & getShape() const
Returns this lane's shape.
const MSRoute * myRoute
This Vehicle's route.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
PositionVector getBoundingBox() const
get bounding rectangle
bool isLinkEnd(MSLinkCont::const_iterator &i) const
const MSRoute & getRoute() const
Returns the current route.
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
PositionVector reverse() const
reverse position vector
virtual double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
SUMOTime until
The time at which the vehicle may continue its journey.
double getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
WaitingTimeCollector myWaitingTimeCollector
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
render as a sedan passenger vehicle ("Stufenheck")
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
double getSafeFollowSpeed(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, const MSLane *const lane, double distToCrossing) const
compute safe speed for following the given leader
std::vector< const MSEdge * > ConstMSEdgeVector
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
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. ...
SUMOTime myMemorySize
the maximal memory to store
void setVTDControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
int myArrivalLane
The destination lane where the vehicle stops.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
const std::string & getID() const
Returns the id.
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane's move reminders.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
A storage for edge travel times and efforts.
int getSpeedMode() const
return the current speed mode
MSChargingStation * getChargingStation(const std::string &id) const
Returns the named charging station.
double getLength() const
return the length of the edge
double nextOccupation
As occupation, but without the first lane.
double length
The overall length which may be driven when using this lane without a lane change.
This is an uncontrolled, all-way stop link.
The action is due to the wish to be faster (tactical lc)
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time...
double getWidth() const
Returns the lane's width.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
used by the sublane model
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist)
Sets the information about an approaching vehicle.
bool isLeader(const MSVehicle *ego, const MSVehicle *foe) const
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
bool collision
Whether this stop was triggered by a collision.
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist) const
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false, bool addStops=true)
Replaces the current route by the given edges.
The car-following model and parameter.
bool triggered
whether an arriving person lets the vehicle continue
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
WaitingTimeCollector(SUMOTime memory=MSGlobals::gWaitingTimeMemory)
Constructor.
MSAbstractLaneChangeModel & getLaneChangeModel()
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
std::string gDebugSelectedVehicle
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
double getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
LinkState getState() const
Returns the current state of the link.
Right blinker lights are switched on.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
MSChargingStation * chargingStation
(Optional) charging station if one is assigned to the stop
virtual MSTransportableControl & getContainerControl()
Returns the container control.
void writeParams(OutputDevice &out) const
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
static CollisionAction getCollisionAction()
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Needs to stay on the current lane.
double getMaxSpeed() const
Returns the maximum speed.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
Applies stored velocity information on the speed to use.
double changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
std::vector< double > myFurtherLanesPosLat
bool signalSet(int which) const
Returns whether the given signal is on.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
WaitingTimeCollector & operator=(const WaitingTimeCollector &wt)
Assignment operator.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool operator!=(const State &state)
Operator !=.
static std::vector< MSTransportable * > myEmptyTransportableVector
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
double departSpeed
(optional) The initial speed of the vehicle
A road/street connecting two junctions.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
double getEndLanePosition() const
Returns the end position of this stop.
The vehicle changes lanes (micro only)
LaneChangeModel getLaneChangeModel() const
MSLane * lane
The described lane.
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
double getCO2Emissions() const
Returns CO2 emission of the current state.
Left blinker lights are switched on.
double myDepartPos
The real depart position.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
void setSublaneChange(double latDist)
Sets a new sublane-change request.
blocked in all directions
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
The edge is a district edge.
MSLane * getViaLane() const
Returns the following inner lane.
The vehicle got a new route.
vehicle want's to change to right lane
void updateState(double vNext)
updates the vehicles state, given a next value for its speed. This value can be negative in case of t...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane ...
The action is urgent (to be defined by lc-model)
double updateFurtherLanes(std::vector< MSLane *> &furtherLanes, std::vector< double > &furtherLanesPosLat, const std::vector< MSLane *> &passedLanes)
update a vector of further lanes and return the new backPos
Representation of a vehicle.
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
render as a hatchback passenger vehicle ("Fliessheck")
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
double startPos
The stopping position start.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
virtual MSTransportableControl & getPersonControl()
Returns the person control.
void adaptLeaveSpeed(const double v)
ChangeRequest
Requests set via TraCI.
std::string chargingStation
(Optional) charging station if one is assigned to the stop
A point in 2D or 3D with translation and scaling methods.
double getCenterOnEdge() const
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
bool isVTDControlled() const
double posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
static void clear()
Clears the dictionary.
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Position myCachedPosition
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, double latOffset, double minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
double getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0) ...
const MSLane * lane
The lane to stop at.
double currentLength
The length which may be driven on this lane.
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
bool triggered
whether an arriving person lets the vehicle continue
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
SUMOTime myTimeLoss
the time loss due to writing with less than maximum speed
bool hasContainers() const
Returns whether containers are simulated.
int getCapacity() const
Returns the area capacity.
bool havePriority() const
Returns whether this link is a major link.
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
MSLane * myLane
The lane the vehicle is on.
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
bool loadAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false)
Adds a stop.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
void resetRoutePosition(int index)
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
double getDeltaPos(double accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOTime duration
The stopping duration.
static double rand()
Returns a random real number in [0, 1)
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
MSVehicle()
invalidated default constructor
The link is a (hard) right direction.
The action is needed to follow the route (navigational lc)
virtual double getSpeedAfterMaxDecel(double v) const
Returns the velocity after maximum deceleration.
const std::string & getID() const
returns the id of the transportable
std::vector< LinkLeader > LinkLeaders
double getImpatience() const
Returns this vehicles impatience.
void addTransportable(MSTransportable *transportable)
Add a passenger.
A blue emergency light is on.
A structure representing the best lanes for continuing the current route starting at 'lane'...
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers)
double myStopDist
distance to the next stop or -1 if there is none
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
bool hasInfluencer() const
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
double endPos
The stopping position end.
double getMinGap() const
Get the free space in front of vehicles of this class.
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
double getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
double myAcceleration
The current acceleration after dawdling in m/s.
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
void fixPosition()
repair errors in vehicle position after changing between internal edges
double myPreviousSpeed
the speed at the begin of the previous time step
render as a passenger vehicle
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
bool isInternal() const
return whether this edge is an internal edge
double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update...
The link is a partial right direction.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
int getOccupancy() const
Returns the area occupancy.
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool containerTriggered
whether an arriving container lets the vehicle continue
void move2side(double amount)
move position vector to side using certain ammount
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
bool allowsContinuation
Whether this lane allows to continue the drive.
const waitingIntervalList & getWaitingIntervals() const
void stopEnded(const SUMOVehicle *veh, const MSVehicle::Stop &stop)
Container that holds the vehicles driving state (position+speed).
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
Base class for objects which have an id.
void registerOneWaitingForPerson()
increases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
void saveState(OutputDevice &out)
Saves the states of a vehicle.
double getOriginalSpeed() const
Returns the originally longitudinal speed to use.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
double getRightSideOnEdge() const
std::string lane
The lane to stop at.
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
double getCOEmissions() const
Returns CO emission of the current state.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
ConstMSEdgeVector myVTDRoute
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
void removeShadowApproachingInformation() const
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
virtual std::string toString() const
print a debugging representation
double departPos
(optional) The position the vehicle shall depart from
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
void registerOneWaitingForContainer()
increases the count of vehicles waiting for a container to allow recogniztion of container related de...
vehicle want's to change to left lane
std::pair< const MSVehicle *, double > CLeaderDist
The vehicle starts or ends parking.
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param=0)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Structure representing possible vehicle parameter.
std::pair< MSVehicle *const, double > getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle &veh, const std::vector< MSLane *> &bestLaneConts) const
Returns the immediate leader and the distance to him.
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void removeApproachingInformation(DriveItemVector &lfLinks) const
unregister approach from all upcoming links
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
void setNoShadowPartialOccupator(MSLane *lane)
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
bool containerTriggered
whether an arriving container lets the vehicle continue
The link has yellow light, may pass.
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
void setVTDState(Position xyPos)
sets position outside the road network
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
void passTime(SUMOTime dt, bool waiting)
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
virtual double getHeadwayTime() const
Get the driver's reaction time [s].
The vehicle is blocked being overlapping.
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
int mySignals
State of things of the vehicle that can be on or off.
void resetChanged()
reset the flag whether a vehicle already moved to false
std::vector< MSLane * > bestContinuations
Definition of vehicle stop (position and duration)
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
void onDepart()
Called when the vehicle is inserted into the network.
The link has red light (must brake)
SUMOTime until
The time at which the vehicle may continue its journey.
double getMinimalArrivalSpeed(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance.
double interpolateLanePosToGeometryPos(double lanePos) const
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const std::string & getID() const
Returns the name of the vehicle type.
double getPMxEmissions() const
Returns PMx emission of the current state.
int index
at which position in the stops list
SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
MSRouteIterator edge
The edge in the route to stop at.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
The arrival lane is given.
int containerNumber
The static number of containers in the vehicle when it departs.
The vehicle ends to stop.
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
void addReference() const
increments the reference counter for the route
double implicitSpeedVTD(const MSVehicle *veh, double oldSpeed)
return the speed that is implicit in the new VTD position
int myNumberReroutes
The number of reroutings.
int getContainerNumber() const
Returns the number of containers.
double getLength() const
Get vehicle's length [m].
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
void setLaneChangeMode(int value)
Sets lane changing behavior.
const MSLane * getBackLane() const
virtual void prepareStep()
bool allowsVehicleClass(SUMOVehicleClass vclass) const
static MSStopOut * getInstance()
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
void write(OutputDevice &dev) const
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
waitingIntervalList myWaitingIntervals
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during lookForward.
void setSignals(int signals)
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
The action is due to a TraCI request.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
const std::vector< MSLane * > & getShadowFurtherLanes() const
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
vehicle want's to keep the current lane
Static storage of an output device and its base (abstract) implementation.
double speed() const
Speed of this state.
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
The vehicle needs another parking area.
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
static bool gSemiImplicitEulerUpdate
void switchOnSignal(int signal)
Switches the given signal on.
double getSlope() const
Returns the slope of the road at vehicle's position.
void addPerson(MSTransportable *person)
Adds a passenger.
static std::vector< MSLane * > myEmptyLaneVector
MSRouteIterator myCurrEdge
Iterator to current route-edge.
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
MSEdgeWeightsStorage & _getWeightsStorage() const
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
double getHCEmissions() const
Returns HC emission of the current state.
virtual ~MSVehicle()
Destructor.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
bool isStopped() const
Returns whether the vehicle is at a stop.
No information given; use default.
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
MSParkingArea * getNextParkingArea()
get the current parking area stop
const Position getBackPosition() const
The link has yellow light, has to brake anyway.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0) ...
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
const MSLane & getLane() const
Returns the lane this stop is located at.
bool isParking() const
Returns whether the vehicle is parking.
double endPos
The stopping position end.
double getSpeed() const
Returns the vehicle's current speed.
State(double pos, double speed, double posLat, double backPos)
Constructor.
double getEndPos(const SUMOVehicle &veh) const
return halting position for upcoming stop;
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
The edge is an internal edge.
public emergency vehicles
render as a wagon passenger vehicle ("Combi")
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
void removeTransportable(MSTransportable *transportable)
Remove a passenger (TraCI)
static SUMOTime gLaneChangeDuration
SUMOTime getLastAccessTimeStep() const
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge ¤tEdge, const int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
const std::string & getID() const
Returns the name of the vehicle.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
Representation of a lane in the micro simulation.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
double myBackPos
the stored back position
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
The link has red light (must brake) but indicates upcoming green.
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders of this links junction
MSRouteIterator end() const
Returns the end of the list of edges to pass.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Interface for lane-change models.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
double mySpeed
the stored speed (should be >=0 at any time)
bool contains(const MSEdge *const edge) const
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
virtual double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
SUMOTime myDeparture
The real departure time.
void removeTransportable(MSTransportable *t)
removes a person or container
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
static const SUMOTime NOT_YET_DEPARTED
double startPos
The stopping position start.
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
used to indicate that a position is valid
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
The vehicle is being teleported.
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
double pos() const
Position of this state.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
MSParkingArea * getParkingArea(const std::string &id) const
Returns the named parking area.
double getWidth() const
Returns the edges's width (sum over all lanes)