39#define DEBUG_COND(obj) (true)
56 std::pair<const MSLane*, double> stopPos;
63 if (stopSeg ==
nullptr) {
72 double stopOffset = 0;
75 while (seg != stopSeg) {
79 stopPos = std::make_pair(stopEdge.
getLanes()[0], stopOffset);
85 if (stopPos.first !=
nullptr) {
88 stop.
edge = stopPos.first->getEdge().getID();
90 stop.
lane = stopPos.first->getID();
92 stop.
startPos =
MAX2(0.0, stopPos.second - POSITION_EPS);
93 stop.
endPos = stopPos.second;
97 stop.
endPos += POSITION_EPS;
101 if (errorOut !=
"") {
145 int remainingEdges = 0;
147 const int routeLength = (int)edges.size();
148 while (routePos + 1 < routeLength && (remainingEdges < 2 || remainingDist < 200)) {
149 const MSEdge* edge = edges[routePos];
153 newEdges.push_back(edge);
155 const MSEdge* lastEdge = edges.back();
156 newEdges.push_back(lastEdge);
158 while (remainingEdges < 2 || remainingDist < 200) {
162 for (
auto it = successors.begin(); it != successors.end();) {
164 it = successors.erase(it);
170 const double threshPref = veh.
getFloatParam(
"device.taxi.idleMinPref",
false, 0);
171 double maxPref = -std::numeric_limits<double>::max();
172 for (
const MSEdge* edge : successors) {
175 if (maxPref >= threshPref) {
177 for (
auto it = successors.begin(); it != successors.end();) {
179 it = successors.erase(it);
186 if (successors.size() == 0) {
191 newEdges.push_back(successors[nextIndex]);
192 lastEdge = newEdges.back();
198 veh.
replaceRouteEdges(newEdges, -1, 0,
"taxi:idling:randomCircling",
false,
false,
false);
218 MSStop* lastStop =
nullptr;
222 if (lastStop ==
nullptr || lastStop->
parkingarea ==
nullptr) {
237 const int nextStopIndex = (int)veh.
getStops().size();
239 if (!veh.
insertStop(nextStopIndex, stop,
"taxi:taxistand",
false, error)) {
240 WRITE_WARNING(
"Stop insertion failed for idling taxi '" + veh.
getID() +
"' (" + error +
").");
252 if (targetPos > vehPos + POSITION_EPS) {
257 if (follower.first !=
nullptr && follower.first->getWaitingTime() >
DELTA_T) {
264 veh.
replaceRouteEdges(loopedRoute, -1, 0,
"taxi:idling_unblock",
false,
false,
false);
std::vector< const MSEdge * > ConstMSEdgeVector
std::vector< MSEdge * > MSEdgeVector
ConstMSEdgeVector::const_iterator MSRouteIterator
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
const int STOP_PARKING_SET
const int STOP_TRIGGER_SET
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
A single mesoscopic segment (cell)
double getLength() const
Returns the length of the segment in meters.
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
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.
The base class for microscopic and mesoscopic vehicles.
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
const std::list< MSStop > & getStops() const
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
MSStop & getStop(int nextStopIndex)
virtual std::pair< const MSVehicle *const, double > getFollower(double dist=0) const
Returns the follower of the vehicle looking for a fixed distance.
bool insertStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, bool teleport, std::string &errorMsg)
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, MSRouteIterator *searchStart=nullptr)
Adds a stop.
const MSRoute & getRoute() const
Returns the current route.
bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given edges.
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i....
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
A device which collects info on the vehicle trip (mainly on departure and arrival)
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
double getLength() const
return the length of the edge
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
void idle(MSDevice_Taxi *taxi)
computes Idling and updates reservations
void idle(MSDevice_Taxi *taxi)
computes Idling and updates reservations
MSTriggeredRerouter * myRerouter
void idle(MSDevice_Taxi *taxi)
computes Idling and updates reservations
@ NOTIFICATION_PARKING_REROUTE
The vehicle needs another parking area.
A lane area vehicles can halt at.
bool mustAdvance(SUMOVehicleClass svc) const
whether parked vehicles must advance in a queue
double getLastFreePos(const SUMOVehicle &forVehicle, double brakePos=0) const override
Returns the last free position on this stop.
const ConstMSEdgeVector & getEdges() const
MSRouteIterator end() const
Returns the end of the list of edges to pass.
static MSVehicleRouter & getRouterTT(const int rngIndex, SUMOVehicleClass svc, const Prohibitions &prohibited={})
return the vehicle router instance
bool triggered
whether an arriving person lets the vehicle continue
bool containerTriggered
whether an arriving container lets the vehicle continue
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
SUMOTime duration
The stopping duration.
const SUMOVehicleParameter::Stop pars
The stop parameter.
double getBeginLanePosition() const
Returns the begin position of this stop.
double getEndLanePosition() const
Returns the end position of this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
bool triggerRouting(SUMOTrafficObject &veh, MSMoveReminder::Notification reason)
const RerouteInterval * getCurrentReroute(SUMOTime time, SUMOTrafficObject &obj) const
Returns the rerouting definition valid for the given time and object, nullptr if none.
SUMOVehicle & getHolder() const
Returns the vehicle that holds this device.
Representation of a vehicle in the micro simulation.
std::pair< const MSLane *, double > getLanePosAfterDist(double distance) const
return lane and position along bestlanes at the given distance
double getSpeed() const
Returns the vehicle's current speed.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
int getContainerCapacity() const
Get this vehicle type's container capacity.
const std::string & getID() const
Returns the id.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
const std::vector< T > & getVals() const
Returns the members of the distribution.
bool computeLooped(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)
Builds the route between the given edges using the minimum effort at the given time if from == to,...
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
virtual const SUMOVTypeParameter & getVTypeParameter() const =0
Returns the object's "vehicle" type parameter.
virtual SUMOVehicleClass getVClass() const =0
Returns the object's access class.
virtual SumoRNG * getRNG() const =0
Returns the associated RNG for this object.
virtual int getRoutePosition() const =0
return index of edge within route
double getFloatParam(const std::string ¶mName, const bool required=false, const double deflt=INVALID_DOUBLE, bool checkDist=true) const
Retrieve a floating point parameter for the traffic object.
virtual double getPositionOnLane() const =0
Get the object's position along the lane.
Representation of a vehicle.
virtual bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true, std::string *msgReturn=nullptr)=0
Replaces the current route by the given edges.
virtual bool hasStops() const =0
Returns whether the vehicle has to stop somewhere.
virtual bool isStoppedTriggered() const =0
Returns whether the vehicle is at a stop and waiting for a person or container to continue.
virtual const MSStop & getNextStop() const =0
virtual MSStop & getNextStopMutable()=0
virtual bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)=0
virtual const MSRoute & getRoute() const =0
Returns the current route.
virtual bool abortNextStop(int nextStopIndex=0)=0
deletes the next stop at the given index if it exists
Definition of vehicle stop (position and duration)
std::string edge
The edge to stop at.
ParkingType parking
whether the vehicle is removed from the net while stopping
std::string lane
The lane to stop at.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
double startPos
The stopping position start.
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
double endPos
The stopping position end.
bool containerTriggered
whether an arriving container lets the vehicle continue
RandomDistributor< MSStoppingPlaceRerouter::StoppingPlaceVisible > parkProbs
The distributions of new parking areas to use as destinations.