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) {
245 return myStops.find(seg)->second;
254 for (std::map<const MESegment* const, SUMOTime>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
255 result.push_back(&iter->first->getEdge());
280 if (i->first == rem) {
285 if (myTraceMoveReminders) {
286 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
305 if (myTraceMoveReminders) {
306 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
312 if (isLeave && myTraceMoveReminders) {
313 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
319 if (myTraceMoveReminders) {
320 traceMoveReminder(
"remove", rem->first, rem->second,
false);
333 std::vector<SUMOTime> internals;
349 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
363 myDeparture -= offset;
364 myEventTime -= offset;
365 myLastEntryTime -= offset;
369 while (seg->
getIndex() != (int)segIndex) {
382 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.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
SUMOTime getTLSPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a tls-controlled link (if using gMesoTLSPenalty > 0) ...
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
SUMOReal myArrivalPos
The position on the destination lane where the vehicle stops.
const ConstMSEdgeVector & getEdges() const
bool hasDeparted() const
Returns whether this vehicle has already departed.
void release() const
deletes the route if there are no further references to it
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
SUMOTime duration
The stopping duration.
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
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
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Notification
Definition of a vehicle state.
SUMOReal getLength() const
Get vehicle's length [m].
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).
const PositionVector & getShape() const
Returns this lane's shape.
const MSRoute * myRoute
This Vehicle's route.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
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
SUMOReal getLength() const
Returns the length of this link.
The base class for microscopic and mesoscopic vehicles.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
The car-following model and parameter.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
SUMOReal getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
A road/street connecting two junctions.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
The edge is a district edge.
The vehicle got a new route.
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
SUMOReal endPos
The stopping position end.
MESegment * getSegment() const
Returns the current segment the vehicle is on.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
bool isStopped() const
Returns whether the vehicle is at a stop.
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
SUMOReal getCurrentTLSPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Something on a lane to be noticed about vehicle movement.
int getQueIndex() const
Returns the index of the que the vehicle is in.
SUMOReal getAngle() const
Returns the vehicle's direction in degrees.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
void saveState(OutputDevice &out)
Saves the states of a vehicle.
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.
SUMOReal getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
SUMOTime getStoptime(const MESegment *const seg) const
Returns how long to stop at the given segment.
SUMOReal getLength() const
Returns the length of the segment in meters.
Structure representing possible vehicle parameter.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
A single mesoscopic segment (cell)
Definition of vehicle stop (position and duration)
SUMOReal getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
const std::string & getID() const
Returns the name of the vehicle type.
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
void addReference() const
increments the reference counter for the route
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.
SUMOReal estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
bool isParking() const
Returns whether the vehicle is parking.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
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)
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Representation of a lane in the micro simulation.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool contains(const MSEdge *const edge) const
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
SUMOTime myDeparture
The real departure time.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
std::string id
The vehicle's id.
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.