 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
71 for (std::vector<MEVehicle*>::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
83 if (onSegment !=
nullptr) {
93 if (onSegment !=
nullptr) {
95 toSegment->
receive(veh, leaveTime,
false, ignoreLink);
102 toSegment->
receive(veh, leaveTime,
false,
true);
115 const bool teleporting = (onSegment ==
nullptr);
126 if (leaveTime < toSegment->getEntryBlockTime()) {
148 const bool teleporting = (onSegment ==
nullptr);
151 while (teleSegment !=
nullptr && !teleSegment->
hasSpaceFor(veh, leaveTime)) {
155 if (teleSegment !=
nullptr) {
205 if (link !=
nullptr) {
219 cands.erase(find(cands.begin(), cands.end(), v));
227 auto it = find(cands.begin(), cands.end(), v);
228 if (it != cands.end()) {
237 if (next !=
nullptr) {
244 if (nextEdge ==
nullptr) {
254 int no = (int)floor(length / sLength + 0.5);
267 const double slength = length / (double)no;
270 bool multiQueue = oc.
getBool(
"meso-multi-queue");
272 for (
int s = no - 1; s >= 0; s--) {
276 e.
getLanes()[0]->getSpeedLimit(), s,
279 oc.
getFloat(
"meso-jam-threshold"), multiQueue, junctionControl);
281 junctionControl =
false;
311 if (succ->isRoundabout()) {
const SUMOTime myFullRecheckInterval
the interval at which to recheck at full segments (<=0 means asap)
A vehicle from the mesoscopic point of view.
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.
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
MELoop(const SUMOTime recheckInterval)
SUMO constructor.
LinkState getState() const
Returns the current state of the link.
int getNumericalID() const
Returns the numerical id of the edge.
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
#define WRITE_WARNING(msg)
A single mesoscopic segment (cell)
void registerTeleportJam()
register one non-collision-related teleport
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...
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool hasSpaceFor(const MEVehicle *veh, SUMOTime entryTime, bool init=false) const
Returns whether the given vehicle would still fit into the segment.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
void setEventTime(SUMOTime t, bool hasDelay=true)
Sets the (planned) time at which the vehicle leaves his current cell.
double getLength() const
return the length of the edge
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
SUMOTime getEntryBlockTime() const
return the next time at which a vehicle my enter this segment
@ NOTIFICATION_VAPORIZED
The vehicle got vaporized.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
SUMOTime getBlockTime() const
Returns the time at which the vehicle was blocked.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
std::vector< MESegment * > myEdges2FirstSegments
mapping from internal edge ids to their initial segments
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
void receive(MEVehicle *veh, SUMOTime time, bool isDepart=false, bool afterTeleport=false)
Adds the vehicle to the segment, adapting its parameters.
MESegment * nextSegment(MESegment *s, MEVehicle *v)
Retrieve next segment.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
void setBlockTime(const SUMOTime t)
Sets the time at which the vehicle was blocked.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
void vaporizeCar(MEVehicle *v)
remove the given car and clean up the relevant data structures
std::string time2string(SUMOTime t)
const SUMOTime myLinkRecheckInterval
the interval at which to recheck at blocked junctions (<=0 means asap)
A storage for options typed value containers)
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
A road/street connecting two junctions.
std::map< SUMOTime, std::vector< MEVehicle * > > myLeaderCars
leader cars in the segments sorted by exit time
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
SUMOTime string2time(const std::string &r)
static bool isEnteringRoundabout(const MSEdge &e)
whether the given edge is entering a roundabout
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
void teleportVehicle(MEVehicle *veh, MESegment *const toSegment)
teleports a vehicle or continues a teleport
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
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
MESegment * getSegment() const
Returns the current segment the vehicle is on.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static SUMOTime gTimeToGridlock
double getLength() const
Returns the length of the segment in meters.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
void setEntryBlockTime(SUMOTime entryBlockTime)
set the next time at which a vehicle my enter this segment
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
void buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
void send(MEVehicle *veh, MESegment *next, SUMOTime time, const MSMoveReminder::Notification reason)
Removes the vehicle from the segment, adapting its parameters.
void addReminders(MEVehicle *veh) const
add this lanes MoveReminders to the given vehicle
const std::string & getID() const
Returns the name of the vehicle.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
static int numSegmentsFor(const double length, const double slength)
Compute number of segments per edge (best value stay close to the configured segment length)
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
void simulate(SUMOTime tMax)
Perform simulation up to the given time.
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
const std::string & getID() const
Returns the id.
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
void checkCar(MEVehicle *veh)
Check whether the vehicle may move.
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.