72 #ifdef CHECK_MEMORY_LEAKS 74 #endif // CHECK_MEMORY_LEAKS 90 myNumericalID(numericalID), myShape(shape), myIndex(index),
91 myVehicles(), myLength(length), myWidth(width), myEdge(edge), myMaxSpeed(maxSpeed),
92 myPermissions(permissions),
93 myLogicalPredecessorLane(0),
94 myBruttoVehicleLengthSum(0), myNettoVehicleLengthSum(0), myInlappingVehicleEnd(10000), myInlappingVehicle(0),
101 for (MSLinkCont::iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
118 (*veh)->addReminder(rem);
147 const bool adaptSpeed =
false;
155 if (leaderBack >= frontGapNeeded) {
165 bool adaptableSpeed =
true;
174 if (missingRearGap > 0) {
175 if (minPos + missingRearGap <=
myLength) {
181 return isInsertionSuccess(&veh, mspeed, minPos + missingRearGap, adaptableSpeed, notification);
195 if (leaderPos >= frontGapNeeded) {
204 MSLane::VehCont::iterator predIt =
myVehicles.begin();
212 if (adaptableSpeed && leader != 0) {
224 frontMax = leaderRearPos - frontGapNeeded;
232 if (frontMax > minPos && backMin +
POSITION_EPS < frontMax) {
275 bool patchSpeed =
true;
291 for (
unsigned int i = 0; i < 10; i++) {
324 if (nspeed < speed) {
326 speed =
MIN2(nspeed, speed);
329 if (errorMsg !=
"") {
330 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (" + errorMsg +
")!");
347 aVehicle->
getID() +
"'. Inserting at lane end instead.");
354 std::vector<MSLane*>::const_iterator ri = bestLaneConts.begin();
359 unsigned int nRouteSuccs = 1;
360 MSLane* currentLane =
this;
363 while (seen < dist && ri != bestLaneConts.end()) {
365 MSLinkCont::const_iterator link =
succLinkSec(*aVehicle, nRouteSuccs, *currentLane, bestLaneConts);
371 patchSpeed,
"arrival speed too low")) {
379 patchSpeed,
"junction too close")) {
387 || !(*link)->havePriority()) {
389 std::string errorMsg =
"";
390 const LinkState state = (*link)->getState();
396 errorMsg =
"unpriorised junction too close";
399 patchSpeed, errorMsg)) {
406 nextLane = (*link)->getViaLaneOrLane();
425 if (
checkFailure(aVehicle, speed, dist, nspeed, patchSpeed,
"")) {
432 if (nspeed < speed) {
438 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (slow lane ahead)!");
447 if ((*link)->hasApproachingFoe(arrivalTime, leaveTime, speed, cfModel.
getMaxDecel())) {
455 currentLane = nextLane;
456 #ifdef HAVE_INTERNAL_LANES 457 if ((*link)->getViaLane() == 0) {
485 if (
checkFailure(aVehicle, speed, dist, nspeed, patchSpeed,
"")) {
497 if (gap < backGapNeeded) {
505 if (missingRearGap > 0) {
562 std::pair<MSVehicle*, SUMOReal>
568 return std::make_pair(last, pos);
574 return std::make_pair<MSVehicle*, SUMOReal>(0, 0);
585 if ((*veh)->getLane() ==
this) {
586 (*veh)->planMove(t, pred, cumulatedVehLength);
600 VehCont::iterator lastVeh =
myVehicles.end() - 1;
601 for (VehCont::iterator veh =
myVehicles.begin(); veh != lastVeh;) {
602 VehCont::iterator pred = veh + 1;
603 if ((*veh)->hasInfluencer() && (*veh)->getInfluencer().isVTDAffected(timestep)) {
607 if ((*pred)->hasInfluencer() && (*pred)->getInfluencer().isVTDAffected(timestep)) {
611 if (
handleCollision(timestep, stage, *veh, *pred, (*pred)->getPositionOnLane() - (*pred)->getVehicleType().getLength())) {
634 if (collider->
getLane() ==
this) {
638 && victim->
getLane() !=
this) {
642 WRITE_WARNING(
"Teleporting vehicle '" + collider->
getID() +
"'; collision with vehicle '" 685 }
else if (target != 0 && moved) {
696 into.push_back(target);
699 if (shadowLane != 0) {
700 into.push_back(shadowLane);
712 WRITE_WARNING(
"Teleporting vehicle '" + veh->
getID() +
"'; beyond end of lane, target lane='" +
getID() +
"', time=" +
723 i = VehCont::reverse_iterator(
myVehicles.erase(i.base()));
734 const bool minorLink = !wrongLane && (link !=
myLinks.end()) && !((*link)->havePriority());
735 const std::string reason = (wrongLane ?
" (wrong lane)" : (minorLink ?
" (yield)" :
" (jam)"));
742 + (r2 ?
" (highway)" :
"")
746 }
else if (minorLink) {
773 DictType::iterator it =
myDict.find(
id);
776 myDict.insert(DictType::value_type(
id, ptr));
785 DictType::iterator it =
myDict.find(
id);
796 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
805 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
806 into.push_back((*i).first);
811 template<
class RTREE>
void 813 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
817 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
818 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
819 into.Insert(cmin, cmax, l);
823 template void MSLane::fill<NamedRTree>(
NamedRTree& into);
843 return (link !=
myLinks.end());
897 MSLinkCont::const_iterator
899 const MSLane& succLinkSource,
const std::vector<MSLane*>& conts) {
902 if (nRouteEdge == 0) {
904 return succLinkSource.
myLinks.end();
908 assert(succLinkSource.
myLinks.size() == 1);
911 return succLinkSource.
myLinks.begin();
921 MSLinkCont::const_iterator link;
922 if (nRouteSuccs < conts.size()) {
924 for (link = succLinkSource.
myLinks.begin(); link != succLinkSource.
myLinks.end(); ++link) {
925 if ((*link)->getLane() != 0 && (*link)->getLane()->myEdge == nRouteEdge && (*link)->getLane()->allowsVehicleClass(veh.
getVehicleType().
getVehicleClass())) {
927 if ((*link)->getLane() == conts[nRouteSuccs]) {
934 return succLinkSource.
myLinks.end();
938 WRITE_WARNING(
"Could not find connection between lane '" + succLinkSource.
getID() +
"' and lane '" + conts[nRouteSuccs]->getID() +
941 return succLinkSource.
myLinks.end();
976 if (remVehicle == *it) {
1014 WRITE_WARNING(
"Lane '" +
getID() +
"' is approached multiple times from edge '" + approachingEdge->
getID() +
"'. This may cause collisions.");
1028 std::map<MSEdge*, std::vector<MSLane*> >::const_iterator i =
myApproachingLanes.find(edge);
1032 const std::vector<MSLane*>& lanes = (*i).second;
1033 return find(lanes.begin(), lanes.end(), lane) != lanes.end();
1039 inline int operator()(
const std::pair<const MSVehicle*, SUMOReal>& p1,
const std::pair<const MSVehicle*, SUMOReal>& p2)
const {
1040 return p1.second < p2.second;
1051 std::pair<MSVehicle* const, SUMOReal> followerInfo =
getFollowerOnConsecutive(backOffset, leaderSpeed, leaderMaxDecel);
1069 std::pair<MSVehicle* const, SUMOReal>
1078 std::pair<MSVehicle*, SUMOReal> result(static_cast<MSVehicle*>(0), -1);
1080 std::set<MSLane*> visited;
1081 std::vector<MSLane::IncomingLaneInfo> newFound;
1083 while (toExamine.size() != 0) {
1084 for (std::vector<MSLane::IncomingLaneInfo>::iterator i = toExamine.begin(); i != toExamine.end(); ++i) {
1085 MSLane* next = (*i).lane;
1103 agap = (*i).length - v->
getPositionOnLane() + backOffset - v->getVehicleType().getMinGap();
1106 const SUMOReal missingRearGap = v->getCarFollowModel().getSecureGap(v->getSpeed(), leaderSpeed, leaderMaxDecel) - agap;
1107 if (missingRearGap > missingRearGapMax) {
1108 missingRearGapMax = missingRearGap;
1110 result.second = agap;
1113 if ((*i).length < dist) {
1114 const std::vector<MSLane::IncomingLaneInfo>& followers = next->
getIncomingLanes();
1115 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator j = followers.begin(); j != followers.end(); ++j) {
1116 if (visited.find((*j).lane) == visited.end()) {
1117 visited.insert((*j).lane);
1119 ili.
lane = (*j).lane;
1120 ili.
length = (*j).length + (*i).length;
1122 newFound.push_back(ili);
1129 swap(newFound, toExamine);
1134 std::pair<MSVehicle* const, SUMOReal>
1155 return std::pair<MSVehicle* const, SUMOReal>(
static_cast<MSVehicle*
>(0), -1);
1160 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1165 std::pair<MSVehicle* const, SUMOReal>
1167 const std::vector<MSLane*>& bestLaneConts)
const {
1169 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1171 unsigned int view = 1;
1176 const MSLane* nextLane =
this;
1180 MSLinkCont::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
1181 if (nextLane->isLinkEnd(link) || !(*link)->opened(arrivalTime, speed, speed, veh.
getVehicleType().
getLength(),
1185 #ifdef HAVE_INTERNAL_LANES 1188 if (linkLeaders.size() > 0) {
1191 return linkLeaders[0].vehAndGap;
1193 bool nextInternal = (*link)->getViaLane() != 0;
1195 nextLane = (*link)->getViaLaneOrLane();
1196 if (nextLane == 0) {
1199 MSVehicle* leader = nextLane->getLastVehicle();
1203 leader = nextLane->getPartialOccupator();
1208 if (nextLane->getVehicleMaxSpeed(&veh) < speed) {
1211 seen += nextLane->getLength();
1216 #ifdef HAVE_INTERNAL_LANES 1217 if (!nextInternal) {
1223 }
while (seen <= dist);
1224 return std::make_pair(static_cast<MSVehicle*>(0), -1);
1228 std::pair<MSVehicle* const, SUMOReal>
1231 std::pair<MSVehicle*, SUMOReal> result = std::make_pair(static_cast<MSVehicle*>(0), -1);
1233 unsigned int view = 1;
1237 const MSLane* nextLane =
this;
1241 MSLinkCont::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
1246 #ifdef HAVE_INTERNAL_LANES 1249 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1250 const MSVehicle* leader = (*it).vehAndGap.first;
1251 if (leader != 0 && leader != result.first) {
1256 if (tmpSpeed < safeSpeed) {
1257 safeSpeed = tmpSpeed;
1258 result = (*it).vehAndGap;
1262 bool nextInternal = (*link)->getViaLane() != 0;
1264 nextLane = (*link)->getViaLaneOrLane();
1265 if (nextLane == 0) {
1269 if (leader != 0 && leader != result.first) {
1272 if (tmpSpeed < safeSpeed) {
1273 safeSpeed = tmpSpeed;
1274 result = std::make_pair(leader, gap);
1278 if (leader != 0 && leader != result.first) {
1281 if (tmpSpeed < safeSpeed) {
1282 safeSpeed = tmpSpeed;
1283 result = std::make_pair(leader, gap);
1295 #ifdef HAVE_INTERNAL_LANES 1296 if (!nextInternal) {
1302 }
while (seen <= dist);
1315 for (MSEdgeVector::iterator i = pred.begin(); i != pred.end();) {
1324 if (pred.size() != 0) {
1326 MSEdge* best = *pred.begin();
1338 MSLane* cand = (*i).lane;
1339 if (&(cand->
getEdge()) == &fromEdge) {
1358 std::vector<const MSLane*>
1360 std::vector<const MSLane*> result;
1361 for (MSLinkCont::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
1362 assert((*i)->getLane() != 0);
1363 result.push_back((*i)->getLane());
1385 for (MSLinkCont::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
1386 if ((*i)->getLane()->getEdge().isCrossing()) {
1387 return (
int)(i -
myLinks.begin());
1437 wtime += (*i)->getWaitingSeconds();
1450 for (VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1451 v += (*i)->getSpeed();
1463 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1464 ret += (*i)->getCO2Emissions();
1475 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1476 ret += (*i)->getCOEmissions();
1487 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1488 ret += (*i)->getPMxEmissions();
1499 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1500 ret += (*i)->getNOxEmissions();
1511 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1512 ret += (*i)->getHCEmissions();
1523 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1524 ret += (*i)->getFuelConsumption();
1535 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1536 ret += (*i)->getElectricityConsumption();
1547 if (vehs.size() == 0) {
1551 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
1552 SUMOReal sv = (*i)->getHarmonoise_NoiseEmissions();
1553 ret += (
SUMOReal) pow(10., (sv / 10.));
1573 myLaneDir(e->getLanes()[0]->
getShape().angleAt2D(0)) {
1582 if (ae1 != 0 && ae1->size() != 0) {
1586 if (ae2 != 0 && ae2->size() != 0) {
1606 for (std::vector<std::string>::const_iterator it = vehIds.begin(); it != vehIds.end(); ++it) {
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos)
Inserts the given vehicle at the given position.
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
VehCont myVehicles
The lane's vehicles. The entering vehicles are inserted at the front of this container and the leavin...
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void descheduleDeparture(SUMOVehicle *veh)
stops trying to emit the given vehicle
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.
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.
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
MSLane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const PositionVector &shape, SUMOReal width, SVCPermissions permissions, int index)
Constructor.
virtual const MSEdge * succEdge(unsigned int nSuccs) const =0
Returns the nSuccs'th successor of edge the vehicle is currently at.
bool hasInfluencer() const
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
SUMOReal getImpatience() const
Returns this vehicles impatience.
bool hasShadowVehicle() const
return true if the vehicle currently has a shadow vehicle
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...
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.
MSVehicle * getFirstVehicle() const
void setLength(SUMOReal val)
Sets a new length for the lane (used by TraCI only)
void addLink(MSLink *link)
Delayed initialization.
virtual bool integrateNewVehicle(SUMOTime t)
Insert buffered vehicle into the real lane.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
std::vector< MSVehicle * > VehCont
Container for vehicles.
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)
virtual void incorporateVehicle(MSVehicle *veh, SUMOReal pos, SUMOReal speed, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
const MSEdge *const myEdge
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
The speed is chosen randomly.
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)
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.
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 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.
The position is chosen randomly.
This is an uncontrolled, all-way stop link.
SUMOReal myMaxSpeed
Lane-wide speedlimit [m/s].
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
SUMOReal xmax() const
Returns maximum x-coordinate.
A class that stores a 2D geometrical boundary.
SUMOReal setPartialOccupation(MSVehicle *v, SUMOReal leftVehicleLength)
Sets the information about a vehicle lapping into this lane.
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, unsigned int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
#define WRITE_WARNING(msg)
MSAbstractLaneChangeModel & getLaneChangeModel()
SUMOReal getHCEmissions() const
Returns the sum of last step HC emissions.
bool isInsertionSuccess(MSVehicle *vehicle, SUMOReal speed, SUMOReal pos, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
void setMaxSpeed(SUMOReal val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
SUMOReal getPartialOccupatorEnd() const
Returns the position of the in-lapping vehicle's end.
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
virtual bool executeMovements(SUMOTime t, std::vector< MSLane * > &into)
Executes planned vehicle movements with regards to right-of-way.
bool lastInsertion(MSVehicle &veh, SUMOReal mspeed)
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.
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
void addApproachingLane(MSLane *lane, bool warnMultiCon)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
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.
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.
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
void setShadowPartialOccupator(MSLane *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.
std::vector< MSVehicle * > myVehBuffer
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
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)
bool alreadyMoved() const
reset the flag whether a vehicle already moved to false
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.
static SUMOReal gap(SUMOReal predPos, SUMOReal predLength, SUMOReal pos)
Uses the given values to compute the brutto-gap.
const MSEdge * succEdge(unsigned int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
ConstMSEdgeVector::const_iterator MSRouteIterator
The vehicle arrived at its destination (is deleted)
bool isStopped() const
Returns whether the vehicle is at a stop.
std::pair< MSVehicle *, SUMOReal > getLastVehicleInformation() const
Returns the last vehicle which is still 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 handleCollision(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, const SUMOReal victimRear)
detect whether there is a collision. then issue warning and add the vehicle to MSVehicleTransfer ...
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 * myLogicalPredecessorLane
Something on a lane to be noticed about vehicle movement.
std::pair< MSVehicle *const, SUMOReal > getLeader(const MSVehicle *veh, const SUMOReal vehPos, bool checkNext) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
SUMOReal myLength
Lane length [m].
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
MSVehicle * getLastVehicle() const
returns the last vehicle
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuouss lane change.
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
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.
Base class for objects which have an id.
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
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.
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
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.
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 operator()(const MSVehicle *cmp, SUMOReal pos) const
compares vehicle position to the detector position
MSVehicle * myInlappingVehicle
The vehicle which laps into this lane.
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 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.
std::pair< MSVehicle *const, SUMOReal > getFollowerOnConsecutive(SUMOReal backOffset, SUMOReal leaderSpeed, SUMOReal leaderMaxDecel) const
return the follower with the largest missing rear gap among all predecessor lanes (within dist) ...
bool checkFailure(MSVehicle *aVehicle, SUMOReal &speed, SUMOReal &dist, const SUMOReal nspeed, const bool patchSpeed, const std::string errorMsg) const
SUMOReal myInlappingVehicleEnd
End position of a vehicle which laps into this lane.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
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)
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 ...
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
const PositionVector & getShape() const
Returns this lane's shape.
LinkState getState() const
Returns the current state of the link.
MSVehicle * getPartialOccupator() const
Returns the vehicle which laps into this lane.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
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.
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.
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::vector< MSEdge * > MSEdgeVector
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.
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.
static SUMOTime gLaneChangeDuration
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void registerTeleportWrongLane()
register one non-collision-related teleport
Representation of a lane in the micro simulation.
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.
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...
const std::string & getID() const
Returns the name of the vehicle.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
unsigned int getLaneIndex() const