92 std::vector<LeaderEvent> tmp;
93 bool curInvalid =
false;
121 if (onSegment !=
nullptr) {
122 onSegment->
send(veh, toSegment, qIdx, leaveTime, reason);
124 WRITE_WARNINGF(
TL(
"Vehicle '%' teleports beyond arrival edge '%', time=%."),
149 if (entry == leaveTime && (ignoreLink || veh->
mayProceed())) {
150 if (onSegment !=
nullptr) {
159 toSegment->
receive(veh, qIdx, leaveTime,
false, ignoreLink, &onSegment->
getEdge() != &toSegment->
getEdge());
169 toSegment->
receive(veh, qIdx, leaveTime,
false,
true,
true);
177 if (entry == leaveTime && !ignoreLink) {
189 const bool teleporting = (onSegment ==
nullptr);
192 if (nextEntry == leaveTime) {
201 if ((r1 && !disconnected) || (r3 && disconnected)) {
232 WRITE_WARNINGF(
TL(
"Teleporting vehicle '%'; waited too long, from edge '%':%, time=%."),
242 const bool teleporting = (onSegment ==
nullptr);
249 if (teleSegment !=
nullptr) {
252 const std::string reason = disconnected ?
" (disconnected)" :
"";
253 WRITE_WARNINGF(
TL(
"Teleporting vehicle '%'; waited too long%, from edge '%':% to edge '%':%, time=%."),
263 WRITE_WARNINGF(
TL(
"Teleporting vehicle '%'; waited too long, from edge '%':%, time=%."),
322 if (next !=
nullptr) {
329 if (nextEdge ==
nullptr) {
345 int no = (int)floor(length / sLength + 0.5);
359 const double slength = length / (double)numSegments;
362 const bool laneQueue = oc.
getBool(
"meso-lane-queue");
363 const bool lift = oc.
getBool(
"meso-ltm");
365 for (
int s = numSegments - 1; s >= 0; s--) {
370 multiQueue = laneQueue;
378 lane->updateMesoGUISegments();
403 if (succ->isRoundabout()) {
412 time(v->getEventTime()),
413 eventIndex(myEventCounter++),
414 nid(v->getNumericalID()),
#define WRITE_WARNINGF(...)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
constexpr SUMOTime TIME2STEPS(double x)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A single mesoscopic segment (cell)
MESegment * nextSegment(MESegment *s, MEVehicle *v)
Retrieve next segment.
static bool isEnteringRoundabout(const MSEdge &e)
whether the given edge is entering a roundabout
bool wasInvalidated(const LeaderEvent &e)
check whether the current car was invalidated and remove it from myInvalidatedLeaderCars
LeaderEventQeue myInvalidatedLeaderCars
MELoop(const SUMOTime recheckInterval)
SUMO constructor.
SUMOTime changeSegment(MEVehicle *veh, SUMOTime leaveTime, MESegment *const toSegment, MSMoveReminder::Notification reason, const bool ignoreLink=false) const
change to the next segment this handles combinations of the following cases: (ending / continuing rou...
MESegment * getSegmentForEdge(const MSEdge &e, double 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 simulate(SUMOTime tMax)
Perform simulation up to the given time.
const SUMOTime myFullRecheckInterval
the interval at which to recheck at full segments (<=0 means asap)
void vaporizeCar(MEVehicle *v, MSMoveReminder::Notification reason)
remove the given car and clean up the relevant data structures
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
void clearState()
Remove all vehicles before quick-loading state.
void removeLeaderCar(MEVehicle *v)
Removes the given car from the leading vehicles.
LeaderEventQeue myLeaderCars
std::vector< MESegment * > myEdges2FirstSegments
mapping from internal edge ids to their initial segments
std::priority_queue< LeaderEvent > LeaderEventQeue
leader cars in the segments sorted by exit time
void checkCar(MEVehicle *veh)
Check whether the vehicle may move.
void teleportVehicle(MEVehicle *veh, MESegment *const toSegment, bool disconnected)
teleports a vehicle or continues a teleport
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 buildSegmentsFor(const MSEdge &e, const OptionsCont &oc)
Build the segments for a given edge.
A single mesoscopic segment (cell)
void addReminders(MEVehicle *veh) const
add this lanes MoveReminders to the given vehicle
static const int PARKING_QUEUE
void receive(MEVehicle *veh, const int qIdx, SUMOTime time, const bool isDepart=false, const bool isTeleport=false, const bool newEdge=false)
Adds the vehicle to the segment, adapting its parameters.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
double getLength() const
Returns the length of the segment in meters.
SUMOTime hasSpaceFor(const MEVehicle *const veh, const SUMOTime entryTime, int &qIdx, const bool init=false) const
Returns whether the given vehicle would still fit into the segment.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
virtual void updateEntryBlockTime(SUMOTime)
update entry blockTime for all queues
virtual void send(MEVehicle *veh, MESegment *const next, const int nextQIdx, SUMOTime time, const MSMoveReminder::Notification reason)
Removes the vehicle from the segment, adapting its parameters.
SUMOTime getEventTime() const
Returns the (planned) time at which the next vehicle leaves this segment.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
static bool isInvalid(const MESegment *segment)
whether the given segment is 0 or encodes vaporization
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
A vehicle from the mesoscopic point of view.
bool mayProceed()
Returns whether the vehicle is allowed to pass the next junction, checks also for triggered stops.
void processStop()
ends the current stop and performs loading/unloading
SUMOTime getWaitingTime(const bool accumulated=false) const
Returns the duration for which the vehicle was blocked.
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
void updateDetectors(const SUMOTime currentTime, const SUMOTime exitTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
void setEventTime(SUMOTime t, bool hasDelay=true)
Sets the (planned) time at which the vehicle leaves its current segment.
void setApproaching(MSLink *link)
registers vehicle with the given link
bool endTriggeredStop()
process triggered stops and return true if all stops on the current segment are completed
MESegment * getSegment() const
Returns the current segment the vehicle is on.
int getQueIndex() const
Returns the index of the que the vehicle is in.
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves its current segment.
void setBlockTime(const SUMOTime t)
Sets the time at which the vehicle was blocked.
SUMOTime getBlockTime() const
Returns the time at which the vehicle was blocked.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
bool isStoppedParking() const
Returns whether the vehicle is on a parking stop.
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
bool ignoreTransientPermissions() const
Returns whether this object is ignoring transient permission changes (during routing)
virtual void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
bool isStopped() const
Returns whether the vehicle is at a stop.
A road/street connecting two junctions.
int getNumSuccessors() const
Returns the number of edges that may be reached from this edge.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING, bool ignoreTransientPermissions=false) const
Get the allowed lanes to reach the destination-edge.
bool isNormal() const
return whether this edge is an internal edge
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is returned; should pr...
double getLength() const
return the length of the edge
int getNumericalID() const
Returns the numerical id of the edge.
const std::string & getEdgeType() const
Returns the type of the edge.
const MSEdge * getInternalFollowingEdge(const MSEdge *followerAfterInternal, SUMOVehicleClass vClass) const
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
static SUMOTime gTimeToTeleportDisconnected
static bool gRemoveGridlocked
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
static SUMOTime gTimeToGridlock
Representation of a lane in the micro simulation.
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
@ NOTIFICATION_SEGMENT
The vehicle changes the segment (meso only)
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MESegment::MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
void registerTeleportJam()
register one non-collision-related teleport
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static long long int myEventCounter
LeaderEvent(MEVehicle *v)
edge type specific meso parameters