73 #ifdef CHECK_MEMORY_LEAKS 75 #endif // CHECK_MEMORY_LEAKS 81 #define DEBUG_COND (getID() == "disabled") 82 #define DEBUG_COND2(obj) ((obj != 0 && (obj)->getID() == "disabled")) 182 for (MSLinkCont::iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
205 (*veh)->addReminder(rem);
214 std::cout <<
SIMTIME <<
" setPartialOccupation. lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
227 std::cout <<
SIMTIME <<
" resetPartialOccupation. lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
267 const bool adaptSpeed =
false;
275 if (leaderBack >= frontGapNeeded) {
285 bool adaptableSpeed =
true;
294 if (missingRearGap > 0) {
295 if (minPos + missingRearGap <=
myLength) {
302 return isInsertionSuccess(&veh, mspeed, minPos + missingRearGap, 0, adaptableSpeed, notification);
316 if (leaderPos >= frontGapNeeded) {
326 MSLane::VehCont::iterator predIt =
myVehicles.begin();
338 if (adaptableSpeed && leader != 0) {
347 frontMax = leaderRearPos - frontGapNeeded;
355 if (frontMax > minPos && backMin +
POSITION_EPS < frontMax) {
401 bool patchSpeed =
true;
417 for (
int i = 0; i < 10; i++) {
451 for (
int i = 0; i < 10; i++) {
488 if (nspeed < speed) {
490 speed =
MIN2(nspeed, speed);
493 if (errorMsg !=
"") {
494 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (" + errorMsg +
")!");
511 aVehicle->
getID() +
"'. Inserting at lane end instead.");
518 std::vector<MSLane*>::const_iterator ri = bestLaneConts.begin();
524 MSLane* currentLane =
this;
527 while (seen < dist && ri != bestLaneConts.end()) {
529 MSLinkCont::const_iterator link =
succLinkSec(*aVehicle, nRouteSuccs, *currentLane, bestLaneConts);
535 patchSpeed,
"arrival speed too low")) {
543 patchSpeed,
"junction too close")) {
551 || !(*link)->havePriority()) {
553 std::string errorMsg =
"";
554 const LinkState state = (*link)->getState();
560 errorMsg =
"unpriorised junction too close";
563 patchSpeed, errorMsg)) {
570 nextLane = (*link)->getViaLaneOrLane();
585 if (
checkFailure(aVehicle, speed, dist, nspeed, patchSpeed,
"")) {
587 #ifdef DEBUG_INSERTION 589 <<
" isInsertionSuccess lane=" <<
getID()
590 <<
" veh=" << aVehicle->
getID()
592 <<
" posLat=" << posLat
593 <<
" patchSpeed=" << patchSpeed
594 <<
" speed=" << speed
595 <<
" nspeed=" << nspeed
596 <<
" nextLane=" << nextLane->
getID()
597 <<
" lead=" << leader->
getID()
599 <<
" failed (@641)!\n";
606 if (nspeed < speed) {
612 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (slow lane ahead)!");
621 if ((*link)->hasApproachingFoe(arrivalTime, leaveTime, speed, cfModel.
getMaxDecel())) {
629 currentLane = nextLane;
630 #ifdef HAVE_INTERNAL_LANES 631 if ((*link)->getViaLane() == 0) {
646 if (nspeed < 0 ||
checkFailure(aVehicle, speed, dist, nspeed, patchSpeed,
"")) {
648 #ifdef DEBUG_INSERTION 650 <<
" isInsertionSuccess lane=" <<
getID()
651 <<
" veh=" << aVehicle->
getID()
653 <<
" posLat=" << posLat
654 <<
" patchSpeed=" << patchSpeed
655 <<
" speed=" << speed
656 <<
" nspeed=" << nspeed
657 <<
" nextLane=" << nextLane->
getID()
658 <<
" leaders=" << leaders.
toString()
659 <<
" failed (@700)!\n";
665 for (
int i = 0; i < followers.
numSublanes(); ++i) {
666 const MSVehicle* follower = followers[i].first;
669 if (followers[i].second < backGapNeeded) {
671 #ifdef DEBUG_INSERTION 673 <<
" isInsertionSuccess lane=" <<
getID()
674 <<
" veh=" << aVehicle->
getID()
676 <<
" posLat=" << posLat
677 <<
" patchSpeed=" << patchSpeed
678 <<
" speed=" << speed
679 <<
" nspeed=" << nspeed
680 <<
" follower=" << follower->
getID()
681 <<
" backGapNeeded=" << backGapNeeded
682 <<
" gap=" << followers[i].second
683 <<
" failure (@719)!\n";
693 if (missingRearGap > 0) {
695 #ifdef DEBUG_INSERTION 697 <<
" isInsertionSuccess lane=" <<
getID()
698 <<
" veh=" << aVehicle->
getID()
700 <<
" posLat=" << posLat
701 <<
" patchSpeed=" << patchSpeed
702 <<
" speed=" << speed
703 <<
" nspeed=" << nspeed
704 <<
" missingRearGap=" << missingRearGap
705 <<
" failure (@728)!\n";
712 #ifdef DEBUG_INSERTION 714 <<
" isInsertionSuccess lane=" <<
getID()
715 <<
" veh=" << aVehicle->
getID()
717 <<
" posLat=" << posLat
718 <<
" patchSpeed=" << patchSpeed
719 <<
" speed=" << speed
720 <<
" nspeed=" << nspeed
721 <<
" failed (@733)!\n";
727 #ifdef DEBUG_INSERTION 729 <<
" isInsertionSuccess lane=" <<
getID()
730 <<
" veh=" << aVehicle->
getID()
732 <<
" posLat=" << posLat
733 <<
" patchSpeed=" << patchSpeed
734 <<
" speed=" << speed
735 <<
" nspeed=" << nspeed
761 nspeed =
MIN2(nspeed,
775 int freeSublanes = 1;
780 while (freeSublanes > 0 && veh != 0) {
781 #ifdef DEBUG_PLAN_MOVE 783 std::cout <<
" getLastVehicleInformation lane=" <<
getID() <<
" minPos=" << minPos <<
" veh=" << veh->
getID() <<
" pos=" << veh->
getPositionOnLane(
this) <<
"\n";
789 #ifdef DEBUG_PLAN_MOVE 797 if (ego == 0 && minPos == 0) {
802 #ifdef DEBUG_PLAN_MOVE 827 int freeSublanes = 1;
829 while (freeSublanes > 0 && veh != 0) {
830 #ifdef DEBUG_PLAN_MOVE 832 std::cout <<
" veh=" << veh->
getID() <<
" pos=" << veh->
getPositionOnLane(
this) <<
" maxPos=" << maxPos <<
"\n";
839 #ifdef DEBUG_PLAN_MOVE 841 std::cout <<
" veh=" << veh->
getID() <<
" latOffset=" << latOffset <<
"\n";
853 #ifdef DEBUG_PLAN_MOVE 879 VehCont::reverse_iterator veh =
myVehicles.rbegin();
881 #ifdef DEBUG_PLAN_MOVE 885 <<
" planMovements lane=" <<
getID()
893 && ((*vehPart)->getPositionOnLane(
this) > (*veh)->getPositionOnLane())) {
894 const SUMOReal latOffset = (*vehPart)->getLatOffset(
this);
895 #ifdef DEBUG_PLAN_MOVE 897 std::cout <<
" partial ahead: " << (*vehPart)->getID() <<
" latOffset=" << latOffset <<
"\n";
900 ahead.
addLeader(*vehPart,
false, latOffset);
903 #ifdef DEBUG_PLAN_MOVE 905 std::cout <<
" plan move for: " << (*veh)->getID() <<
" ahead=" << ahead.
toString() <<
"\n";
908 (*veh)->planMove(t, ahead, cumulatedVehLength);
909 cumulatedVehLength += (*veh)->getVehicleType().getLengthWithGap();
930 std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess> toRemove;
931 std::set<const MSVehicle*> toTeleport;
934 VehCont::iterator lastVeh =
myVehicles.end() - 1;
935 for (VehCont::iterator veh =
myVehicles.begin(); veh != lastVeh; ++veh) {
936 VehCont::iterator pred = veh + 1;
956 if (lead == follow) {
974 if (lead != 0 && lead != follow && shadowLane->
detectCollisionBetween(timestep, stage, follow, lead, toRemove, toTeleport)) {
985 const std::vector<const MSLane*>& foeLanes =
myLinks.front()->getFoeLanes();
990 for (std::vector<const MSLane*>::const_iterator it = foeLanes.begin(); it != foeLanes.end(); ++it) {
991 const MSLane* foeLane = *it;
1008 for (std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess>::iterator it = toRemove.begin(); it != toRemove.end(); ++it) {
1012 if (toTeleport.count(veh) > 0) {
1024 std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess>& toRemove,
1025 std::set<const MSVehicle*>& toTeleport)
const {
1057 && victim->
getLane() !=
this) {
1070 SUMOReal gap,
SUMOReal latGap, std::set<const MSVehicle*, SUMOVehicle::ComparatorIdLess>& toRemove,
1071 std::set<const MSVehicle*>& toTeleport)
const {
1075 prefix =
"Vehicle '" + collider->
getID() +
"'; collision with vehicle '" + victim->
getID() ;
1078 prefix =
"Teleporting vehicle '" + collider->
getID() +
"'; collision with vehicle '" + victim->
getID() ;
1079 toRemove.insert(collider);
1080 toTeleport.insert(collider);
1083 prefix =
"Removing collision participants: vehicle '" + collider->
getID() +
"', vehicle '" + victim->
getID();
1084 bool removeCollider =
true;
1085 bool removeVictim =
true;
1090 toRemove.insert(victim);
1092 if (removeCollider) {
1093 toRemove.insert(collider);
1095 if (!removeVictim) {
1096 if (!removeCollider) {
1097 prefix =
"Keeping remote-controlled collision participants: vehicle '" + collider->
getID() +
"', vehicle '" + victim->
getID();
1099 prefix =
"Removing collision participant: vehicle '" + collider->
getID() +
"', keeping remote-controlled vehicle '" + victim->
getID();
1101 }
else if (!removeCollider) {
1102 prefix =
"Keeping remote-controlled collision participant: vehicle '" + collider->
getID() +
"', removing vehicle '" + victim->
getID();
1105 toRemove.insert(victim);
1106 toRemove.insert(collider);
1114 +
"', lane='" +
getID()
1116 + (latGap == 0 ?
"" :
"', latGap=" +
toString(latGap))
1118 +
" stage=" + stage +
".");
1142 }
else if (target != 0 && moved) {
1153 lanesWithVehiclesToIntegrate.push_back(target);
1162 WRITE_WARNING(
"Teleporting vehicle '" + veh->
getID() +
"'; beyond end of lane, target lane='" +
getID() +
"', time=" +
1173 i = VehCont::reverse_iterator(
myVehicles.erase(i.base()));
1184 const bool minorLink = !wrongLane && (link !=
myLinks.end()) && !((*link)->havePriority());
1185 const std::string reason = (wrongLane ?
" (wrong lane)" : (minorLink ?
" (yield)" :
" (jam)"));
1192 + (r2 ?
" (highway)" :
"")
1196 }
else if (minorLink) {
1208 lanesWithVehiclesToIntegrate.push_back(
this);
1227 DictType::iterator it =
myDict.find(
id);
1228 if (it ==
myDict.end()) {
1230 myDict.insert(DictType::value_type(
id, ptr));
1239 DictType::iterator it =
myDict.find(
id);
1240 if (it ==
myDict.end()) {
1250 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
1259 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
1260 into.push_back((*i).first);
1265 template<
class RTREE>
void 1267 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
1271 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
1272 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
1273 into.Insert(cmin, cmax, l);
1277 template void MSLane::fill<NamedRTree>(
NamedRTree& into);
1297 return (link !=
myLinks.end());
1308 assert(veh->
getLane() ==
this);
1322 return wasInactive &&
myVehicles.size() != 0;
1395 MSLinkCont::const_iterator
1397 const MSLane& succLinkSource,
const std::vector<MSLane*>& conts) {
1400 if (nRouteEdge == 0) {
1402 return succLinkSource.
myLinks.end();
1406 assert(succLinkSource.
myLinks.size() == 1);
1409 return succLinkSource.
myLinks.begin();
1419 MSLinkCont::const_iterator link;
1420 if (nRouteSuccs < (
int)conts.size()) {
1422 for (link = succLinkSource.
myLinks.begin(); link != succLinkSource.
myLinks.end(); ++link) {
1423 if ((*link)->getLane() != 0 && (*link)->getLane()->myEdge == nRouteEdge && (*link)->getLane()->allowsVehicleClass(veh.
getVehicleType().
getVehicleClass())) {
1425 if ((*link)->getLane() == conts[nRouteSuccs]) {
1432 return succLinkSource.
myLinks.end();
1436 WRITE_WARNING(
"Could not find connection between lane '" + succLinkSource.
getID() +
"' and lane '" + conts[nRouteSuccs]->getID() +
1439 return succLinkSource.
myLinks.end();
1477 assert(remVehicle->
getLane() ==
this);
1479 if (remVehicle == *it) {
1517 WRITE_WARNING(
"Lane '" +
getID() +
"' is approached multiple times from edge '" + approachingEdge->
getID() +
"'. This may cause collisions.");
1531 std::map<MSEdge*, std::vector<MSLane*> >::const_iterator i =
myApproachingLanes.find(edge);
1535 const std::vector<MSLane*>& lanes = (*i).second;
1536 return find(lanes.begin(), lanes.end(), lane) != lanes.end();
1542 inline int operator()(
const std::pair<const MSVehicle*, SUMOReal>& p1,
const std::pair<const MSVehicle*, SUMOReal>& p2)
const {
1543 return p1.second < p2.second;
1554 std::pair<MSVehicle* const, SUMOReal> followerInfo =
getFollowerOnConsecutive(backOffset, leaderSpeed, leaderMaxDecel);
1572 std::pair<MSVehicle* const, SUMOReal>
1582 #ifdef DEBUG_CONTEXT 1584 <<
" backOffset=" << backOffset
1585 <<
" leaderSpeed=" << leaderSpeed
1589 std::pair<MSVehicle*, SUMOReal> result(static_cast<MSVehicle*>(0), -1);
1591 std::set<MSLane*> visited;
1592 std::vector<MSLane::IncomingLaneInfo> newFound;
1594 while (toExamine.size() != 0) {
1595 for (std::vector<MSLane::IncomingLaneInfo>::iterator i = toExamine.begin(); i != toExamine.end(); ++i) {
1596 MSLane* next = (*i).lane;
1597 #ifdef DEBUG_CONTEXT 1599 std::cout <<
SIMTIME <<
" nextLane=" << next->
getID() <<
"\n";
1611 if (!v->isFrontOnLane(next)) {
1612 agap = (*i).length - next->
getLength() + backOffset
1614 - v->getVehicleType().getMinGap();
1620 agap = (*i).length - v->
getPositionOnLane() + backOffset - v->getVehicleType().getMinGap();
1624 agap = (*i).length - v->getPositionOnLane() + backOffset - v->getVehicleType().getMinGap();
1626 #ifdef DEBUG_CONTEXT 1635 const SUMOReal missingRearGap = v->getCarFollowModel().getSecureGap(v->getSpeed(), leaderSpeed, leaderMaxDecel) - agap;
1636 if (missingRearGap > missingRearGapMax) {
1637 missingRearGapMax = missingRearGap;
1639 result.second = agap;
1642 if ((*i).length < dist) {
1643 const std::vector<MSLane::IncomingLaneInfo>& followers = next->
getIncomingLanes();
1644 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator j = followers.begin(); j != followers.end(); ++j) {
1645 if (visited.find((*j).lane) == visited.end()) {
1646 visited.insert((*j).lane);
1648 ili.
lane = (*j).lane;
1649 ili.
length = (*j).length + (*i).length;
1651 newFound.push_back(ili);
1658 swap(newFound, toExamine);
1663 std::pair<MSVehicle* const, SUMOReal>
1667 #ifdef DEBUG_CONTEXT 1672 if (checkTmpVehicles) {
1676 #ifdef DEBUG_CONTEXT 1678 std::cout <<
" getLeader lane=" <<
getID() <<
" ego=" << veh->
getID() <<
" egoPos=" << vehPos <<
" pred=" << pred->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
"\n";
1689 #ifdef DEBUG_CONTEXT 1691 std::cout <<
" getLeader lane=" <<
getID() <<
" ego=" << veh->
getID() <<
" egoPos=" << vehPos <<
" pred=" << pred->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
"\n";
1700 if (bestLaneConts.size() > 0) {
1706 #ifdef DEBUG_CONTEXT 1708 std::cout <<
" getLeader lane=" <<
getID() <<
" seen=" << seen <<
" dist=" << dist <<
"\n";
1712 return std::pair<MSVehicle* const, SUMOReal>(
static_cast<MSVehicle*
>(0), -1);
1716 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1721 std::pair<MSVehicle* const, SUMOReal>
1723 const std::vector<MSLane*>& bestLaneConts)
const {
1724 #ifdef DEBUG_CONTEXT 1726 std::cout <<
" getLeaderOnConsecutive lane=" <<
getID() <<
" ego=" << veh.
getID() <<
" seen=" << seen <<
" dist=" << dist <<
" conts=" <<
toString(bestLaneConts) <<
"\n";
1730 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1737 #ifdef DEBUG_CONTEXT 1744 const MSLane* nextLane =
this;
1747 nextLane->getVehiclesSecure();
1749 MSLinkCont::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
1750 if (nextLane->isLinkEnd(link) || !(*link)->opened(arrivalTime, speed, speed, veh.
getVehicleType().
getLength(),
1752 #ifdef DEBUG_CONTEXT 1754 std::cout <<
" cannot continue after nextLane=" << nextLane->getID() <<
"\n";
1757 nextLane->releaseVehicles();
1760 #ifdef HAVE_INTERNAL_LANES 1763 nextLane->releaseVehicles();
1764 if (linkLeaders.size() > 0) {
1767 #ifdef DEBUG_CONTEXT 1769 std::cout <<
" found linkLeader after nextLane=" << nextLane->getID() <<
"\n";
1772 return linkLeaders[0].vehAndGap;
1774 bool nextInternal = (*link)->getViaLane() != 0;
1776 nextLane = (*link)->getViaLaneOrLane();
1777 if (nextLane == 0) {
1780 nextLane->getVehiclesSecure();
1781 MSVehicle* leader = nextLane->getLastAnyVehicle();
1783 #ifdef DEBUG_CONTEXT 1785 std::cout <<
" found leader " << leader->
getID() <<
" on nextLane=" << nextLane->getID() <<
"\n";
1789 nextLane->releaseVehicles();
1790 return std::make_pair(leader, dist);
1792 nextLane->releaseVehicles();
1793 if (nextLane->getVehicleMaxSpeed(&veh) < speed) {
1796 seen += nextLane->getLength();
1801 #ifdef HAVE_INTERNAL_LANES 1802 if (!nextInternal) {
1808 }
while (seen <= dist);
1809 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1813 std::pair<MSVehicle* const, SUMOReal>
1816 std::pair<MSVehicle*, SUMOReal> result = std::make_pair(static_cast<MSVehicle*>(0), -1);
1822 const MSLane* nextLane =
this;
1826 MSLinkCont::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
1831 #ifdef HAVE_INTERNAL_LANES 1834 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1835 const MSVehicle* leader = (*it).vehAndGap.first;
1836 if (leader != 0 && leader != result.first) {
1841 if (tmpSpeed < safeSpeed) {
1842 safeSpeed = tmpSpeed;
1843 result = (*it).vehAndGap;
1847 bool nextInternal = (*link)->getViaLane() != 0;
1849 nextLane = (*link)->getViaLaneOrLane();
1850 if (nextLane == 0) {
1854 if (leader != 0 && leader != result.first) {
1857 if (tmpSpeed < safeSpeed) {
1858 safeSpeed = tmpSpeed;
1859 result = std::make_pair(leader, gap);
1870 #ifdef HAVE_INTERNAL_LANES 1871 if (!nextInternal) {
1877 }
while (seen <= dist);
1890 for (MSEdgeVector::iterator i = pred.begin(); i != pred.end();) {
1899 if (pred.size() != 0) {
1901 MSEdge* best = *pred.begin();
1913 MSLane* cand = (*i).lane;
1914 if (&(cand->
getEdge()) == &fromEdge) {
1933 std::vector<const MSLane*>
1935 std::vector<const MSLane*> result;
1936 for (MSLinkCont::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
1937 assert((*i)->getLane() != 0);
1938 result.push_back((*i)->getLane());
1960 for (MSLinkCont::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
1961 if ((*i)->getLane()->getEdge().isCrossing()) {
1962 return (
int)(i -
myLinks.begin());
2006 wtime += (*i)->getWaitingSeconds();
2019 for (VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2020 v += (*i)->getSpeed();
2032 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2033 ret += (*i)->getCO2Emissions();
2044 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2045 ret += (*i)->getCOEmissions();
2056 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2057 ret += (*i)->getPMxEmissions();
2068 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2069 ret += (*i)->getNOxEmissions();
2080 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2081 ret += (*i)->getHCEmissions();
2092 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2093 ret += (*i)->getFuelConsumption();
2104 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2105 ret += (*i)->getElectricityConsumption();
2116 if (vehs.size() == 0) {
2120 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2121 SUMOReal sv = (*i)->getHarmonoise_NoiseEmissions();
2122 ret += (
SUMOReal) pow(10., (sv / 10.));
2153 myLaneDir(e->getLanes()[0]->
getShape().angleAt2D(0)) {
2162 if (ae1 != 0 && ae1->size() != 0) {
2166 if (ae2 != 0 && ae2->size() != 0) {
2186 for (std::vector<std::string>::const_iterator it = vehIds.begin(); it != vehIds.end(); ++it) {
2199 #ifdef DEBUG_CONTEXT 2211 #ifdef DEBUG_CONTEXT 2221 #ifdef DEBUG_CONTEXT 2223 std::cout <<
" (1) added veh=" << veh->
getID() <<
" latOffset=" << latOffset <<
" result=" << result.
toString() <<
"\n";
2228 #ifdef DEBUG_CONTEXT 2230 std::cout <<
" result.numFreeSublanes=" << result.
numFreeSublanes() <<
"\n";
2234 const SUMOReal backOffset = ego->getBackPositionOnLane(ego->getLane());
2241 std::set<MSLane*> visited;
2242 std::vector<MSLane::IncomingLaneInfo> newFound;
2244 while (toExamine.size() != 0) {
2245 for (std::vector<MSLane::IncomingLaneInfo>::iterator it = toExamine.begin(); it != toExamine.end(); ++it) {
2246 MSLane* next = (*it).lane;
2250 #ifdef DEBUG_CONTEXT 2252 std::cout <<
" next=" << next->
getID() <<
" first=" << first.toString() <<
" firstFront=" << firstFront.
toString() <<
"\n";
2255 for (
int i = 0; i < first.numSublanes(); ++i) {
2258 if (v != 0 && v != ego) {
2265 agap = (*it).length - next->
getLength() + backOffset
2272 if (v != 0 && v != ego) {
2282 #ifdef DEBUG_CONTEXT 2289 if ((*it).length < dist) {
2290 const std::vector<MSLane::IncomingLaneInfo>& followers = next->
getIncomingLanes();
2291 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator j = followers.begin(); j != followers.end(); ++j) {
2292 if (visited.find((*j).lane) == visited.end()) {
2293 visited.insert((*j).lane);
2295 ili.
lane = (*j).lane;
2296 ili.
length = (*j).length + (*it).length;
2298 newFound.push_back(ili);
2304 swap(newFound, toExamine);
2329 const MSLane* nextLane =
this;
2335 MSLinkCont::const_iterator link =
succLinkSec(*ego, view, *nextLane, bestLaneConts);
2340 #ifdef HAVE_INTERNAL_LANES 2343 if (linkLeaders.size() > 0) {
2354 bool nextInternal = (*link)->getViaLane() != 0;
2356 nextLane = (*link)->getViaLaneOrLane();
2357 if (nextLane == 0) {
2362 #ifdef DEBUG_CONTEXT 2364 std::cout <<
SIMTIME <<
" getLeadersOnConsecutive lane=" <<
getID() <<
" nextLane=" << nextLane->
getID() <<
" leaders=" << leaders.
toString() <<
"\n";
2369 for (
int i = 0; i < iMax; ++i) {
2372 #ifdef DEBUG_CONTEXT 2392 #ifdef HAVE_INTERNAL_LANES 2393 if (!nextInternal) {
2411 #ifdef DEBUG_CONTEXT 2413 std::cout <<
SIMTIME <<
" getPartialBehind lane=" <<
getID() <<
" ego=" << ego->
getID() <<
" found=" << veh->
getID() <<
"\n";
2419 #ifdef DEBUG_CONTEXT 2440 if (opposite == 0) {
2442 throw ProcessError(
"Lane '" +
getID() +
"' cannot compute oppositePos as there is no opposite lane.");
2449 std::pair<MSVehicle* const, SUMOReal>
2454 #ifdef DEBUG_CONTEXT 2456 std::cout <<
" getFollower lane=" <<
getID() <<
" egoPos=" << egoPos <<
" pred=" << pred->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
"\n";
2468 std::pair<MSVehicle* const, SUMOReal>
2470 #ifdef DEBUG_OPPOSITE 2472 <<
" ego=" << ego->
getID()
2489 std::pair<MSVehicle* const, SUMOReal>
2491 #ifdef DEBUG_OPPOSITE 2493 <<
" ego=" << ego->
getID()
2503 if (result.second > 0) {
2505 return std::make_pair(static_cast<MSVehicle*>(0), -1);
2515 const std::string action = oc.
getString(
"collision.action");
2516 if (action ==
"none") {
2518 }
else if (action ==
"warn") {
2520 }
else if (action ==
"teleport") {
2522 }
else if (action ==
"remove") {
2525 throw ProcessError(
"Invalid collision.action '" + action +
"'.");
const std::map< SUMOVehicleClass, SUMOReal > * myRestrictions
The vClass speed restrictions for this lane.
void loadState(std::vector< std::string > &vehIDs, MSVehicleControl &vc)
Loads the state of this segment with the given parameters.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
SVCPermissions myPermissions
The vClass permissions for this lane.
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
saves leader/follower vehicles and their distances relative to an ego vehicle
MSEdge & getEdge() const
Returns the lane's edge.
A free lateral position is chosen.
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void descheduleDeparture(SUMOVehicle *veh)
stops trying to emit the given vehicle (and delete it)
At the leftmost side of the lane.
virtual std::string toString() const
print a debugging representation
std::pair< MSVehicle *, SUMOReal > vehAndGap
SUMOReal getWaitingSeconds() const
Returns the overall waiting time on this lane.
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
void setTentativeLaneAndPosition(MSLane *lane, SUMOReal pos, SUMOReal posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
int myI2
index for myPartialVehicles
std::pair< MSVehicle *const, SUMOReal > getOppositeFollower(const MSVehicle *ego) const
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, SUMOReal posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
bool hasInfluencer() const
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
SUMOReal getImpatience() const
Returns this vehicles impatience.
virtual SUMOReal insertionFollowSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const
Computes the vehicle's safe speed (no dawdling) This method is used during the insertion stage...
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
void registerTeleportYield()
register one non-collision-related teleport
const std::map< SUMOVehicleClass, SUMOReal > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
static void fill(RTREE &into)
Fills the given RTree with lane instances.
The vehicle arrived at a junction.
bool isVTDControlled() const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
SUMOReal ymin() const
Returns minimum y-coordinate.
void recalcCache()
Recalculates the cached values.
This is an uncontrolled, minor link, has to stop.
const MSEdge * getLastEdge() const
returns the destination edge
SUMOReal getLength() const
Returns the lane's length.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
std::vector< IncomingLaneInfo > myIncomingLanes
The car-following model abstraction.
int myI2End
end index for myPartialVehicles
void setLength(SUMOReal val)
Sets a new length for the lane (used by TraCI only)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void addLink(MSLink *link)
Delayed initialization.
int myIndex
The lane index.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
The lateral position is chosen randomly.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
MSVehicle * getFirstFullVehicle() const
returns the first vehicle for which this lane is responsible or 0
If a fixed number of random choices fails, a free lateral position is chosen.
SUMOReal xmin() const
Returns minimum x-coordinate.
Notification
Definition of a vehicle state.
static SUMOReal rand()
Returns a random real number in [0, 1)
std::string time2string(SUMOTime t)
SUMOReal getFuelConsumption() const
Returns the sum of last step fuel consumption.
A RT-tree for efficient storing of SUMO's Named objects.
SUMOReal getLength() const
Get vehicle's length [m].
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
const MSEdge *const myEdge
SUMOReal getWidth() const
Returns the lane's width.
SUMOReal getMaximumBrakeDist() const
compute maximum braking distance on this lane
void addIncomingLane(MSLane *lane, MSLink *viaLink)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)...
const MSRoute & getRoute() const
Returns the current route.
by_connections_to_sorter(const MSEdge *const e)
constructor
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
The speed is chosen randomly.
static void initCollisionOptions(const OptionsCont &oc)
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
bool hasDeparted() const
Returns whether this vehicle has already departed.
The vehicle got vaporized.
void leftByLaneChange(MSVehicle *v)
void getLeadersOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle *ego, const std::vector< MSLane * > &bestLaneConts, MSLeaderDistanceInfo &result) const
Returns the immediate leaders and the distance to them (as getLeaderOnConsecutive but for the sublane...
SUMOReal getSecureGap(const SUMOReal speed, const SUMOReal leaderSpeed, const SUMOReal leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum.
This is an uncontrolled, right-before-left link.
SUMOReal getElectricityConsumption() const
Returns the sum of last step electricity consumption.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
void addNeigh(const std::string &id)
Adds a neighbor to this lane.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
void gotActive(MSLane *l)
Informs the control that the given lane got active.
std::pair< MSVehicle *const, SUMOReal > getCriticalLeader(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
const SUMOReal myWidth
Lane width [m].
const MSEdgeVector & getIncomingEdges() const
Returns the list of edges from which this edge may be reached.
static SUMOReal angleDiff(const SUMOReal angle1, const SUMOReal angle2)
Returns the difference of the second angle to the first angle in radiants.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool freeInsertion(MSVehicle &veh, SUMOReal speed, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
The position is chosen randomly.
static bool myCheckJunctionCollisions
This is an uncontrolled, all-way stop link.
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
SUMOReal xmax() const
Returns maximum x-coordinate.
int myI1End
end index for myVehicles
A class that stores a 2D geometrical boundary.
int myDirection
index delta
PositionVector myShape
The shape of the lane.
#define WRITE_WARNING(msg)
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, bool allSublanes) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
bool myDownstream
iteration direction
MSAbstractLaneChangeModel & getLaneChangeModel()
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
std::vector< std::string > myNeighs
void setMaxSpeed(SUMOReal val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
static CollisionAction myCollisionAction
the action to take on collisions
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
SUMOReal getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
bool lastInsertion(MSVehicle &veh, SUMOReal mspeed)
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, SUMOReal posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
static DictType myDict
Static dictionary to associate string-ids with objects.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addApproachingLane(MSLane *lane, bool warnMultiCon)
const std::string & getID() const
Returns the id.
virtual const MSEdge * succEdge(int nSuccs) const =0
Returns the nSuccs'th successor of edge the vehicle is currently at.
A road/street connecting two junctions.
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
int numFreeSublanes() const
SUMOReal myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
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.
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
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.
const MSVehicle * operator*()
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
SUMOReal getMissingRearGap(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const
return by how much further the leader must be inserted to avoid rear end collisions ...
SUMOReal basePos(const MSVehicle &veh) const
departure position where the vehicle fits fully onto the lane (if possible)
Representation of a vehicle.
PositionVector getBoundingBox() const
get bounding rectangle
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
virtual int addLeader(const MSVehicle *veh, bool beyond, SUMOReal latOffset=0)
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
This is an uncontrolled, minor link, has to brake.
SUMOReal getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)
Sorts vehicles by their position (descending)
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
void enteredByLaneChange(MSVehicle *v)
SUMOReal getMaxSpeedFactor() const
return the maximum speed factor for all vehicles that ever entered the network
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
SUMOReal getMeanSpeed() const
Returns the mean speed on this lane.
ConstMSEdgeVector::const_iterator MSRouteIterator
PositionVector getBoundingPoly() const
get bounding polygon
The vehicle arrived at its destination (is deleted)
bool isStopped() const
Returns whether the vehicle is at a stop.
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, SUMOReal minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
The maximum speed is used.
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
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
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 getSpeedLimit() const
Returns the lane's maximum allowed speed.
No information given; use default.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
MSLane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, int index)
Constructor.
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
MSLane * myLogicalPredecessorLane
virtual int addLeader(const MSVehicle *veh, SUMOReal gap, SUMOReal latOffset=0, int sublane=-1)
Something on a lane to be noticed about vehicle movement.
SUMOReal myLength
Lane length [m].
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
virtual SUMOReal setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
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.
void registerTeleportJam()
register one non-collision-related teleport
void handleCollisionBetween(SUMOTime timestep, const std::string &stage, const MSVehicle *collider, const MSVehicle *victim, SUMOReal gap, SUMOReal latGap, std::set< const MSVehicle *, SUMOVehicle::ComparatorIdLess > &toRemove, std::set< const MSVehicle * > &toTeleport) const
take action upon collision
bool isInternal() const
return whether this edge is an internal edge
If a fixed number of random choices fails, a free position is chosen.
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.
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
const std::string & getEdgeType() const
Returns the type of the edge.
int addFollower(const MSVehicle *veh, const MSVehicle *ego, SUMOReal gap, SUMOReal latOffset=0, int sublane=-1)
std::vector< MSVehicle * > VehCont
Container for vehicles.
Base class for objects which have an id.
int myNumericalID
Unique numerical ID (set on reading by netload)
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
SUMOReal safeInsertionSpeed(const MSVehicle *veh, const MSLeaderInfo &leaders, SUMOReal speed)
return the maximum safe speed for insertion behind leaders (a negative value indicates that safe inse...
const SUMOReal myLengthGeometryFactor
precomputed myShape.length / myLength
AnyVehicleIterator & operator++()
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.
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
void sortPartialVehicles()
sorts myPartialVehicles
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
SUMOReal getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
SUMOReal getNOxEmissions() const
Returns the sum of last step NOx emissions.
static SUMOTime gTimeToGridlockHighways
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
SUMOReal getPMxEmissions() const
Returns the sum of last step PMx emissions.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
The vehicle has departed (was inserted into the network)
Influencer & getInfluencer()
Returns the velocity/lane influencer.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
Structure representing possible vehicle parameter.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
int myI1
index for myVehicles
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, const MSVehicle *collider, const MSVehicle *victim, std::set< const MSVehicle *, SUMOVehicle::ComparatorIdLess > &toRemove, std::set< const MSVehicle * > &toTeleport) const
detect whether there is a collision between the two vehicles
bool operator()(const MSVehicle *cmp, SUMOReal pos) const
compares vehicle position to the detector position
std::pair< MSVehicle *const, SUMOReal > getOppositeLeader(const MSVehicle *ego, SUMOReal dist) const
SUMOReal myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
MSLane * parallelLane(const MSLane *const lane, int offset) const
Returns the lane with the given offset parallel to the given lane one or 0 if it does not exist...
MSInsertionControl & getInsertionControl()
Returns the insertion control.
static void clear()
Clears the dictionary.
SUMOReal getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0) ...
SUMOReal getCO2Emissions() const
Returns the sum of last step CO2 emissions.
MSEdge *const myEdge
The lane's edge, for routing only.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
SUMOReal getCOEmissions() const
Returns the sum of last step CO emissions.
At the rightmost side of the lane.
At the center of the lane.
const MSLane * myLane
the lane that is being iterated
bool checkFailure(MSVehicle *aVehicle, SUMOReal &speed, SUMOReal &dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const
MSVehicle * getPartialBehind(const MSVehicle *ego) const
A storage for options typed value containers)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
static SUMOReal gLateralResolution
bool overlapsWith(const AbstractPoly &poly, SUMOReal offset=0) const
Returns the information whether the given polygon overlaps with this.
bool isApproachedFrom(MSEdge *const edge)
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
static SUMOReal sum(SUMOReal val)
Computes the resulting noise.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
static SUMOTime gTimeToGridlock
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
SUMOReal departPos
(optional) The position the vehicle shall depart from
SUMOReal getMinDeceleration() const
return the minimum deceleration capability for all vehicles that ever entered the network ...
const MSLeaderInfo & getFirstVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, bool onlyFrontOnLane, SUMOReal maxPos=std::numeric_limits< SUMOReal >::max(), bool allowCached=true) const
analogue to getLastVehicleInformation but in the upstream direction
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
const PositionVector & getShape() const
Returns this lane's shape.
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
LinkState getState() const
Returns the current state of the link.
Static storage of an output device and its base (abstract) implementation.
bool nextIsMyVehicles() const
bool closeTag()
Closes the most recently opened tag.
const MSEdgeVector & getSuccessors() const
Returns the following edges.
void registerCollision()
registers one collision-related teleport
SUMOReal ymax() const
Returns maximum y-coordinate.
MSEdgeControl & getEdgeControl()
Returns the edge control.
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
virtual ~MSLane()
Destructor.
int operator()(const std::pair< const MSVehicle *, SUMOReal > &p1, const std::pair< const MSVehicle *, SUMOReal > &p2) const
SUMOReal myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
std::string toString() const
print a debugging representation
bool isInsertionSuccess(MSVehicle *vehicle, SUMOReal speed, SUMOReal pos, SUMOReal posLat, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
No information given; use default.
A free position is chosen.
The class responsible for building and deletion of vehicles.
std::pair< MSVehicle *const, SUMOReal > getFollower(const MSVehicle *ego, SUMOReal egoPos, SUMOReal dist) const
Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane) ...
std::vector< MSEdge * > MSEdgeVector
MSLeaderInfo myLeaderInfoTmp
Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DEPART_POS_BASE if there is no vehicle on the departLane yet.
VehCont myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
MSLane * getLane() const
Returns the lane the vehicle is on.
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
The edge is an internal edge.
SUMOReal getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &lanesWithVehiclesToIntegrate)
Executes planned vehicle movements with regards to right-of-way.
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
static SUMOTime gLaneChangeDuration
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void registerTeleportWrongLane()
register one non-collision-related teleport
SUMOReal departPosLat
(optional) The lateral position the vehicle shall depart from
Representation of a lane in the micro simulation.
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
bool isVTDAffected(SUMOTime t) const
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1 ...
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::pair< MSVehicle *const, SUMOReal > getFollowerOnConsecutive(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel, SUMOReal dist=-1) const
return the follower with the largest missing rear gap among all predecessor lanes (within dist) ...
std::pair< MSVehicle *const, SUMOReal > getLeader(const MSVehicle *veh, const SUMOReal vehPos, const std::vector< MSLane * > &bestLaneConts, SUMOReal dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
virtual bool appropriate(const MSVehicle *veh)
The vehicle is being teleported.
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
SUMOReal getRightSideOnEdge() const
const std::string & getID() const
Returns the name of the vehicle.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.