GUIInternalLane Class Reference

#include <GUIInternalLane.h>

Inheritance diagram for GUIInternalLane:

MSInternalLane MSLane

Detailed Description

An extended MSInternalLane. A mechanism to avoid concurrent visualisation and simulation what may cause problems when vehicles disappear is implemented using a mutex

Definition at line 57 of file GUIInternalLane.h.


interaction with MSMoveReminder

virtual void addMoveReminder (MSMoveReminder *rem) throw ()
 Add a move-reminder to move-reminder container.
const MoveReminderContgetMoveReminders () const throw ()
 Return the list of this lane's move reminders.
typedef std::vector
< MSMoveReminder * > 
MoveReminderCont
 Definition of a container for move reminder.

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)
GUILaneWrapperbuildLaneWrapper (GUIGlObjectStorage &idStorage)
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)
MSEdgegetEdge () 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 MSLinkContgetLinkCont () const
 returns the container with all links !!!
MSLane *const getRightLane () const
 GUIInternalLane (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.
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)
MSVehicleremoveFirstVehicle ()
MSVehicleremoveVehicle (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
 ~GUIInternalLane () 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.
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 Position2DVectorgetShape () 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.
MSVehiclegetPartialOccupator () 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.
Access to vehicles
const VehContgetVehiclesSecure () const throw ()
 Returns the vehicles container; locks it for microsimulation.
void releaseVehicles () const throw ()
 Allows to use the container for microsimulation again.
Additional initialisation
void initialize (MSLinkCont *succs)
 Delayed initialization.
Vehicle movement (longitudinal)
bool integrateNewVehicle (SUMOTime t)
bool moveCritical (SUMOTime t)
bool setCritical (SUMOTime t, std::vector< MSLane * > &into)
Vehicle emission
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).
Additional initialisation
void setParentJunctionInformation (MSLogicJunction::InnerState *const foescont, unsigned int foesIdx) throw ()
 Sets the information where to report vehicles being on this lane to.
void setPassPosition (SUMOReal passPos) throw ()
 Sets the position that must be free so that vehicles can pass.

Static Public Member Functions

static void clear ()
static MSLanedictionary (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

MSVehiclepop (SUMOTime t)
bool push (MSVehicle *veh)
void swapAfterLaneChange (SUMOTime t)
 moves myTmpVehicles int myVehicles after a lane change procedure

Protected Attributes

std::vector< SUMOVehicleClassmyAllowedClasses
 The list of allowed vehicle classes.
SUMOReal myBackDistance
MSEdgemyEdge
 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< IncomingLaneInfomyIncomingLanes
MSVehiclemyInlappingVehicle
 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< SUMOVehicleClassmyNotAllowedClasses
 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 Attributes

MFXMutex myLock
 The mutex used to avoid concurrent updates of the vehicle buffer.

Friends

class GUILaneWrapper
class MSLaneChanger
 needs access to myTmpVehicles (this maybe should be done via SUMOReal-buffering!!!)
class MSXMLRawOut

Member Typedef Documentation

typedef std::map< std::string, MSLane* > MSLane::DictType [protected, inherited]

definition of the tatic dictionary type

Definition at line 647 of file MSLane.h.

typedef std::vector< MSMoveReminder* > MSLane::MoveReminderCont [inherited]

Definition of a container for move reminder.

Definition at line 133 of file MSLane.h.

typedef std::deque< MSVehicle* > MSLane::VehCont [inherited]

Container for vehicles.

Definition at line 422 of file MSLane.h.


Constructor & Destructor Documentation

GUIInternalLane::GUIInternalLane ( 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.

Parameters:
[in] id The lane's id
[in] maxSpeed The speed allowed 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
See also:
SUMOVehicleClass

MSLane

MSInternalLane

Definition at line 51 of file GUIInternalLane.cpp.

00057         : MSInternalLane(id, maxSpeed, length, edge, numericalID, shape, allowed, disallowed) {}

GUIInternalLane::~GUIInternalLane (  )  throw ()

Destructor.

Definition at line 60 of file GUIInternalLane.cpp.

References MFXMutex::locked(), myLock, and MFXMutex::unlock().

00060                                           {
00061     // just to quit cleanly on a failure
00062     if (myLock.locked()) {
00063         myLock.unlock();
00064     }
00065 }


Member Function Documentation

void MSLane::addIncomingLane ( MSLane lane,
MSLink viaLink 
) [inherited]

Definition at line 891 of file MSLane.cpp.

References MSLane::getLength(), MSLane::IncomingLaneInfo::lane, MSLane::IncomingLaneInfo::length, MSLane::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, inherited]

Add a move-reminder to move-reminder container.

The move reminder will not be deleted by the lane.

Parameters:
[in] rem The move reminder to add

Definition at line 98 of file MSLane.cpp.

References MSLane::myMoveReminders.

00098                                                    {
00099     myMoveReminders.push_back(rem);
00100 }

bool MSLane::allowsVehicleClass ( SUMOVehicleClass  vclass  )  const [inherited]

Definition at line 870 of file MSLane.cpp.

References MSLane::myAllowedClasses, MSLane::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 }

bool MSLane::appropriate ( const MSVehicle veh  )  [virtual, inherited]

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(), MSLane::myEdge, MSLane::myLinks, and MSLane::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 * GUIInternalLane::buildLaneWrapper ( GUIGlObjectStorage idStorage  )  [virtual]

Reimplemented from MSLane.

Definition at line 194 of file GUIInternalLane.cpp.

References MSLane::GUILaneWrapper, and MSLane::myShape.

00194                                                                {
00195     return new GUILaneWrapper(idStorage, *this, myShape);
00196 }

void MSLane::clear (  )  [static, inherited]

Clears the dictionary

Definition at line 636 of file MSLane.cpp.

References MSLane::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 GUIInternalLane::detectCollisions ( SUMOTime  timestep  )  [virtual]

Check if vehicles are too close.

Reimplemented from MSLane.

Definition at line 200 of file GUIInternalLane.cpp.

References MSLane::detectCollisions(), MFXMutex::lock(), myLock, and MFXMutex::unlock().

00200                                                    {
00201     myLock.lock();
00202     try {
00203         MSLane::detectCollisions(timestep);
00204         myLock.unlock();
00205     } catch (ProcessError &) {
00206         myLock.unlock();
00207         throw;
00208     }
00209 }

MSLane * MSLane::dictionary ( std::string  id  )  [static, inherited]

Returns the MSEdgeControl associated to the key id if exists Otherwise returns 0.

Definition at line 625 of file MSLane.cpp.

References MSLane::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 }

bool MSLane::dictionary ( std::string  id,
MSLane lane 
) [static, inherited]

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 MSLane::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, inherited]

Definition at line 415 of file MSLane.h.

References MSLane::myDict.

00415                              {
00416         return myDict.size();
00417     }

bool MSLane::emit ( MSVehicle v  )  throw (ProcessError) [inherited]

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.

Parameters:
[in] v The vehicle to emit
Returns:
Whether the vehicle could be emitted
See also:
isEmissionSuccess

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, MSLane::freeEmit(), MSLane::getLength(), MSLane::getMaxSpeed(), MSLane::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, inherited]

Returns true if there is not a single vehicle on the lane.

Definition at line 382 of file MSLane.h.

References MSLane::myVehBuffer, and MSLane::myVehicles.

00382                        {
00383         assert(myVehBuffer.size()==0);
00384         return myVehicles.empty();
00385     }

void MSLane::enteredByLaneChange ( MSVehicle v  )  [inherited]

bool MSLane::freeEmit ( MSVehicle veh,
SUMOReal  speed 
) throw () [inherited]

Tries to emit the given vehicle on any place.

Parameters:
[in] veh The vehicle to emit
[in] speed The maximum emission speed
Returns:
Whether the vehicle could be emitted

Definition at line 106 of file MSLane.cpp.

References MSVehicle::getCarFollowModel(), MSLane::getLength(), MSVehicleType::getLength(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSCFModel::getSpeedAfterMaxDecel(), MSVehicle::getVehicleType(), MSLane::isEmissionSuccess(), MIN2(), MSLane::myVehicles, POSITION_EPS, and SUMOReal.

Referenced by MSVehicleTransfer::checkEmissions(), and MSLane::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, inherited]

Returns vehicle classes explicitely allowed on this lane.

Returns:
This lane's allowed vehicle classes

Definition at line 338 of file MSLane.h.

References MSLane::myAllowedClasses.

Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().

00338                                                                          {
00339         return myAllowedClasses;
00340     }

MSEdge& MSLane::getEdge (  )  const throw () [inline, inherited]

const MSVehicle *const MSLane::getFirstVehicle (  )  const [virtual, inherited]

Definition at line 731 of file MSLane.cpp.

References MSLane::myVehicles.

Referenced by MSLane::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 [inherited]

Definition at line 907 of file MSLane.cpp.

References MSVehicle::getCarFollowModel(), MSLane::getFirstVehicle(), MSLane::getIncomingLanes(), MSVehicle::getLane(), MSLane::getMaxSpeed(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSCFModel::hasSafeGap(), MSLane::IncomingLaneInfo::lane, MSLane::IncomingLaneInfo::length, MSLink::LINKSTATE_TL_RED, MSCFModel::maxNextSpeed(), MSLane::myIncomingLanes, SUMOReal, and MSLane::IncomingLaneInfo::viaLink.

Referenced by MSLane::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 () [inherited]

Returns the sum of last step noise emissions.

Returns:
noise emissions of vehicles on this lane during the last step

Definition at line 1128 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step CO2 emissions.

Returns:
CO2 emissions of vehicles on this lane during the last step

Definition at line 1056 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step CO emissions.

Returns:
CO emissions of vehicles on this lane during the last step

Definition at line 1068 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step fuel consumption.

Returns:
fuel consumption of vehicles on this lane during the last step

Definition at line 1116 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step HC emissions.

Returns:
HC emissions of vehicles on this lane during the last step

Definition at line 1104 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step NOx emissions.

Returns:
NOx emissions of vehicles on this lane during the last step

Definition at line 1092 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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 () [inherited]

Returns the sum of last step PMx emissions.

Returns:
PMx emissions of vehicles on this lane during the last step

Definition at line 1080 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::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, inherited]

const std::vector<IncomingLaneInfo>& MSLane::getIncomingLanes (  )  const [inline, inherited]

Definition at line 488 of file MSLane.h.

References MSLane::myIncomingLanes.

Referenced by MSVehicle::enterLaneAtEmit(), MSVehicle::enterLaneAtLaneChange(), and MSLane::getFollowerOnConsecutive().

00488                                                                 {
00489         return myIncomingLanes;
00490     }

MSVehicle *const MSLane::getLastVehicle (  )  const [virtual, inherited]

returns the last vehicle

Definition at line 722 of file MSLane.cpp.

References MSLane::myVehicles.

Referenced by MSVehicle::checkRewindLinkLanes(), MSLane::getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), and MSLane::isEmissionSuccess().

00722                                  {
00723     if (myVehicles.size()==0) {
00724         return 0;
00725     }
00726     return *myVehicles.begin();
00727 }

std::pair< MSVehicle *, SUMOReal > MSLane::getLastVehicleInformation (  )  const throw () [inherited]

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.

Returns:
Information about the last vehicle and it's back position

Definition at line 448 of file MSLane.cpp.

References MSVehicleType::getLength(), MSVehicle::getPositionOnLane(), MSVehicle::getVehicleType(), MAX2(), MSLane::myInlappingVehicle, MSLane::myInlappingVehicleEnd, MSLane::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 [inherited]

Definition at line 954 of file MSLane.cpp.

References MSCFModel::brakeGap(), MSVehicle::getCarFollowModel(), MSLane::getLastVehicle(), MSLane::getLength(), MSLane::getMaxSpeed(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSLane::isLinkEnd(), MSLink::LINKSTATE_TL_RED, and MSLane::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 [inherited]

Definition at line 858 of file MSLane.cpp.

References MSEdge::leftLane(), and MSLane::myEdge.

00858                               {
00859     return myEdge->leftLane(this);
00860 }

SUMOReal MSLane::getLength (  )  const throw () [inline, inherited]

Returns the lane's length.

Returns:
This lane's length

Definition at line 330 of file MSLane.h.

References MSLane::myLength.

Referenced by MSVehicle::adaptLaneEntering2MoveReminder(), MSLane::addIncomingLane(), NLSucceedingLaneBuilder::addSuccLane(), NLDetectorBuilder::buildInductLoop(), MSVehicleTransfer::checkEmissions(), MSVehicle::checkRewindLinkLanes(), NLDetectorBuilder::convUncontE2PosLength(), MSLane::emit(), MS_E2_ZS_CollectorOverLanes::extendTo(), MSLane::freeEmit(), MSVehicle::getBestLanes(), MSVehicle::getDistanceToPosition(), TraCIDijkstraRouter< E >::getEffort(), MSLane::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(), MSLane::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(), MSLane::setCritical(), MSVehicle::vsafeCriticalCont(), MSLCM_DK2004::wantsChangeToLeft(), MSLCM_DK2004::wantsChangeToRight(), and MSMeanData::writeEdge().

00330                                        {
00331         return myLength;
00332     }

const MSLinkCont & MSLane::getLinkCont (  )  const [inherited]

SUMOReal MSLane::getMaxSpeed (  )  const throw () [inline, inherited]

SUMOReal MSLane::getMeanSpeed (  )  const throw () [inherited]

Returns the mean speed on this lane.

Returns:
The average speed of vehicles during the last step; default speed if no vehicle was on this lane

Definition at line 1040 of file MSLane.cpp.

References MSLane::getVehiclesSecure(), MSLane::myMaxSpeed, MSLane::myVehicles, MSLane::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, inherited]

Return the list of this lane's move reminders.

Returns:
Previously added move reminder

Definition at line 148 of file MSLane.h.

References MSLane::myMoveReminders.

Referenced by MSVehicle::enterLaneAtEmit(), and MSVehicle::enterLaneAtLaneChange().

00148                                                                     {
00149         return myMoveReminders;
00150     }

const std::vector<SUMOVehicleClass>& MSLane::getNotAllowedClasses (  )  const throw () [inline, inherited]

Returns vehicle classes explicitely disallowed on this lane.

Returns:
This lane's disallowed vehicle classes

Definition at line 346 of file MSLane.h.

References MSLane::myNotAllowedClasses.

Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().

00346                                                                             {
00347         return myNotAllowedClasses;
00348     }

size_t MSLane::getNumericalID (  )  const throw () [inline, inherited]

Returns this lane's numerical id.

Returns:
This lane's numerical id

Definition at line 306 of file MSLane.h.

References MSLane::myNumericalID.

00306                                           {
00307         return myNumericalID;
00308     }

SUMOReal MSLane::getOccupancy (  )  const throw () [inherited]

Returns the occupancy of this lane during the last step.

Returns:
The occupancy during the last step

Definition at line 1028 of file MSLane.cpp.

References MSLane::myLength, and MSLane::myVehicleLengthSum.

Referenced by GUILaneWrapper::Colorer::getColorValue(), and TraCIServerAPI_Lane::processGet().

01028                                    {
01029     return myVehicleLengthSum / myLength;
01030 }

MSVehicle* MSLane::getPartialOccupator (  )  const throw () [inline, inherited]

Returns the vehicle which laps into this lane.

Returns:
The vehicle which laps into this lane, 0 if there is no such

Definition at line 237 of file MSLane.h.

References MSLane::myInlappingVehicle.

Referenced by MSLane::freeEmit(), MSLane::getLeaderOnConsecutive(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), MSLane::isEmissionSuccess(), and MSVehicle::moveRegardingCritical().

00237                                                    {
00238         return myInlappingVehicle;
00239     }

SUMOReal MSLane::getPartialOccupatorEnd (  )  const throw () [inline, inherited]

Returns the position of the in-lapping vehicle's end.

Returns:
Information about how far the vehicle laps into this lane

Definition at line 245 of file MSLane.h.

References MSLane::myInlappingVehicleEnd.

Referenced by MSLane::freeEmit(), MSLane::getLeaderOnConsecutive(), MSLaneChanger::getRealLeader(), MSLaneChanger::getRealThisLeader(), MSLane::isEmissionSuccess(), and MSVehicle::moveRegardingCritical().

00245                                                     {
00246         return myInlappingVehicleEnd;
00247     }

MSLane *const MSLane::getRightLane (  )  const [inherited]

const Position2DVector& MSLane::getShape (  )  const throw () [inline, inherited]

unsigned int MSLane::getVehicleNumber (  )  const throw () [inline, inherited]

Returns the number of vehicles on this lane.

Returns:
The number of vehicles on this lane

Definition at line 269 of file MSLane.h.

References MSLane::myVehicles.

Referenced by MSVehicle::checkRewindLinkLanes(), MSCalibrator::execute(), MSEdge::getFreeLane(), and TraCIServerAPI_Lane::processGet().

00269                                                   {
00270         return (unsigned int) myVehicles.size();
00271     }

const MSLane::VehCont & GUIInternalLane::getVehiclesSecure (  )  const throw () [virtual]

Returns the vehicles container; locks it for microsimulation.

Locks "myLock" preventing usage by microsimulation.

Please note that it is necessary to release the vehicles container afterwards using "releaseVehicles".

Returns:
The vehicles on this lane
See also:
MSLane::getVehiclesSecure

Reimplemented from MSLane.

Definition at line 81 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, and MSLane::myVehicles.

00081                                                  {
00082     myLock.lock();
00083     return myVehicles;
00084 }

SUMOReal MSLane::getVehLenSum (  )  const throw () [inherited]

Returns the sum of lengths of vehicles which were on the lane during the last step.

Returns:
The sum of vehicle lengths of vehicles in the last step

Definition at line 1034 of file MSLane.cpp.

References MSLane::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 
) [inherited]

Definition at line 827 of file MSLane.cpp.

References MSLane::myFirstNeigh, and MSLane::myLastNeigh.

00827                                                                                                                      {
00828     myFirstNeigh = firstNeigh;
00829     myLastNeigh = lastNeigh;
00830 }

void MSLane::initialize ( MSLinkCont succs  )  [inherited]

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.

Parameters:
[in] succs The list of (outgoing) links
Todo:
Why are succs not const?

Definition at line 90 of file MSLane.cpp.

References MSLane::myLinks.

Referenced by NLSucceedingLaneBuilder::closeSuccLane().

00090                                     {
00091     myLinks = *links;
00092     delete links;
00093 }

void MSLane::insertIDs ( std::vector< std::string > &  into  )  throw () [static, inherited]

Definition at line 645 of file MSLane.cpp.

References MSLane::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 }

bool GUIInternalLane::integrateNewVehicle ( SUMOTime  t  )  [virtual]

the same as in MSLane, but locks the access for the visualisation first; the access will be granted at the end of this method

Reimplemented from MSLane.

Definition at line 180 of file GUIInternalLane.cpp.

References MSLane::integrateNewVehicle(), MFXMutex::lock(), myLock, and MFXMutex::unlock().

00180                                                {
00181     myLock.lock();
00182     try {
00183         bool ret = MSLane::integrateNewVehicle(t);
00184         myLock.unlock();
00185         return ret;
00186     } catch (ProcessError &) {
00187         myLock.unlock();
00188         throw;
00189     }
00190 }

bool GUIInternalLane::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).

Locks the lock, calls MSLane::isEmissionSuccess keeping the result, unlocks the lock and returns the result.

Parameters:
[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
Returns:
Whether the vehicle could be emitted
See also:
MSLane::isEmissionSuccess

Reimplemented from MSLane.

Definition at line 70 of file GUIInternalLane.cpp.

References MSLane::isEmissionSuccess(), MFXMutex::lock(), myLock, and MFXMutex::unlock().

00071                                                                               {
00072     myLock.lock();
00073     bool ret = MSInternalLane::isEmissionSuccess(aVehicle, speed, pos, recheckNextLanes);
00074     myLock.unlock();
00075     return ret;
00076 }

bool MSLane::isLinkEnd ( MSLinkCont::iterator &  i  )  [inherited]

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 MSLane::myLinks.

00716                                        {
00717     return i==myLinks.end();
00718 }

bool MSLane::isLinkEnd ( MSLinkCont::const_iterator &  i  )  const [inherited]

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 MSLane::myLinks.

Referenced by MSLane::getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), MSLane::isEmissionSuccess(), and MSVehicle::vsafeCriticalCont().

00710                                                    {
00711     return i==myLinks.end();
00712 }

void MSLane::leftByLaneChange ( MSVehicle v  )  [inherited]

bool GUIInternalLane::moveCritical ( SUMOTime  t  )  [virtual]

the same as in MSLane, but locks the access for the visualisation first; the access will be granted at the end of this method

Reimplemented from MSInternalLane.

Definition at line 94 of file GUIInternalLane.cpp.

References MFXMutex::lock(), MSInternalLane::moveCritical(), myLock, and MFXMutex::unlock().

00094                                         {
00095     myLock.lock();
00096     try {
00097         bool ret = MSInternalLane::moveCritical(t);
00098         myLock.unlock();
00099         return ret;
00100     } catch (ProcessError &) {
00101         myLock.unlock();
00102         throw;
00103     }
00104 }

MSVehicle * GUIInternalLane::pop ( SUMOTime  t  )  [protected, virtual]

Returns the first/front vehicle of the lane and removing it from the lane.

Reimplemented from MSLane.

Definition at line 213 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::pop(), and MFXMutex::unlock().

00213                                {
00214     myLock.lock();
00215     try {
00216         MSVehicle *ret = MSLane::pop(t);
00217         myLock.unlock();
00218         return ret;
00219     } catch (ProcessError &) {
00220         myLock.unlock();
00221         throw;
00222     }
00223 }

bool GUIInternalLane::push ( MSVehicle veh  )  [protected, virtual]

the same as in MSLane, but locks the access for the visualisation first; the access will be granted at the end of this method

Reimplemented from MSLane.

Definition at line 122 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::push(), and MFXMutex::unlock().

00122                                     {
00123     // Insert vehicle only if it's destination isn't reached.
00124     //  and it does not collide with previous
00125     // check whether the vehicle has ended his route
00126     myLock.lock();
00127     try {
00128         MSLane::push(veh);
00129         myLock.unlock();
00130         return false;
00131     } catch (ProcessError &) {
00132         myLock.unlock();
00133         throw;
00134     }
00135 }

void GUIInternalLane::releaseVehicles (  )  const throw () [virtual]

Allows to use the container for microsimulation again.

Unlocks "myLock" preventing usage by microsimulation.

See also:
MSLane::releaseVehicles

Reimplemented from MSLane.

Definition at line 88 of file GUIInternalLane.cpp.

References myLock, and MFXMutex::unlock().

00088                                                {
00089     myLock.unlock();
00090 }

MSVehicle * GUIInternalLane::removeFirstVehicle (  )  [virtual]

Reimplemented from MSLane.

Definition at line 139 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::removeFirstVehicle(), and MFXMutex::unlock().

00139                                     {
00140     myLock.lock();
00141     try {
00142         MSVehicle *ret = MSLane::removeFirstVehicle();
00143         myLock.unlock();
00144         return ret;
00145     } catch (ProcessError &) {
00146         myLock.unlock();
00147         throw;
00148     }
00149 }

MSVehicle * GUIInternalLane::removeVehicle ( MSVehicle remVehicle  )  [virtual]

Reimplemented from MSLane.

Definition at line 153 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::removeVehicle(), and MFXMutex::unlock().

00153                                                      {
00154     myLock.lock();
00155     try {
00156         MSVehicle *ret = MSLane::removeVehicle(remVehicle);
00157         myLock.unlock();
00158         return ret;
00159     } catch (ProcessError &) {
00160         myLock.unlock();
00161         throw;
00162     }
00163 }

void MSLane::resetPartialOccupation ( MSVehicle v  )  throw () [inherited]

Removes the information about a vehicle lapping into this lane.

Parameters:
[in] v The vehicle which laps into this lane

Definition at line 439 of file MSLane.cpp.

References MSLane::myInlappingVehicle, and MSLane::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, inherited]

Definition at line 468 of file MSLane.h.

References MSLane::myAllowedClasses.

Referenced by TraCIServerAPI_Lane::processSet().

00468                                                                                {
00469         myAllowedClasses = classes;
00470     }

bool GUIInternalLane::setCritical ( SUMOTime  t,
std::vector< MSLane * > &  into 
) [virtual]

the same as in MSLane, but locks the access for the visualisation first; the access will be granted at the end of this method

Reimplemented from MSLane.

Definition at line 108 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::setCritical(), and MFXMutex::unlock().

00108                                                                  {
00109     myLock.lock();
00110     try {
00111         bool ret = MSInternalLane::setCritical(t, into);
00112         myLock.unlock();
00113         return ret;
00114     } catch (ProcessError &) {
00115         myLock.unlock();
00116         throw;
00117     }
00118 }

void MSLane::setLength ( SUMOReal  val  )  throw () [inline, inherited]

Definition at line 391 of file MSLane.h.

References MSLane::myLength.

Referenced by TraCIServerAPI_Lane::processSet().

00391                                          {
00392         myLength = val;
00393     }

void MSLane::setMaxSpeed ( SUMOReal  val  )  throw () [inline, inherited]

Definition at line 387 of file MSLane.h.

References MSLane::myMaxSpeed.

Referenced by TraCIServerAPI_Lane::processSet().

00387                                            {
00388         myMaxSpeed = val;
00389     }

void MSLane::setNotAllowedClasses ( const std::vector< SUMOVehicleClass > &  classes  )  throw () [inline, inherited]

Definition at line 473 of file MSLane.h.

References MSLane::myNotAllowedClasses.

Referenced by TraCIServerAPI_Lane::processSet().

00473                                                                                   {
00474         myNotAllowedClasses = classes;
00475     }

void MSInternalLane::setParentJunctionInformation ( MSLogicJunction::InnerState *const   foescont,
unsigned int  foesIdx 
) throw () [inherited]

Sets the information where to report vehicles being on this lane to.

In addition to a lane's normal initialization (MSLane::initialize), an internal lane needs to know which junction has to be informed about a vehicle being on the internal lane. This information is set herein.

Parameters:
[in] foescont The junction inner state to set information about vehicles into
[in] foesIdx This lane's index within this state

Definition at line 70 of file MSInternalLane.cpp.

References MSInternalLane::myFoesCont, and MSInternalLane::myFoesIndex.

00071                                       {
00072     myFoesCont = foescont;
00073     myFoesIndex = (int) foesIdx;
00074 }

SUMOReal MSLane::setPartialOccupation ( MSVehicle v,
SUMOReal  leftVehicleLength 
) throw () [inherited]

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.

Parameters:
[in] v The vehicle which laps into this lane
[in] leftVehicleLength The distance the vehicle laps into this lane
Returns:
This lane's length

Definition at line 427 of file MSLane.cpp.

References MSLane::myInlappingVehicle, MSLane::myInlappingVehicleEnd, and MSLane::myLength.

00427                                                                              {
00428     myInlappingVehicle = v;
00429     if (leftVehicleLength>myLength) {
00430         myInlappingVehicleEnd = 0;
00431     } else {
00432         myInlappingVehicleEnd = myLength-leftVehicleLength;
00433     }
00434     return myLength;
00435 }

void MSInternalLane::setPassPosition ( SUMOReal  passPos  )  throw () [inherited]

Sets the position that must be free so that vehicles can pass.

Todo:
!!! incomplete usage; check

Definition at line 78 of file MSInternalLane.cpp.

References MSInternalLane::myPassPosition.

00078                                                         {
00079     myPassPosition = passPos;
00080 }

MSLinkCont::const_iterator MSLane::succLinkSec ( const SUMOVehicle veh,
unsigned int  nRouteSuccs,
const MSLane succLinkSource,
const std::vector< MSLane * > &  conts 
) const [virtual, inherited]

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(), MSLane::myLinks, and SUMOVehicle::succEdge().

Referenced by MSLane::appropriate(), MSLane::getLeaderOnConsecutive(), MSLaneChanger::getRealThisLeader(), MSLane::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 GUIInternalLane::swapAfterLaneChange ( SUMOTime  t  )  [protected, virtual]

moves myTmpVehicles int myVehicles after a lane change procedure

Reimplemented from MSLane.

Definition at line 167 of file GUIInternalLane.cpp.

References MFXMutex::lock(), myLock, MSLane::swapAfterLaneChange(), and MFXMutex::unlock().

00167                                                {
00168     myLock.lock();
00169     try {
00170         MSLane::swapAfterLaneChange(t);
00171         myLock.unlock();
00172     } catch (ProcessError &) {
00173         myLock.unlock();
00174         throw;
00175     }
00176 }


Friends And Related Function Documentation

friend class GUILaneWrapper [friend, inherited]

Definition at line 75 of file MSLane.h.

Referenced by GUILane::buildLaneWrapper(), and buildLaneWrapper().

friend class MSLaneChanger [friend, inherited]

needs access to myTmpVehicles (this maybe should be done via SUMOReal-buffering!!!)

Definition at line 73 of file MSLane.h.

friend class MSXMLRawOut [friend, inherited]

Definition at line 77 of file MSLane.h.


Field Documentation

std::vector<SUMOVehicleClass> MSLane::myAllowedClasses [protected, inherited]

The list of allowed vehicle classes.

Definition at line 616 of file MSLane.h.

Referenced by MSLane::allowsVehicleClass(), MSLane::getAllowedClasses(), and MSLane::setAllowedClasses().

SUMOReal MSLane::myBackDistance [protected, inherited]

Definition at line 607 of file MSLane.h.

MSLane::DictType MSLane::myDict [static, protected, inherited]

Static dictionary to associate string-ids with objects.

Definition at line 650 of file MSLane.h.

Referenced by MSLane::clear(), MSLane::dictionary(), MSLane::dictSize(), and MSLane::insertIDs().

MSEdge* MSLane::myEdge [protected, inherited]

The lane's edge, for routing only.

Definition at line 597 of file MSLane.h.

Referenced by MSLane::appropriate(), MSLane::getEdge(), MSLane::getLeftLane(), GUILaneWrapper::getPurpose(), MSLane::getRightLane(), and MSLane::push().

std::vector<MSLane*>::const_iterator MSLane::myFirstNeigh [protected, inherited]

The lane left to the described lane (==lastNeigh if none).

Definition at line 634 of file MSLane.h.

Referenced by MSLane::init().

std::string MSLane::myID [protected, inherited]

Unique ID.

Definition at line 579 of file MSLane.h.

Referenced by MSLane::getID().

std::vector<IncomingLaneInfo> MSLane::myIncomingLanes [protected, inherited]

MSVehicle* MSLane::myInlappingVehicle [protected, inherited]

The vehicle which laps into this lane.

Definition at line 630 of file MSLane.h.

Referenced by MSLane::getLastVehicleInformation(), MSLane::getPartialOccupator(), MSLane::resetPartialOccupation(), and MSLane::setPartialOccupation().

SUMOReal MSLane::myInlappingVehicleEnd [protected, inherited]

End position of a vehicle which laps into this lane.

Definition at line 627 of file MSLane.h.

Referenced by MSLane::getLastVehicleInformation(), MSLane::getPartialOccupatorEnd(), MSLane::resetPartialOccupation(), and MSLane::setPartialOccupation().

std::vector<MSLane*>::const_iterator MSLane::myLastNeigh [protected, inherited]

The end of this lane's edge's lane container.

Definition at line 637 of file MSLane.h.

Referenced by MSLane::init().

SUMOReal MSLane::myLeftVehLength [protected, inherited]

Not yet seen vehicle lengths.

Definition at line 640 of file MSLane.h.

Referenced by MSLane::moveCritical().

SUMOReal MSLane::myLength [protected, inherited]

MSLinkCont MSLane::myLinks [protected, inherited]

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 MSLane::appropriate(), MSLane::getLinkCont(), MSLane::initialize(), MSLane::isLinkEnd(), MSLane::succLinkSec(), and MSLane::~MSLane().

MFXMutex GUIInternalLane::myLock [mutable, private]

SUMOReal MSLane::myMaxSpeed [protected, inherited]

Lane-wide speedlimit [m/s].

Definition at line 600 of file MSLane.h.

Referenced by MSLane::getMaxSpeed(), MSLane::getMeanSpeed(), and MSLane::setMaxSpeed().

std::vector<SUMOVehicleClass> MSLane::myNotAllowedClasses [protected, inherited]

The list of disallowed vehicle classes.

Definition at line 619 of file MSLane.h.

Referenced by MSLane::allowsVehicleClass(), MSLane::getNotAllowedClasses(), and MSLane::setNotAllowedClasses().

size_t MSLane::myNumericalID [protected, inherited]

Unique numerical ID (set on reading by netload).

Definition at line 582 of file MSLane.h.

Referenced by MSLane::getNumericalID().

The shape of the lane.

Definition at line 457 of file MSLane.h.

Referenced by GUILane::buildLaneWrapper(), buildLaneWrapper(), and MSLane::getShape().

VehCont MSLane::myTmpVehicles [protected, inherited]

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 MSLane::swapAfterLaneChange().

std::vector<MSVehicle*> MSLane::myVehBuffer [protected, inherited]

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 MSLane::empty(), MSLane::integrateNewVehicle(), and MSLane::push().

SUMOReal MSLane::myVehicleLengthSum [protected, inherited]

VehCont MSLane::myVehicles [protected, inherited]

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 MSLane::detectCollisions(), MSLane::empty(), GUILaneWrapper::firstWaitingTime(), MSLane::freeEmit(), MSLane::getFirstVehicle(), MSLane::getLastVehicle(), MSLane::getLastVehicleInformation(), MSLane::getMeanSpeed(), MSLane::getVehicleNumber(), MSLane::getVehiclesSecure(), GUILane::getVehiclesSecure(), getVehiclesSecure(), MSLane::integrateNewVehicle(), MSLane::isEmissionSuccess(), MSLane::moveCritical(), MSInternalLane::moveCritical(), MSLane::pop(), MSLane::removeFirstVehicle(), MSLane::removeVehicle(), MSLane::setCritical(), and MSLane::swapAfterLaneChange().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:44 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6