81 #include <mesosim/MESegment.h>
82 #include <mesosim/MELoop.h>
86 #ifdef CHECK_MEMORY_LEAKS
88 #endif // CHECK_MEMORY_LEAKS
91 #ifdef DEBUG_VEHICLE_GUI_SELECTION
98 #define BUS_STOP_OFFSET 0.5
100 #define CRLL_LOOK_AHEAD 5
103 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0
133 return (myPos != state.
myPos ||
145 myPos(pos), mySpeed(speed) {}
153 mySpeedAdaptationStarted(true),
154 myConsiderSafeVelocity(true),
155 myConsiderMaxAcceleration(true),
156 myConsiderMaxDeceleration(true),
157 myRespectJunctionPriority(true),
158 myEmergencyBrakeRedLight(true),
159 myAmVTDControlled(false),
174 mySpeedAdaptationStarted =
true;
175 mySpeedTimeLine = speedTimeLine;
181 myLaneTimeLine = laneTimeLine;
188 myOriginalSpeed = speed;
190 while (mySpeedTimeLine.size() == 1 || (mySpeedTimeLine.size() > 1 && currentTime > mySpeedTimeLine[1].first)) {
191 mySpeedTimeLine.erase(mySpeedTimeLine.begin());
194 if (mySpeedTimeLine.size() < 2 || currentTime < mySpeedTimeLine[0].first) {
198 if (!mySpeedAdaptationStarted) {
199 mySpeedTimeLine[0].second = speed;
200 mySpeedAdaptationStarted =
true;
204 speed = mySpeedTimeLine[0].second - (mySpeedTimeLine[0].second - mySpeedTimeLine[1].second) * td;
205 if (myConsiderSafeVelocity) {
206 speed =
MIN2(speed, vSafe);
208 if (myConsiderMaxAcceleration) {
209 speed =
MIN2(speed, vMax);
211 if (myConsiderMaxDeceleration) {
212 speed =
MAX2(speed, vMin);
221 while (myLaneTimeLine.size() == 1 || (myLaneTimeLine.size() > 1 && currentTime > myLaneTimeLine[1].first)) {
222 myLaneTimeLine.erase(myLaneTimeLine.begin());
226 if (myLaneTimeLine.size() >= 2 && currentTime >= myLaneTimeLine[0].first) {
227 const unsigned int destinationLaneIndex = myLaneTimeLine[1].second;
228 if (destinationLaneIndex < (
unsigned int)currentEdge.
getLanes().size()) {
229 if (currentLaneIndex > destinationLaneIndex) {
231 }
else if (currentLaneIndex < destinationLaneIndex) {
243 mode = myStrategicLC;
245 mode = myCooperativeLC;
247 mode = mySpeedGainLC;
249 mode = myRightDriveLC;
257 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
265 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
286 switch (changeRequest) {
302 assert(myLaneTimeLine.size() >= 2);
303 assert(currentTime >= myLaneTimeLine[0].first);
304 return STEPS2TIME(myLaneTimeLine[1].first - currentTime);
310 myConsiderSafeVelocity = value;
316 myConsiderMaxAcceleration = value;
322 myConsiderMaxDeceleration = value;
328 myRespectJunctionPriority = value;
334 myEmergencyBrakeRedLight = value;
352 if (myVTDRoute.size() != 0) {
356 if (myVTDPos > myVTDLane->getLength()) {
357 myVTDPos = myVTDLane->getLength();
359 myVTDLane->forceVehicleInsertion(v, myVTDPos);
361 myAmVTDControlled =
false;
375 (*i)->resetPartialOccupation(
this);
379 if ((*i).myLink != 0) {
380 (*i).myLink->removeApproaching(
this);
417 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
418 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
422 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
427 "' is too high for the vehicle type '" + type->
getID() +
"'.");
440 if ((*i).myLink != 0) {
441 (*i).myLink->removeApproaching(
this);
484 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
485 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
488 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
493 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
552 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
554 if (myTraceMoveReminders) {
555 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
561 if (myTraceMoveReminders) {
562 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
577 rem->second += oldLaneLength;
579 if (myTraceMoveReminders) {
580 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
613 if (offset == 0. && !changingLanes) {
636 #ifdef HAVE_INTERNAL_LANES
667 atan2(p1.
x() - p2.
x(), p2.
y() - p1.
y()) * 180. /
M_PI :
683 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
696 if (stop.
until != -1) {
697 stop.
until += untilOffset;
709 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
722 std::list<Stop>::iterator iter =
myStops.begin();
725 prevStopEdge =
myStops.back().edge;
726 prevStopPos =
myStops.back().endPos;
729 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
735 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
736 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
737 prevStopEdge = iter->edge;
738 prevStopPos = iter->endPos;
742 int index = stopPar.
index;
744 prevStopEdge = iter->edge;
745 prevStopPos = iter->endPos;
753 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
759 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
765 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
773 pos += (*myCurrEdge)->getLength();
785 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is behind departPos.";
790 std::list<Stop>::iterator iter2 = iter;
792 if (stop.
until >= 0 && iter2->until > stop.
until) {
798 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
834 return currentVelocity;
848 for (std::vector<MSPerson*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
862 for (std::vector<MSContainer*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
895 bool busStopsMustHaveSpace =
true;
901 busStopsMustHaveSpace =
false;
904 bool containerStopsMustHaveSpace =
true;
910 containerStopsMustHaveSpace =
false;
915 && containerStopsMustHaveSpace &&
myLane == stop.
lane) {
921 if (stop.
until >= 0) {
941 return currentVelocity;
948 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
949 result.push_back(*iter->edge);
965 #ifdef DEBUG_VEHICLE_GUI_SELECTION
971 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
972 if ((*i).myLink != 0) {
973 (*i).myLink->removeApproaching(
this);
997 assert(bestLaneConts.size() > 0);
998 #ifdef HAVE_INTERNAL_LANES
999 bool hadNonInternal =
false;
1001 bool hadNonInternal =
true;
1006 unsigned int view = 0;
1016 std::pair<const MSVehicle*, SUMOReal> leaderInfo = std::make_pair(pred, gap);
1022 adaptToLeader(leaderInfo, seen, lastLink, lane, v, vLinkPass);
1031 if (lastLink != 0) {
1034 v =
MIN2(v, stopSpeed);
1041 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1050 if (lastLink != 0) {
1059 if (lastLink != 0) {
1088 (*link)->getViaLaneOrLane()->getParallelLane(-
getLaneChangeModel().getLaneChangeDirection()) == 0)) {
1090 const SUMOReal va = seen / timeRemaining;
1095 bool setRequest = v > 0;
1098 if (yellowOrRed && seen >= brakeDist) {
1105 #ifdef HAVE_INTERNAL_LANES
1108 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1110 const MSVehicle* leader = (*it).vehAndGap.first;
1114 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1115 }
else if (leader->myLinkLeaders[(*link)->getJunction()].count(
getID()) == 0) {
1117 myLinkLeaders[(*link)->getJunction()].insert(leader->
getID());
1118 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1119 if (lastLink != 0) {
1131 vLinkWait =
MIN2(vLinkWait, v);
1134 if (lastLink != 0) {
1141 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel() && brakeDist < seen) {
1148 const SUMOReal accelTime = (arrivalSpeed - v) / accel;
1149 const SUMOReal accelWay = accelTime * (arrivalSpeed + v) * 0.5;
1166 arrivalSpeedBraking = arrivalSpeed;
1173 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1174 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1177 arrivalTime, arrivalSpeed,
1178 arrivalTimeBraking, arrivalSpeedBraking,
1181 #ifdef HAVE_INTERNAL_LANES
1182 if ((*link)->getViaLane() == 0) {
1183 hadNonInternal =
true;
1190 if (!setRequest || ((v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD)) {
1194 lane = (*link)->getViaLaneOrLane();
1206 lastLink = &lfLinks.back();
1217 if (leaderInfo.first != 0) {
1219 if (lastLink != 0) {
1222 v =
MIN2(v, vsafeLeader);
1223 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1231 assert(leaderInfo.first != 0);
1234 if (leaderInfo.second >= 0) {
1235 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1241 if (distToCrossing >= 0) {
1251 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1272 DriveItemVector::iterator i;
1274 MSLink* link = (*i).myLink;
1276 if (link != 0 && (*i).mySetRequest) {
1282 vSafe = (*i).myVLinkWait;
1289 const bool influencerPrio =
false;
1293 const bool opened = yellow || influencerPrio ||
1294 link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1300 vSafe = (*i).myVLinkWait;
1319 vSafe = (*i).myVLinkPass;
1325 vSafe = (*i).myVLinkWait;
1333 vSafe = (*i).myVLinkWait;
1398 std::vector<MSLane*> passedLanes;
1400 passedLanes.push_back(*i);
1402 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1403 passedLanes.push_back(
myLane);
1406 std::string emergencyReason =
" for unknown reasons";
1419 MSLink* link = (*i).myLink;
1430 emergencyReason =
" because of a red traffic light";
1437 emergencyReason =
" because there is no connection to the next edge";
1441 if (approachedLane !=
myLane && approachedLane != 0) {
1449 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1454 #ifdef HAVE_INTERNAL_LANES
1456 if (link->getViaLane() == 0) {
1466 passedLanes.push_back(approachedLane);
1472 (*i)->resetPartialOccupation(
this);
1493 std::vector<MSLane*>::reverse_iterator i = passedLanes.rbegin() + 1;
1494 while (leftLength > 0 && i != passedLanes.rend()) {
1496 leftLength -= (*i)->setPartialOccupation(
this, leftLength);
1518 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1520 foundStopped =
true;
1521 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
1525 lengths += (*i)->getVehicleType().getLengthWithGap();
1534 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1542 #ifdef HAVE_INTERNAL_LANES
1544 bool hadVehicle =
false;
1545 SUMOReal seenSpace = -lengthsInFront;
1547 bool foundStopped =
false;
1550 for (
unsigned int i = 0; i < lfLinks.size(); ++i) {
1553 if (item.
myLink == 0 || foundStopped) {
1559 const MSLane* approachedLane = item.
myLink->getViaLane();
1560 if (approachedLane != 0) {
1584 foundStopped =
true;
1587 seenSpace += approachedLane->
getLength();
1601 foundStopped =
true;
1609 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1615 for (
int i = (
int)(lfLinks.size() - 1); i > 0; --i) {
1617 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
1625 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
1626 if (!opened && item.
myLink != 0) {
1630 allowsContinuation =
true;
1634 if (allowsContinuation) {
1640 int removalBegin = -1;
1641 for (
unsigned int i = 0; hadVehicle && i < lfLinks.size() && removalBegin < 0; ++i) {
1655 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
1662 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes()) {
1670 while (removalBegin < (
int)(lfLinks.size())) {
1672 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
1674 lfLinks[removalBegin].mySetRequest =
false;
1683 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
1684 if ((*i).myLink != 0) {
1688 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1689 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime());
1698 if (rem->first->getLane() != 0 && rem->first->getLane() !=
getLane()) {
1700 if (myTraceMoveReminders) {
1701 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
1706 if (rem->first->notifyEnter(*
this, reason)) {
1708 if (myTraceMoveReminders) {
1709 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
1715 if (myTraceMoveReminders) {
1716 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
1746 if (!onTeleporting) {
1783 while (i != route.
begin() && leftLength > 0) {
1790 leftLength -= (lane)->setPartialOccupation(
this, leftLength);
1831 MSLane* clane = enteredLane;
1832 while (leftLength > 0) {
1838 leftLength -= (clane)->setPartialOccupation(
this, leftLength);
1846 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
1848 if (myTraceMoveReminders) {
1849 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
1855 if (myTraceMoveReminders) {
1856 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
1864 (*i)->resetPartialOccupation(
this);
1895 const std::vector<MSVehicle::LaneQ>&
1903 #ifdef DEBUG_VEHICLE_GUI_SELECTION
1909 if (startLane == 0) {
1912 assert(startLane != 0);
1930 std::vector<LaneQ>& lanes = *it;
1931 assert(lanes.size() > 0);
1932 if (&(lanes[0].lane->getEdge()) == nextEdge) {
1934 std::vector<LaneQ> oldLanes = lanes;
1936 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
1937 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
1938 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
1939 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
1940 lanes.push_back(*it_lane);
1947 for (
int i = 0; i < (int)lanes.size(); ++i) {
1948 if (i + lanes[i].bestLaneOffset < 0) {
1949 lanes[i].bestLaneOffset = -i;
1951 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
1952 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
1954 assert(i + lanes[i].bestLaneOffset >= 0);
1955 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
1956 if (lanes[i].bestContinuations[0] != 0) {
1958 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
1960 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
1963 assert(&(lanes[i].lane->getEdge()) == nextEdge);
1976 myLastBestLanesEdge = &startLane->
getEdge();
1980 const MSEdge* nextStopEdge = 0;
1981 const MSLane* nextStopLane = 0;
1985 nextStopLane = nextStop.
lane;
1986 nextStopEdge = &nextStopLane->
getEdge();
1994 if (nextStopEdge != 0) {
2003 bool progress =
true;
2005 std::vector<LaneQ> currentLanes;
2006 const std::vector<MSLane*>* allowed = 0;
2007 const MSEdge* nextEdge = 0;
2009 nextEdge = *(ce + 1);
2012 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2013 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2020 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2021 currentLanes.push_back(q);
2024 if (nextStopEdge == *ce) {
2026 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2027 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2028 (*q).allowsContinuation =
false;
2029 (*q).length = nextStopPos;
2036 seenLength += currentLanes[0].lane->getLength();
2038 progress &= (seen <= 4 || seenLength < 3000);
2039 progress &= seen <= 8;
2051 int bestThisIndex = 0;
2054 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2055 if ((*j).length > bestLength) {
2056 bestLength = (*j).length;
2057 bestThisIndex = index;
2061 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2062 if ((*j).length < bestLength) {
2063 (*j).bestLaneOffset = bestThisIndex - index;
2070 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2071 std::vector<LaneQ>& nextLanes = (*(i - 1));
2072 std::vector<LaneQ>& clanes = (*i);
2073 MSEdge& cE = clanes[0].lane->getEdge();
2077 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2078 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2079 bestConnectedLength = (*j).length;
2081 if (bestLength < (*j).length) {
2082 bestLength = (*j).length;
2086 int bestThisIndex = 0;
2087 if (bestConnectedLength > 0) {
2089 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2090 LaneQ bestConnectedNext;
2091 bestConnectedNext.
length = -1;
2092 if ((*j).allowsContinuation) {
2093 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2094 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2095 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2096 bestConnectedNext = *m;
2101 (*j).
length += bestLength;
2103 (*j).length += bestConnectedNext.
length;
2107 if (clanes[bestThisIndex].length < (*j).length || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))) {
2108 bestThisIndex = index;
2114 int bestNextIndex = 0;
2115 int bestDistToNeeded = (int) clanes.size();
2117 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2118 if ((*j).allowsContinuation) {
2120 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2121 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2122 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2123 bestDistToNeeded =
abs((*m).bestLaneOffset);
2124 bestThisIndex = index;
2125 bestNextIndex = nextIndex;
2131 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2132 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2137 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2138 if ((*j).length < clanes[bestThisIndex].length || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))) {
2139 (*j).bestLaneOffset = bestThisIndex - index;
2141 (*j).bestLaneOffset = 0;
2152 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2153 std::vector<LaneQ>::iterator i;
2154 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2156 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2157 nextOccupation += (*j)->getBruttoVehLenSum();
2159 (*i).nextOccupation = nextOccupation;
2160 if ((*i).lane == startLane) {
2167 const std::vector<MSLane*>&
2172 return (*myCurrentLaneInBestLanes).bestContinuations;
2176 const std::vector<MSLane*>&
2187 if ((*i).lane == lane) {
2188 return (*i).bestContinuations;
2200 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2207 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2208 assert(laneIndex < (
int)preb.size());
2209 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2226 #ifdef DEBUG_VEHICLE_GUI_SELECTION
2231 if (
isOnRoad() && destEdge != NULL) {
2245 std::pair<const MSVehicle* const, SUMOReal>
2248 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2255 MSLane::VehCont::const_iterator pred = std::find(vehs.begin(), vehs.end(),
this) + 1;
2256 if (pred != vehs.end()) {
2271 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2272 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2329 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2330 if (numExpected != 0) {
2335 numExpected = (
unsigned int)
myStops.front().awaitedPersons.size();
2337 if (numExpected == 0) {
2351 unsigned int numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2352 if (numExpected != 0) {
2353 myStops.front().awaitedContainers.erase(container->
getID());
2354 numExpected = (
unsigned int)
myStops.front().awaitedContainers.size();
2356 if (numExpected == 0) {
2388 switch ((*link)->getDirection()) {
2433 bool parking,
bool triggered,
bool containerTriggered, std::string& errorMsg) {
2435 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
2436 if (iter->lane == lane && fabs(iter->endPos - pos) <
POSITION_EPS) {
2437 if (duration == 0 && !iter->reached) {
2440 iter->duration = duration;
2458 const bool result =
addStop(newStop, errorMsg);
2478 if (
myStops.front().busstop != 0) {
2480 myStops.front().busstop->leaveFrom(
this);
2483 if (
myStops.front().containerstop != 0) {
2485 myStops.front().containerstop->leaveFrom(
this);
2545 std::vector<int> internals;
2558 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
2560 unsigned int routeOffset;
2565 myDeparture -= offset;
void resetRoutePosition(unsigned int index)
bool signalSet(int which) const
Returns whether the given signal is on.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
const std::string & getID() const
returns the person id
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].
void addContainer(MSContainer *container)
Add a container.
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOReal speed() const
Speed of this state.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void removePerson(MSPerson *p)
Removes a person from this stop.
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
const SUMOReal SUMO_const_laneWidth
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Current lane's move reminder.
SUMOReal myArrivalPos
the position on the destination lane where the vehicle stops
const MSEdge * myLastBestLanesEdge
std::string containerstop
(Optional) container stop if one is assigned to the stop
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
MSAbstractLaneChangeModel * myLaneChangeModel
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
std::vector< std::vector< LaneQ > > myBestLanes
bool parking
whether the vehicle is removed from the net while stopping
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
void endLaneChangeManeuver()
SUMOReal getEndLanePosition() const
Returns the end position of this container stop.
const Position geometryPositionAtOffset(SUMOReal offset) const
DriveItemVector myLFLinkLanes
Container for used Links/visited Lanes during lookForward.
SUMOReal pos() const
Position of this state.
bool resumeFromStopping()
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
bool hasInfluencer() const
SUMOTime duration
The stopping duration.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
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()
SUMOReal getLeaveSpeed() const
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
SUMOReal getBeginLanePosition() const
Returns the begin position of this container stop.
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.
std::string getContainerStopID(const MSLane *lane, const SUMOReal pos) const
Returns the container stop close to the given position.
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 getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
Changes the wished vehicle speed / lanes.
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
bool reached
Information whether the stop has been reached.
void registerEmergencyStop()
register emergency stop
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
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
const MSRoute * myRoute
This Vehicle's route.
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)
MSContainerStop * getContainerStop(const std::string &id) const
Returns the named container stop.
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 number of persons in the vehicle.
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
std::vector< const MSEdge * > ConstMSEdgeVector
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
SUMOReal getEndLanePosition() const
Returns the end position of this bus stop.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
The action is due to a TraCI request.
A storage for edge travel times and efforts.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
SUMOReal x() const
Returns the x-position.
This is an uncontrolled, all-way stop link.
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
The action is urgent (to be defined by lc-model)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
std::string getBusStopID(const MSLane *lane, const SUMOReal pos) const
Returns the bus stop close to the given position.
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge ¤tEdge, const unsigned int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
The link is a (hard) left direction.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, unsigned int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
#define WRITE_WARNING(msg)
SUMOReal getBeginLanePosition() const
Returns the begin position of this bus stop.
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)
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.
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
bool operator!=(const State &state)
Operator !=.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
Position getPositionAtDistance(SUMOReal offset) const
MSLane * lane
The described lane.
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
SUMOReal getLength() const
return the length of the edge
Left blinker lights are switched on.
MSLane * getLogicalPredecessorLane() const
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.
unsigned int getContainerNumber() const
Returns the number of containers.
static MSDevice_Container * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
SUMOReal startPos
The stopping position start.
The edge is a district edge.
std::pair< MSVehicle *const, SUMOReal > getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the immediate leader and the distance to him.
The vehicle got a new route.
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
vehicle want's to change to right lane
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, unsigned int > > &laneTimeLine)
Sets a new lane timeline.
ChangeRequest
Requests set via TraCI.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
A point in 2D or 3D with translation and scaling methods.
SUMOReal endPos
The stopping position end.
bool loadAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
MSLane * getLane() const
Returns the connected lane.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
void addPerson(MSPerson *person)
Add a passenger.
virtual MSContainerControl & getContainerControl()
Returns the container control.
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
static void clear()
Clears the dictionary.
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
Position myCachedPosition
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MSLane * lane
The lane to stop at.
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
bool triggered
whether an arriving person lets the vehicle continue
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
bool contains(const MSEdge *const edge) const
unsigned int size() const
Return the number of containers.
bool isStopped() const
Returns whether the vehicle is at a stop.
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
std::pair< MSVehicle *, SUMOReal > getLastVehicleInformation() const
Returns the last vehicle which is still on the lane.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
void adaptLeaveSpeed(const SUMOReal v)
MSLane * myLane
The lane the vehicle is on.
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
const ConstMSEdgeVector & getEdges() const
SUMOReal getSafeFollowSpeed(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
compute safe speed for following the given leader
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
SUMOTime duration
The stopping duration.
bool isRoundabout() const
MSVehicle()
invalidated default constructor
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
The link is a (hard) right direction.
virtual SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap2pred) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
std::vector< LinkLeader > LinkLeaders
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
A structure representing the best lanes for continuing the route.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
bool addTraciStop(MSLane *lane, SUMOReal pos, SUMOReal radius, SUMOTime duration, bool parking, bool triggered, bool containerTriggered, std::string &errorMsg)
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.
const std::vector< MSPerson * > & getPersons() const
Returns the list of persons using this vehicle.
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
MSBusStop * getBusStop(const std::string &id) const
Returns the named bus stop.
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
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)
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.
The link is a partial right direction.
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
void addReference() const
increments the reference counter for the route
bool isParking() const
Returns whether the vehicle is parking.
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
SUMOReal getLaneChangeCompletion() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
bool containerTriggered
whether an arriving container lets the vehicle continue
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Container that holds the vehicles driving state (position+speed).
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
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.
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
MSEdgeWeightsStorage & _getWeightsStorage() const
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false)
Replaces the current route by the given edges.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void leaveLane(const MSMoveReminder::Notification reason)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
unsigned int getVehicleNumber() const
Returns the number of vehicles on this lane.
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
const MSJunction * getJunction() const
return the junction to which this link belongs
void removeContainer(MSContainer *container)
Removes a container from this stop.
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
void registerOneWaitingForContainer()
increases the count of vehicles waiting for a container to allow recogniztion of container related de...
vehicle want's to change to left lane
The action is needed to follow the route (navigational lc)
The vehicle starts or ends parking.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
LaneChangeModel getLaneChangeModel() const
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void setTentativeLaneAndPosition(MSLane *lane, const SUMOReal pos)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Structure representing possible vehicle parameter.
bool havePriority() const
Returns whether this link is a major link.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
static SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
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
MSContainerStop * containerstop
(Optional) container stop if one is assigned to the stop
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
void addContainer(MSContainer *container)
Adds a container.
Definition of vehicle stop (position and duration)
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
SUMOReal y() const
Returns the y-position.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
void adaptToLeader(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
The action is due to the default of keeping right "Rechtsfahrgebot".
The link has red light (must brake)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime until
The time at which the vehicle may continue its journey.
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
int index
at which position in the stops list
void calculateArrivalPos()
(Re-)Calculates the arrival position from the vehicle parameters
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
MSRouteIterator edge
The edge in the route to stop at.
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge)
const std::vector< MSContainer * > & getContainers() const
Returns the list of containers using this vehicle.
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.
const std::string & getID() const
returns the container id
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()
MSBusStop * busstop
(Optional) bus stop if one is assigned to the stop
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
std::vector< DriveProcessItem > DriveItemVector
void planMove(const SUMOTime t, const MSVehicle *pred, const SUMOReal lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal endPos
The stopping position end.
void move2side(SUMOReal amount)
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
vehicle want's to keep the current lane
LinkState getState() const
Returns the current state of the link.
bool hasValidRoute(std::string &msg) const
Validates the current route.
MSVehicle * getPartialOccupator() const
Returns the vehicle which laps into this lane.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
void switchOnSignal(int signal)
Switches the given signal on.
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 MSLinkCont & getLinkCont() const
returns the container with all links !!!
No information given; use default.
The link has yellow light, has to brake anyway.
unsigned int containerNumber
The number of containers in the vehicle.
void release() const
deletes the route if there are no further references to it
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
The edge is an internal edge.
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
static SUMOTime gLaneChangeDuration
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
void addPerson(MSPerson *person)
Adds a passenger.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
SUMOReal startPos
The stopping position start.
GUISelectedStorage gSelected
A global holder of selected objects.
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
Representation of a lane in the micro simulation.
MSDevice_Container * myContainerDevice
The containers this vehicle may have.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
unsigned int size() const
Return the number of passengers.
The link has red light (must brake) but indicates upcoming green.
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, std::vector< const SUMOVehicle * > *collectFoes=0) const
Returns the information whether the link may be passed.
unsigned int getRoutePosition() const
Interface for lane-change models.
MSDevice_Person * myPersonDevice
The passengers this vehicle may have.
int getBestLaneOffset() const
returns the current offset from the best lane
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
SUMOTime myDeparture
The real departure time.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
The vehicle is being teleported.
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
const std::string & getID() const
Returns the name of the vehicle.
The action is due to the wish to be faster (tactical lc)
unsigned int getLaneIndex() const