 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
59 if (!(*myCurrEdge)->isTazConnector()) {
61 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
65 "' is too high for the vehicle type '" + type->
getID() +
"'.");
145 if ((*myCurrEdge)->isVaporizing()) {
186 MSLink* oldLink =
nullptr;
187 MSLink* newLink =
nullptr;
206 if (oldLink !=
nullptr && oldLink != newLink) {
226 std::vector<SUMOVehicleParameter::Stop>& segmentStops =
myStops[stopSeg];
228 && segmentStops.size() > 0 && segmentStops.back().endPos > stopPar.
endPos
230 segmentStops.push_back(stopPar);
231 if (segmentStops.back().until >= 0) {
232 segmentStops.back().until += untilOffset;
263 time += stop.duration;
264 if (stop.until > time) {
292 std::vector<std::pair<int, double> >
294 std::vector<std::pair<int, double> > result;
299 result.push_back(std::make_pair((
int)(it2 -
myRoute->
begin()), 0));
311 std::vector<SUMOVehicleParameter::Stop>& stops = segStopsIt->second;
313 for (
auto it = stops.begin(); it != stops.end();) {
315 if (stop.
endPos <= lastPos) {
331 if (vehroutes !=
nullptr) {
337 it = stops.erase(it);
341 if (stops.size() == 0) {
344 bool removeStopEdge =
true;
347 if (
myStops.count(next) != 0) {
348 removeStopEdge =
false;
352 if (removeStopEdge) {
381 if (i->first == rem) {
386 if (myTraceMoveReminders) {
387 traceMoveReminder(
"notifyMove", i->first, i->second,
true);
406 if (myTraceMoveReminders) {
407 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
413 if (isLeave && myTraceMoveReminders) {
414 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
420 if (myTraceMoveReminders) {
421 traceMoveReminder(
"remove", rem->first, rem->second,
false);
434 std::vector<SUMOTime> internals;
445 for (
const auto& it :
myStops) {
461 throw ProcessError(
"Error: Invalid vehicles in state (may be a micro state)!");
483 while (seg->
getIndex() != (int)segIndex) {
The car-following model and parameter.
bool boardAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToBoardNextPerson, SUMOTime &stopDuration)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
#define UNUSED_PARAMETER(x)
void release() const
deletes the route if there are no further references to it
const std::string & getID() const
Returns the name of the vehicle type.
bool hasDeparted() const
Returns whether this vehicle has already departed.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
bool hasContainers() const
Returns whether containers are simulated.
int getContainerNumber() const
Returns the number of containers.
Representation of a lane in the micro simulation.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
std::string lane
The lane to stop at.
A single mesoscopic segment (cell)
void updateDetectorForWriting(MSMoveReminder *rem, SUMOTime currentTime, SUMOTime exitTime)
Updates a single vehicle detector if present.
Static storage of an output device and its base (abstract) implementation.
SUMOTime myDeparture
The real departure time.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
ConstMSEdgeVector::const_iterator MSRouteIterator
double getAverageSpeed() const
Returns the vehicle's estimated average speed on the segment assuming no further delays.
static MSStopOut * getInstance()
double departSpeed
(optional) The initial speed of the vehicle
void saveState(OutputDevice &out)
Saves the states of a vehicle.
ConstMSEdgeVector myStopEdges
edges to stop
virtual MSTransportableControl & getContainerControl()
Returns the container control.
std::vector< MSVehicleDevice * > myDevices
The devices this vehicle has.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
void removeWaiting(const MSEdge *const edge, const SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles for the given edge.
The simulated network and simulation perfomer.
double getPositionOnLane() const
Get the vehicle's position along the lane.
SUMOTime getLastEntryTime() const
Returns the time the vehicle entered the current segment.
const MSRoute * myRoute
This vehicle's route.
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
std::vector< const MSEdge * > ConstMSEdgeVector
SUMOTime myBlockTime
The time at which the vehicle was blocked on its current segment.
bool hasPersons() const
Returns whether persons are simulated.
double getCurrentStoppingTimeSeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
const ConstMSEdgeVector & getEdges() const
Structure representing possible vehicle parameter.
bool isOpen(const MEVehicle *veh) const
Returns whether the vehicle may use the next link.
The vehicle got a new route.
bool loadAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToLoadNextContainer, SUMOTime &stopDuration)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
bool moveRoutePointer()
Update when the vehicle enters a new edge in the move step.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
Something on a lane to be noticed about vehicle movement.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
double myArrivalPos
The position on the destination lane where the vehicle stops.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
void updateDetectors(SUMOTime currentTime, const bool isLeave, const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_JUNCTION)
Updates all vehicle detectors.
SUMOTime getEventTime() const
Returns the (planned) time at which the vehicle leaves his current cell.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
double getSlope() const
Returns the slope of the road at vehicle's position.
void addLeaderCar(MEVehicle *veh, MSLink *link)
Adds the given car to the leading vehicles.
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
void updateDetector(SUMOTrafficObject &veh, double entryPos, double leavePos, SUMOTime entryTime, SUMOTime currentTime, SUMOTime leaveTime, bool cleanUp)
bool isStopped() const
Returns whether the vehicle is at a stop.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
double getAngle() const
Returns the vehicle's direction in degrees.
bool mayProceed() const
Returns whether the vehicle is allowed to pass the next junction.
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....
std::string id
The vehicle's id.
double myDepartPos
The real depart position.
double interpolateLanePosToGeometryPos(double lanePos) const
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
MSLink * getLink(const MEVehicle *veh, bool tlsPenalty=false) const
Returns the link the given car will use when passing the next junction.
Abstract in-vehicle / in-person device.
SUMOTime getStoptime(const MESegment *const seg, SUMOTime time) const
Returns until when to stop at the given segment.
A point in 2D or 3D with translation and scaling methods.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
MEVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
void write(OutputDevice &dev) const
Writes the stop as XML.
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
void processStop()
ends the current stop and performs loading/unloading
A road/street connecting two junctions.
double endPos
The stopping position end.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
std::vector< std::pair< int, double > > getStopIndices() const
return list of route indices for the remaining stops
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
static void setApproaching(MEVehicle *veh, MSLink *link)
registers vehicle with the given link
The vehicle changes the segment (meso only)
int myNumberReroutes
The number of reroutings.
double estimateLeaveSpeed(const MSLink *link) const
Returns the vehicle's estimated speed after driving accross the link.
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
void stopEnded(const SUMOVehicleParameter::Stop &stop)
SUMOTime getWaitingTime() const
Returns the duration for which the vehicle was blocked.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const PositionVector & getShape() const
Returns this lane's shape.
double getCurrentLinkPenaltySeconds() const
Returns the delay that is accrued due to option –meso-tls-penalty or –meso-minor-penalty.
MESegment * getSegment() const
Returns the current segment the vehicle is on.
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual MSTransportableControl & getPersonControl()
Returns the person control.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
MSRouteIterator myCurrEdge
Iterator to current route-edge.
A device which collects info on the vehicle trip (mainly on departure and arrival)
std::vector< std::string > via
List of the via-edges the vehicle must visit.
double getLength() const
Returns the length of this link.
double getLength() const
Returns the length of the segment in meters.
MESegment * mySegment
The segment the vehicle is at.
int index
at which position in the stops list
SUMOTime myLastEntryTime
The time the vehicle entered its current segment.
bool isParking() const
Returns whether the vehicle is parking.
double getSpeed() const
Returns the vehicle's estimated speed assuming no delays.
double getConservativeSpeed(SUMOTime &earliestArrival) const
Returns the vehicle's estimated speed taking into account delays.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
bool isStoppedInRange(const double pos, const double tolerance) const
return whether the given position is within range of the current stop
double getLength() const
Get vehicle's length [m].
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers, SUMOTime time)
virtual void setSegment(MESegment *s, int idx=0)
Sets the current segment the vehicle is at together with its que.
int getPersonNumber() const
Returns the number of persons.
const ConstMSEdgeVector getStopEdges(double &firstPos, double &lastPos) const
Returns the list of still pending stop edges.
The base class for microscopic and mesoscopic vehicles.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
int getQueIndex() const
Returns the index of the que the vehicle is in.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
SUMOTime getLinkPenalty(const MEVehicle *veh) const
Returns the penalty time for passing a link (if using gMesoTLSPenalty > 0 or gMesoMinorPenalty > 0)
void addReference() const
increments the reference counter for the route
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
bool contains(const MSEdge *const edge) const
void stopEnded(const SUMOVehicle *veh, const SUMOVehicleParameter::Stop &stop, const std::string &laneOrEdgeID)
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
MSVehicleDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
Encapsulated SAX-Attributes.
MoveReminderCont myMoveReminders
Currently relevant move reminders.
const std::string & getID() const
Returns the id.
Notification
Definition of a vehicle state.
std::map< const MESegment *const, std::vector< SUMOVehicleParameter::Stop > > myStops
where to stop
SUMOTime myEventTime
The (planned) time of leaving the segment (cell)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
Definition of vehicle stop (position and duration)