79 for (std::vector<MEVehicle*>::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
92 onSegment->
send(veh, toSegment, leaveTime);
101 if (onSegment != 0) {
102 onSegment->
send(veh, toSegment, leaveTime);
103 toSegment->
receive(veh, leaveTime,
false, ignoreLink);
110 toSegment->
receive(veh, leaveTime,
false,
true);
123 const bool teleporting = (onSegment == 0);
134 if (leaveTime < toSegment->getEntryBlockTime()) {
156 const bool teleporting = (onSegment == 0);
159 while (teleSegment != 0 && !teleSegment->
hasSpaceFor(veh, leaveTime)) {
163 if (teleSegment != 0) {
183 onSegment->
send(veh, 0, leaveTime);
227 cands.erase(find(cands.begin(), cands.end(), v));
252 int no = (int)floor(length / sLength + 0.5);
265 const double slength = length / (double)no;
268 bool multiQueue = oc.
getBool(
"meso-multi-queue");
269 bool junctionControl = oc.
getBool(
"meso-junction-control");
270 for (
int s = no - 1; s >= 0; s--) {
273 new MESegment(
id, e, nextSegment, slength,
274 e.
getLanes()[0]->getSpeedLimit(), s,
277 oc.
getFloat(
"meso-jam-threshold"), multiQueue, junctionControl);
279 junctionControl =
false;
280 nextSegment = newSegment;
double getLength() const
return the length of the edge
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.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
The vehicle arrived at a junction.
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
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.
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
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
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
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.
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)
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.
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).
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
double 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
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.
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)
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.
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.
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.
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.