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());
50 myLanes[pos].haveNeighbors =
false;
52 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
53 int pos = (*j)->getNumericalID();
56 myLanes[pos].haveNeighbors =
true;
73 if (!lu.
amActive && (*i)->getVehicleNumber() > 0) {
89 if ((*i)->getVehicleNumber() == 0) {
90 myLanes[(*i)->getNumericalID()].amActive =
false;
93 (*i)->planMovements(t);
102 lane->setJunctionApproaches(t);
111 myLanes[(*i)->getNumericalID()].amActive =
false;
118 if ((*i)->integrateNewVehicle(t)) {
133 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
134 (*it).lane->sortPartialVehicles();
142 std::vector<MSLane*> toAdd;
147 MSEdge& edge = (*i)->getEdge();
151 const std::vector<MSLane*>& lanes = edge.
getLanes();
152 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
158 if ((*i)->getVehicleNumber() > 0 && !lu.
amActive) {
170 for (std::vector<MSLane*>::iterator i = toAdd.begin(); i != toAdd.end(); ++i) {
175 for (LaneUsageVector::iterator it =
myLanes.begin(); it !=
myLanes.end(); ++it) {
176 (*it).lane->sortManeuverReservations();
186 if (lane->needsCollisionCheck()) {
187 lane->detectCollisions(timestep, stage);
193 std::vector<std::string>
195 std::vector<std::string> ret;
196 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
197 ret.push_back((*i)->getID());
210 for (MSEdgeVector::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
211 const std::vector<MSLane*>& lanes = (*i)->getLanes();
212 for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
213 (*j)->initRestrictions();
std::list< MSLane * > myActiveLanes
The list of active (not empty) lanes.
static double gLateralResolution
~MSEdgeControl()
Destructor.
std::set< MSLane *, ComparatorNumericalIdLess > myChangedStateLanes
Lanes which changed the state without informing the control.
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.
void setJunctionApproaches(SUMOTime t)
Register junction approaches for all vehicles after velocities have been planned. This is a prerequis...
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...
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.