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 148 mySpeedAdaptationStarted(true),
149 myConsiderSafeVelocity(true),
150 myConsiderMaxAcceleration(true),
151 myConsiderMaxDeceleration(true),
152 myRespectJunctionPriority(true),
153 myEmergencyBrakeRedLight(true),
154 myAmVTDControlled(false),
201 speed =
MIN2(speed, vSafe);
204 speed =
MIN2(speed, vMax);
207 speed =
MAX2(speed, vMin);
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) {
252 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
260 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
281 switch (changeRequest) {
388 (*i)->resetPartialOccupation(
this);
393 if ((*i).myLink != 0) {
394 (*i).myLink->removeApproaching(
this);
431 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
432 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
436 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
441 "' is too high for the vehicle type '" + type->
getID() +
"'.");
454 if ((*i).myLink != 0) {
455 (*i).myLink->removeApproaching(
this);
498 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
499 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
502 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
507 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
566 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
568 if (myTraceMoveReminders) {
569 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
575 if (myTraceMoveReminders) {
576 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
591 rem->second += oldLaneLength;
593 if (myTraceMoveReminders) {
594 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
627 if (offset == 0. && !changingLanes) {
653 #ifdef HAVE_INTERNAL_LANES 703 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
716 if (stop.
until != -1) {
717 stop.
until += untilOffset;
729 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
742 std::list<Stop>::iterator iter =
myStops.begin();
745 prevStopEdge =
myStops.back().edge;
746 prevStopPos =
myStops.back().endPos;
749 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
755 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
756 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
757 prevStopEdge = iter->edge;
758 prevStopPos = iter->endPos;
762 int index = stopPar.
index;
764 prevStopEdge = iter->edge;
765 prevStopPos = iter->endPos;
773 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
779 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
785 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
793 pos += (*myCurrEdge)->getLength();
805 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
810 std::list<Stop>::iterator iter2 = iter;
812 if (stop.
until >= 0 && iter2->until > stop.
until) {
818 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
854 return currentVelocity;
868 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
882 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
915 bool busStopsMustHaveSpace =
true;
921 busStopsMustHaveSpace =
false;
924 bool containerStopsMustHaveSpace =
true;
930 containerStopsMustHaveSpace =
false;
935 && containerStopsMustHaveSpace &&
myLane == stop.
lane) {
941 if (stop.
until >= 0) {
961 return currentVelocity;
968 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
969 result.push_back(*iter->edge);
985 #ifdef DEBUG_VEHICLE_GUI_SELECTION 991 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
992 if ((*i).myLink != 0) {
993 (*i).myLink->removeApproaching(
this);
1013 assert(bestLaneConts.size() > 0);
1014 #ifdef HAVE_INTERNAL_LANES 1015 bool hadNonInternal =
false;
1017 bool hadNonInternal =
true;
1022 unsigned int view = 0;
1024 bool slowedDownForMinor =
false;
1033 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
1039 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
1043 if (shadowLane != 0) {
1044 std::pair<const MSVehicle*, SUMOReal> shadowLeaderInfo = shadowLane->
getLeader(
this, lane->
getLength() - seen,
false);
1045 adaptToLeader(shadowLeaderInfo, seen, lastLink, shadowLane, v, vLinkPass);
1056 if (lastLink != 0) {
1059 v =
MIN2(v, stopSpeed);
1066 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1075 if (lastLink != 0) {
1084 if (lastLink != 0) {
1113 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
1124 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1126 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1130 if (yellowOrRed && seen >= brakeDist) {
1137 #ifdef HAVE_INTERNAL_LANES 1141 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1143 const MSVehicle* leader = (*it).vehAndGap.first;
1147 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1148 }
else if ((*link)->isLeader(
this, leader)) {
1149 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1150 if (lastLink != 0) {
1162 vLinkWait =
MIN2(vLinkWait, v);
1166 if (lastLink != 0) {
1173 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel() && brakeDist < seen) {
1176 slowedDownForMinor =
true;
1181 const SUMOReal accelTime = (arrivalSpeed - v) / accel;
1182 const SUMOReal accelWay = accelTime * (arrivalSpeed + v) * 0.5;
1199 arrivalSpeedBraking = arrivalSpeed;
1206 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1207 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1210 arrivalTime, arrivalSpeed,
1211 arrivalTimeBraking, arrivalSpeedBraking,
1214 #ifdef HAVE_INTERNAL_LANES 1215 if ((*link)->getViaLane() == 0) {
1216 hadNonInternal =
true;
1223 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1227 lane = (*link)->getViaLaneOrLane();
1239 lastLink = &lfLinks.back();
1250 if (leaderInfo.first != 0) {
1252 if (lastLink != 0) {
1255 v =
MIN2(v, vsafeLeader);
1256 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1264 assert(leaderInfo.first != 0);
1267 if (leaderInfo.second >= 0) {
1268 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1274 if (distToCrossing >= 0) {
1284 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1299 DriveItemVector::iterator i;
1301 MSLink* link = (*i).myLink;
1303 if (link != 0 && (*i).mySetRequest) {
1309 vSafe = (*i).myVLinkWait;
1316 const bool influencerPrio =
false;
1320 std::vector<const SUMOVehicle*> collectFoes;
1321 const bool opened = yellow || influencerPrio ||
1322 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1329 vSafe = (*i).myVLinkWait;
1348 vSafe = (*i).myVLinkPass;
1354 vSafeZipper =
MIN2(vSafeZipper,
1355 link->
getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
1357 vSafe = (*i).myVLinkWait;
1365 vSafe = (*i).myVLinkWait;
1382 vSafe =
MIN2(vSafe, vSafeZipper);
1438 std::vector<MSLane*> passedLanes;
1440 passedLanes.push_back(*i);
1442 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1443 passedLanes.push_back(
myLane);
1446 std::string emergencyReason =
" for unknown reasons";
1459 MSLink* link = (*i).myLink;
1470 emergencyReason =
" because of a red traffic light";
1477 emergencyReason =
" because there is no connection to the next edge";
1481 if (approachedLane !=
myLane && approachedLane != 0) {
1486 #ifdef HAVE_INTERNAL_LANES 1489 if (link->getViaLane() == 0) {
1500 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1511 passedLanes.push_back(approachedLane);
1517 (*i)->resetPartialOccupation(
this);
1524 +
"'" + emergencyReason
1533 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1534 while (leftLength > 0 && i != passedLanes.rend()) {
1536 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1562 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1564 foundStopped =
true;
1565 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1569 lengths += (*i)->getVehicleType().getLengthWithGap();
1578 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1583 #ifdef HAVE_INTERNAL_LANES 1585 bool hadVehicle =
false;
1586 SUMOReal seenSpace = -lengthsInFront;
1588 bool foundStopped =
false;
1591 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1594 if (item.
myLink == 0 || foundStopped) {
1600 const MSLane* approachedLane = item.
myLink->getViaLane();
1601 if (approachedLane != 0) {
1625 foundStopped =
true;
1628 seenSpace += approachedLane->
getLength();
1642 foundStopped =
true;
1650 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1656 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
1658 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
1666 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1667 if (!opened && item.
myLink != 0) {
1671 allowsContinuation =
true;
1675 if (allowsContinuation) {
1681 int removalBegin = -1;
1682 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1696 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1703 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
1711 while (removalBegin < (
int)(lfLinks.size())) {
1713 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1715 lfLinks[removalBegin].mySetRequest =
false;
1724 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1725 if ((*i).myLink != 0) {
1729 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1730 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
1739 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1741 if (myTraceMoveReminders) {
1742 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1747 if (rem->first->notifyEnter(*
this, reason)) {
1749 if (myTraceMoveReminders) {
1750 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1756 if (myTraceMoveReminders) {
1757 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1787 if (!onTeleporting) {
1821 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1848 MSLane* clane = enteredLane;
1849 while (leftLength > 0) {
1855 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1863 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1865 if (myTraceMoveReminders) {
1866 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1872 if (myTraceMoveReminders) {
1873 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1883 (*i)->resetPartialOccupation(
this);
1915 const std::vector<MSVehicle::LaneQ>&
1923 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1929 if (startLane == 0) {
1932 assert(startLane != 0);
1950 std::vector<LaneQ>& lanes = *it;
1951 assert(lanes.size() > 0);
1952 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1954 std::vector<LaneQ> oldLanes = lanes;
1956 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1957 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1958 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1959 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1960 lanes.push_back(*it_lane);
1967 for (
int i = 0; i < (int)lanes.size(); ++i) {
1968 if (i + lanes[i].bestLaneOffset < 0) {
1969 lanes[i].bestLaneOffset = -i;
1971 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1972 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
1974 assert(i + lanes[i].bestLaneOffset >= 0);
1975 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1976 if (lanes[i].bestContinuations[0] != 0) {
1978 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1980 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1983 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1996 myLastBestLanesEdge = &startLane->
getEdge();
2000 const MSEdge* nextStopEdge = 0;
2001 const MSLane* nextStopLane = 0;
2005 nextStopLane = nextStop.
lane;
2006 nextStopEdge = &nextStopLane->
getEdge();
2014 if (nextStopEdge != 0) {
2023 bool progress =
true;
2025 std::vector<LaneQ> currentLanes;
2026 const std::vector<MSLane*>* allowed = 0;
2027 const MSEdge* nextEdge = 0;
2029 nextEdge = *(ce + 1);
2032 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2033 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2040 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2041 currentLanes.push_back(q);
2044 if (nextStopEdge == *ce) {
2046 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2047 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2048 (*q).allowsContinuation =
false;
2049 (*q).length = nextStopPos;
2056 seenLength += currentLanes[0].lane->getLength();
2058 progress &= (seen <= 4 || seenLength < 3000);
2059 progress &= seen <= 8;
2071 int bestThisIndex = 0;
2074 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2075 if ((*j).length > bestLength) {
2076 bestLength = (*j).length;
2077 bestThisIndex = index;
2081 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2082 if ((*j).length < bestLength) {
2083 (*j).bestLaneOffset = bestThisIndex - index;
2090 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2091 std::vector<LaneQ>& nextLanes = (*(i - 1));
2092 std::vector<LaneQ>& clanes = (*i);
2093 MSEdge& cE = clanes[0].lane->getEdge();
2097 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2098 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2099 bestConnectedLength = (*j).length;
2101 if (bestLength < (*j).length) {
2102 bestLength = (*j).length;
2106 int bestThisIndex = 0;
2107 if (bestConnectedLength > 0) {
2109 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2110 LaneQ bestConnectedNext;
2111 bestConnectedNext.
length = -1;
2112 if ((*j).allowsContinuation) {
2113 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2114 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2115 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2116 bestConnectedNext = *m;
2121 (*j).
length += bestLength;
2123 (*j).length += bestConnectedNext.
length;
2127 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
2128 bestThisIndex = index;
2134 int bestNextIndex = 0;
2135 int bestDistToNeeded = (int) clanes.size();
2137 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2138 if ((*j).allowsContinuation) {
2140 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2141 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2142 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2143 bestDistToNeeded =
abs((*m).bestLaneOffset);
2144 bestThisIndex = index;
2145 bestNextIndex = nextIndex;
2151 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2152 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2157 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2158 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2159 (*j).bestLaneOffset = bestThisIndex - index;
2161 (*j).bestLaneOffset = 0;
2172 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2173 std::vector<LaneQ>::iterator i;
2174 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2176 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2177 nextOccupation += (*j)->getBruttoVehLenSum();
2179 (*i).nextOccupation = nextOccupation;
2180 if ((*i).lane == startLane) {
2187 const std::vector<MSLane*>&
2192 return (*myCurrentLaneInBestLanes).bestContinuations;
2196 const std::vector<MSLane*>&
2207 if ((*i).lane == lane) {
2208 return (*i).bestContinuations;
2220 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2227 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2228 assert(laneIndex < (
int)preb.size());
2229 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2247 if (
isOnRoad() && destEdge != NULL) {
2261 std::pair<const MSVehicle* const, SUMOReal>
2264 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2271 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2272 if (pred != vehs.end()) {
2287 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2288 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2345 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2346 if (numExpected != 0) {
2351 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2353 if (numExpected == 0) {
2367 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2368 if (numExpected != 0) {
2369 myStops.front().awaitedContainers.erase(container->
getID());
2370 numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2372 if (numExpected == 0) {
2410 switch ((*link)->getDirection()) {
2430 if (currentTime % 1000 == 0) {
2466 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
2468 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2469 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
2470 if (duration == 0 && !iter->reached) {
2473 iter->duration = duration;
2484 newStop.
until = until;
2489 const bool result =
addStop(newStop, errorMsg);
2499 const bool triggered,
const bool containerTriggered,
const bool isContainerStop, std::string& errorMsg) {
2501 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2502 const Named*
const stop = isContainerStop ? (
Named*)iter->containerstop : iter->busstop;
2503 if (stop != 0 && stop->
getID() == stopId) {
2504 if (duration == 0 && !iter->reached) {
2507 iter->duration = duration;
2515 if (isContainerStop) {
2519 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2526 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
2531 newStop.
until = until;
2539 const bool result =
addStop(newStop, errorMsg);
2559 if (
myStops.front().busstop != 0) {
2561 myStops.front().busstop->leaveFrom(
this);
2564 if (
myStops.front().containerstop != 0) {
2566 myStops.front().containerstop->leaveFrom(
this);
2626 std::vector<SUMOTime> internals;
2639 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2641 unsigned int routeOffset;
2646 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
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.
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.
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.
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)
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).
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.
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 position on 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.
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 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.
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)
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.
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
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.
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
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.
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".
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
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.
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)
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.
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.
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.
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 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.
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
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.
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)
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.
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.
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 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
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.
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