79 #ifdef CHECK_MEMORY_LEAKS 81 #endif // CHECK_MEMORY_LEAKS 86 #define BUS_STOP_OFFSET 0.5 88 #define CRLL_LOOK_AHEAD 5 91 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0 163 if (memorySpan == -1) {
168 if (i->second >= memorySpan) {
169 if (i->first >= memorySpan) {
172 totalWaitingTime += memorySpan - i->first;
175 totalWaitingTime += i->second - i->first;
178 return totalWaitingTime;
185 bool startNewInterval = i == end || (i->first != 0);
196 waitingIntervalList::iterator::difference_type d = std::distance(i, end);
204 }
else if (!startNewInterval) {
221 mySpeedAdaptationStarted(true),
222 myConsiderSafeVelocity(true),
223 myConsiderMaxAcceleration(true),
224 myConsiderMaxDeceleration(true),
225 myRespectJunctionPriority(true),
226 myEmergencyBrakeRedLight(true),
273 speed =
MIN2(speed, vSafe);
276 speed =
MIN2(speed, vMax);
279 speed =
MAX2(speed, vMin);
294 const unsigned int destinationLaneIndex =
myLaneTimeLine[1].second;
295 if (destinationLaneIndex < (
unsigned int)currentEdge.
getLanes().size()) {
296 if (currentLaneIndex > destinationLaneIndex) {
298 }
else if (currentLaneIndex < destinationLaneIndex) {
324 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
332 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
353 switch (changeRequest) {
484 (*i)->resetPartialOccupation(
this);
489 if ((*i).myLink != 0) {
490 (*i).myLink->removeApproaching(
this);
532 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
533 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
537 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
542 "' is too high for the vehicle type '" + type->
getID() +
"'.");
555 if ((*i).myLink != 0) {
556 (*i).myLink->removeApproaching(
this);
599 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
600 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
603 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
608 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
667 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
669 if (myTraceMoveReminders) {
670 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
676 if (myTraceMoveReminders) {
677 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
692 rem->second += oldLaneLength;
694 if (myTraceMoveReminders) {
695 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
728 if (offset == 0. && !changingLanes) {
754 #ifdef HAVE_INTERNAL_LANES 809 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
822 if (stop.
until != -1) {
823 stop.
until += untilOffset;
835 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
848 std::list<Stop>::iterator iter =
myStops.begin();
851 prevStopEdge =
myStops.back().edge;
852 prevStopPos =
myStops.back().endPos;
855 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
861 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
862 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
863 prevStopEdge = iter->edge;
864 prevStopPos = iter->endPos;
868 int index = stopPar.
index;
870 prevStopEdge = iter->edge;
871 prevStopPos = iter->endPos;
879 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
885 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
891 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
899 pos += (*myCurrEdge)->getLength();
911 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
916 std::list<Stop>::iterator iter2 = iter;
918 if (stop.
until >= 0 && iter2->until > stop.
until) {
924 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
960 return currentVelocity;
974 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
988 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
1021 bool busStopsMustHaveSpace =
true;
1027 busStopsMustHaveSpace =
false;
1030 bool containerStopsMustHaveSpace =
true;
1036 containerStopsMustHaveSpace =
false;
1041 && containerStopsMustHaveSpace &&
myLane == stop.
lane) {
1047 if (stop.
until >= 0) {
1067 return currentVelocity;
1074 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1075 result.push_back(*iter->edge);
1091 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1097 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1098 if ((*i).myLink != 0) {
1099 (*i).myLink->removeApproaching(
this);
1119 assert(bestLaneConts.size() > 0);
1120 #ifdef HAVE_INTERNAL_LANES 1121 bool hadNonInternal =
false;
1123 bool hadNonInternal =
true;
1128 unsigned int view = 0;
1130 bool slowedDownForMinor =
false;
1139 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
1145 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
1149 if (shadowLane != 0) {
1150 std::pair<const MSVehicle*, SUMOReal> shadowLeaderInfo = shadowLane->
getLeader(
this, lane->
getLength() - seen,
false);
1151 adaptToLeader(shadowLeaderInfo, seen, lastLink, shadowLane, v, vLinkPass);
1162 if (lastLink != 0) {
1165 v =
MIN2(v, stopSpeed);
1172 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1181 if (lastLink != 0) {
1190 if (lastLink != 0) {
1219 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
1230 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1232 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1236 if (yellowOrRed && seen >= brakeDist) {
1243 #ifdef HAVE_INTERNAL_LANES 1247 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1249 const MSVehicle* leader = (*it).vehAndGap.first;
1253 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1254 }
else if ((*link)->isLeader(
this, leader)) {
1255 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1256 if (lastLink != 0) {
1268 vLinkWait =
MIN2(vLinkWait, v);
1272 if (lastLink != 0) {
1279 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel() && brakeDist < seen) {
1282 slowedDownForMinor =
true;
1287 const SUMOReal accelTime = (arrivalSpeed - v) / accel;
1288 const SUMOReal accelWay = accelTime * (arrivalSpeed + v) * 0.5;
1305 arrivalSpeedBraking = arrivalSpeed;
1312 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1313 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1316 arrivalTime, arrivalSpeed,
1317 arrivalTimeBraking, arrivalSpeedBraking,
1320 #ifdef HAVE_INTERNAL_LANES 1321 if ((*link)->getViaLane() == 0) {
1322 hadNonInternal =
true;
1329 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1333 lane = (*link)->getViaLaneOrLane();
1345 lastLink = &lfLinks.back();
1356 if (leaderInfo.first != 0) {
1358 if (lastLink != 0) {
1361 v =
MIN2(v, vsafeLeader);
1362 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1370 assert(leaderInfo.first != 0);
1373 if (leaderInfo.second >= 0) {
1374 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1380 if (distToCrossing >= 0) {
1390 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1405 DriveItemVector::iterator i;
1407 MSLink* link = (*i).myLink;
1409 if (link != 0 && (*i).mySetRequest) {
1415 vSafe = (*i).myVLinkWait;
1422 const bool influencerPrio =
false;
1426 std::vector<const SUMOVehicle*> collectFoes;
1427 const bool opened = yellow || influencerPrio ||
1428 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1435 vSafe = (*i).myVLinkWait;
1454 vSafe = (*i).myVLinkPass;
1460 vSafeZipper =
MIN2(vSafeZipper,
1461 link->
getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
1463 vSafe = (*i).myVLinkWait;
1471 vSafe = (*i).myVLinkWait;
1488 vSafe =
MIN2(vSafe, vSafeZipper);
1525 brakelightsOn =
true;
1531 if (brakelightsOn) {
1551 std::vector<MSLane*> passedLanes;
1553 passedLanes.push_back(*i);
1555 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1556 passedLanes.push_back(
myLane);
1559 std::string emergencyReason =
" for unknown reasons";
1572 MSLink* link = (*i).myLink;
1583 emergencyReason =
" because of a red traffic light";
1590 emergencyReason =
" because there is no connection to the next edge";
1594 if (approachedLane !=
myLane && approachedLane != 0) {
1599 #ifdef HAVE_INTERNAL_LANES 1602 if (link->getViaLane() == 0) {
1613 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1624 passedLanes.push_back(approachedLane);
1630 (*i)->resetPartialOccupation(
this);
1637 +
"'" + emergencyReason
1646 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1647 while (leftLength > 0 && i != passedLanes.rend()) {
1649 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1675 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1677 foundStopped =
true;
1678 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1682 lengths += (*i)->getVehicleType().getLengthWithGap();
1691 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1696 #ifdef HAVE_INTERNAL_LANES 1698 bool hadVehicle =
false;
1699 SUMOReal seenSpace = -lengthsInFront;
1701 bool foundStopped =
false;
1704 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1707 if (item.
myLink == 0 || foundStopped) {
1713 const MSLane* approachedLane = item.
myLink->getViaLane();
1714 if (approachedLane != 0) {
1738 foundStopped =
true;
1741 seenSpace += approachedLane->
getLength();
1755 foundStopped =
true;
1763 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1769 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
1771 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
1779 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1780 if (!opened && item.
myLink != 0) {
1784 allowsContinuation =
true;
1788 if (allowsContinuation) {
1794 int removalBegin = -1;
1795 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1809 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1816 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
1824 while (removalBegin < (
int)(lfLinks.size())) {
1826 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1828 lfLinks[removalBegin].mySetRequest =
false;
1837 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1838 if ((*i).myLink != 0) {
1842 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1843 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
1853 if (rem->first->getLane() != 0 && rem->second > 0.) {
1855 if (myTraceMoveReminders) {
1856 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1861 if (rem->first->notifyEnter(*
this, reason)) {
1863 if (myTraceMoveReminders) {
1864 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1870 if (myTraceMoveReminders) {
1871 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1901 if (!onTeleporting) {
1935 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1968 MSLane* clane = enteredLane;
1969 while (leftLength > 0) {
1971 if (clane == 0 || clane ==
myLane) {
1975 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1984 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1986 if (myTraceMoveReminders) {
1987 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1993 if (myTraceMoveReminders) {
1994 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
2004 (*i)->resetPartialOccupation(
this);
2036 const std::vector<MSVehicle::LaneQ>&
2044 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2050 if (startLane == 0) {
2053 assert(startLane != 0);
2071 std::vector<LaneQ>& lanes = *it;
2072 assert(lanes.size() > 0);
2073 if (&(lanes[0].lane->getEdge()) == nextEdge) {
2075 std::vector<LaneQ> oldLanes = lanes;
2077 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
2078 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
2079 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
2080 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
2081 lanes.push_back(*it_lane);
2088 for (
int i = 0; i < (int)lanes.size(); ++i) {
2089 if (i + lanes[i].bestLaneOffset < 0) {
2090 lanes[i].bestLaneOffset = -i;
2092 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
2093 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
2095 assert(i + lanes[i].bestLaneOffset >= 0);
2096 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
2097 if (lanes[i].bestContinuations[0] != 0) {
2099 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
2101 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
2104 assert(&(lanes[i].lane->getEdge()) == nextEdge);
2117 myLastBestLanesEdge = &startLane->
getEdge();
2121 const MSEdge* nextStopEdge = 0;
2122 const MSLane* nextStopLane = 0;
2126 nextStopLane = nextStop.
lane;
2127 nextStopEdge = &nextStopLane->
getEdge();
2135 if (nextStopEdge != 0) {
2144 bool progress =
true;
2146 std::vector<LaneQ> currentLanes;
2147 const std::vector<MSLane*>* allowed = 0;
2148 const MSEdge* nextEdge = 0;
2150 nextEdge = *(ce + 1);
2153 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2154 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2162 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2165 currentLanes.push_back(q);
2168 if (nextStopEdge == *ce) {
2170 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2171 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2172 (*q).allowsContinuation =
false;
2173 (*q).length = nextStopPos;
2174 (*q).currentLength = (*q).length;
2181 seenLength += currentLanes[0].lane->getLength();
2183 progress &= (seen <= 4 || seenLength < 3000);
2184 progress &= seen <= 8;
2196 int bestThisIndex = 0;
2199 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2200 if ((*j).length > bestLength) {
2201 bestLength = (*j).length;
2202 bestThisIndex = index;
2206 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2207 if ((*j).length < bestLength) {
2208 (*j).bestLaneOffset = bestThisIndex - index;
2214 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2215 std::vector<LaneQ>& nextLanes = (*(i - 1));
2216 std::vector<LaneQ>& clanes = (*i);
2217 MSEdge& cE = clanes[0].lane->getEdge();
2221 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2222 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2223 bestConnectedLength = (*j).length;
2225 if (bestLength < (*j).length) {
2226 bestLength = (*j).length;
2230 int bestThisIndex = 0;
2231 if (bestConnectedLength > 0) {
2233 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2234 LaneQ bestConnectedNext;
2235 bestConnectedNext.
length = -1;
2236 if ((*j).allowsContinuation) {
2237 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2238 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2239 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2240 bestConnectedNext = *m;
2245 (*j).
length += bestLength;
2247 (*j).length += bestConnectedNext.
length;
2252 if (clanes[bestThisIndex].length < (*j).length
2253 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))
2254 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) ==
abs((*j).bestLaneOffset) &&
2257 bestThisIndex = index;
2263 int bestNextIndex = 0;
2264 int bestDistToNeeded = (int) clanes.size();
2266 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2267 if ((*j).allowsContinuation) {
2269 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2270 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2271 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2272 bestDistToNeeded =
abs((*m).bestLaneOffset);
2273 bestThisIndex = index;
2274 bestNextIndex = nextIndex;
2280 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2281 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2286 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2287 if ((*j).length < clanes[bestThisIndex].length
2288 || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))
2291 (*j).bestLaneOffset = bestThisIndex - index;
2294 (*j).length = (*j).currentLength;
2297 (*j).bestLaneOffset = 0;
2308 if (conts.size() < 2) {
2324 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2325 std::vector<LaneQ>::iterator i;
2326 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2328 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2329 nextOccupation += (*j)->getBruttoVehLenSum();
2331 (*i).nextOccupation = nextOccupation;
2332 if ((*i).lane == startLane) {
2339 const std::vector<MSLane*>&
2344 return (*myCurrentLaneInBestLanes).bestContinuations;
2348 const std::vector<MSLane*>&
2359 if ((*i).lane == lane) {
2360 return (*i).bestContinuations;
2372 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2379 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2380 assert(laneIndex < (
int)preb.size());
2381 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2399 if (
isOnRoad() && destEdge != NULL) {
2413 std::pair<const MSVehicle* const, SUMOReal>
2416 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2423 assert(vehs.size() > 0);
2424 MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(),
this);
2425 if (it != vehs.end() && it + 1 != vehs.end()) {
2429 std::pair<const MSVehicle* const, SUMOReal> result(lead,
2443 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2444 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2507 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2508 if (numExpected != 0) {
2513 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2515 if (numExpected == 0) {
2529 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2530 if (numExpected != 0) {
2531 myStops.front().awaitedContainers.erase(container->
getID());
2532 numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2534 if (numExpected == 0) {
2541 const std::vector<MSTransportable*>&
2551 const std::vector<MSTransportable*>&
2592 switch ((*link)->getDirection()) {
2612 if (currentTime % 1000 == 0) {
2654 unsigned int view = 1;
2657 while (!lane->
isLinkEnd(link) && seen <= dist) {
2660 || !(*link)->havePriority())) {
2664 if ((*di).myLink != 0) {
2665 const MSLane* diPredLane = (*di).myLink->getApproachingLane();
2666 if (diPredLane != 0) {
2677 const SUMOTime leaveTime = (*link)->getLeaveTime((*di).myArrivalTime, (*di).myArrivalSpeed,
2679 if ((*link)->hasApproachingFoe((*di).myArrivalTime, leaveTime, (*di).myArrivalSpeed,
getCarFollowModel().getMaxDecel())) {
2686 lane = (*link)->getViaLaneOrLane();
2701 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
2703 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2704 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
2705 if (duration == 0 && !iter->reached) {
2708 iter->duration = duration;
2719 newStop.
until = until;
2724 const bool result =
addStop(newStop, errorMsg);
2734 const bool triggered,
const bool containerTriggered,
const bool isContainerStop, std::string& errorMsg) {
2736 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2737 const Named*
const stop = isContainerStop ? (
Named*)iter->containerstop : iter->busstop;
2738 if (stop != 0 && stop->
getID() == stopId) {
2739 if (duration == 0 && !iter->reached) {
2742 iter->duration = duration;
2750 if (isContainerStop) {
2754 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2761 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2766 newStop.
until = until;
2774 const bool result =
addStop(newStop, errorMsg);
2794 if (
myStops.front().busstop != 0) {
2796 myStops.front().busstop->leaveFrom(
this);
2799 if (
myStops.front().containerstop != 0) {
2801 myStops.front().containerstop->leaveFrom(
this);
2861 std::vector<SUMOTime> internals;
2874 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2876 unsigned int routeOffset;
2881 myDeparture -= offset;
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos)
Inserts the given vehicle at the given position.
void resetRoutePosition(unsigned int index)
bool signalSet(int which) const
Returns whether the given signal is on.
SUMOReal getZipperSpeed(const MSVehicle *ego, const SUMOReal dist, SUMOReal vSafe, SUMOTime arrivalTime, std::vector< const SUMOVehicle * > *collectFoes) const
return the speed at which ego vehicle must approach the zipper link
void setAngle(SUMOReal angle)
Set a custom vehicle angle in rad.
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.
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
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.
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
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) ...
LaneChangeMode myRightDriveLC
changing to the rightmost lane
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
SUMOReal getMaxSpeed() const
Returns the maximum speed.
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.
static const SUMOReal ZIPPER_ADAPT_DIST
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
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
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) ...
The car-following model abstraction.
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
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)
SUMOReal currentLength
The length which may be driven on this lane.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
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 implicitDeltaPosVTD(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new VTD position ...
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
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).
const MSRoute & getRoute() const
Returns the current route.
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.
WaitingTimeCollector myWaitingTimeCollector
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.
SUMOTime myMemorySize
the maximal memory to store
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
int myArrivalLane
The destination lane where the vehicle stops.
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
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.
This is an uncontrolled, zipper-merge link.
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.
WaitingTimeCollector(SUMOTime memory=MSGlobals::gWaitingTimeMemory)
Constructor.
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.
SUMOReal nextOccupation
As occupation, but without the first lane.
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
SUMOTime getMemorySize() const
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
WaitingTimeCollector & operator=(const WaitingTimeCollector &wt)
Assignment operator.
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 !=.
static std::vector< MSTransportable * > myEmptyTransportableVector
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
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.
SUMOReal computeAngle() const
compute the current vehicle angle
void setVTDControlled(MSLane *l, SUMOReal pos, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
SUMOReal implicitSpeedVTD(const MSVehicle *veh, SUMOReal oldSpeed)
return the speed that is implicit in the new VTD position
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
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
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.
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
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.
SUMOReal myAngle
the angle (
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.
SUMOReal myOriginalSpeed
The velocity before influence.
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
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
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.
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
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".
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge) const
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
void addTransportable(MSTransportable *transportable)
Add a passenger.
A blue emergency light is on.
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.
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)
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
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.
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
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.
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
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.
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
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.
ConstMSEdgeVector myVTDRoute
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.
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
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.
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into, const bool isContainer)
Build devices for the given vehicle, if needed.
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...
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
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.
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...
bool fixPosition()
repair errors in vehicle position after changing between internal edges
void passTime(SUMOTime dt, bool waiting)
bool isLaneChangeMidpointPassed() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
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.
void onDepart()
Called when the vehicle is inserted into the network.
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
MSRouteIterator edge
The edge in the route to stop at.
const waitingIntervalList & getWaitingIntervals() const
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.
waitingIntervalList myWaitingIntervals
std::vector< DriveProcessItem > DriveItemVector
std::vector< std::pair< SUMOTime, unsigned int > > myLaneTimeLine
The lane usage time line to apply.
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.
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.
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
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 !!!
unsigned int size() const
Return the number of passengers / containers.
No information given; use default.
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)
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
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.
public emergency vehicles
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.
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.
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
bool isVTDAffected(SUMOTime t) const
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.
int getBestLaneOffset() const
returns the current offset from the best lane
SUMOReal angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
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.
static const SUMOTime NOT_YET_DEPARTED
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
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
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