SUMO - Simulation of Urban MObility

MSEdgeControl Class Reference

Stores edges and lanes, performs moving of vehicle. More...

#include <MSEdgeControl.h>

Data Structures

struct  LaneUsage
 A structure holding some basic information about a simulated lane. More...

Public Types

typedef std::vector< MSEdge * > EdgeCont
 Container for edges.

Public Member Functions

void changeLanes (SUMOTime t) throw ()
 Moves (precomputes) critical vehicles.
void detectCollisions (SUMOTime timestep) throw ()
 Detect collisions.
std::vector< std::string > getEdgeNames () const throw ()
 Returns the list of names of all known edges.
const std::vector< MSEdge * > & getEdges () const throw ()
 Returns loaded edges.
void gotActive (MSLane *l) throw ()
 Informs the control that the given lane got active.
 MSEdgeControl (const std::vector< MSEdge * > &edges) throw ()
 Constructor.
void patchActiveLanes () throw ()
 Resets information whether a lane is active for all lanes.
 ~MSEdgeControl () throw ()
 Destructor.
Interfaces for longitudinal vehicle movement
void moveCritical (SUMOTime t) throw ()
 Moves (precomputes) critical vehicles.
void moveFirst (SUMOTime t) throw ()
 Really moves critical vehicles.

Private Types

typedef std::vector< LaneUsage > LaneUsageVector
 Definition of a container about a lane's number of vehicles and neighbors.

Private Member Functions

 MSEdgeControl (const MSEdgeControl &)
 Copy constructor.
MSEdgeControl & operator= (const MSEdgeControl &)
 Assignment operator.

Private Attributes

std::list< MSLane * > myActiveLanes
 The list of active (not empty) lanes.
std::set< MSLane
*, Named::ComparatorIdLess > 
myChangedStateLanes
 Lanes which changed the state without informing the control.
std::vector< MSEdge * > myEdges
 Loaded edges.
LaneUsageVector myLanes
 Information about lanes' number of vehicles and neighbors.
std::vector< SUMOTime > myLastLaneChange
 The list of active (not empty) lanes.
std::vector< MSLane * > myWithVehicles2Integrate
 A storage for lanes which shall be integrated because vehicles have moved onto them.

Detailed Description

Stores edges and lanes, performs moving of vehicle.

In order to avoid touching all lanes, even the empty ones, this class stores and updates the information about "active" lanes, those that have at least one vehicle on them. During longitudinal movement, this can be simply achieved through return values of the MSLane-methods, signalling either that the lane got active or inactive. This is but not possible when changing lanes, we have to go through the lanes, here. Also, we have to add lanes on which a vehicle was inserted, separately, doing this into ("myChangedStateLanes") which entries are integrated at the begin of is step in "patchActiveLanes".

Definition at line 68 of file MSEdgeControl.h.


Member Typedef Documentation

typedef std::vector< MSEdge* > MSEdgeControl::EdgeCont

Container for edges.

Definition at line 71 of file MSEdgeControl.h.

typedef std::vector<LaneUsage> MSEdgeControl::LaneUsageVector [private]

Definition of a container about a lane's number of vehicles and neighbors.

Definition at line 214 of file MSEdgeControl.h.


Constructor & Destructor Documentation

MSEdgeControl::MSEdgeControl ( const std::vector< MSEdge * > &  edges) throw ()

Constructor.

Builds LaneUsage information for each lane and assigns them to lanes.

Parameters:
[in]edgesThe loaded edges
Todo:
Assure both containers are not 0

Definition at line 44 of file MSEdgeControl.cpp.

MSEdgeControl::~MSEdgeControl ( ) throw ()

Destructor.

Definition at line 74 of file MSEdgeControl.cpp.

MSEdgeControl::MSEdgeControl ( const MSEdgeControl &  ) [private]

Copy constructor.


Member Function Documentation

void MSEdgeControl::changeLanes ( SUMOTime  t) throw ()

Moves (precomputes) critical vehicles.

Calls "changeLanes" of each of the multi-lane edges. Check then for this edge whether a lane got active, adding it to "myActiveLanes" and marking it as active in such cases.

See also:
MSEdge::changeLanes

Definition at line 137 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, MSEdge::changeLanes(), MSEdge::getLanes(), MSEdge::getNumericalID(), and MSEdgeControl::LaneUsage::haveNeighbors.

Referenced by MSNet::simulationStep().

void MSEdgeControl::detectCollisions ( SUMOTime  timestep) throw ()

Detect collisions.

Calls "detectCollisions" of each lane. Shouldn't be necessary if model-implementation is correct. The parameter is simply passed to the lane-instance for reporting.

Parameters:
[in]timestepThe current time step

Definition at line 167 of file MSEdgeControl.cpp.

Referenced by MSNet::simulationStep().

std::vector< std::string > MSEdgeControl::getEdgeNames ( ) const throw ()

Returns the list of names of all known edges.

Returns:
a vector of names of all known edges

Definition at line 176 of file MSEdgeControl.cpp.

References myEdges.

Referenced by TraCIServerAPI_Simulation::convertCartesianToRoadMap().

const std::vector<MSEdge*>& MSEdgeControl::getEdges ( ) const throw () [inline]

Returns loaded edges.

Returns:
the container storing one-lane edges
Todo:
Check: Is this secure?

Definition at line 164 of file MSEdgeControl.h.

References myEdges.

Referenced by MSDevice_Routing::adaptEdgeEfforts(), MSDevice_Routing::buildVehicleDevices(), and MSMeanData::init().

void MSEdgeControl::gotActive ( MSLane *  l) throw ()

Informs the control that the given lane got active.

Parameters:
[in]lThe activated lane
Todo:
Check for l==0?

Definition at line 186 of file MSEdgeControl.cpp.

Referenced by MSLane::incorporateVehicle().

void MSEdgeControl::moveCritical ( SUMOTime  t) throw ()

Moves (precomputes) critical vehicles.

"Critical" are those vehicles that interact with the next junction and all first vehicles. They are not moved, in fact, but their speed along the next path is precomputed.

This method goes through all active lanes calling their "moveCritical" implementation. If this call returns true, the lane is removed from the list of active lanes.

See also:
MSLane::moveCritical

Definition at line 97 of file MSEdgeControl.cpp.

Referenced by MSNet::simulationStep().

void MSEdgeControl::moveFirst ( SUMOTime  t) throw ()

Really moves critical vehicles.

"Critical" are those vehicles that interact with the next junction and all first vehicles.

At first, this method goes through all active lanes calling their "setCritical" implementation. If this call returns true, the lane is removed from the list of active lanes. During this call, "myWithVehicles2Integrate" is filled with lanes that obtain new vehicles.

Then, myWithVehicles2Integrate is gone through, calling "integrateNewVehicle" of each of the stored instances. If this call returns true and the lane was not active before, it is added to the list of active lanes.

See also:
MSLane::setCritical
MSLane::integrateNewVehicle
Todo:
When moving to parallel processing, the usage of myWithVehicles2Integrate would get insecure!!

Definition at line 110 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, and MSEdgeControl::LaneUsage::haveNeighbors.

Referenced by MSNet::simulationStep().

MSEdgeControl& MSEdgeControl::operator= ( const MSEdgeControl &  ) [private]

Assignment operator.

void MSEdgeControl::patchActiveLanes ( ) throw ()

Resets information whether a lane is active for all lanes.

For each lane in "myChangedStateLanes": if the lane has at least one vehicle and is not marked as being active, it is added to the list og active lanes and marked as being active.

Definition at line 79 of file MSEdgeControl.cpp.

References MSEdgeControl::LaneUsage::amActive, MSEdgeControl::LaneUsage::haveNeighbors, myActiveLanes, myChangedStateLanes, and myLanes.

Referenced by MSNet::simulationStep().


Field Documentation

std::list<MSLane*> MSEdgeControl::myActiveLanes [private]

The list of active (not empty) lanes.

Definition at line 220 of file MSEdgeControl.h.

Referenced by patchActiveLanes().

Lanes which changed the state without informing the control.

Definition at line 226 of file MSEdgeControl.h.

Referenced by patchActiveLanes().

std::vector<MSEdge*> MSEdgeControl::myEdges [private]

Loaded edges.

Definition at line 211 of file MSEdgeControl.h.

Referenced by getEdgeNames(), and getEdges().

Information about lanes' number of vehicles and neighbors.

Definition at line 217 of file MSEdgeControl.h.

Referenced by patchActiveLanes().

std::vector<SUMOTime> MSEdgeControl::myLastLaneChange [private]

The list of active (not empty) lanes.

Definition at line 229 of file MSEdgeControl.h.

A storage for lanes which shall be integrated because vehicles have moved onto them.

Definition at line 223 of file MSEdgeControl.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines