41 myLanes(
MSLane::dictSize()),
42 myLastLaneChange(
MSEdge::dictSize()) {
44 for (std::vector< MSEdge* >::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
45 const std::vector<MSLane*>& lanes = (*i)->getLanes();
46 if (!(*i)->hasLaneChanger()) {
47 int pos = (*lanes.begin())->getNumericalID();
48 myLanes[pos].lane = *(lanes.begin());
49 myLanes[pos].firstNeigh = lanes.end();
50 myLanes[pos].lastNeigh = lanes.end();
52 myLanes[pos].haveNeighbors =
false;
54 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
55 int pos = (*j)->getNumericalID();
57 myLanes[pos].firstNeigh = (j + 1);
58 myLanes[pos].lastNeigh = lanes.end();
60 myLanes[pos].haveNeighbors =
true;
77 if (!lu.
amActive && (*i)->getVehicleNumber() > 0) {
93 if ((*i)->getVehicleNumber() == 0) {
94 myLanes[(*i)->getNumericalID()].amActive =
false;
97 (*i)->planMovements(t);
109 myLanes[(*i)->getNumericalID()].amActive =
false;
116 if ((*i)->integrateNewVehicle(t)) {
131 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
132 (*it).lane->sortPartialVehicles();
140 std::vector<MSLane*> toAdd;
145 MSEdge& edge = (*i)->getEdge();
149 const std::vector<MSLane*>& lanes = edge.
getLanes();
150 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
156 if ((*i)->getVehicleNumber() > 0 && !lu.
amActive) {
168 for (std::vector<MSLane*>::iterator i = toAdd.begin(); i != toAdd.end(); ++i) {
173 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
174 (*it).lane->sortManeuverReservations();
184 (*i)->detectCollisions(timestep, stage);
189 std::vector<std::string>
191 std::vector<std::string> ret;
192 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
193 ret.push_back((*i)->getID());
206 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
207 const std::vector<MSLane*>& lanes = (*i)->getLanes();
208 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
209 (*j)->initRestrictions();
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
static double gLateralResolution
~MSEdgeControl()
Destructor.
void patchActiveLanes()
Resets information whether a lane is active for all lanes.
static bool gComputeLC
whether the simulationLoop is in the lane changing phase
LaneUsageVector myLanes
Information about lanes' number of vehicles and neighbors.
void changeLanes(SUMOTime t)
Moves (precomputes) critical vehicles.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
bool amActive
Information whether this lane is active.
A structure holding some basic information about a simulated lane.
void gotActive(MSLane *l)
Informs the control that the given lane got active.
void detectCollisions(SUMOTime timestep, const std::string &stage)
Detect collisions.
int getNumericalID() const
Returns the numerical id of the edge.
void setAdditionalRestrictions()
apply additional restrictions
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
A road/street connecting two junctions.
std::vector< SUMOTime > myLastLaneChange
The list of active (not empty) lanes.
MSEdgeVector myEdges
Loaded edges.
void planMovements(SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step...
std::set< MSLane *, ComparatorIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
void executeMovements(SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
virtual void changeLanes(SUMOTime t)
Performs lane changing on this edge.
bool haveNeighbors
Information whether this lane belongs to a multi-lane edge.
std::vector< MSLane * > myWithVehicles2Integrate
A storage for lanes which shall be integrated because vehicles have moved onto them.
MSEdgeControl(const std::vector< MSEdge * > &edges)
Constructor.
Representation of a lane in the micro simulation.