49 #ifdef CHECK_MEMORY_LEAKS 51 #endif // CHECK_MEMORY_LEAKS 67 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
71 "' is too high for the vehicle type '" + type->
getID() +
"'.");
151 if ((*myCurrEdge)->isVaporizing()) {
206 if (oldLink != 0 && oldLink != newLink) {
244 return myStops.find(seg)->second;
253 for (std::map<const MESegment* const, SUMOTime>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
254 result.push_back(&iter->first->getEdge());
279 if (i->first == rem) {
284 if (myTraceMoveReminders) {
285 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
304 if (myTraceMoveReminders) {
305 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
311 if (isLeave && myTraceMoveReminders) {
312 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
318 if (myTraceMoveReminders) {
319 traceMoveReminder(
"remove", rem->first, rem->second,
false);
332 std::vector<SUMOTime> internals;
348 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
362 myDeparture -= offset;
363 myEventTime -= offset;
364 myLastEntryTime -= offset;
368 while (seg->
getIndex() != (int)segIndex) {
381 myBlockTime -= offset;
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool isParking() const
Returns whether the vehicle is parking.
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
MoveReminderCont myMoveReminders
Current lane's move reminder.
SUMOReal myArrivalPos
The position on the destination lane where the vehicle stops.
SUMOTime duration
The stopping duration.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
SUMOTime getStoptime(const MESegment *const seg) const
Returns how long to stop at the given segment.
void updateDetector(SUMOVehicle &veh, SUMOReal entryPos, SUMOReal leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
SUMOReal departSpeed
(optional) The initial speed of the vehicle
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
SUMOReal getCurrentTLSPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty.
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
SUMOReal getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle's length [m].
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.
const MSRoute * myRoute
This Vehicle's route.
bool hasDeparted() const
Returns whether this vehicle has already departed.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
The vehicle changes the segment (meso only)
std::vector< const MSEdge * > ConstMSEdgeVector
The base class for microscopic and mesoscopic vehicles.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
SUMOReal getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
SUMOReal getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
The car-following model and parameter.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
A road/street connecting two junctions.
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
bool isStopped() const
Returns whether the vehicle is at a stop.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
The edge is a district edge.
The vehicle got a new route.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
SUMOReal endPos
The stopping position end.
SUMOReal getLength() const
Returns the length of the segment in meters.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
bool contains(const MSEdge *const edge) const
const ConstMSEdgeVector & getEdges() const
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
Something on a lane to be noticed about vehicle movement.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
void addReference() const
increments the reference counter for the route
void saveState(OutputDevice &out)
Saves the states of a vehicle.
SUMOReal getLength() const
Returns the length of this link.
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
MESegment * mySegment
The segment the vehicle is at.
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
std::string lane
The lane to stop at.
SUMOTime getTLSPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a tls-controlled link (if using gMesoTLSPenalty > 0) ...
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Structure representing possible vehicle parameter.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
A single mesoscopic segment (cell)
Definition of vehicle stop (position and duration)
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
int getQueIndex() const
Returns the index of the que the vehicle is in.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
const std::string & getID() const
Returns the name of the vehicle type.
std::map< const MESegment *const, SUMOTime > myStops
where to stop
static MELoop * gMesoNet
mesoscopic simulation infrastructure
int myNumberReroutes
The number of reroutings.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
const PositionVector & getShape() const
Returns this lane's shape.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
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 release() const
deletes the route if there are no further references to it
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
Representation of a lane in the micro simulation.
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.
SUMOReal estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
SUMOTime myDeparture
The real departure time.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
std::string id
The vehicle's id.
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.