81 #include <mesosim/MESegment.h>
82 #include <mesosim/MELoop.h>
86 #ifdef CHECK_MEMORY_LEAKS
88 #endif // CHECK_MEMORY_LEAKS
93 #define BUS_STOP_OFFSET 0.5
95 #define CRLL_LOOK_AHEAD 5
98 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0
128 return (myPos != state.
myPos ||
140 myPos(pos), mySpeed(speed) {}
148 mySpeedAdaptationStarted(true),
149 myConsiderSafeVelocity(true),
150 myConsiderMaxAcceleration(true),
151 myConsiderMaxDeceleration(true),
152 myRespectJunctionPriority(true),
153 myEmergencyBrakeRedLight(true),
154 myAmVTDControlled(false),
169 mySpeedAdaptationStarted =
true;
170 mySpeedTimeLine = speedTimeLine;
176 myLaneTimeLine = laneTimeLine;
183 myOriginalSpeed = speed;
185 while (mySpeedTimeLine.size() == 1 || (mySpeedTimeLine.size() > 1 && currentTime > mySpeedTimeLine[1].first)) {
186 mySpeedTimeLine.erase(mySpeedTimeLine.begin());
189 if (mySpeedTimeLine.size() < 2 || currentTime < mySpeedTimeLine[0].first) {
193 if (!mySpeedAdaptationStarted) {
194 mySpeedTimeLine[0].second = speed;
195 mySpeedAdaptationStarted =
true;
199 speed = mySpeedTimeLine[0].second - (mySpeedTimeLine[0].second - mySpeedTimeLine[1].second) * td;
200 if (myConsiderSafeVelocity) {
201 speed =
MIN2(speed, vSafe);
203 if (myConsiderMaxAcceleration) {
204 speed =
MIN2(speed, vMax);
206 if (myConsiderMaxDeceleration) {
207 speed =
MAX2(speed, vMin);
216 while (myLaneTimeLine.size() == 1 || (myLaneTimeLine.size() > 1 && currentTime > myLaneTimeLine[1].first)) {
217 myLaneTimeLine.erase(myLaneTimeLine.begin());
221 if (myLaneTimeLine.size() >= 2 && currentTime >= myLaneTimeLine[0].first) {
222 const unsigned int destinationLaneIndex = myLaneTimeLine[1].second;
223 if (destinationLaneIndex < (
unsigned int)currentEdge.
getLanes().size()) {
224 if (currentLaneIndex > destinationLaneIndex) {
226 }
else if (currentLaneIndex < destinationLaneIndex) {
238 mode = myStrategicLC;
240 mode = myCooperativeLC;
242 mode = mySpeedGainLC;
244 mode = myRightDriveLC;
252 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
260 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
281 switch (changeRequest) {
297 assert(myLaneTimeLine.size() >= 2);
298 assert(currentTime >= myLaneTimeLine[0].first);
299 return STEPS2TIME(myLaneTimeLine[1].first - currentTime);
305 myConsiderSafeVelocity = value;
311 myConsiderMaxAcceleration = value;
317 myConsiderMaxDeceleration = value;
323 myRespectJunctionPriority = value;
329 myEmergencyBrakeRedLight = value;
347 if (myVTDRoute.size() != 0) {
351 if (myVTDPos > myVTDLane->getLength()) {
352 myVTDPos = myVTDLane->getLength();
354 myVTDLane->forceVehicleInsertion(v, myVTDPos);
356 myAmVTDControlled =
false;
368 (*i)->resetPartialOccupation(
this);
373 if ((*i).myLink != 0) {
374 (*i).myLink->removeApproaching(
this);
411 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
412 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
416 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
421 "' is too high for the vehicle type '" + type->
getID() +
"'.");
434 if ((*i).myLink != 0) {
435 (*i).myLink->removeApproaching(
this);
478 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
479 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
482 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
487 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
546 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
548 if (myTraceMoveReminders) {
549 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
555 if (myTraceMoveReminders) {
556 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
571 rem->second += oldLaneLength;
573 if (myTraceMoveReminders) {
574 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
607 if (offset == 0. && !changingLanes) {
630 #ifdef HAVE_INTERNAL_LANES
665 atan2(p1.
x() - p2.
x(), p2.
y() - p1.
y()) * 180. /
M_PI :
681 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
694 if (stop.
until != -1) {
695 stop.
until += untilOffset;
707 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
720 std::list<Stop>::iterator iter =
myStops.begin();
723 prevStopEdge =
myStops.back().edge;
724 prevStopPos =
myStops.back().endPos;
727 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
733 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
734 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
735 prevStopEdge = iter->edge;
736 prevStopPos = iter->endPos;
740 int index = stopPar.
index;
742 prevStopEdge = iter->edge;
743 prevStopPos = iter->endPos;
751 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
757 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
763 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
771 pos += (*myCurrEdge)->getLength();
783 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
788 std::list<Stop>::iterator iter2 = iter;
790 if (stop.
until >= 0 && iter2->until > stop.
until) {
796 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
832 return currentVelocity;
846 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
860 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
893 bool busStopsMustHaveSpace =
true;
899 busStopsMustHaveSpace =
false;
902 bool containerStopsMustHaveSpace =
true;
908 containerStopsMustHaveSpace =
false;
913 && containerStopsMustHaveSpace &&
myLane == stop.
lane) {
919 if (stop.
until >= 0) {
939 return currentVelocity;
946 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
947 result.push_back(*iter->edge);
963 #ifdef DEBUG_VEHICLE_GUI_SELECTION
969 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
970 if ((*i).myLink != 0) {
971 (*i).myLink->removeApproaching(
this);
995 assert(bestLaneConts.size() > 0);
996 #ifdef HAVE_INTERNAL_LANES
997 bool hadNonInternal =
false;
999 bool hadNonInternal =
true;
1004 unsigned int view = 0;
1014 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
1020 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
1024 if (shadowLane != 0) {
1025 std::pair<const MSVehicle*, SUMOReal> shadowLeaderInfo = shadowLane->
getLeader(
this, lane->
getLength() - seen,
false);
1026 adaptToLeader(shadowLeaderInfo, seen, lastLink, shadowLane, v, vLinkPass);
1037 if (lastLink != 0) {
1040 v =
MIN2(v, stopSpeed);
1047 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1056 if (lastLink != 0) {
1065 if (lastLink != 0) {
1094 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
1107 if (yellowOrRed && seen >= brakeDist) {
1114 #ifdef HAVE_INTERNAL_LANES
1117 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1119 const MSVehicle* leader = (*it).vehAndGap.first;
1123 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1124 }
else if (leader->myLinkLeaders[(*link)->getJunction()].count(
getID()) == 0) {
1126 myLinkLeaders[(*link)->getJunction()].insert(leader->
getID());
1127 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1128 if (lastLink != 0) {
1140 vLinkWait =
MIN2(vLinkWait, v);
1143 if (lastLink != 0) {
1150 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel() && brakeDist < seen) {
1157 const SUMOReal accelTime = (arrivalSpeed - v) / accel;
1158 const SUMOReal accelWay = accelTime * (arrivalSpeed + v) * 0.5;
1175 arrivalSpeedBraking = arrivalSpeed;
1182 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1183 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1186 arrivalTime, arrivalSpeed,
1187 arrivalTimeBraking, arrivalSpeedBraking,
1190 #ifdef HAVE_INTERNAL_LANES
1191 if ((*link)->getViaLane() == 0) {
1192 hadNonInternal =
true;
1199 if (!setRequest || ((v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD)) {
1203 lane = (*link)->getViaLaneOrLane();
1215 lastLink = &lfLinks.back();
1226 if (leaderInfo.first != 0) {
1228 if (lastLink != 0) {
1231 v =
MIN2(v, vsafeLeader);
1232 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1240 assert(leaderInfo.first != 0);
1243 if (leaderInfo.second >= 0) {
1244 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1250 if (distToCrossing >= 0) {
1260 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1281 DriveItemVector::iterator i;
1283 MSLink* link = (*i).myLink;
1285 if (link != 0 && (*i).mySetRequest) {
1291 vSafe = (*i).myVLinkWait;
1298 const bool influencerPrio =
false;
1302 const bool opened = yellow || influencerPrio ||
1303 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1309 vSafe = (*i).myVLinkWait;
1328 vSafe = (*i).myVLinkPass;
1334 vSafe = (*i).myVLinkWait;
1342 vSafe = (*i).myVLinkWait;
1407 std::vector<MSLane*> passedLanes;
1409 passedLanes.push_back(*i);
1411 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1412 passedLanes.push_back(
myLane);
1415 std::string emergencyReason =
" for unknown reasons";
1428 MSLink* link = (*i).myLink;
1439 emergencyReason =
" because of a red traffic light";
1446 emergencyReason =
" because there is no connection to the next edge";
1450 if (approachedLane !=
myLane && approachedLane != 0) {
1461 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1466 #ifdef HAVE_INTERNAL_LANES
1468 if (link->getViaLane() == 0) {
1478 passedLanes.push_back(approachedLane);
1484 (*i)->resetPartialOccupation(
this);
1505 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1506 while (leftLength > 0 && i != passedLanes.rend()) {
1508 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1530 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1532 foundStopped =
true;
1533 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1537 lengths += (*i)->getVehicleType().getLengthWithGap();
1546 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1551 #ifdef HAVE_INTERNAL_LANES
1553 bool hadVehicle =
false;
1554 SUMOReal seenSpace = -lengthsInFront;
1556 bool foundStopped =
false;
1559 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1562 if (item.
myLink == 0 || foundStopped) {
1568 const MSLane* approachedLane = item.
myLink->getViaLane();
1569 if (approachedLane != 0) {
1593 foundStopped =
true;
1596 seenSpace += approachedLane->
getLength();
1610 foundStopped =
true;
1618 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1624 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
1626 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
1634 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1635 if (!opened && item.
myLink != 0) {
1639 allowsContinuation =
true;
1643 if (allowsContinuation) {
1649 int removalBegin = -1;
1650 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1664 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1671 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
1679 while (removalBegin < (
int)(lfLinks.size())) {
1681 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1683 lfLinks[removalBegin].mySetRequest =
false;
1692 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1693 if ((*i).myLink != 0) {
1697 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1698 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime());
1707 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1709 if (myTraceMoveReminders) {
1710 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1715 if (rem->first->notifyEnter(*
this, reason)) {
1717 if (myTraceMoveReminders) {
1718 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1724 if (myTraceMoveReminders) {
1725 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1755 if (!onTeleporting) {
1789 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1820 MSLane* clane = enteredLane;
1821 while (leftLength > 0) {
1827 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1835 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1837 if (myTraceMoveReminders) {
1838 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1844 if (myTraceMoveReminders) {
1845 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1855 (*i)->resetPartialOccupation(
this);
1887 const std::vector<MSVehicle::LaneQ>&
1895 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1901 if (startLane == 0) {
1904 assert(startLane != 0);
1922 std::vector<LaneQ>& lanes = *it;
1923 assert(lanes.size() > 0);
1924 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1926 std::vector<LaneQ> oldLanes = lanes;
1928 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1929 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1930 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1931 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1932 lanes.push_back(*it_lane);
1939 for (
int i = 0; i < (int)lanes.size(); ++i) {
1940 if (i + lanes[i].bestLaneOffset < 0) {
1941 lanes[i].bestLaneOffset = -i;
1943 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1944 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
1946 assert(i + lanes[i].bestLaneOffset >= 0);
1947 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1948 if (lanes[i].bestContinuations[0] != 0) {
1950 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1952 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1955 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1968 myLastBestLanesEdge = &startLane->
getEdge();
1972 const MSEdge* nextStopEdge = 0;
1973 const MSLane* nextStopLane = 0;
1977 nextStopLane = nextStop.
lane;
1978 nextStopEdge = &nextStopLane->
getEdge();
1986 if (nextStopEdge != 0) {
1995 bool progress =
true;
1997 std::vector<LaneQ> currentLanes;
1998 const std::vector<MSLane*>* allowed = 0;
1999 const MSEdge* nextEdge = 0;
2001 nextEdge = *(ce + 1);
2004 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2005 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2012 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2013 currentLanes.push_back(q);
2016 if (nextStopEdge == *ce) {
2018 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2019 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2020 (*q).allowsContinuation =
false;
2021 (*q).length = nextStopPos;
2028 seenLength += currentLanes[0].lane->getLength();
2030 progress &= (seen <= 4 || seenLength < 3000);
2031 progress &= seen <= 8;
2043 int bestThisIndex = 0;
2046 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2047 if ((*j).length > bestLength) {
2048 bestLength = (*j).length;
2049 bestThisIndex = index;
2053 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2054 if ((*j).length < bestLength) {
2055 (*j).bestLaneOffset = bestThisIndex - index;
2062 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2063 std::vector<LaneQ>& nextLanes = (*(i - 1));
2064 std::vector<LaneQ>& clanes = (*i);
2065 MSEdge& cE = clanes[0].lane->getEdge();
2069 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2070 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2071 bestConnectedLength = (*j).length;
2073 if (bestLength < (*j).length) {
2074 bestLength = (*j).length;
2078 int bestThisIndex = 0;
2079 if (bestConnectedLength > 0) {
2081 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2082 LaneQ bestConnectedNext;
2083 bestConnectedNext.
length = -1;
2084 if ((*j).allowsContinuation) {
2085 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2086 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2087 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2088 bestConnectedNext = *m;
2093 (*j).
length += bestLength;
2095 (*j).length += bestConnectedNext.
length;
2099 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
2100 bestThisIndex = index;
2106 int bestNextIndex = 0;
2107 int bestDistToNeeded = (int) clanes.size();
2109 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2110 if ((*j).allowsContinuation) {
2112 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2113 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2114 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2115 bestDistToNeeded =
abs((*m).bestLaneOffset);
2116 bestThisIndex = index;
2117 bestNextIndex = nextIndex;
2123 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2124 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2129 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2130 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2131 (*j).bestLaneOffset = bestThisIndex - index;
2133 (*j).bestLaneOffset = 0;
2144 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2145 std::vector<LaneQ>::iterator i;
2146 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2148 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2149 nextOccupation += (*j)->getBruttoVehLenSum();
2151 (*i).nextOccupation = nextOccupation;
2152 if ((*i).lane == startLane) {
2159 const std::vector<MSLane*>&
2164 return (*myCurrentLaneInBestLanes).bestContinuations;
2168 const std::vector<MSLane*>&
2179 if ((*i).lane == lane) {
2180 return (*i).bestContinuations;
2192 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2199 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2200 assert(laneIndex < (
int)preb.size());
2201 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2218 #ifdef DEBUG_VEHICLE_GUI_SELECTION
2223 if (
isOnRoad() && destEdge != NULL) {
2237 std::pair<const MSVehicle* const, SUMOReal>
2240 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2247 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2248 if (pred != vehs.end()) {
2263 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2264 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2321 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2322 if (numExpected != 0) {
2327 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2329 if (numExpected == 0) {
2343 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2344 if (numExpected != 0) {
2345 myStops.front().awaitedContainers.erase(container->
getID());
2346 numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2348 if (numExpected == 0) {
2386 switch ((*link)->getDirection()) {
2431 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
2433 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2434 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
2435 if (duration == 0 && !iter->reached) {
2438 iter->duration = duration;
2449 newStop.
until = until;
2454 const bool result =
addStop(newStop, errorMsg);
2464 const bool triggered,
const bool containerTriggered,
const bool isContainerStop, std::string& errorMsg) {
2466 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2467 const Named*
const stop = isContainerStop ? (
Named*)iter->containerstop : iter->busstop;
2468 if (stop != 0 && stop->
getID() == stopId) {
2469 if (duration == 0 && !iter->reached) {
2472 iter->duration = duration;
2480 if (isContainerStop) {
2484 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2491 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2496 newStop.
until = until;
2504 const bool result =
addStop(newStop, errorMsg);
2524 if (
myStops.front().busstop != 0) {
2526 myStops.front().busstop->leaveFrom(
this);
2529 if (
myStops.front().containerstop != 0) {
2531 myStops.front().containerstop->leaveFrom(
this);
2591 std::vector<SUMOTime> internals;
2604 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2606 unsigned int routeOffset;
2611 myDeparture -= offset;
void resetRoutePosition(unsigned int index)
bool signalSet(int which) const
Returns whether the given signal is on.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSVehicleType * myType
This Vehicle's type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const
Returns the velocity after maximum deceleration.
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Adds a vehicle to the list of waiting vehiclse to a given edge.
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOReal speed() const
Speed of this state.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
const SUMOReal SUMO_const_laneWidth
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Current lane's move reminder.
SUMOReal myArrivalPos
the position on the destination lane where the vehicle stops
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...
MSAbstractLaneChangeModel * myLaneChangeModel
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
std::vector< std::vector< LaneQ > > myBestLanes
bool parking
whether the vehicle is removed from the net while stopping
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
A lane area vehicles can halt at.
const Position geometryPositionAtOffset(SUMOReal offset) const
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
SUMOReal pos() const
Position of this state.
bool resumeFromStopping()
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
bool hasInfluencer() const
SUMOTime duration
The stopping duration.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
bool keepClear() const
whether the junction after this link must be kept clear
The action is done to help someone else.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
SUMOReal getImpatience() const
Returns this vehicles impatience.
void setBlinkerInformation()
void addContainer(MSTransportable *container)
Adds a container.
SUMOReal getLeaveSpeed() const
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
The vehicle arrived at a junction.
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
bool isVTDControlled() const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
virtual SUMOReal followSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const =0
Computes the vehicle's follow speed (no dawdling)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal getLength() const
Returns the lane's length.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
SUMOReal departSpeed
(optional) The initial speed of the vehicle
virtual SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
static MSDevice_Person * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
The car-following model abstraction.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
The link is a 180 degree turn.
State(SUMOReal pos, SUMOReal speed)
Constructor.
std::vector< MSVehicle * > VehCont
Container for vehicles.
Notification
Definition of a vehicle state.
static SUMOReal rand()
Returns a random real number in [0, 1)
std::string time2string(SUMOTime t)
SUMOReal getLength() const
Get vehicle's length [m].
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
Changes the wished vehicle speed / lanes.
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
bool reached
Information whether the stop has been reached.
void registerEmergencyStop()
register emergency stop
SUMOReal getEndLanePosition() const
Returns the end position of this stop.
State & operator=(const State &state)
Assignment operator.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
vehicle doesn't want to change
unsigned int getPersonNumber() const
Returns the number of persons.
TraciLaneChangePriority
modes for prioritizing traci lane change requests
const MSRoute * myRoute
This Vehicle's route.
const std::string & getID() const
returns the id of the transportable
unsigned int myNumberReroutes
The number of reroutings.
bool hasDeparted() const
Returns whether this vehicle has already departed.
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
SUMOTime until
The time at which the vehicle may continue its journey.
SUMOReal mySpeed
the stored speed
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
unsigned int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
std::vector< const MSEdge * > ConstMSEdgeVector
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
The action is due to a TraCI request.
A storage for edge travel times and efforts.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
SUMOReal x() const
Returns the x-position.
This is an uncontrolled, all-way stop link.
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
The action is urgent (to be defined by lc-model)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge ¤tEdge, const unsigned int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
The link is a (hard) left direction.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, unsigned int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
#define WRITE_WARNING(msg)
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.
MSAbstractLaneChangeModel & getLaneChangeModel()
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
std::string gDebugSelectedVehicle
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
Right blinker lights are switched on.
SUMOReal getPartialOccupatorEnd() const
Returns the position of the in-lapping vehicle's end.
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
bool operator!=(const State &state)
Operator !=.
const std::vector< MSTransportable * > & getPersons() const
Returns the list of persons using this vehicle.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
void addContainer(MSTransportable *container)
Add a container.
The vehicle changes lanes (micro only)
Position getPositionAtDistance(SUMOReal offset) const
MSLane * lane
The described lane.
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
SUMOReal getLength() const
return the length of the edge
Left blinker lights are switched on.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
void continueLaneChangeManeuver(bool moved)
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
SUMOReal brakeGap(const SUMOReal speed) const
Returns the distance the vehicle needs to halt including driver's reaction time.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
const MSLane & getLane() const
Returns the lane this stop is located at.
unsigned int getContainerNumber() const
Returns the number of containers.
static MSDevice_Container * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
SUMOReal startPos
The stopping position start.
The edge is a district edge.
std::pair< MSVehicle *const, SUMOReal > getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the immediate leader and the distance to him.
The vehicle got a new route.
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
vehicle want's to change to right lane
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal 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::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
ChangeRequest
Requests set via TraCI.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
A point in 2D or 3D with translation and scaling methods.
SUMOReal endPos
The stopping position end.
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...
MSLane * getLane() const
Returns the connected lane.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
virtual MSContainerControl & getContainerControl()
Returns the container control.
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.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
Position myCachedPosition
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MSLane * lane
The lane to stop at.
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
bool triggered
whether an arriving person lets the vehicle continue
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
bool contains(const MSEdge *const edge) const
unsigned int size() const
Return the number of containers.
bool isStopped() const
Returns whether the vehicle is at a stop.
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
std::pair< MSVehicle *, SUMOReal > getLastVehicleInformation() const
Returns the last vehicle which is still on the lane.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
void adaptLeaveSpeed(const SUMOReal v)
MSLane * myLane
The lane the vehicle is on.
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
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".
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
const ConstMSEdgeVector & getEdges() const
SUMOReal getSafeFollowSpeed(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
compute safe speed for following the given leader
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
SUMOTime duration
The stopping duration.
bool isRoundabout() const
MSVehicle()
invalidated default constructor
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
The link is a (hard) right direction.
virtual SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap2pred) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
std::vector< LinkLeader > LinkLeaders
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
A structure representing the best lanes for continuing the route.
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.
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.
std::pair< MSVehicle *const, SUMOReal > getLeader(const MSVehicle *veh, const SUMOReal vehPos, bool checkNext) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
MSVehicle * getLastVehicle() const
returns the last vehicle
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuouss lane change.
const std::vector< MSTransportable * > & getContainers() const
Returns the list of containers using this vehicle.
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
virtual SUMOReal freeSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal seen, SUMOReal maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
bool isInternal() const
return whether this edge is an internal edge
The link is a partial right direction.
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
void addReference() const
increments the reference counter for the route
bool isParking() const
Returns whether the vehicle is parking.
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
SUMOReal getLaneChangeCompletion() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
bool containerTriggered
whether an arriving container lets the vehicle continue
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
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.
void planMoveInternal(const SUMOTime t, const MSVehicle *pred, DriveItemVector &lfLinks) const
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
std::string lane
The lane to stop at.
MSEdgeWeightsStorage & _getWeightsStorage() const
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false)
Replaces the current route by the given edges.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
void leaveLane(const MSMoveReminder::Notification reason)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
unsigned int getVehicleNumber() const
Returns the number of vehicles on this lane.
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
const MSJunction * getJunction() const
return the junction to which this link belongs
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
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
The action is needed to follow the route (navigational lc)
The vehicle starts or ends parking.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
LaneChangeModel getLaneChangeModel() const
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void setTentativeLaneAndPosition(MSLane *lane, const SUMOReal pos)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Structure representing possible vehicle parameter.
bool havePriority() const
Returns whether this link is a major link.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
static SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
void setNoShadowPartialOccupator(MSLane *lane)
bool containerTriggered
whether an arriving container lets the vehicle continue
virtual MSPersonControl & getPersonControl()
Returns the person control.
The link has yellow light, may pass.
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
bool fixPosition()
repair errors in vehicle position after changing between internal edges
bool isLaneChangeMidpointPassed() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
int mySignals
State of things of the vehicle that can be on or off.
std::vector< MSLane * > bestContinuations
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition of vehicle stop (position and duration)
SUMOReal getBeginLanePosition() const
Returns the begin position of this stop.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
void adaptToLeader(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
The action is due to the default of keeping right "Rechtsfahrgebot".
The link has red light (must brake)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime until
The time at which the vehicle may continue its journey.
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
int index
at which position in the stops list
void calculateArrivalPos()
(Re-)Calculates the arrival position from the vehicle parameters
MSRouteIterator edge
The edge in the route to stop at.
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
bool addTraciBusOrContainerStop(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string &errorMsg)
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
The arrival lane is given.
Needs to stay on the current lane.
const std::string & getID() const
Returns the name of the vehicle type.
The vehicle ends to stop.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
void resetMoved()
reset the flag whether a vehicle already moved to false
SUMOReal departPos
(optional) The position the vehicle shall depart from
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
void setLaneChangeMode(int value)
Sets lane changing behavior.
SUMOReal myPos
the stored position
virtual void prepareStep()
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
std::vector< DriveProcessItem > DriveItemVector
void planMove(const SUMOTime t, const MSVehicle *pred, const SUMOReal lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal endPos
The stopping position end.
void move2side(SUMOReal amount)
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
vehicle want's to keep the current lane
LinkState getState() const
Returns the current state of the link.
bool hasValidRoute(std::string &msg) const
Validates the current route.
MSVehicle * getPartialOccupator() const
Returns the vehicle which laps into this lane.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
void addPerson(MSTransportable *person)
Adds a passenger.
static std::vector< MSLane * > myEmptyLaneVector
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
virtual ~MSVehicle()
Destructor.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
No information given; use default.
void addPerson(MSTransportable *person)
Add a passenger.
The link has yellow light, has to brake anyway.
unsigned int containerNumber
The static number of containers in the vehicle when it departs.
void release() const
deletes the route if there are no further references to it
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
The edge is an internal edge.
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
static SUMOTime gLaneChangeDuration
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
bool addTraciStop(MSLane *const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
SUMOReal startPos
The stopping position start.
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.
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
unsigned int size() const
Return the number of passengers.
The link has red light (must brake) but indicates upcoming green.
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether the link may be passed.
unsigned int getRoutePosition() const
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
int getBestLaneOffset() const
returns the current offset from the best lane
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
SUMOTime myDeparture
The real departure time.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
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...
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
The vehicle is being teleported.
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
const std::string & getID() const
Returns the name of the vehicle.
The action is due to the wish to be faster (tactical lc)
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
unsigned int getLaneIndex() const