#include <MSLane.h>

Class which represents a single lane. Somekind of the main class of the simulation. Allows moving vehicles.
Definition at line 70 of file MSLane.h.
interaction with MSMoveReminder | |
| typedef std::vector < MSMoveReminder * > | MoveReminderCont |
| Definition of a container for move reminder. | |
| virtual void | addMoveReminder (MSMoveReminder *rem) throw () |
| Add a move-reminder to move-reminder container. | |
| const MoveReminderCont & | getMoveReminders () const throw () |
| Return the list of this lane's move reminders. | |
Public Types | |
| typedef std::deque< MSVehicle * > | VehCont |
| Container for vehicles. | |
Public Member Functions | |
| void | addIncomingLane (MSLane *lane, MSLink *viaLink) |
| bool | allowsVehicleClass (SUMOVehicleClass vclass) const |
| virtual bool | appropriate (const MSVehicle *veh) |
| virtual GUILaneWrapper * | buildLaneWrapper (GUIGlObjectStorage &idStorage) |
| virtual void | detectCollisions (SUMOTime timestep) |
| Check if vehicles are too close. | |
| bool | empty () const |
| Returns true if there is not a single vehicle on the lane. | |
| void | enteredByLaneChange (MSVehicle *v) |
| MSEdge & | getEdge () const throw () |
| Returns the lane's edge. | |
| virtual const MSVehicle *const | getFirstVehicle () const |
| std::pair< MSVehicle *const, SUMOReal > | getFollowerOnConsecutive (SUMOReal dist, SUMOReal seen, SUMOReal leaderSpeed, SUMOReal backOffset) const |
| const std::vector < IncomingLaneInfo > & | getIncomingLanes () const |
| virtual MSVehicle *const | getLastVehicle () const |
| returns the last vehicle | |
| std::pair< MSVehicle *const, SUMOReal > | getLeaderOnConsecutive (SUMOReal dist, SUMOReal seen, SUMOReal leaderSpeed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const |
| MSLane *const | getLeftLane () const |
| const MSLinkCont & | getLinkCont () const |
| returns the container with all links !!! | |
| MSLane *const | getRightLane () const |
| void | init (MSEdgeControl &, std::vector< MSLane * >::const_iterator firstNeigh, std::vector< MSLane * >::const_iterator lastNeigh) |
| bool | isLinkEnd (MSLinkCont::iterator &i) |
| bool | isLinkEnd (MSLinkCont::const_iterator &i) const |
| void | leftByLaneChange (MSVehicle *v) |
| MSLane (const std::string &id, SUMOReal maxSpeed, SUMOReal length, MSEdge *const edge, unsigned int numericalID, const Position2DVector &shape, const std::vector< SUMOVehicleClass > &allowed, const std::vector< SUMOVehicleClass > &disallowed) throw () | |
| Constructor. | |
| virtual MSVehicle * | removeFirstVehicle () |
| virtual MSVehicle * | removeVehicle (MSVehicle *remVehicle) |
| void | setAllowedClasses (const std::vector< SUMOVehicleClass > &classes) throw () |
| void | setLength (SUMOReal val) throw () |
| void | setMaxSpeed (SUMOReal val) throw () |
| void | setNotAllowedClasses (const std::vector< SUMOVehicleClass > &classes) throw () |
| virtual MSLinkCont::const_iterator | succLinkSec (const SUMOVehicle &veh, unsigned int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts) const |
| virtual | ~MSLane () throw () |
| Destructor. | |
Vehicle emission | |
| bool | emit (MSVehicle &v) throw (ProcessError) |
| Tries to emit the given vehicle. | |
| bool | freeEmit (MSVehicle &veh, SUMOReal speed) throw () |
| Tries to emit the given vehicle on any place. | |
| virtual bool | isEmissionSuccess (MSVehicle *vehicle, SUMOReal speed, SUMOReal pos, bool recheckNextLanes) throw (ProcessError) |
| Tries to emit the given vehicle with the given state (speed and pos). | |
Atomar value getter | |
| const std::vector < SUMOVehicleClass > & | getAllowedClasses () const throw () |
| Returns vehicle classes explicitely allowed on this lane. | |
| const std::string & | getID () const throw () |
| Returns this lane's id. | |
| SUMOReal | getLength () const throw () |
| Returns the lane's length. | |
| SUMOReal | getMaxSpeed () const throw () |
| Returns the lane's maximum speed. | |
| const std::vector < SUMOVehicleClass > & | getNotAllowedClasses () const throw () |
| Returns vehicle classes explicitely disallowed on this lane. | |
| size_t | getNumericalID () const throw () |
| Returns this lane's numerical id. | |
| const Position2DVector & | getShape () const throw () |
| Returns this lane's shape. | |
Current state retrieval | |
| SUMOReal | getHarmonoise_NoiseEmissions () const throw () |
| Returns the sum of last step noise emissions. | |
| SUMOReal | getHBEFA_CO2Emissions () const throw () |
| Returns the sum of last step CO2 emissions. | |
| SUMOReal | getHBEFA_COEmissions () const throw () |
| Returns the sum of last step CO emissions. | |
| SUMOReal | getHBEFA_FuelConsumption () const throw () |
| Returns the sum of last step fuel consumption. | |
| SUMOReal | getHBEFA_HCEmissions () const throw () |
| Returns the sum of last step HC emissions. | |
| SUMOReal | getHBEFA_NOxEmissions () const throw () |
| Returns the sum of last step NOx emissions. | |
| SUMOReal | getHBEFA_PMxEmissions () const throw () |
| Returns the sum of last step PMx emissions. | |
| SUMOReal | getMeanSpeed () const throw () |
| Returns the mean speed on this lane. | |
| SUMOReal | getOccupancy () const throw () |
| Returns the occupancy of this lane during the last step. | |
| SUMOReal | getVehLenSum () const throw () |
| Returns the sum of lengths of vehicles which were on the lane during the last step. | |
Handling vehicles lapping into lanes | |
| std::pair< MSVehicle *, SUMOReal > | getLastVehicleInformation () const throw () |
| Returns the last vehicle which is still on the lane. | |
| MSVehicle * | getPartialOccupator () const throw () |
| Returns the vehicle which laps into this lane. | |
| SUMOReal | getPartialOccupatorEnd () const throw () |
| Returns the position of the in-lapping vehicle's end. | |
| void | resetPartialOccupation (MSVehicle *v) throw () |
| Removes the information about a vehicle lapping into this lane. | |
| SUMOReal | setPartialOccupation (MSVehicle *v, SUMOReal leftVehicleLength) throw () |
| Sets the information about a vehicle lapping into this lane. | |
Access to vehicles | |
| unsigned int | getVehicleNumber () const throw () |
| Returns the number of vehicles on this lane. | |
| virtual const std::deque < MSVehicle * > & | getVehiclesSecure () const throw () |
| Returns the vehicles container; locks it for microsimulation. | |
| virtual void | releaseVehicles () const throw () |
| Allows to use the container for microsimulation again. | |
Additional initialisation | |
| void | initialize (MSLinkCont *succs) |
| Delayed initialization. | |
Vehicle movement (longitudinal) | |
| virtual bool | integrateNewVehicle (SUMOTime t) |
| Insert buffered vehicle into the real lane. | |
| virtual bool | moveCritical (SUMOTime t) |
| virtual bool | setCritical (SUMOTime t, std::vector< MSLane * > &into) |
Static Public Member Functions | |
| static void | clear () |
| static MSLane * | dictionary (std::string id) |
| Returns the MSEdgeControl associated to the key id if exists Otherwise returns 0. | |
| static bool | dictionary (std::string id, MSLane *lane) |
| Inserts a MSLane into the static dictionary Returns true if the key id isn't already in the dictionary. Otherwise returns false. | |
| static size_t | dictSize () |
| static void | insertIDs (std::vector< std::string > &into) throw () |
Data Fields | |
| Position2DVector | myShape |
| The shape of the lane. | |
Protected Types | |
| typedef std::map< std::string, MSLane * > | DictType |
| definition of the tatic dictionary type | |
Protected Member Functions | |
| virtual MSVehicle * | pop (SUMOTime t) |
| virtual bool | push (MSVehicle *veh) |
| Insert a vehicle into the lane's vehicle buffer. After processing done from moveCritical, when a vehicle exits it's lane. Returned is the information whether the vehicle was removed. | |
| virtual void | swapAfterLaneChange (SUMOTime t) |
| moves myTmpVehicles int myVehicles after a lane change procedure | |
Protected Attributes | |
| std::vector< SUMOVehicleClass > | myAllowedClasses |
| The list of allowed vehicle classes. | |
| SUMOReal | myBackDistance |
| MSEdge * | myEdge |
| The lane's edge, for routing only. | |
| std::vector< MSLane * > ::const_iterator | myFirstNeigh |
| The lane left to the described lane (==lastNeigh if none). | |
| std::string | myID |
| Unique ID. | |
| std::vector< IncomingLaneInfo > | myIncomingLanes |
| MSVehicle * | myInlappingVehicle |
| The vehicle which laps into this lane. | |
| SUMOReal | myInlappingVehicleEnd |
| End position of a vehicle which laps into this lane. | |
| std::vector< MSLane * > ::const_iterator | myLastNeigh |
| The end of this lane's edge's lane container. | |
| SUMOReal | myLeftVehLength |
| Not yet seen vehicle lengths. | |
| SUMOReal | myLength |
| Lane length [m]. | |
| MSLinkCont | myLinks |
| SUMOReal | myMaxSpeed |
| Lane-wide speedlimit [m/s]. | |
| std::vector< SUMOVehicleClass > | myNotAllowedClasses |
| The list of disallowed vehicle classes. | |
| size_t | myNumericalID |
| Unique numerical ID (set on reading by netload). | |
| VehCont | myTmpVehicles |
| std::vector< MSVehicle * > | myVehBuffer |
| SUMOReal | myVehicleLengthSum |
| The current length of all vehicles on this lane. | |
| VehCont | myVehicles |
| The lane's vehicles. The entering vehicles are inserted at the front of this container and the leaving ones leave from the back, e.g. the vehicle in front of the junction (often called first) is myVehicles.back() (if it exists). And if it is an iterator at a vehicle, ++it points to the vehicle in front. This is the interaction vehicle. | |
Static Protected Attributes | |
| static DictType | myDict |
| Static dictionary to associate string-ids with objects. | |
Private Member Functions | |
| MSLane (const MSLane &) | |
| invalidated copy constructor | |
| MSLane & | operator= (const MSLane &) |
| invalidated assignment operator | |
Private Attributes | |
| MoveReminderCont | myMoveReminders |
| This lane's move reminder. | |
Friends | |
| class | GUILaneWrapper |
| class | MSLaneChanger |
| needs access to myTmpVehicles (this maybe should be done via SUMOReal-buffering!!!) | |
| class | MSXMLRawOut |
Data Structures | |
| struct | IncomingLaneInfo |
| class | vehicle_position_sorter |
| Sorts vehicles by their position (descending). More... | |
| struct | VehPosition |
typedef std::map< std::string, MSLane* > MSLane::DictType [protected] |
| typedef std::vector< MSMoveReminder* > MSLane::MoveReminderCont |
| typedef std::deque< MSVehicle* > MSLane::VehCont |
| MSLane::MSLane | ( | const std::string & | id, | |
| SUMOReal | maxSpeed, | |||
| SUMOReal | length, | |||
| MSEdge *const | edge, | |||
| unsigned int | numericalID, | |||
| const Position2DVector & | shape, | |||
| const std::vector< SUMOVehicleClass > & | allowed, | |||
| const std::vector< SUMOVehicleClass > & | disallowed | |||
| ) | throw () |
Constructor.
| [in] | id | The lane's id |
| [in] | maxSpeed | The speed allwoed on this lane |
| [in] | length | The lane's length |
| [in] | edge | The edge this lane belongs to |
| [in] | numericalID | The numerical id of the lane |
| [in] | allowed | Vehicle classes that explicitely may drive on this lane |
| [in] | disallowed | Vehicle classes that are explicitaly forbidden on this lane |
Definition at line 71 of file MSLane.cpp.
00075 : myShape(shape), myID(id), myNumericalID(numericalID), 00076 myVehicles(), myLength(length), myEdge(edge), myMaxSpeed(maxSpeed), 00077 myAllowedClasses(allowed), myNotAllowedClasses(disallowed), 00078 myVehicleLengthSum(0), myInlappingVehicleEnd(10000), myInlappingVehicle(0) { 00079 }
| MSLane::~MSLane | ( | ) | throw () [virtual] |
Destructor.
Definition at line 82 of file MSLane.cpp.
References myLinks.
00082 { 00083 for (MSLinkCont::iterator i=myLinks.begin(); i!=myLinks.end(); ++i) { 00084 delete *i; 00085 } 00086 }
| MSLane::MSLane | ( | const MSLane & | ) | [private] |
invalidated copy constructor
Definition at line 891 of file MSLane.cpp.
References getLength(), MSLane::IncomingLaneInfo::lane, MSLane::IncomingLaneInfo::length, myIncomingLanes, and MSLane::IncomingLaneInfo::viaLink.
Referenced by NLSucceedingLaneBuilder::addSuccLane().
00891 { 00892 IncomingLaneInfo ili; 00893 ili.lane = lane; 00894 ili.viaLink = viaLink; 00895 ili.length = lane->getLength(); 00896 myIncomingLanes.push_back(ili); 00897 }
| void MSLane::addMoveReminder | ( | MSMoveReminder * | rem | ) | throw () [virtual] |
Add a move-reminder to move-reminder container.
The move reminder will not be deleted by the lane.
| [in] | rem | The move reminder to add |
Definition at line 98 of file MSLane.cpp.
References myMoveReminders.
00098 { 00099 myMoveReminders.push_back(rem); 00100 }
| bool MSLane::allowsVehicleClass | ( | SUMOVehicleClass | vclass | ) | const |
Definition at line 870 of file MSLane.cpp.
References myAllowedClasses, myNotAllowedClasses, and SVC_UNKNOWN.
Referenced by MSEdge::getDepartLane().
00870 { 00871 if (vclass==SVC_UNKNOWN) { 00872 return true; 00873 } 00874 if (myAllowedClasses.size()==0&&myNotAllowedClasses.size()==0) { 00875 return true; 00876 } 00877 if (find(myAllowedClasses.begin(), myAllowedClasses.end(), vclass)!=myAllowedClasses.end()) { 00878 return true; 00879 } 00880 if (myAllowedClasses.size()!=0) { 00881 return false; 00882 } 00883 if (find(myNotAllowedClasses.begin(), myNotAllowedClasses.end(), vclass)!=myNotAllowedClasses.end()) { 00884 return false; 00885 } 00886 return true; 00887 }
Returns the information whether this lane may be used to continue the current route
Definition at line 686 of file MSLane.cpp.
References MSEdge::EDGEFUNCTION_INTERNAL, MSVehicle::getBestLanesContinuation(), MSEdge::getPurpose(), myEdge, myLinks, and succLinkSec().
Referenced by MSVehicle::moveRegardingCritical().
00686 { 00687 if (myEdge->getPurpose()==MSEdge::EDGEFUNCTION_INTERNAL) { 00688 return true; 00689 } 00690 MSLinkCont::const_iterator link = succLinkSec(*veh, 1, *this, veh->getBestLanesContinuation()); 00691 return (link != myLinks.end()); 00692 }
| GUILaneWrapper * MSLane::buildLaneWrapper | ( | GUIGlObjectStorage & | idStorage | ) | [virtual] |
| void MSLane::clear | ( | ) | [static] |
Clears the dictionary
Definition at line 636 of file MSLane.cpp.
References myDict.
Referenced by MSNet::clearAll().
00636 { 00637 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); ++i) { 00638 delete(*i).second; 00639 } 00640 myDict.clear(); 00641 }
| void MSLane::detectCollisions | ( | SUMOTime | timestep | ) | [virtual] |
Check if vehicles are too close.
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 498 of file MSLane.cpp.
References MSVehicleTransfer::addVeh(), getID(), MSVehicle::getID(), MSVehicleTransfer::getInstance(), MSNet::getInstance(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myVehicleLengthSum, myVehicles, SUMOReal, and toString().
Referenced by GUILane::detectCollisions(), and GUIInternalLane::detectCollisions().
00498 { 00499 if (myVehicles.size() < 2) { 00500 return; 00501 } 00502 00503 VehCont::iterator lastVeh = myVehicles.end() - 1; 00504 for (VehCont::iterator veh = myVehicles.begin(); veh != lastVeh;) { 00505 VehCont::iterator pred = veh + 1; 00506 SUMOReal gap = (*pred)->getPositionOnLane() - (*pred)->getVehicleType().getLength() - (*veh)->getPositionOnLane(); 00507 if (gap < 0) { 00508 MSVehicle *vehV = *veh; 00509 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + vehV->getID() + "'; collision, lane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00510 MSVehicleTransfer::getInstance()->addVeh(vehV); 00511 veh = myVehicles.erase(veh); // remove current vehicle 00512 lastVeh = myVehicles.end() - 1; 00513 myVehicleLengthSum -= (*veh)->getVehicleType().getLength(); 00514 if (veh==myVehicles.end()) { 00515 break; 00516 } 00517 } else { 00518 ++veh; 00519 } 00520 } 00521 }
| MSLane * MSLane::dictionary | ( | std::string | id | ) | [static] |
Returns the MSEdgeControl associated to the key id if exists Otherwise returns 0.
Definition at line 625 of file MSLane.cpp.
References myDict.
00625 { 00626 DictType::iterator it = myDict.find(id); 00627 if (it == myDict.end()) { 00628 // id not in myDict. 00629 return 0; 00630 } 00631 return it->second; 00632 }
Inserts a MSLane into the static dictionary Returns true if the key id isn't already in the dictionary. Otherwise returns false.
Definition at line 613 of file MSLane.cpp.
References myDict.
Referenced by NLHandler::addIncomingLanes(), MSVehicle::addStop(), NLSucceedingLaneBuilder::addSuccLane(), NLHandler::closeLane(), NLSucceedingLaneBuilder::closeSuccLane(), traci::TraCIServer::commandAddVehicle(), NLTriggerBuilder::getLane(), NLDetectorBuilder::getLaneChecking(), NLGeomShapeBuilder::getPointPosition(), GUISelectionLoader::loadSelection(), MSRouteHandler::myStartElement(), NLTriggerBuilder::parseAndBuildLaneSpeedTrigger(), TraCIServerAPI_Lane::processGet(), and TraCIServerAPI_Lane::processSet().
00613 { 00614 DictType::iterator it = myDict.find(id); 00615 if (it == myDict.end()) { 00616 // id not in myDict. 00617 myDict.insert(DictType::value_type(id, ptr)); 00618 return true; 00619 } 00620 return false; 00621 }
| static size_t MSLane::dictSize | ( | ) | [inline, static] |
| bool MSLane::emit | ( | MSVehicle & | v | ) | throw (ProcessError) |
Tries to emit the given vehicle.
The emission position and speed are determined in dependence to the vehicle's departure definition, first. If "isReinsertion" is set, meaning the vehicle tries to end a teleportation, then the values for the fastest emission are used (speed=max, pos=free).
Then, the vehicle is tried to be inserted into the lane using these values by a call to "isEmissionSuccess". The result of "isEmissionSuccess" is returned.
| [in] | v | The vehicle to emit |
MSVehicle::getDepartureDefinition
MSVehicle::DepartArrivalDefinition
Definition at line 171 of file MSLane.cpp.
References DEPART_POS_DEFAULT, DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_RANDOM, DEPART_POS_RANDOM_FREE, DEPART_SPEED_DEFAULT, DEPART_SPEED_GIVEN, DEPART_SPEED_MAX, DEPART_SPEED_RANDOM, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosProcedure, SUMOVehicleParameter::departSpeed, SUMOVehicleParameter::departSpeedProcedure, freeEmit(), getLength(), getMaxSpeed(), isEmissionSuccess(), MIN2(), RandHelper::rand(), and SUMOReal.
Referenced by MSEdge::emit().
00171 { 00172 SUMOReal pos = 0; 00173 SUMOReal speed = 0; 00174 bool patchSpeed = true; // whether the speed shall be adapted to infrastructure/traffic in front 00175 00176 // determine the speed 00177 const SUMOVehicleParameter &pars = veh.getParameter(); 00178 switch (pars.departSpeedProcedure) { 00179 case DEPART_SPEED_GIVEN: 00180 speed = pars.departSpeed; 00181 patchSpeed = false; 00182 break; 00183 case DEPART_SPEED_RANDOM: 00184 speed = RandHelper::rand(MIN2(veh.getMaxSpeed(), getMaxSpeed())); 00185 patchSpeed = true; // !!!(?) 00186 break; 00187 case DEPART_SPEED_MAX: 00188 speed = MIN2(veh.getMaxSpeed(), getMaxSpeed()); 00189 patchSpeed = true; // !!!(?) 00190 break; 00191 case DEPART_SPEED_DEFAULT: 00192 default: 00193 // speed = 0 was set before 00194 patchSpeed = false; // !!!(?) 00195 break; 00196 } 00197 00198 // determine the position 00199 switch (pars.departPosProcedure) { 00200 case DEPART_POS_GIVEN: 00201 if (pars.departPos >= 0.) { 00202 pos = pars.departPos; 00203 } else { 00204 pos = pars.departPos + getLength(); 00205 } 00206 break; 00207 case DEPART_POS_RANDOM: 00208 pos = RandHelper::rand(getLength()); 00209 break; 00210 case DEPART_POS_RANDOM_FREE: { 00211 for (unsigned int i=0; i < 10; i++) { 00212 // we will try some random positions ... 00213 pos = RandHelper::rand(getLength()); 00214 if (isEmissionSuccess(&veh, speed, pos, patchSpeed)) { 00215 return true; 00216 } 00217 } 00218 // ... and if that doesn't work, we put the vehicle to the free position 00219 return freeEmit(veh, speed); 00220 } 00221 break; 00222 case DEPART_POS_FREE: 00223 return freeEmit(veh, speed); 00224 case DEPART_POS_DEFAULT: 00225 default: 00226 // pos = 0 was set before 00227 break; 00228 } 00229 00230 // try to emit 00231 return isEmissionSuccess(&veh, speed, pos, patchSpeed); 00232 }
| bool MSLane::empty | ( | ) | const [inline] |
Returns true if there is not a single vehicle on the lane.
Definition at line 382 of file MSLane.h.
References myVehBuffer, and myVehicles.
00382 { 00383 assert(myVehBuffer.size()==0); 00384 return myVehicles.empty(); 00385 }
| void MSLane::enteredByLaneChange | ( | MSVehicle * | v | ) |
Definition at line 1021 of file MSLane.cpp.
References MSVehicleType::getLength(), MSVehicle::getVehicleType(), and myVehicleLengthSum.
01021 { 01022 myVehicleLengthSum += v->getVehicleType().getLength(); 01023 }
Tries to emit the given vehicle on any place.
| [in] | veh | The vehicle to emit |
| [in] | speed | The maximum emission speed |
Definition at line 106 of file MSLane.cpp.
References MSVehicle::getCarFollowModel(), getLength(), MSVehicleType::getLength(), getPartialOccupator(), getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSCFModel::getSpeedAfterMaxDecel(), MSVehicle::getVehicleType(), isEmissionSuccess(), MIN2(), myVehicles, POSITION_EPS, and SUMOReal.
Referenced by MSVehicleTransfer::checkEmissions(), and emit().
00106 { 00107 bool adaptableSpeed = true; 00108 if (myVehicles.size()==0) { 00109 if (isEmissionSuccess(&veh, mspeed, 0, adaptableSpeed)) { 00110 return true; 00111 } 00112 } else { 00113 // check whether the vehicle can be put behind the last one if there is such 00114 MSVehicle *leader = *myVehicles.begin(); 00115 SUMOReal leaderPos = leader->getPositionOnLane() - leader->getVehicleType().getLength(); 00116 SUMOReal speed = mspeed; 00117 if (adaptableSpeed) { 00118 speed = leader->getSpeed(); 00119 } 00120 SUMOReal frontGapNeeded = veh.getCarFollowModel().getSecureGap(speed, leader->getCarFollowModel().getSpeedAfterMaxDecel(leader->getSpeed())); 00121 if (leaderPos-frontGapNeeded>=0) { 00122 SUMOReal tspeed = MIN2(veh.getCarFollowModel().ffeV(&veh, mspeed, frontGapNeeded, leader->getSpeed()), mspeed); 00123 // check whether we can emit in behind the last vehicle on the lane 00124 if (isEmissionSuccess(&veh, tspeed, 0, adaptableSpeed)) { 00125 return true; 00126 } 00127 } 00128 } 00129 // go through the lane, look for free positions (starting after the last vehicle) 00130 MSLane::VehCont::iterator predIt = myVehicles.begin(); 00131 while (predIt!=myVehicles.end()) { 00132 // get leader (may be zero) and follower 00133 const MSVehicle *leader = predIt!=myVehicles.end()-1 ? *(predIt+1) : getPartialOccupator(); 00134 const MSVehicle *follower = *predIt; 00135 00136 // patch speed if allowed 00137 SUMOReal speed = mspeed; 00138 if (adaptableSpeed&&leader!=0) { 00139 speed = MIN2(leader->getSpeed(), mspeed); 00140 } 00141 00142 // compute the space needed to not collide with leader 00143 SUMOReal frontMax = getLength(); 00144 if (leader!=0) { 00145 SUMOReal leaderRearPos = leader->getPositionOnLane() - leader->getVehicleType().getLength(); 00146 if (leader == getPartialOccupator()) { 00147 leaderRearPos = getPartialOccupatorEnd(); 00148 } 00149 frontMax = leaderRearPos - veh.getCarFollowModel().getSecureGap(speed, leader->getCarFollowModel().getSpeedAfterMaxDecel(leader->getSpeed())); 00150 } 00151 // compute the space needed to not let the follower collide 00152 const SUMOReal followPos = follower->getPositionOnLane(); 00153 const SUMOReal backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), veh.getCarFollowModel().getSpeedAfterMaxDecel(speed)); 00154 const SUMOReal backMin = followPos + backGapNeeded + veh.getVehicleType().getLength(); 00155 00156 // check whether there is enough room (given some extra space for rounding errors) 00157 if (frontMax>0 && backMin+POSITION_EPS<frontMax) { 00158 // try emit vehicle (should be always ok) 00159 if (isEmissionSuccess(&veh, speed, backMin+POSITION_EPS, adaptableSpeed)) { 00160 return true; 00161 } 00162 } 00163 ++predIt; 00164 } 00165 // first check at lane's begin 00166 return false; 00167 }
| const std::vector<SUMOVehicleClass>& MSLane::getAllowedClasses | ( | ) | const throw () [inline] |
Returns vehicle classes explicitely allowed on this lane.
Definition at line 338 of file MSLane.h.
References myAllowedClasses.
Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().
00338 { 00339 return myAllowedClasses; 00340 }
| MSEdge& MSLane::getEdge | ( | ) | const throw () [inline] |
Returns the lane's edge.
Definition at line 399 of file MSLane.h.
References myEdge.
Referenced by MSVehicle::addStop(), NLDetectorBuilder::buildInductLoop(), MSVehicle::checkRewindLinkLanes(), MSEmitter::childCheckEmit(), MSCalibrator::childCheckEmit(), MSEdge::closeBuilding(), MSVehicle::enterLaneAtMove(), MS_E2_ZS_CollectorOverLanes::extendTo(), MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), MSVehicle::getDistanceToPosition(), GUILaneWrapper::getEdgeLaneNumber(), GUINet::initDetectors(), MSTriggeredRerouter::Setter::isStillActive(), GUISelectionLoader::loadSelection(), GUI_E2_ZS_CollectorOverLanes::MyWrapper::MyWrapper(), MSTriggeredRerouter::Setter::notifyEnter(), NLTriggerBuilder::parseAndBuildCalibrator(), MSLCM_DK2004::patchSpeed(), traci::TraCIServer::postProcessSimulationStep(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Lane::processGet(), MSVehicle::processNextStop(), TraCIServerAPI_Lane::processSet(), MSVehicle::rebuildContinuationsFor(), and MSVehicle::vsafeCriticalCont().
00399 { 00400 return *myEdge; 00401 }
| const MSVehicle *const MSLane::getFirstVehicle | ( | ) | const [virtual] |
Definition at line 731 of file MSLane.cpp.
References myVehicles.
Referenced by getFollowerOnConsecutive(), and MSVehicle::vsafeCriticalCont().
00731 { 00732 if (myVehicles.size()==0) { 00733 return 0; 00734 } 00735 return *(myVehicles.end()-1); 00736 }
| std::pair< MSVehicle *const, SUMOReal > MSLane::getFollowerOnConsecutive | ( | SUMOReal | dist, | |
| SUMOReal | seen, | |||
| SUMOReal | leaderSpeed, | |||
| SUMOReal | backOffset | |||
| ) | const |
Definition at line 907 of file MSLane.cpp.
References MSVehicle::getCarFollowModel(), getFirstVehicle(), getIncomingLanes(), MSVehicle::getLane(), getMaxSpeed(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSCFModel::hasSafeGap(), MSLane::IncomingLaneInfo::lane, MSLane::IncomingLaneInfo::length, MSLink::LINKSTATE_TL_RED, MSCFModel::maxNextSpeed(), myIncomingLanes, SUMOReal, and MSLane::IncomingLaneInfo::viaLink.
Referenced by isEmissionSuccess().
00907 { 00908 // ok, a vehicle has not noticed the lane about itself; 00909 // iterate as long as necessary to search for an approaching one 00910 std::set<MSLane*> visited; 00911 std::vector<std::pair<MSVehicle *, SUMOReal> > possible; 00912 std::vector<MSLane::IncomingLaneInfo> newFound; 00913 std::vector<MSLane::IncomingLaneInfo> toExamine = myIncomingLanes; 00914 while (toExamine.size()!=0) { 00915 for (std::vector<MSLane::IncomingLaneInfo>::iterator i=toExamine.begin(); i!=toExamine.end(); ++i) { 00916 if ((*i).viaLink->getState()==MSLink::LINKSTATE_TL_RED) { 00917 continue; 00918 } 00919 MSLane *next = (*i).lane; 00920 if (next->getFirstVehicle()!=0) { 00921 MSVehicle * v = (MSVehicle*) next->getFirstVehicle(); 00922 SUMOReal agap = (*i).length - v->getPositionOnLane() + backOffset; 00923 if (!v->getCarFollowModel().hasSafeGap(v->getCarFollowModel().maxNextSpeed(v->getSpeed()), agap, leaderSpeed, v->getLane().getMaxSpeed())) { 00924 possible.push_back(std::make_pair(v, (*i).length-v->getPositionOnLane()+seen)); 00925 } 00926 } else { 00927 if ((*i).length+seen<dist) { 00928 const std::vector<MSLane::IncomingLaneInfo> &followers = next->getIncomingLanes(); 00929 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator j=followers.begin(); j!=followers.end(); ++j) { 00930 if (visited.find((*j).lane)==visited.end()) { 00931 visited.insert((*j).lane); 00932 MSLane::IncomingLaneInfo ili; 00933 ili.lane = (*j).lane; 00934 ili.length = (*j).length + (*i).length; 00935 ili.viaLink = (*j).viaLink; 00936 newFound.push_back(ili); 00937 } 00938 } 00939 } 00940 } 00941 } 00942 toExamine.clear(); 00943 swap(newFound, toExamine); 00944 } 00945 if (possible.size()==0) { 00946 return std::pair<MSVehicle * const, SUMOReal>(0, -1); 00947 } 00948 sort(possible.begin(), possible.end(), by_second_sorter()); 00949 return *(possible.begin()); 00950 }
| SUMOReal MSLane::getHarmonoise_NoiseEmissions | ( | ) | const throw () |
Returns the sum of last step noise emissions.
Definition at line 1128 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), HelpersHarmonoise::sum(), and SUMOReal.
Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().
01128 { 01129 SUMOReal ret = 0; 01130 const MSLane::VehCont &vehs = getVehiclesSecure(); 01131 if (vehs.size()==0) { 01132 releaseVehicles(); 01133 return 0; 01134 } 01135 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01136 SUMOReal sv = (*i)->getHarmonoise_NoiseEmissions(); 01137 ret += (SUMOReal) pow(10., (sv/10.)); 01138 } 01139 releaseVehicles(); 01140 return HelpersHarmonoise::sum(ret); 01141 }
| SUMOReal MSLane::getHBEFA_CO2Emissions | ( | ) | const throw () |
Returns the sum of last step CO2 emissions.
Definition at line 1056 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_CO2Emissions(), and TraCIServerAPI_Lane::processGet().
01056 { 01057 SUMOReal ret = 0; 01058 const MSLane::VehCont &vehs = getVehiclesSecure(); 01059 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01060 ret += (*i)->getHBEFA_CO2Emissions(); 01061 } 01062 releaseVehicles(); 01063 return ret; 01064 }
| SUMOReal MSLane::getHBEFA_COEmissions | ( | ) | const throw () |
Returns the sum of last step CO emissions.
Definition at line 1068 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_COEmissions(), and TraCIServerAPI_Lane::processGet().
01068 { 01069 SUMOReal ret = 0; 01070 const MSLane::VehCont &vehs = getVehiclesSecure(); 01071 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01072 ret += (*i)->getHBEFA_COEmissions(); 01073 } 01074 releaseVehicles(); 01075 return ret; 01076 }
| SUMOReal MSLane::getHBEFA_FuelConsumption | ( | ) | const throw () |
Returns the sum of last step fuel consumption.
Definition at line 1116 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_FuelConsumption(), and TraCIServerAPI_Lane::processGet().
01116 { 01117 SUMOReal ret = 0; 01118 const MSLane::VehCont &vehs = getVehiclesSecure(); 01119 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01120 ret += (*i)->getHBEFA_FuelConsumption(); 01121 } 01122 releaseVehicles(); 01123 return ret; 01124 }
| SUMOReal MSLane::getHBEFA_HCEmissions | ( | ) | const throw () |
Returns the sum of last step HC emissions.
Definition at line 1104 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_HCEmissions(), and TraCIServerAPI_Lane::processGet().
01104 { 01105 SUMOReal ret = 0; 01106 const MSLane::VehCont &vehs = getVehiclesSecure(); 01107 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01108 ret += (*i)->getHBEFA_HCEmissions(); 01109 } 01110 releaseVehicles(); 01111 return ret; 01112 }
| SUMOReal MSLane::getHBEFA_NOxEmissions | ( | ) | const throw () |
Returns the sum of last step NOx emissions.
Definition at line 1092 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_NOxEmissions(), and TraCIServerAPI_Lane::processGet().
01092 { 01093 SUMOReal ret = 0; 01094 const MSLane::VehCont &vehs = getVehiclesSecure(); 01095 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01096 ret += (*i)->getHBEFA_NOxEmissions(); 01097 } 01098 releaseVehicles(); 01099 return ret; 01100 }
| SUMOReal MSLane::getHBEFA_PMxEmissions | ( | ) | const throw () |
Returns the sum of last step PMx emissions.
Definition at line 1080 of file MSLane.cpp.
References getVehiclesSecure(), releaseVehicles(), and SUMOReal.
Referenced by GUILaneWrapper::getNormedHBEFA_PMxEmissions(), and TraCIServerAPI_Lane::processGet().
01080 { 01081 SUMOReal ret = 0; 01082 const MSLane::VehCont &vehs = getVehiclesSecure(); 01083 for (MSLane::VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01084 ret += (*i)->getHBEFA_PMxEmissions(); 01085 } 01086 releaseVehicles(); 01087 return ret; 01088 }
| const std::string& MSLane::getID | ( | ) | const throw () [inline] |
Returns this lane's id.
Definition at line 298 of file MSLane.h.
References myID.
Referenced by MSVehicle::addTraciStop(), traci::TraCIServer::commandStopNode(), NLDetectorBuilder::convUncontE2PosLength(), detectCollisions(), MSVTypeProbe::execute(), Command_SaveTLSSwitches::execute(), GUILaneWrapper::getMicrosimID(), GUIInductLoop::MyWrapper::getParameterWindow(), GUI_E2_ZS_Collector::MyWrapper::getParameterWindow(), MSUnboundActuatedTrafficLightLogic::init(), MSAgentbasedTrafficLightLogic::init(), MSActuatedTrafficLightLogic::init(), moveCritical(), MSCalibrator::MSCalibrator(), MSRouteHandler::myStartElement(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_TLS::processGet(), TraCIServerAPI_Lane::processGet(), MSVehicleControl::scheduleVehicleRemoval(), setCritical(), and MSMeanData::writeEdge().
00298 { 00299 return myID; 00300 }
| const std::vector<IncomingLaneInfo>& MSLane::getIncomingLanes | ( | ) | const [inline] |
Definition at line 488 of file MSLane.h.
References myIncomingLanes.
Referenced by MSVehicle::enterLaneAtEmit(), MSVehicle::enterLaneAtLaneChange(), and getFollowerOnConsecutive().
00488 { 00489 return myIncomingLanes; 00490 }
| MSVehicle *const MSLane::getLastVehicle | ( | ) | const [virtual] |
returns the last vehicle
Definition at line 722 of file MSLane.cpp.
References myVehicles.
Referenced by MSVehicle::checkRewindLinkLanes(), getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), and isEmissionSuccess().
00722 { 00723 if (myVehicles.size()==0) { 00724 return 0; 00725 } 00726 return *myVehicles.begin(); 00727 }
| std::pair< MSVehicle *, SUMOReal > MSLane::getLastVehicleInformation | ( | ) | const throw () |
Returns the last vehicle which is still on the lane.
The information about the last vehicle in this lane's que is returned. If there is no such vehicle, the information about the vehicle which laps into this lane is returned. If there is no such vehicle, the first returned member is 0.
Definition at line 448 of file MSLane.cpp.
References MSVehicleType::getLength(), MSVehicle::getPositionOnLane(), MSVehicle::getVehicleType(), MAX2(), myInlappingVehicle, myInlappingVehicleEnd, myVehicles, and SUMOReal.
Referenced by MSVehicle::vsafeCriticalCont().
00448 { 00449 if (myVehicles.size()!=0) { 00450 // the last vehicle is the one in scheduled by this lane 00451 MSVehicle *last = *myVehicles.begin(); 00452 SUMOReal pos = MAX2(SUMOReal(0), last->getPositionOnLane()-last->getVehicleType().getLength()); 00453 return std::make_pair(last, pos); 00454 } 00455 if (myInlappingVehicle!=0) { 00456 // the last one is a vehicle extending into this lane 00457 return std::make_pair(myInlappingVehicle, myInlappingVehicleEnd); 00458 } 00459 return std::make_pair<MSVehicle*, SUMOReal>(0, 0); 00460 }
| std::pair< MSVehicle *const, SUMOReal > MSLane::getLeaderOnConsecutive | ( | SUMOReal | dist, | |
| SUMOReal | seen, | |||
| SUMOReal | leaderSpeed, | |||
| const MSVehicle & | veh, | |||
| const std::vector< MSLane * > & | bestLaneConts | |||
| ) | const |
Definition at line 954 of file MSLane.cpp.
References MSCFModel::brakeGap(), MSVehicle::getCarFollowModel(), getLastVehicle(), getLength(), getMaxSpeed(), getPartialOccupator(), getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), isLinkEnd(), MSLink::LINKSTATE_TL_RED, and succLinkSec().
00955 { 00956 if (seen>dist) { 00957 return std::pair<MSVehicle * const, SUMOReal>(0, -1); 00958 } 00959 unsigned int view = 1; 00960 // loop over following lanes 00961 const MSLane * targetLane = this; 00962 MSVehicle *leader = targetLane->getPartialOccupator(); 00963 if (leader!=0) { 00964 return std::pair<MSVehicle * const, SUMOReal>(leader, seen-targetLane->getPartialOccupatorEnd()); 00965 } 00966 const MSLane * nextLane = targetLane; 00967 while (true) { 00968 // get the next link used 00969 MSLinkCont::const_iterator link = targetLane->succLinkSec(veh, view, *nextLane, bestLaneConts); 00970 if (nextLane->isLinkEnd(link) || !(*link)->havePriority() || (*link)->getState()==MSLink::LINKSTATE_TL_RED) { 00971 return std::pair<MSVehicle * const, SUMOReal>(0, -1); 00972 } 00973 #ifdef HAVE_INTERNAL_LANES 00974 bool nextInternal = false; 00975 nextLane = (*link)->getViaLane(); 00976 if (nextLane==0) { 00977 nextLane = (*link)->getLane(); 00978 } else { 00979 nextInternal = true; 00980 } 00981 #else 00982 nextLane = (*link)->getLane(); 00983 #endif 00984 if (nextLane==0) { 00985 return std::pair<MSVehicle * const, SUMOReal>(0, -1); 00986 } 00987 MSVehicle * leader = nextLane->getLastVehicle(); 00988 if (leader!=0) { 00989 return std::pair<MSVehicle * const, SUMOReal>(leader, seen+leader->getPositionOnLane()-leader->getVehicleType().getLength()); 00990 } else { 00991 leader = nextLane->getPartialOccupator(); 00992 if (leader!=0) { 00993 return std::pair<MSVehicle * const, SUMOReal>(leader, seen+nextLane->getPartialOccupatorEnd()); 00994 } 00995 } 00996 if (nextLane->getMaxSpeed()<speed) { 00997 dist = veh.getCarFollowModel().brakeGap(nextLane->getMaxSpeed()); 00998 } 00999 seen += nextLane->getLength(); 01000 if (seen>dist) { 01001 return std::pair<MSVehicle * const, SUMOReal>(0, -1); 01002 } 01003 #ifdef HAVE_INTERNAL_LANES 01004 if (!nextInternal) { 01005 view++; 01006 } 01007 #else 01008 view++; 01009 #endif 01010 } 01011 }
| MSLane *const MSLane::getLeftLane | ( | ) | const |
| SUMOReal MSLane::getLength | ( | ) | const throw () [inline] |
Returns the lane's length.
Definition at line 330 of file MSLane.h.
References myLength.
Referenced by MSVehicle::adaptLaneEntering2MoveReminder(), addIncomingLane(), NLSucceedingLaneBuilder::addSuccLane(), NLDetectorBuilder::buildInductLoop(), MSVehicleTransfer::checkEmissions(), MSVehicle::checkRewindLinkLanes(), NLDetectorBuilder::convUncontE2PosLength(), emit(), MS_E2_ZS_CollectorOverLanes::extendTo(), freeEmit(), MSVehicle::getBestLanes(), MSVehicle::getDistanceToPosition(), TraCIDijkstraRouter< E >::getEffort(), getLeaderOnConsecutive(), getMaxSpeedRegardingNextLanes(), GUILaneWrapper::getNormedHBEFA_CO2Emissions(), GUILaneWrapper::getNormedHBEFA_COEmissions(), GUILaneWrapper::getNormedHBEFA_FuelConsumption(), GUILaneWrapper::getNormedHBEFA_HCEmissions(), GUILaneWrapper::getNormedHBEFA_NOxEmissions(), GUILaneWrapper::getNormedHBEFA_PMxEmissions(), GUILaneWrapper::getParameterWindow(), NLGeomShapeBuilder::getPointPosition(), MSNet::EdgeWeightsProxi::getTravelTime(), MSActuatedTrafficLightLogic::init(), isEmissionSuccess(), MSMeanData_Net::MSLaneMeanDataValues::isStillActive(), MSMeanData_HBEFA::MSLaneMeanDataValues::isStillActive(), MSMeanData_Harmonoise::MSLaneMeanDataValues::isStillActive(), MSVehicle::moveFirstChecked(), MSVehicle::moveRegardingCritical(), NLTriggerBuilder::parseAndBuildBusStop(), TraCIServerAPI_Lane::processGet(), MSVehicle::rebuildContinuationsFor(), MSVehicleControl::scheduleVehicleRemoval(), GUIVehicle::setBlinkerInformation(), setCritical(), MSVehicle::vsafeCriticalCont(), MSLCM_DK2004::wantsChangeToLeft(), MSLCM_DK2004::wantsChangeToRight(), and MSMeanData::writeEdge().
00330 { 00331 return myLength; 00332 }
| const MSLinkCont & MSLane::getLinkCont | ( | ) | const |
returns the container with all links !!!
Definition at line 806 of file MSLane.cpp.
References myLinks.
Referenced by MSLinkContHelper::getConnectingLink(), GUILaneWrapper::getLinkDirection(), GUILaneWrapper::getLinkLane(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkRespondIndex(), GUILaneWrapper::getLinkState(), GUILaneWrapper::getLinkTLID(), GUILaneWrapper::getLinkTLIndex(), TraCIServerAPI_Lane::processGet(), MSVehicle::rebuildContinuationsFor(), GUIVehicle::setBlinkerInformation(), and MSVehicle::vsafeCriticalCont().
00806 { 00807 return myLinks; 00808 }
| SUMOReal MSLane::getMaxSpeed | ( | ) | const throw () [inline] |
Returns the lane's maximum speed.
Definition at line 322 of file MSLane.h.
References myMaxSpeed.
Referenced by MSVehicleTransfer::checkEmissions(), MSEmitter::childCheckEmit(), MSCalibrator::childCheckEmit(), traci::TraCIServer::commandAddVehicle(), MSAbstractLaneChangeModel::congested(), MSCFModel_IDM::desiredSpeed(), emit(), GUILaneWrapper::Colorer::getColorValue(), TraCIDijkstraRouter< E >::getEffort(), getFollowerOnConsecutive(), getLeaderOnConsecutive(), getMaxSpeedRegardingNextLanes(), GUILaneWrapper::getParameterWindow(), MSNet::EdgeWeightsProxi::getTravelTime(), traci::TraCIServer::handleVehicleDomain(), MSLCM_DK2004::informBlocker(), MSActuatedTrafficLightLogic::init(), isEmissionSuccess(), MSVehicle::moveRegardingCritical(), TraCIServerAPI_Lane::processGet(), GUIVehicle::setBlinkerInformation(), MSLaneChanger::setIsSafeChange(), MSVehicle::vsafeCriticalCont(), MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
00322 { 00323 return myMaxSpeed; 00324 }
| SUMOReal MSLane::getMeanSpeed | ( | ) | const throw () |
Returns the mean speed on this lane.
Definition at line 1040 of file MSLane.cpp.
References getVehiclesSecure(), myMaxSpeed, myVehicles, releaseVehicles(), and SUMOReal.
Referenced by TraCIServerAPI_Lane::processGet().
01040 { 01041 if (myVehicles.size()==0) { 01042 return myMaxSpeed; 01043 } 01044 SUMOReal v = 0; 01045 const MSLane::VehCont &vehs = getVehiclesSecure(); 01046 for (VehCont::const_iterator i=vehs.begin(); i!=vehs.end(); ++i) { 01047 v += (*i)->getSpeed(); 01048 } 01049 SUMOReal ret = v / (SUMOReal) myVehicles.size(); 01050 releaseVehicles(); 01051 return ret; 01052 }
| const MoveReminderCont& MSLane::getMoveReminders | ( | ) | const throw () [inline] |
Return the list of this lane's move reminders.
Definition at line 148 of file MSLane.h.
References myMoveReminders.
Referenced by MSVehicle::enterLaneAtEmit(), and MSVehicle::enterLaneAtLaneChange().
00148 { 00149 return myMoveReminders; 00150 }
| const std::vector<SUMOVehicleClass>& MSLane::getNotAllowedClasses | ( | ) | const throw () [inline] |
Returns vehicle classes explicitely disallowed on this lane.
Definition at line 346 of file MSLane.h.
References myNotAllowedClasses.
Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().
00346 { 00347 return myNotAllowedClasses; 00348 }
| size_t MSLane::getNumericalID | ( | ) | const throw () [inline] |
Returns this lane's numerical id.
Definition at line 306 of file MSLane.h.
References myNumericalID.
00306 { 00307 return myNumericalID; 00308 }
| SUMOReal MSLane::getOccupancy | ( | ) | const throw () |
Returns the occupancy of this lane during the last step.
Definition at line 1028 of file MSLane.cpp.
References myLength, and myVehicleLengthSum.
Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().
01028 { 01029 return myVehicleLengthSum / myLength; 01030 }
| MSVehicle* MSLane::getPartialOccupator | ( | ) | const throw () [inline] |
Returns the vehicle which laps into this lane.
Definition at line 237 of file MSLane.h.
References myInlappingVehicle.
Referenced by freeEmit(), getLeaderOnConsecutive(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), isEmissionSuccess(), and MSVehicle::moveRegardingCritical().
00237 { 00238 return myInlappingVehicle; 00239 }
| SUMOReal MSLane::getPartialOccupatorEnd | ( | ) | const throw () [inline] |
Returns the position of the in-lapping vehicle's end.
Definition at line 245 of file MSLane.h.
References myInlappingVehicleEnd.
Referenced by freeEmit(), getLeaderOnConsecutive(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), isEmissionSuccess(), and MSVehicle::moveRegardingCritical().
00245 { 00246 return myInlappingVehicleEnd; 00247 }
| MSLane *const MSLane::getRightLane | ( | ) | const |
Definition at line 864 of file MSLane.cpp.
References myEdge, and MSEdge::rightLane().
Referenced by MSVehicle::checkForLaneChanges(), traci::TraCIServer::convertCartesianToRoadMap(), traci::TraCIServer::handleVehicleDomain(), and traci::TraCIServer::postProcessSimulationStep().
| const Position2DVector& MSLane::getShape | ( | ) | const throw () [inline] |
Returns this lane's shape.
Definition at line 314 of file MSLane.h.
References myShape.
Referenced by NLSucceedingLaneBuilder::addSuccLane(), GUIE3Collector::MyWrapper::buildDefinition(), GUIVehicle::drawGL(), NLGeomShapeBuilder::getPointPosition(), MSVehicle::getPosition(), TraCIServerAPI_Vehicle::processGet(), TraCIServerAPI_Lane::processGet(), and ROWdrawAction_drawLane2LaneConnections().
00314 { 00315 return myShape; 00316 }
| unsigned int MSLane::getVehicleNumber | ( | ) | const throw () [inline] |
Returns the number of vehicles on this lane.
Definition at line 269 of file MSLane.h.
References myVehicles.
Referenced by MSVehicle::checkRewindLinkLanes(), MSCalibrator::execute(), MSEdge::getFreeLane(), and TraCIServerAPI_Lane::processGet().
00269 { 00270 return (unsigned int) myVehicles.size(); 00271 }
| virtual const std::deque< MSVehicle* >& MSLane::getVehiclesSecure | ( | ) | const throw () [inline, virtual] |
Returns the vehicles container; locks it for microsimulation.
Please note that it is necessary to release the vehicles container afterwards using "releaseVehicles".
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 280 of file MSLane.h.
References myVehicles.
Referenced by GUILaneWrapper::drawGL(), MSCalibrator::execute(), getHarmonoise_NoiseEmissions(), getHBEFA_CO2Emissions(), getHBEFA_COEmissions(), getHBEFA_FuelConsumption(), getHBEFA_HCEmissions(), getHBEFA_NOxEmissions(), getHBEFA_PMxEmissions(), getMeanSpeed(), and TraCIServerAPI_Lane::processGet().
00280 { 00281 return myVehicles; 00282 }
| SUMOReal MSLane::getVehLenSum | ( | ) | const throw () |
Returns the sum of lengths of vehicles which were on the lane during the last step.
Definition at line 1034 of file MSLane.cpp.
References myVehicleLengthSum.
Referenced by MSVehicle::checkRewindLinkLanes(), MSVehicle::getBestLanes(), and MSVehicle::rebuildContinuationsFor().
01034 { 01035 return myVehicleLengthSum; 01036 }
| void MSLane::init | ( | MSEdgeControl & | , | |
| std::vector< MSLane * >::const_iterator | firstNeigh, | |||
| std::vector< MSLane * >::const_iterator | lastNeigh | |||
| ) |
Definition at line 827 of file MSLane.cpp.
References myFirstNeigh, and myLastNeigh.
00827 { 00828 myFirstNeigh = firstNeigh; 00829 myLastNeigh = lastNeigh; 00830 }
| void MSLane::initialize | ( | MSLinkCont * | succs | ) |
Delayed initialization.
Not all lane-members are known at the time the lane is born, above all the pointers to other lanes, so we have to initialize later.
| [in] | succs | The list of (outgoing) links |
Definition at line 90 of file MSLane.cpp.
References myLinks.
Referenced by NLSucceedingLaneBuilder::closeSuccLane().
00090 { 00091 myLinks = *links; 00092 delete links; 00093 }
| void MSLane::insertIDs | ( | std::vector< std::string > & | into | ) | throw () [static] |
Definition at line 645 of file MSLane.cpp.
References myDict.
Referenced by TraCIServerAPI_Lane::processGet().
00645 { 00646 for (DictType::iterator i=myDict.begin(); i!=myDict.end(); ++i) { 00647 into.push_back((*i).first); 00648 } 00649 }
Insert buffered vehicle into the real lane.
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 696 of file MSLane.cpp.
References MSVehicleType::getLength(), MSVehicle::getVehicleType(), myVehBuffer, myVehicleLengthSum, and myVehicles.
Referenced by GUILane::integrateNewVehicle(), and GUIInternalLane::integrateNewVehicle().
00696 { 00697 bool wasInactive = myVehicles.size()==0; 00698 sort(myVehBuffer.begin(), myVehBuffer.end(), vehicle_position_sorter()); 00699 for (std::vector<MSVehicle*>::const_iterator i=myVehBuffer.begin(); i!=myVehBuffer.end(); ++i) { 00700 MSVehicle *veh = *i; 00701 myVehicles.push_front(veh); 00702 myVehicleLengthSum += veh->getVehicleType().getLength(); 00703 } 00704 myVehBuffer.clear(); 00705 return wasInactive&&myVehicles.size()!=0; 00706 }
| bool MSLane::isEmissionSuccess | ( | MSVehicle * | vehicle, | |
| SUMOReal | speed, | |||
| SUMOReal | pos, | |||
| bool | recheckNextLanes | |||
| ) | throw (ProcessError) [virtual] |
Tries to emit the given vehicle with the given state (speed and pos).
Checks whether the vehicle can be inserted at the given position with the given speed so that no collisions with leader/follower occure and the speed does not yield in unexpected behaviour on consecutive lanes. Returns false if the vehicle can not be inserted.
If the insertion can take place, the vehicle's "enterLaneAtEmit" method is called, the vehicle is inserted into the lane's vehicle container ("myVehicles"), the lane's statistical information is patched (including the mean data). true is returned.
| [in] | vehicle | The vehicle to emit |
| [in] | speed | The speed with which it shall be emitted |
| [in] | pos | The position at which it shall be emitted |
| [in] | recheckNextLanes | Forces patching the speed for not being too fast on next lanes |
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 236 of file MSLane.cpp.
References MSRoute::begin(), MSCFModel::brakeGap(), MSCFModel::ffeV(), MSVehicle::gap(), MSVehicle::getCarFollowModel(), MSNet::getCurrentTimeStep(), MSNet::getEdgeControl(), MsgHandler::getErrorInstance(), getFollowerOnConsecutive(), MSNet::getInstance(), getLastVehicle(), MSVehicleType::getLength(), getLength(), getMaxSpeed(), getPartialOccupator(), getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSCFModel::getSpeedAfterMaxDecel(), MSVehicle::getVehicleType(), MSEdgeControl::gotActive(), MsgHandler::inform(), isLinkEnd(), MSLink::LINKSTATE_TL_RED, MIN2(), myVehicleLengthSum, myVehicles, SPEED2DIST, succLinkSec(), SUMOReal, and TIME2STEPS.
Referenced by MSEmitter::childCheckEmit(), MSCalibrator::childCheckEmit(), traci::TraCIServer::commandAddVehicle(), emit(), freeEmit(), GUILane::isEmissionSuccess(), and GUIInternalLane::isEmissionSuccess().
00238 { 00239 // and the speed is not too high (vehicle should decelerate) 00240 // try to get a leader on consecutive lanes 00241 // we have to do this even if we have found a leader on our lane because it may 00242 // be driving into another direction 00243 aVehicle->getBestLanes(true, this); 00244 const MSCFModel &cfModel = aVehicle->getCarFollowModel(); 00245 const std::vector<MSLane*> &bestLaneConts = aVehicle->getBestLanesContinuation(this); 00246 std::vector<MSLane*>::const_iterator ri = bestLaneConts.begin(); 00247 SUMOReal seen = getLength() - pos; 00248 SUMOReal dist = cfModel.brakeGap(speed); 00249 const MSRoute &r = aVehicle->getRoute(); 00250 MSRouteIterator ce = r.begin(); 00251 MSLane *currentLane = this; 00252 MSLane *nextLane = this; 00253 while (seen<dist&&ri!=bestLaneConts.end()&&nextLane!=0/*&&ce!=r.end()*/) { 00254 // get the next link used... 00255 MSLinkCont::const_iterator link = currentLane->succLinkSec(*aVehicle, 1, *currentLane, bestLaneConts); 00256 // ...and the next used lane (including internal) 00257 if (!currentLane->isLinkEnd(link) && (*link)->havePriority() && (*link)->getState()!=MSLink::LINKSTATE_TL_RED) { // red may have priority? 00258 #ifdef HAVE_INTERNAL_LANES 00259 bool nextInternal = false; 00260 nextLane = (*link)->getViaLane(); 00261 if (nextLane==0) { 00262 nextLane = (*link)->getLane(); 00263 } else { 00264 nextInternal = true; 00265 } 00266 #else 00267 nextLane = (*link)->getLane(); 00268 #endif 00269 } else { 00270 nextLane = 0; 00271 } 00272 // check how next lane effects the journey 00273 if (nextLane!=0) { 00274 SUMOReal gap = 0; 00275 MSVehicle * leader = currentLane->getPartialOccupator(); 00276 if (leader!=0) { 00277 gap = getPartialOccupatorEnd(); 00278 } else { 00279 // check leader on next lane 00280 leader = nextLane->getLastVehicle(); 00281 if (leader!=0) { 00282 gap = seen+leader->getPositionOnLane()-leader->getVehicleType().getLength(); 00283 } 00284 } 00285 if (leader!=0) { 00286 SUMOReal nspeed = gap>=0 ? cfModel.ffeV(aVehicle, speed, gap, leader->getSpeed()) : 0; 00287 if (nspeed<speed) { 00288 if (patchSpeed) { 00289 speed = MIN2(nspeed, speed); 00290 dist = cfModel.brakeGap(speed); 00291 } else { 00292 // we may not drive with the given velocity - we crash into the leader 00293 return false; 00294 } 00295 } 00296 } 00297 // check next lane's maximum velocity 00298 SUMOReal nspeed = nextLane->getMaxSpeed(); 00299 if (nspeed<speed) { 00300 // patch speed if needed 00301 if (patchSpeed) { 00302 speed = MIN2(cfModel.ffeV(aVehicle, speed, seen, nspeed), speed); 00303 dist = cfModel.brakeGap(speed); 00304 } else { 00305 // we may not drive with the given velocity - we would be too fast on the next lane 00306 return false; 00307 } 00308 } 00309 // check traffic on next junctions 00310 const SUMOTime arrivalTime = MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(seen / speed); 00311 #ifdef HAVE_INTERNAL_LANES 00312 const SUMOTime leaveTime = (*link)->getViaLane()==0 ? arrivalTime + TIME2STEPS((*link)->getLength() * speed) : arrivalTime + TIME2STEPS((*link)->getViaLane()->getLength() * speed); 00313 #else 00314 const SUMOTime leaveTime = arrivalTime + TIME2STEPS((*link)->getLength() * speed); 00315 #endif 00316 if ((*link)->hasApproachingFoe(arrivalTime, leaveTime)) { 00317 SUMOReal nspeed = cfModel.ffeV(aVehicle, speed, seen, 0); 00318 if (nspeed<speed) { 00319 if (patchSpeed) { 00320 speed = MIN2(nspeed, speed); 00321 dist = cfModel.brakeGap(speed); 00322 } else { 00323 // we may not drive with the given velocity - we crash into the leader 00324 return false; 00325 } 00326 } 00327 } else { 00328 // we can only drive to the end of the current lane... 00329 SUMOReal nspeed = cfModel.ffeV(aVehicle, speed, seen, 0); 00330 if (nspeed<speed) { 00331 if (patchSpeed) { 00332 speed = MIN2(nspeed, speed); 00333 dist = cfModel.brakeGap(speed); 00334 } else { 00335 // we may not drive with the given velocity - we crash into the leader 00336 return false; 00337 } 00338 } 00339 } 00340 seen += nextLane->getLength(); 00341 ++ce; 00342 ++ri; 00343 currentLane = nextLane; 00344 } 00345 } 00346 if (seen<dist) { 00347 SUMOReal nspeed = cfModel.ffeV(aVehicle, speed, seen, 0); 00348 if (nspeed<speed) { 00349 if (patchSpeed) { 00350 speed = MIN2(nspeed, speed); 00351 dist = cfModel.brakeGap(speed); 00352 } else { 00353 // we may not drive with the given velocity - we crash into the leader 00354 MsgHandler::getErrorInstance()->inform("Vehicle '" + aVehicle->getID() + "' will not be able to emit using given velocity!"); 00355 // !!! we probably should do something else... 00356 return false; 00357 } 00358 } 00359 } 00360 00361 // get the pointer to the vehicle next in front of the given position 00362 MSLane::VehCont::iterator predIt = 00363 find_if(myVehicles.begin(), myVehicles.end(), bind2nd(VehPosition(), pos)); 00364 if (predIt != myVehicles.end()) { 00365 // ok, there is one (a leader) 00366 MSVehicle* leader = *predIt; 00367 SUMOReal frontGapNeeded = aVehicle->getCarFollowModel().getSecureGap(speed, leader->getCarFollowModel().getSpeedAfterMaxDecel(leader->getSpeed())); 00368 SUMOReal gap = MSVehicle::gap(leader->getPositionOnLane(), leader->getVehicleType().getLength(), pos); 00369 if (gap<frontGapNeeded) { 00370 // too close to the leader on this lane 00371 return false; 00372 } 00373 } 00374 00375 // check back vehicle 00376 if (predIt!=myVehicles.begin()) { 00377 // there is direct follower on this lane 00378 MSVehicle *follower = *(predIt-1); 00379 SUMOReal backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), aVehicle->getCarFollowModel().getSpeedAfterMaxDecel(speed)); 00380 SUMOReal gap = MSVehicle::gap(pos, aVehicle->getVehicleType().getLength(), follower->getPositionOnLane()); 00381 if (gap<backGapNeeded) { 00382 // too close to the follower on this lane 00383 return false; 00384 } 00385 } else { 00386 // check approaching vehicle (consecutive follower) 00387 SUMOReal lspeed = getMaxSpeed(); 00388 // in order to look back, we'd need the minimum braking ability of vehicles in the net... 00389 // we'll assume it to be 4m/s^2 00390 // !!!revisit 00391 SUMOReal dist = lspeed * lspeed * SUMOReal(1./2.*4.) + SPEED2DIST(lspeed); 00392 std::pair<const MSVehicle * const, SUMOReal> approaching = getFollowerOnConsecutive(dist, 0, speed, pos - aVehicle->getVehicleType().getLength()); 00393 if (approaching.first!=0) { 00394 const MSVehicle *const follower = approaching.first; 00395 SUMOReal backGapNeeded = follower->getCarFollowModel().getSecureGap(follower->getSpeed(), aVehicle->getCarFollowModel().getSpeedAfterMaxDecel(speed)); 00396 SUMOReal gap = approaching.second - pos - aVehicle->getVehicleType().getLength(); 00397 if (gap<backGapNeeded) { 00398 // too close to the consecutive follower 00399 return false; 00400 } 00401 } 00402 } 00403 00404 // may got negative while adaptation 00405 if (speed<0) { 00406 return false; 00407 } 00408 // enter 00409 aVehicle->enterLaneAtEmit(this, pos, speed); 00410 bool wasInactive = myVehicles.size()==0; 00411 if (predIt==myVehicles.end()) { 00412 // vehicle will be the first on the lane 00413 myVehicles.push_back(aVehicle); 00414 } else { 00415 myVehicles.insert(predIt, aVehicle); 00416 } 00417 myVehicleLengthSum += aVehicle->getVehicleType().getLength(); 00418 if (wasInactive) { 00419 MSNet::getInstance()->getEdgeControl().gotActive(this); 00420 } 00421 return true; 00422 }
| bool MSLane::isLinkEnd | ( | MSLinkCont::iterator & | i | ) |
Returns the information whether the given link shows at the end of the list of links (is not valid)
Definition at line 716 of file MSLane.cpp.
References myLinks.
00716 { 00717 return i==myLinks.end(); 00718 }
| bool MSLane::isLinkEnd | ( | MSLinkCont::const_iterator & | i | ) | const |
Returns the information whether the given link shows at the end of the list of links (is not valid)
Definition at line 710 of file MSLane.cpp.
References myLinks.
Referenced by getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), isEmissionSuccess(), and MSVehicle::vsafeCriticalCont().
00710 { 00711 return i==myLinks.end(); 00712 }
| void MSLane::leftByLaneChange | ( | MSVehicle * | v | ) |
Definition at line 1015 of file MSLane.cpp.
References MSVehicleType::getLength(), MSVehicle::getVehicleType(), and myVehicleLengthSum.
01015 { 01016 myVehicleLengthSum -= v->getVehicleType().getLength(); 01017 }
Reimplemented in GUIInternalLane, GUILane, and MSInternalLane.
Definition at line 465 of file MSLane.cpp.
References MSVehicleTransfer::addVeh(), getID(), MSVehicleTransfer::getInstance(), MSNet::getInstance(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myLeftVehLength, myLength, myVehicleLengthSum, myVehicles, and toString().
Referenced by MSInternalLane::moveCritical(), and GUILane::moveCritical().
00465 { 00466 myLeftVehLength = myVehicleLengthSum; 00467 assert(myVehicles.size()!=0); 00468 std::vector<MSVehicle*> collisions; 00469 VehCont::iterator lastBeforeEnd = myVehicles.end() - 1; 00470 VehCont::iterator veh; 00471 // Move all next vehicles beside the first 00472 for (veh=myVehicles.begin(); veh != lastBeforeEnd;) { 00473 myLeftVehLength -= (*veh)->getVehicleType().getLength(); 00474 VehCont::const_iterator pred(veh + 1); 00475 if ((*veh)->moveRegardingCritical(t, this, *pred, 0, myLeftVehLength)) { 00476 collisions.push_back(*veh); 00477 } 00478 ++veh; 00479 } 00480 myLeftVehLength -= (*veh)->getVehicleType().getLength(); 00481 if ((*veh)->moveRegardingCritical(t, this, 0, 0, myLeftVehLength)) { 00482 collisions.push_back(*veh); 00483 } 00484 assert((*veh)->getPositionOnLane() <= myLength); 00485 assert(&(*veh)->getLane()==this); 00486 // deal with collisions 00487 for (std::vector<MSVehicle*>::iterator i=collisions.begin(); i!=collisions.end(); ++i) { 00488 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + (*i)->getID() + "'; collision, lane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00489 myVehicleLengthSum -= (*i)->getVehicleType().getLength(); 00490 MSVehicleTransfer::getInstance()->addVeh((*i)); 00491 myVehicles.erase(find(myVehicles.begin(), myVehicles.end(), *i)); 00492 } 00493 return myVehicles.size()==0; 00494 }
Returns the first/front vehicle of the lane and removing it from the lane.
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 675 of file MSLane.cpp.
References myVehicleLengthSum, myVehicles, and SPEED2DIST.
Referenced by GUILane::pop(), GUIInternalLane::pop(), and setCritical().
00675 { 00676 assert(! myVehicles.empty()); 00677 MSVehicle* first = myVehicles.back(); 00678 first->leaveLaneAtMove(SPEED2DIST(first->getSpeed())/* - first->pos()*/); 00679 myVehicles.pop_back(); 00680 myVehicleLengthSum -= first->getVehicleType().getLength(); 00681 return first; 00682 }
Insert a vehicle into the lane's vehicle buffer. After processing done from moveCritical, when a vehicle exits it's lane. Returned is the information whether the vehicle was removed.
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 653 of file MSLane.cpp.
References MSVehicle::enterLaneAtMove(), MSNet::getInstance(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSNet::getVehicleControl(), MSVehicle::moveRoutePointer(), myEdge, myVehBuffer, MSVehicle::onRemovalFromNet(), MSVehicleControl::scheduleVehicleRemoval(), SPEED2DIST, SUMOReal, and MSVehicle::workOnMoveReminders().
Referenced by GUILane::push(), GUIInternalLane::push(), and setCritical().
00653 { 00654 // Insert vehicle only if it's destination isn't reached. 00655 // and it does not collide with previous 00656 // check whether the vehicle has ended his route 00657 // Add to mean data (edge/lane state dump) 00658 if (! veh->moveRoutePointer(myEdge)) { // adjusts vehicles routeIterator 00659 myVehBuffer.push_back(veh); 00660 veh->enterLaneAtMove(this, SPEED2DIST(veh->getSpeed()) - veh->getPositionOnLane()); 00661 SUMOReal pspeed = veh->getSpeed(); 00662 SUMOReal oldPos = veh->getPositionOnLane() - SPEED2DIST(veh->getSpeed()); 00663 veh->workOnMoveReminders(oldPos, veh->getPositionOnLane(), pspeed); 00664 return false; 00665 } else { 00666 veh->enterLaneAtMove(this, SPEED2DIST(veh->getSpeed()) - veh->getPositionOnLane()); 00667 veh->onRemovalFromNet(false); 00668 MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(veh); 00669 return true; 00670 } 00671 }
| virtual void MSLane::releaseVehicles | ( | ) | const throw () [inline, virtual] |
Allows to use the container for microsimulation again.
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 287 of file MSLane.h.
Referenced by GUILaneWrapper::drawGL(), getHarmonoise_NoiseEmissions(), getHBEFA_CO2Emissions(), getHBEFA_COEmissions(), getHBEFA_FuelConsumption(), getHBEFA_HCEmissions(), getHBEFA_NOxEmissions(), getHBEFA_PMxEmissions(), getMeanSpeed(), and TraCIServerAPI_Lane::processGet().
| MSVehicle * MSLane::removeFirstVehicle | ( | ) | [virtual] |
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 834 of file MSLane.cpp.
References MSVehicleType::getLength(), MSVehicle::getVehicleType(), MSVehicle::leaveLaneAtMove(), myVehicleLengthSum, and myVehicles.
Referenced by GUILane::removeFirstVehicle(), GUIInternalLane::removeFirstVehicle(), and setCritical().
00834 { 00835 MSVehicle *veh = *(myVehicles.end()-1); 00836 veh->leaveLaneAtMove(0); 00837 myVehicles.erase(myVehicles.end()-1); 00838 myVehicleLengthSum -= veh->getVehicleType().getLength(); 00839 return veh; 00840 }
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 844 of file MSLane.cpp.
References MSVehicle::getID(), MSVehicleType::getLength(), MSVehicle::getVehicleType(), MSVehicle::leaveLane(), myVehicleLengthSum, and myVehicles.
Referenced by MSCalibrator::execute(), GUILane::removeVehicle(), and GUIInternalLane::removeVehicle().
00844 { 00845 for (MSLane::VehCont::iterator it = myVehicles.begin(); it < myVehicles.end(); it++) { 00846 if (remVehicle->getID() == (*it)->getID()) { 00847 remVehicle->leaveLane(true); 00848 myVehicles.erase(it); 00849 myVehicleLengthSum -= remVehicle->getVehicleType().getLength(); 00850 break; 00851 } 00852 } 00853 return remVehicle; 00854 }
| void MSLane::resetPartialOccupation | ( | MSVehicle * | v | ) | throw () |
Removes the information about a vehicle lapping into this lane.
| [in] | v | The vehicle which laps into this lane |
Definition at line 439 of file MSLane.cpp.
References myInlappingVehicle, and myInlappingVehicleEnd.
Referenced by MSVehicle::moveFirstChecked().
00439 { 00440 if (v==myInlappingVehicle) { 00441 myInlappingVehicleEnd = 10000; 00442 } 00443 myInlappingVehicle = 0; 00444 }
| void MSLane::setAllowedClasses | ( | const std::vector< SUMOVehicleClass > & | classes | ) | throw () [inline] |
Definition at line 468 of file MSLane.h.
References myAllowedClasses.
Referenced by TraCIServerAPI_Lane::processSet().
00468 { 00469 myAllowedClasses = classes; 00470 }
Moves the critical vehicles This step is done after the responds have been set
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 544 of file MSLane.cpp.
References MSVehicleTransfer::addVeh(), MSVehicle::ends(), getID(), MSVehicle::getID(), MSVehicleTransfer::getInstance(), MSNet::getInstance(), MSVehicleType::getLength(), getLength(), MSVehicle::getPositionOnLane(), MSVehicle::getTargetLane(), MSNet::getVehicleControl(), MSVehicle::getVehicleType(), MsgHandler::getWarningInstance(), MSGlobals::gTimeToGridlock, MsgHandler::inform(), MSVehicle::isOnRoad(), myVehicleLengthSum, myVehicles, MSVehicle::onRemovalFromNet(), pop(), push(), removeFirstVehicle(), MSVehicleControl::scheduleVehicleRemoval(), and toString().
Referenced by GUILane::setCritical(), and GUIInternalLane::setCritical().
00544 { 00545 // move critical vehicles 00546 int first2pop = -1; 00547 int curr = 0; 00548 bool hadProblem = false; 00549 VehCont::iterator i; 00550 for (i=myVehicles.begin(); i!=myVehicles.end(); ++i, ++curr) { 00551 (*i)->moveFirstChecked(); 00552 MSLane *target = (*i)->getTargetLane(); 00553 if (target!=0&&first2pop<0) { 00554 first2pop = curr; 00555 } 00556 } 00557 if (first2pop>=0) { 00558 const int remove = (int)myVehicles.size() - first2pop; 00559 for (int j = 0; j<remove; ++j) { 00560 MSVehicle *v = *(myVehicles.end() - 1); 00561 MSVehicle *p = pop(t); 00562 assert(v==p); 00563 MSLane *target = p->getTargetLane(); 00564 if (target==0||p->getPositionOnLane()>target->getLength()) { 00565 if (target==0) { 00566 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + v->getID() + "'; false leaving order, targetLane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00567 } else if (p->getPositionOnLane()>target->getLength()) { 00568 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + v->getID() + "'; beyond lane (1), targetLane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00569 } 00570 MSVehicleTransfer::getInstance()->addVeh(v); 00571 hadProblem = true; 00572 continue; 00573 } 00574 if (target!=0&&p->isOnRoad()) { 00575 target->push(p); 00576 into.push_back(target); 00577 } 00578 } 00579 } 00580 if (myVehicles.size()>0) { 00581 if (MSGlobals::gTimeToGridlock>0 00582 && !(*(myVehicles.end()-1))->isStopped() 00583 && 00584 (*(myVehicles.end()-1))->getWaitingTime()>MSGlobals::gTimeToGridlock) { 00585 00586 MSVehicleTransfer *vt = MSVehicleTransfer::getInstance(); 00587 MSVehicle *veh = removeFirstVehicle(); 00588 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + veh->getID() + "'; waited too long, lane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00589 vt->addVeh(veh); 00590 } 00591 } 00592 // check for vehicle removal 00593 for (VehCont::iterator veh = myVehicles.begin(); veh != myVehicles.end();) { 00594 MSVehicle *vehV = *veh; 00595 if (vehV->getPositionOnLane()>getLength()) { 00596 MsgHandler::getWarningInstance()->inform("Teleporting vehicle '" + vehV->getID() + "'; beyond lane (2), targetLane='" + getID() + "', time=" + toString(MSNet::getInstance()->getCurrentTimeStep()) + "."); 00597 MSVehicleTransfer::getInstance()->addVeh(vehV); 00598 veh = myVehicles.erase(veh); // remove current vehicle 00599 } else if (vehV->ends()) { 00600 myVehicleLengthSum -= vehV->getVehicleType().getLength(); 00601 vehV->onRemovalFromNet(false); 00602 MSNet::getInstance()->getVehicleControl().scheduleVehicleRemoval(vehV); 00603 veh = myVehicles.erase(veh); // remove current vehicle 00604 } else { 00605 ++veh; 00606 } 00607 } 00608 return myVehicles.size()==0; 00609 }
| void MSLane::setLength | ( | SUMOReal | val | ) | throw () [inline] |
Definition at line 391 of file MSLane.h.
References myLength.
Referenced by TraCIServerAPI_Lane::processSet().
00391 { 00392 myLength = val; 00393 }
| void MSLane::setMaxSpeed | ( | SUMOReal | val | ) | throw () [inline] |
Definition at line 387 of file MSLane.h.
References myMaxSpeed.
Referenced by TraCIServerAPI_Lane::processSet().
00387 { 00388 myMaxSpeed = val; 00389 }
| void MSLane::setNotAllowedClasses | ( | const std::vector< SUMOVehicleClass > & | classes | ) | throw () [inline] |
Definition at line 473 of file MSLane.h.
References myNotAllowedClasses.
Referenced by TraCIServerAPI_Lane::processSet().
00473 { 00474 myNotAllowedClasses = classes; 00475 }
| SUMOReal MSLane::setPartialOccupation | ( | MSVehicle * | v, | |
| SUMOReal | leftVehicleLength | |||
| ) | throw () |
Sets the information about a vehicle lapping into this lane.
The given left length of vehicle which laps into this lane is used to determine the vehicle's end position in regard to this lane's length. This information is set into myInlappingVehicleState; additionally, the vehicle pointer is stored in myInlappingVehicle; Returns this lane's length for subtracting it from the left vehicle length.
| [in] | v | The vehicle which laps into this lane |
| [in] | leftVehicleLength | The distance the vehicle laps into this lane |
Definition at line 427 of file MSLane.cpp.
References myInlappingVehicle, myInlappingVehicleEnd, and myLength.
00427 { 00428 myInlappingVehicle = v; 00429 if (leftVehicleLength>myLength) { 00430 myInlappingVehicleEnd = 0; 00431 } else { 00432 myInlappingVehicleEnd = myLength-leftVehicleLength; 00433 } 00434 return myLength; 00435 }
| MSLinkCont::const_iterator MSLane::succLinkSec | ( | const SUMOVehicle & | veh, | |
| unsigned int | nRouteSuccs, | |||
| const MSLane & | succLinkSource, | |||
| const std::vector< MSLane * > & | conts | |||
| ) | const [virtual] |
Same as succLink, but does not throw any assertions when the succeeding link could not be found; Returns the myLinks.end() instead; Further, the number of edges to look forward may be given
Definition at line 740 of file MSLane.cpp.
References MSEdge::allowedLanes(), MSVehicleType::getVehicleClass(), SUMOVehicle::getVehicleType(), myLinks, and SUMOVehicle::succEdge().
Referenced by appropriate(), getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), isEmissionSuccess(), GUIVehicle::setBlinkerInformation(), and MSVehicle::vsafeCriticalCont().
00741 { 00742 const MSEdge* nRouteEdge = veh.succEdge(nRouteSuccs); 00743 // check whether the vehicle tried to look beyond its route 00744 if (nRouteEdge==0) { 00745 // return end (no succeeding link) if so 00746 return succLinkSource.myLinks.end(); 00747 } 00748 // a link may be used if 00749 // 1) there is a destination lane ((*link)->getLane()!=0) 00750 // 2) the destination lane belongs to the next edge in route ((*link)->getLane()->myEdge == nRouteEdge) 00751 // 3) the destination lane allows the vehicle's class ((*link)->getLane()->allowsVehicleClass(veh.getVehicleClass())) 00752 00753 // at first, we'll assume we have the continuations of our route in "conts" (built in "getBestLanes") 00754 // "conts" stores the best continuations of our current lane 00755 MSLinkCont::const_iterator link; 00756 if (nRouteSuccs>0&&conts.size()>=nRouteSuccs&&nRouteSuccs>0) { 00757 // we go through the links in our list and return the matching one 00758 for (link=succLinkSource.myLinks.begin(); link!=succLinkSource.myLinks.end() ; ++link) { 00759 if ((*link)->getLane()!=0 && (*link)->getLane()->myEdge == nRouteEdge && (*link)->getLane()->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) { 00760 // we should use the link if it connects us to the best lane 00761 if ((*link)->getLane()==conts[nRouteSuccs-1]) { 00762 return link; 00763 } 00764 } 00765 } 00766 } 00767 00768 // ok, we were not able to use the conts for any reason 00769 // we will now collect allowed links, at first 00770 // collect allowed links 00771 std::vector<MSLinkCont::const_iterator> valid; 00772 for (link=succLinkSource.myLinks.begin(); link!=succLinkSource.myLinks.end() ; ++link) { 00773 if ((*link)->getLane()!=0 && (*link)->getLane()->myEdge == nRouteEdge && (*link)->getLane()->allowsVehicleClass(veh.getVehicleType().getVehicleClass())) { 00774 valid.push_back(link); 00775 } 00776 } 00777 // if no valid link was found... 00778 if (valid.size()==0) { 00779 // ... return end (no succeeding link) 00780 return succLinkSource.myLinks.end(); 00781 } 00782 // if there is only one valid link, let's use it... 00783 if (valid.size()==1) { 00784 return *(valid.begin()); 00785 } 00786 // if the next edge is the route end, then we may return an arbitary link 00787 // also, if there is no allowed lane on the edge following the current one (recheck?) 00788 const MSEdge* nRouteEdge2 = veh.succEdge(nRouteSuccs+1); 00789 const std::vector<MSLane*> *next_allowed = nRouteEdge->allowedLanes(*nRouteEdge2, veh.getVehicleType().getVehicleClass()); 00790 if (nRouteEdge2==0||next_allowed==0) { 00791 return *(valid.begin()); 00792 } 00793 // now let's determine which link is the best 00794 // in fact, we do not know it, here... 00795 for (std::vector<MSLinkCont::const_iterator>::iterator i=valid.begin(); i!=valid.end(); ++i) { 00796 if (find(next_allowed->begin(), next_allowed->end(), (**i)->getLane())!=next_allowed->end()) { 00797 return *i; 00798 } 00799 } 00800 return *(valid.begin()); 00801 }
| void MSLane::swapAfterLaneChange | ( | SUMOTime | t | ) | [protected, virtual] |
moves myTmpVehicles int myVehicles after a lane change procedure
Reimplemented in GUIInternalLane, and GUILane.
Definition at line 812 of file MSLane.cpp.
References myTmpVehicles, and myVehicles.
Referenced by GUILane::swapAfterLaneChange(), and GUIInternalLane::swapAfterLaneChange().
00812 { 00813 myVehicles = myTmpVehicles; 00814 myTmpVehicles.clear(); 00815 }
friend class GUILaneWrapper [friend] |
Definition at line 75 of file MSLane.h.
Referenced by GUILane::buildLaneWrapper(), and GUIInternalLane::buildLaneWrapper().
friend class MSLaneChanger [friend] |
friend class MSXMLRawOut [friend] |
std::vector<SUMOVehicleClass> MSLane::myAllowedClasses [protected] |
The list of allowed vehicle classes.
Definition at line 616 of file MSLane.h.
Referenced by allowsVehicleClass(), getAllowedClasses(), and setAllowedClasses().
SUMOReal MSLane::myBackDistance [protected] |
MSLane::DictType MSLane::myDict [static, protected] |
Static dictionary to associate string-ids with objects.
Definition at line 650 of file MSLane.h.
Referenced by clear(), dictionary(), dictSize(), and insertIDs().
MSEdge* MSLane::myEdge [protected] |
The lane's edge, for routing only.
Definition at line 597 of file MSLane.h.
Referenced by appropriate(), getEdge(), getLeftLane(), GUILaneWrapper::getPurpose(), getRightLane(), and push().
std::vector<MSLane*>::const_iterator MSLane::myFirstNeigh [protected] |
std::string MSLane::myID [protected] |
std::vector<IncomingLaneInfo> MSLane::myIncomingLanes [protected] |
Definition at line 621 of file MSLane.h.
Referenced by addIncomingLane(), getFollowerOnConsecutive(), and getIncomingLanes().
MSVehicle* MSLane::myInlappingVehicle [protected] |
The vehicle which laps into this lane.
Definition at line 630 of file MSLane.h.
Referenced by getLastVehicleInformation(), getPartialOccupator(), resetPartialOccupation(), and setPartialOccupation().
SUMOReal MSLane::myInlappingVehicleEnd [protected] |
End position of a vehicle which laps into this lane.
Definition at line 627 of file MSLane.h.
Referenced by getLastVehicleInformation(), getPartialOccupatorEnd(), resetPartialOccupation(), and setPartialOccupation().
std::vector<MSLane*>::const_iterator MSLane::myLastNeigh [protected] |
SUMOReal MSLane::myLeftVehLength [protected] |
Not yet seen vehicle lengths.
Definition at line 640 of file MSLane.h.
Referenced by moveCritical().
SUMOReal MSLane::myLength [protected] |
Lane length [m].
Definition at line 594 of file MSLane.h.
Referenced by getLength(), getOccupancy(), moveCritical(), setLength(), and setPartialOccupation().
MSLinkCont MSLane::myLinks [protected] |
The lane's Links to it's succeeding lanes and the default right-of-way rule, i.e. blocked or not blocked.
Definition at line 644 of file MSLane.h.
Referenced by appropriate(), getLinkCont(), initialize(), isLinkEnd(), succLinkSec(), and ~MSLane().
SUMOReal MSLane::myMaxSpeed [protected] |
Lane-wide speedlimit [m/s].
Definition at line 600 of file MSLane.h.
Referenced by getMaxSpeed(), getMeanSpeed(), and setMaxSpeed().
MoveReminderCont MSLane::myMoveReminders [private] |
This lane's move reminder.
Definition at line 654 of file MSLane.h.
Referenced by addMoveReminder(), and getMoveReminders().
std::vector<SUMOVehicleClass> MSLane::myNotAllowedClasses [protected] |
The list of disallowed vehicle classes.
Definition at line 619 of file MSLane.h.
Referenced by allowsVehicleClass(), getNotAllowedClasses(), and setNotAllowedClasses().
size_t MSLane::myNumericalID [protected] |
Unique numerical ID (set on reading by netload).
Definition at line 582 of file MSLane.h.
Referenced by getNumericalID().
The shape of the lane.
Definition at line 457 of file MSLane.h.
Referenced by GUILane::buildLaneWrapper(), GUIInternalLane::buildLaneWrapper(), and getShape().
VehCont MSLane::myTmpVehicles [protected] |
Container for lane-changing vehicles. After completion of lane-change- process, the two containers will be swapped.
Definition at line 604 of file MSLane.h.
Referenced by swapAfterLaneChange().
std::vector<MSVehicle*> MSLane::myVehBuffer [protected] |
Vehicle-buffer for vehicle that was put onto this lane by a junction. The buffer is necessary, because of competing push- and pop-operations on myVehicles during Junction::moveFirst()
Definition at line 613 of file MSLane.h.
Referenced by empty(), integrateNewVehicle(), and push().
SUMOReal MSLane::myVehicleLengthSum [protected] |
The current length of all vehicles on this lane.
Definition at line 624 of file MSLane.h.
Referenced by detectCollisions(), enteredByLaneChange(), getOccupancy(), getVehLenSum(), integrateNewVehicle(), isEmissionSuccess(), leftByLaneChange(), moveCritical(), pop(), removeFirstVehicle(), removeVehicle(), and setCritical().
VehCont MSLane::myVehicles [protected] |
The lane's vehicles. The entering vehicles are inserted at the front of this container and the leaving ones leave from the back, e.g. the vehicle in front of the junction (often called first) is myVehicles.back() (if it exists). And if it is an iterator at a vehicle, ++it points to the vehicle in front. This is the interaction vehicle.
Definition at line 591 of file MSLane.h.
Referenced by detectCollisions(), empty(), GUILaneWrapper::firstWaitingTime(), freeEmit(), getFirstVehicle(), getLastVehicle(), getLastVehicleInformation(), getMeanSpeed(), getVehicleNumber(), getVehiclesSecure(), GUILane::getVehiclesSecure(), GUIInternalLane::getVehiclesSecure(), integrateNewVehicle(), isEmissionSuccess(), moveCritical(), MSInternalLane::moveCritical(), pop(), removeFirstVehicle(), removeVehicle(), setCritical(), and swapAfterLaneChange().
1.5.6