62 if (!(*myCurrEdge)->isTazConnector()) {
64 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
68 "' is too high for the vehicle type '" + type->
getID() +
"'.");
148 if ((*myCurrEdge)->isVaporizing()) {
208 if (oldLink != 0 && oldLink != newLink) {
255 return myStops.find(seg)->second;
264 for (std::map<const MESegment* const, SUMOTime>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
265 result.push_back(&iter->first->getEdge());
290 if (i->first == rem) {
295 if (myTraceMoveReminders) {
296 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
315 if (myTraceMoveReminders) {
316 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
322 if (isLeave && myTraceMoveReminders) {
323 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
329 if (myTraceMoveReminders) {
330 traceMoveReminder(
"remove", rem->first, rem->second,
false);
343 std::vector<SUMOTime> internals;
353 for (std::map<const MESegment* const, SUMOTime>::const_iterator it =
myStops.begin(); it !=
myStops.end(); ++it) {
361 for (std::vector<MSDevice*>::const_iterator dev =
myDevices.begin(); dev !=
myDevices.end(); ++dev) {
362 (*dev)->saveState(out);
371 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
385 myDeparture -= offset;
386 myEventTime -= offset;
387 myLastEntryTime -= offset;
391 while (seg->
getIndex() != (int)segIndex) {
404 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
void updateDetector(SUMOVehicle &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
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.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
MoveReminderCont myMoveReminders
Currently relevant move reminders.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
SUMOTime duration
The stopping duration.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true)
Replaces the current route by the given one.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getLength() const
Returns the length of this link.
SUMOTime getStoptime(const MESegment *const seg) const
Returns how long to stop at the given segment.
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
double myArrivalPos
The position on the destination lane where the vehicle stops.
double getSlope() const
Returns the slope of the road at vehicle's position.
Notification
Definition of a vehicle state.
double interpolateLanePosToGeometryPos(double lanePos) const
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
double getPositionOnLane() const
Get the vehicle's position along the lane.
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
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
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
The base class for microscopic and mesoscopic vehicles.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
#define UNUSED_PARAMETER(x)
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)
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.
double departSpeed
(optional) The initial speed of the vehicle
A road/street connecting two junctions.
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 vehicle got a new route.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Encapsulated SAX-Attributes.
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0) ...
A point in 2D or 3D with translation and scaling methods.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
ConstMSEdgeVector::const_iterator MSRouteIterator
bool contains(const MSEdge *const edge) const
const ConstMSEdgeVector & getEdges() const
double getLength() const
Returns the length of the segment in meters.
double getAngle() const
Returns the vehicle's direction in degrees.
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double endPos
The stopping position end.
Something on a lane to be noticed about vehicle movement.
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
void addReference() const
increments the reference counter for the route
void saveState(OutputDevice &out)
Saves the states of a vehicle.
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
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.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double getLength() const
Get vehicle's length [m].
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
Structure representing possible vehicle parameter.
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
A single mesoscopic segment (cell)
Definition of vehicle stop (position and duration)
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
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.
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.
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
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.
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
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
void writeParams(OutputDevice &out) const
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
Representation of a lane in the micro simulation.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
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.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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.