50 #ifdef CHECK_MEMORY_LEAKS 52 #endif // CHECK_MEMORY_LEAKS 82 for (std::vector<MEVehicle*>::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
95 onSegment->
send(veh, toSegment, leaveTime);
104 if (onSegment != 0) {
105 onSegment->
send(veh, toSegment, leaveTime);
106 toSegment->
receive(veh, leaveTime,
false, ignoreLink);
113 toSegment->
receive(veh, leaveTime,
false,
true);
126 const bool teleporting = (onSegment == 0);
137 if (leaveTime < toSegment->getEntryBlockTime()) {
159 const bool teleporting = (onSegment == 0);
162 while (teleSegment != 0 && !teleSegment->
hasSpaceFor(veh, leaveTime)) {
166 if (teleSegment != 0) {
186 onSegment->
send(veh, 0, leaveTime);
230 cands.erase(find(cands.begin(), cands.end(), v));
255 int no = (int)floor(length / sLength + 0.5);
269 const SUMOReal lengthGeometryFactor = e.
getLanes()[0]->getLengthGeometryFactor();
272 bool multiQueue = oc.
getBool(
"meso-multi-queue");
273 bool junctionControl = oc.
getBool(
"meso-junction-control");
274 for (
int s = no - 1; s >= 0; s--) {
277 new MESegment(
id, e, nextSegment, slength,
278 e.
getLanes()[0]->getSpeedLimit(), s,
281 oc.
getFloat(
"meso-jam-threshold"), multiQueue, junctionControl,
282 lengthGeometryFactor);
284 junctionControl =
false;
285 nextSegment = newSegment;
bool changeSegment(MEVehicle *veh, SUMOTime leaveTime, MESegment *const toSegment, const bool ignoreLink=false)
change to the next segment this handles combinations of the following cases: (ending / continuing rou...
MELoop(const SUMOTime recheckInterval)
SUMO constructor.
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
MESegment * nextSegment(MESegment *s, MEVehicle *v)
Retrieve next segment.
SUMOTime getBlockTime() const
Returns the time at which the vehicle was blocked.
A vehicle from the mesoscopic point of view.
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const SUMOReal arrivalSpeedBraking, const SUMOTime waitingTime, SUMOReal dist)
Sets the information about an approaching vehicle.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
The vehicle arrived at a junction.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
const SUMOTime myFullRecheckInterval
the interval at which to recheck at full segments (<=0 means asap)
std::vector< MESegment * > myEdges2FirstSegments
mapping from internal edge ids to their initial segments
SUMOReal getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
void buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
static SUMOReal rand()
Returns a random real number in [0, 1)
std::string time2string(SUMOTime t)
void teleportVehicle(MEVehicle *veh, MESegment *const toSegment)
teleports a vehicle or continues a teleport
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
SUMOTime getEntryBlockTime() const
return the next time at which a vehicle my enter this segment
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
This is an uncontrolled, all-way stop link.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
void setBlockTime(const SUMOTime t)
Sets the time at which the vehicle was blocked.
#define WRITE_WARNING(msg)
void setEntryBlockTime(SUMOTime entryBlockTime)
set the next time at which a vehicle my enter this segment
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
SUMOReal getLength() const
return the length of the edge
bool isStopped() const
Returns whether the vehicle is at a stop.
void receive(MEVehicle *veh, SUMOTime time, bool isDepart=false, bool afterTeleport=false)
Adds the vehicle to the segment, adapting its parameters.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
static int numSegmentsFor(const SUMOReal length, const SUMOReal slength)
Compute number of segments per edge (best value stay close to the configured segment length) ...
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
SUMOReal getLength() const
Returns the length of the segment in meters.
SUMOTime string2time(const std::string &r)
std::map< SUMOTime, std::vector< MEVehicle * > > myLeaderCars
leader cars in the segments sorted by exit time
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
void registerTeleportJam()
register one non-collision-related teleport
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
void scheduleVehicleRemoval(SUMOVehicle *veh)
Removes a vehicle after it has ended.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
int getNumericalID() const
Returns the numerical id of the edge.
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
virtual void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
A single mesoscopic segment (cell)
bool hasSpaceFor(const MEVehicle *veh, SUMOTime entryTime, bool init=false) const
Returns whether the given vehicle would still fit into the segment.
A storage for options typed value containers)
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
const SUMOTime myLinkRecheckInterval
the interval at which to recheck at blocked junctions (<=0 means asap)
void checkCar(MEVehicle *veh)
Check whether the vehicle may move.
static SUMOTime gTimeToGridlock
void setEventTime(SUMOTime t, bool hasDelay=true)
Sets the (planned) time at which the vehicle leaves his current cell.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
LinkState getState() const
Returns the current state of the link.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
void send(MEVehicle *veh, MESegment *next, SUMOTime time)
Removes the vehicle from the segment, adapting its parameters.
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
MESegment * getSegment() const
Returns the current segment the vehicle is on.
const std::string & getID() const
Returns the name of the vehicle.