78 for (std::vector<MEVehicle*>::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
91 onSegment->
send(veh, toSegment, leaveTime);
100 if (onSegment != 0) {
101 onSegment->
send(veh, toSegment, leaveTime);
102 toSegment->
receive(veh, leaveTime,
false, ignoreLink);
109 toSegment->
receive(veh, leaveTime,
false,
true);
122 const bool teleporting = (onSegment == 0);
133 if (leaveTime < toSegment->getEntryBlockTime()) {
155 const bool teleporting = (onSegment == 0);
158 while (teleSegment != 0 && !teleSegment->
hasSpaceFor(veh, leaveTime)) {
162 if (teleSegment != 0) {
182 onSegment->
send(veh, 0, leaveTime);
226 cands.erase(find(cands.begin(), cands.end(), v));
251 int no = (int)floor(length / sLength + 0.5);
264 const double slength = length / (double)no;
267 bool multiQueue = oc.
getBool(
"meso-multi-queue");
268 bool junctionControl = oc.
getBool(
"meso-junction-control");
269 for (
int s = no - 1; s >= 0; s--) {
272 new MESegment(
id, e, nextSegment, slength,
273 e.
getLanes()[0]->getSpeedLimit(), s,
276 oc.
getFloat(
"meso-jam-threshold"), multiQueue, junctionControl);
278 junctionControl =
false;
279 nextSegment = newSegment;
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
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.
A vehicle from the mesoscopic point of view.
double getLength() const
Returns the length of the segment in meters.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
The vehicle arrived at a junction.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
SUMOTime getEntryBlockTime() const
return the next time at which a vehicle my enter this segment
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
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
void buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
std::string time2string(SUMOTime t)
void teleportVehicle(MEVehicle *veh, MESegment *const toSegment)
teleports a vehicle or continues a teleport
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
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.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
double getLength() const
return the length of the edge
int getNumericalID() const
Returns the numerical id of the edge.
This is an uncontrolled, all-way stop link.
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
void setBlockTime(const SUMOTime t)
Sets the time at which the vehicle was blocked.
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist)
Sets the information about an approaching vehicle.
#define WRITE_WARNING(msg)
LinkState getState() const
Returns the current state of the link.
bool hasSpaceFor(const MEVehicle *veh, SUMOTime entryTime, bool init=false) const
Returns whether the given vehicle would still fit into the segment.
void setEntryBlockTime(SUMOTime entryBlockTime)
set the next time at which a vehicle my enter this segment
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
A road/street connecting two junctions.
void receive(MEVehicle *veh, SUMOTime time, bool isDepart=false, bool afterTeleport=false)
Adds the vehicle to the segment, adapting its parameters.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
MESegment * getSegment() const
Returns the current segment the vehicle is on.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isStopped() const
Returns whether the vehicle is at a stop.
SUMOTime string2time(const std::string &r)
std::map< SUMOTime, std::vector< MEVehicle * > > myLeaderCars
leader cars in the segments sorted by exit time
void registerTeleportJam()
register one non-collision-related teleport
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
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.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
A single mesoscopic segment (cell)
A storage for options typed value containers)
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
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.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length) ...
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.
const std::string & getID() const
Returns the name of the vehicle.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
SUMOTime getBlockTime() const
Returns the time at which the vehicle was blocked.