Eclipse SUMO - Simulation of Urban MObility
MSStageTrip.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // An intermodal routing request (to be transformed into a sequence of walks and rides)
22 /****************************************************************************/
23 #include <config.h>
24 
26 #include <utils/geom/GeomHelper.h>
31 #include <microsim/MSEdge.h>
32 #include <microsim/MSLane.h>
33 #include <microsim/MSNet.h>
42 
43 
44 // ===========================================================================
45 // method definitions
46 // ===========================================================================
47 
48 /* -------------------------------------------------------------------------
49 * MSStageTrip - methods
50 * ----------------------------------------------------------------------- */
52  const MSEdge* destination, MSStoppingPlace* toStop,
53  const SUMOTime duration, const SVCPermissions modeSet,
54  const std::string& vTypes, const double speed, const double walkFactor,
55  const std::string& group,
56  const double departPosLat, const bool hasArrivalPos, const double arrivalPos):
57  MSStage(MSStageType::TRIP, destination, toStop, arrivalPos, 0.0, group),
58  myOrigin(origin),
59  myOriginStop(fromStop),
60  myDuration(duration),
61  myModeSet(modeSet),
62  myVTypes(vTypes),
63  mySpeed(speed),
64  myWalkFactor(walkFactor),
65  myDepartPosLat(departPosLat),
66  myHaveArrivalPos(hasArrivalPos) {
67 }
68 
69 
71 
72 MSStage*
74  MSStage* const clon = new MSStageTrip(myOrigin, const_cast<MSStoppingPlace*>(myOriginStop),
78  clon->setParameters(*this);
79  return clon;
80 }
81 
82 
85  // may be called concurrently while the trip is still being routed
87 }
88 
89 
90 double
91 MSStageTrip::getAngle(SUMOTime /* now */) const {
92  // may be called concurrently while the trip is still being routed
93  return getEdgeAngle(myOrigin, myDepartPos) + M_PI / 2 * (MSGlobals::gLefthand ? -1 : 1);
94 }
95 
96 
97 const MSEdge*
99  return myOrigin;
100 }
101 
102 
103 double
105  return myDepartPos;
106 }
107 
108 
109 const std::string
110 MSStageTrip::setArrived(MSNet* net, MSTransportable* transportable, SUMOTime now, const bool vehicleArrived) {
111  MSStage::setArrived(net, transportable, now, vehicleArrived);
112  if (myOrigin->isTazConnector() && myOrigin->getSuccessors().size() == 0) {
113  // previous stage ended at a taz sink-edge
114  myOrigin = transportable->getNextStage(-1)->getDestination();
115  }
116  MSVehicleControl& vehControl = net->getVehicleControl();
117  std::vector<SUMOVehicleParameter*> pars;
118  for (StringTokenizer st(myVTypes); st.hasNext();) {
119  pars.push_back(new SUMOVehicleParameter());
120  pars.back()->vtypeid = st.next();
121  pars.back()->parametersSet |= VEHPARS_VTYPE_SET;
122  pars.back()->departProcedure = DepartDefinition::TRIGGERED;
123  pars.back()->id = transportable->getID() + "_" + toString(pars.size() - 1);
124  }
125  if (pars.empty()) {
126  if ((myModeSet & SVC_PASSENGER) != 0) {
127  pars.push_back(new SUMOVehicleParameter());
128  pars.back()->id = transportable->getID() + "_0";
129  pars.back()->departProcedure = DepartDefinition::TRIGGERED;
130  } else if ((myModeSet & SVC_TAXI) != 0) {
131  pars.push_back(new SUMOVehicleParameter());
132  pars.back()->vtypeid = DEFAULT_TAXITYPE_ID;
133  pars.back()->id = transportable->getID() + "_taxi";
134  pars.back()->line = "taxi";
135  } else if ((myModeSet & SVC_BICYCLE) != 0) {
136  pars.push_back(new SUMOVehicleParameter());
137  pars.back()->vtypeid = DEFAULT_BIKETYPE_ID;
138  pars.back()->id = transportable->getID() + "_b0";
139  pars.back()->departProcedure = DepartDefinition::TRIGGERED;
140  } else {
141  // allow shortcut via busStop even when not intending to ride
142  pars.push_back(nullptr);
143  }
144  }
145  MSStage* previous;
147  if (transportable->getCurrentStageIndex() == 0) {
148  myDepartPos = transportable->getParameter().departPos;
150  // TODO we should probably use the rng of the lane here
152  }
153  previous = new MSStageWaiting(myOrigin, nullptr, -1, transportable->getParameter().depart, myDepartPos, "start", true);
154  time = transportable->getParameter().depart;
155  } else {
156  previous = transportable->getNextStage(-1);
157  myDepartPos = previous->getArrivalPos();
158  }
159  // TODO This works currently only for a single vehicle type
160  const int oldNumStages = transportable->getNumStages();
161  for (SUMOVehicleParameter* vehPar : pars) {
162  SUMOVehicle* vehicle = nullptr;
163  bool isTaxi = false;
164  if (vehPar != nullptr) {
165  isTaxi = vehPar->vtypeid == DEFAULT_TAXITYPE_ID && vehPar->line == "taxi";
166  if (myDepartPos != 0) {
167  vehPar->departPosProcedure = DepartPosDefinition::GIVEN;
168  vehPar->departPos = myDepartPos;
169  vehPar->parametersSet |= VEHPARS_DEPARTPOS_SET;
170  }
171  pars.back()->parametersSet |= VEHPARS_ARRIVALPOS_SET;
172  pars.back()->arrivalPosProcedure = ArrivalPosDefinition::GIVEN;
173  pars.back()->parametersSet |= VEHPARS_ARRIVALSPEED_SET;
174  pars.back()->arrivalSpeedProcedure = ArrivalSpeedDefinition::GIVEN;
175  pars.back()->arrivalSpeed = 0;
176 
177  MSVehicleType* type = vehControl.getVType(vehPar->vtypeid);
178  if (type->getVehicleClass() != SVC_IGNORING && (myOrigin->getPermissions() & type->getVehicleClass()) == 0 && !isTaxi) {
179  WRITE_WARNINGF(TL("Ignoring vehicle type '%' when routing person '%' because it is not allowed on the start edge."), type->getID(), transportable->getID());
180  delete vehPar;
181  } else {
182  ConstMSRoutePtr const routeDummy = std::make_shared<MSRoute>(vehPar->id, ConstMSEdgeVector({ myOrigin }), false, nullptr, std::vector<SUMOVehicleParameter::Stop>());
183  vehicle = vehControl.buildVehicle(vehPar, routeDummy, type, !MSGlobals::gCheckRoutes);
184  }
185  }
186  bool carUsed = false;
187  std::vector<MSTransportableRouter::TripItem> result;
188  int stageIndex = 1;
189  double departPos = previous->getArrivalPos();
190  MSStoppingPlace* const prevStop = previous->getDestinationStop();
191  if (MSGlobals::gUseMesoSim && prevStop != nullptr) {
192  departPos = (prevStop->getBeginLanePosition() + prevStop->getEndLanePosition()) / 2.;
193  }
195  departPos, myOriginStop == nullptr ? "" : myOriginStop->getID(),
197  transportable->getMaxSpeed() * myWalkFactor, vehicle, myModeSet, time, result)) {
198  double totalCost = 0;
199  for (std::vector<MSTransportableRouter::TripItem>::iterator it = result.begin(); it != result.end(); ++it) {
200  totalCost += it->cost;
201  if (!it->edges.empty()) {
203  double localArrivalPos = bs != nullptr ? bs->getAccessPos(it->edges.back()) : it->edges.back()->getLength() / 2.;
204  const MSEdge* const first = it->edges.front();
205  const MSEdge* const rideOrigin = myOrigin->isTazConnector() && (transportable->getNumStages() == oldNumStages) ? first : nullptr;
206  if (it + 1 == result.end() && myHaveArrivalPos) {
207  localArrivalPos = myArrivalPos;
208  }
209  if (it->line == "") {
210  // determine walk departPos
211  double depPos = previous->getArrivalPos();
212  if (previous->getDestinationStop() != nullptr) {
213  depPos = previous->getDestinationStop()->getAccessPos(first, first->getLanes()[0]->getRNG());
214  } else if (myOrigin->isTazConnector()) {
215  // walk the whole length of the first edge
216  if (std::find(first->getPredecessors().begin(), first->getPredecessors().end(), myOrigin) != first->getPredecessors().end()) {
217  depPos = 0;
218  } else {
219  depPos = first->getLength();
220  }
221  } else if (previous->getDestination() != first) {
222  if ((previous->getDestination()->getToJunction() == first->getToJunction())
223  || (previous->getDestination()->getFromJunction() == first->getToJunction())) {
224  depPos = first->getLength();
225  } else {
226  depPos = 0.;
227  }
228  }
229  if (myDestination->isTazConnector()) {
230  // walk the whole length of the last edge
231  const MSEdge* last = it->edges.back();
232  if (std::find(last->getSuccessors().begin(), last->getSuccessors().end(), myDestination) != last->getSuccessors().end()) {
233  localArrivalPos = last->getLength();
234  } else {
235  localArrivalPos = 0;
236  }
237  }
238  previous = new MSStageWalking(transportable->getID(), it->edges, bs, myDuration, mySpeed, depPos, localArrivalPos, myDepartPosLat);
239  previous->setParameters(*this);
240  previous->setCosts(it->cost);
241  transportable->appendStage(previous, stageIndex++);
242  } else if (isTaxi) {
243  const ConstMSEdgeVector& prevEdges = previous->getEdges();
244  if (prevEdges.size() >= 2 && previous->getDestinationStop() == nullptr) {
245  // determine walking direction and let the previous
246  // stage end after entering its final edge
247  const MSEdge* last = prevEdges.back();
248  const MSEdge* prev = prevEdges[prevEdges.size() - 2];
249  if (last->getFromJunction() == prev->getToJunction() || prev->getFromJunction() == last->getFromJunction()) {
250  previous->setArrivalPos(MIN2(last->getLength(), 10.0));
251  } else {
252  previous->setArrivalPos(MAX2(0.0, last->getLength() - 10));
253  }
254  }
255  previous = new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ "taxi" }), myGroup);
256  previous->setParameters(*this);
257  previous->setCosts(it->cost);
258  transportable->appendStage(previous, stageIndex++);
259  } else if (vehicle != nullptr && it->line == vehicle->getID()) {
260  if (bs == nullptr && it + 1 != result.end()) {
261  // we have no defined endpoint and are in the middle of the trip, drive as far as possible
262  localArrivalPos = it->edges.back()->getLength();
263  }
264  previous = new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ it->line }));
265  previous->setParameters(*this);
266  previous->setCosts(it->cost);
267  transportable->appendStage(previous, stageIndex++);
268  vehicle->replaceRouteEdges(it->edges, -1, 0, "person:" + transportable->getID(), true);
269  vehicle->setArrivalPos(localArrivalPos);
270  const_cast<SUMOVehicleParameter&>(vehicle->getParameter()).arrivalPos = localArrivalPos;
271  vehControl.addVehicle(vehPar->id, vehicle);
272  carUsed = true;
273  } else {
274  previous = new MSStageDriving(rideOrigin, it->edges.back(), bs, localArrivalPos, 0.0, std::vector<std::string>({ it->line }), myGroup, it->intended, TIME2STEPS(it->depart));
275  previous->setParameters(*this);
276  previous->setCosts(it->cost);
277  transportable->appendStage(previous, stageIndex++);
278  }
279  }
280  }
281  if (wasSet(VEHPARS_ARRIVALPOS_SET) && stageIndex > 1) {
282  // mark the last stage
283  transportable->getNextStage(stageIndex - 1)->markSet(VEHPARS_ARRIVALPOS_SET);
284  }
285  setCosts(totalCost);
286  } else {
287  // append stage so the GUI won't crash due to inconsistent state
289  previous->setParameters(*this);
290  transportable->appendStage(previous, stageIndex++);
291  if (MSGlobals::gCheckRoutes) { // if not pedestrians will teleport
292  if (vehicle != nullptr) {
293  vehControl.deleteVehicle(vehicle, true);
294  }
295  return "No connection found between " + getOriginDescription() + " and " + getDestinationDescription() + " for person '" + transportable->getID() + "'.";
296  }
297  }
298  if (vehicle != nullptr && (isTaxi || !carUsed)) {
299  vehControl.deleteVehicle(vehicle, true);
300  }
301  }
302  if (transportable->getNumStages() == oldNumStages) {
303  // append stage so the GUI won't crash due to inconsistent state
304  if (myOriginStop != nullptr && myOriginStop == myDestinationStop) {
305  transportable->appendStage(new MSStageWaiting(myDestination, myDestinationStop, 0, -1, previous->getArrivalPos(), "sameStop", false), 1);
306  } else {
308  if (MSGlobals::gCheckRoutes) { // if not pedestrians will teleport
309  return "Empty route between " + getOriginDescription() + " and " + getDestinationDescription() + " for person '" + transportable->getID() + "'.";
310  }
311  }
312  }
313  return "";
314 }
315 
316 
317 void
318 MSStageTrip::proceed(MSNet* net, MSTransportable* transportable, SUMOTime now, MSStage* /* previous */) {
319  // just skip the stage, every interesting happens in setArrived
320  transportable->proceed(net, now);
321 }
322 
323 
324 std::string
326  return (myOriginStop != nullptr
328  : "edge '" + myOrigin->getID()) + "'";
329 }
330 
331 std::string
333  return (myDestinationStop != nullptr
335  : "edge '" + myDestination->getID()) + "'";
336 }
337 
338 std::string
339 MSStageTrip::getStageSummary(const bool) const {
340  return "trip from " + getOriginDescription() + " to " + getDestinationDescription();
341 }
342 
343 void
344 MSStageTrip::routeOutput(const bool /*isPerson*/, OutputDevice& os, const bool /*withRouteLength*/, const MSStage* const previous) const {
345  if (myArrived < 0) {
346  const bool walkFactorSet = myWalkFactor != OptionsCont::getOptions().getFloat("persontrip.walkfactor");
347  const bool groupSet = myGroup != OptionsCont::getOptions().getString("persontrip.default.group");
348  // could still be a persontrip but most likely it was a walk in the input
349  SumoXMLTag tag = myModeSet == 0 && !walkFactorSet && !groupSet ? SUMO_TAG_WALK : SUMO_TAG_PERSONTRIP;
350  os.openTag(tag);
351  if (previous == nullptr || previous->getStageType() == MSStageType::WAITING_FOR_DEPART) {
353  }
354  if (myDestinationStop == nullptr) {
358  }
359  } else {
361  }
362  std::vector<std::string> modes;
363  if ((myModeSet & SVC_PASSENGER) != 0) {
364  modes.push_back("car");
365  }
366  if ((myModeSet & SVC_BICYCLE) != 0) {
367  modes.push_back("bicycle");
368  }
369  if ((myModeSet & SVC_TAXI) != 0) {
370  modes.push_back("taxi");
371  }
372  if ((myModeSet & SVC_BUS) != 0) {
373  modes.push_back("public");
374  }
375  if (modes.size() > 0) {
376  os.writeAttr(SUMO_ATTR_MODES, modes);
377  }
378  if (myVTypes.size() > 0) {
380  }
381  if (groupSet) {
383  }
384  if (walkFactorSet) {
386  }
387  if (OptionsCont::getOptions().getBool("vehroute-output.cost")) {
389  }
390  os.closeTag();
391  }
392 }
393 
394 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
MSStageType
Definition: MSStage.h:54
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define TL(string)
Definition: MsgHandler.h:315
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:31
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_TAXITYPE_ID
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const std::string DEFAULT_BIKETYPE_ID
@ GIVEN
The speed is given.
@ RANDOM
A random position is chosen.
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_ARRIVALSPEED_SET
@ GIVEN
The arrival position is given.
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_WALK
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PERSONTRIP
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_MODES
@ SUMO_ATTR_VTYPES
@ SUMO_ATTR_GROUP
@ SUMO_ATTR_COST
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_WALKFACTOR
T MIN2(T a, T b)
Definition: StdDefs.h:76
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
bool compute(const E *from, const E *to, const double departPos, const std::string &originStopID, const double arrivalPos, const std::string &stopID, const double speed, const V *const vehicle, const SVCPermissions modeSet, const SUMOTime msTime, std::vector< TripItem > &into, const double externalFactor=0.)
Builds the route between the given edges using the minimum effort at the given time The definition of...
A road/street connecting two junctions.
Definition: MSEdge.h:77
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:626
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:406
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:168
const MSJunction * getFromJunction() const
Definition: MSEdge.h:411
double getLength() const
return the length of the edge
Definition: MSEdge.h:662
bool isTazConnector() const
Definition: MSEdge.h:288
const MSJunction * getToJunction() const
Definition: MSEdge.h:415
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1194
static bool gUseMesoSim
Definition: MSGlobals.h:103
static bool gCheckRoutes
Definition: MSGlobals.h:88
static bool gLefthand
Whether lefthand-drive is being simulated.
Definition: MSGlobals.h:169
The simulated network and simulation perfomer.
Definition: MSNet.h:89
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:182
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:378
MSTransportableRouter & getIntermodalRouter(const int rngIndex, const int routingMode=0, const MSEdgeVector &prohibited=MSEdgeVector()) const
Definition: MSNet.cpp:1504
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:320
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
Definition: MSNet.cpp:1364
const MSEdge * getDestination() const
returns the destination edge
Definition: MSStage.cpp:65
virtual ConstMSEdgeVector getEdges() const
the edges of the current stage
Definition: MSStage.cpp:113
virtual double getArrivalPos() const
Definition: MSStage.h:93
MSStoppingPlace * myDestinationStop
the stop to reach by getting transported (if any)
Definition: MSStage.h:272
const std::string myGroup
The id of the group of transportables traveling together.
Definition: MSStage.h:290
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
Definition: MSStage.cpp:161
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Definition: MSStage.h:84
double getCosts() const
Returns the costs of the stage.
Definition: MSStage.h:255
bool wasSet(int what) const
Definition: MSStage.h:243
MSStageType getStageType() const
Definition: MSStage.h:126
void setArrivalPos(double arrivalPos)
Definition: MSStage.h:101
void setCosts(double costs)
Sets the costs of the stage.
Definition: MSStage.h:263
SUMOTime myArrived
the time at which this stage ended
Definition: MSStage.h:284
void markSet(int what)
Definition: MSStage.h:247
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
Definition: MSStage.cpp:183
static const double ROADSIDE_OFFSET
the offset for computing positions when standing at an edge
Definition: MSStage.h:299
double myArrivalPos
the longitudinal position at which we want to arrive
Definition: MSStage.h:275
Position getEdgePosition(const MSEdge *e, double at, double offset) const
get position on edge e at length at with orthogonal offset
Definition: MSStage.cpp:172
const MSEdge * myDestination
the next edge to reach by getting transported
Definition: MSStage.h:269
const bool myHaveArrivalPos
whether an arrivalPos was in the input
Definition: MSStageTrip.h:153
double getAngle(SUMOTime now) const
returns the angle of the transportable
Definition: MSStageTrip.cpp:91
MSStageTrip(const MSEdge *origin, MSStoppingPlace *fromStop, const MSEdge *destination, MSStoppingPlace *toStop, const SUMOTime duration, const SVCPermissions modeSet, const std::string &vTypes, const double speed, const double walkFactor, const std::string &group, const double departPosLat, const bool hasArrivalPos, const double arrivalPos)
constructor
Definition: MSStageTrip.cpp:51
void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, MSStage *previous)
proceeds to the next step
const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
std::string getOriginDescription() const
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
const std::string myVTypes
The possible vehicles to use.
Definition: MSStageTrip.h:138
double myDepartPos
The depart position.
Definition: MSStageTrip.h:147
double getEdgePos(SUMOTime now) const
MSStage * clone() const
Definition: MSStageTrip.cpp:73
const MSEdge * getEdge() const
Returns the current edge.
Definition: MSStageTrip.cpp:98
void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const
Called on writing vehroute output.
const MSEdge * myOrigin
the origin edge
Definition: MSStageTrip.h:126
const double mySpeed
The walking speed.
Definition: MSStageTrip.h:141
MSStoppingPlace * myOriginStop
the origin edge
Definition: MSStageTrip.h:129
std::string getDestinationDescription() const
SUMOTime myDuration
the time the trip should take (applies to only walking)
Definition: MSStageTrip.h:132
const double myWalkFactor
The factor to apply to walking durations.
Definition: MSStageTrip.h:144
const double myDepartPosLat
The lateral depart position.
Definition: MSStageTrip.h:150
const SVCPermissions myModeSet
The allowed modes of transportation.
Definition: MSStageTrip.h:135
Position getPosition(SUMOTime now) const
returns the position of the transportable
Definition: MSStageTrip.cpp:84
virtual ~MSStageTrip()
destructor
Definition: MSStageTrip.cpp:70
A lane area vehicles can halt at.
double getBeginLanePosition() const
Returns the begin position of this stop.
SumoXMLTag getElement() const
return the type of this stopping place
double getEndLanePosition() const
Returns the end position of this stop.
double getAccessPos(const MSEdge *edge, SumoRNG *rng=nullptr) const
the position on the given edge which is connected to this stop, -1 on failure
MSStage * getNextStage(int offset) const
Return the next (or previous) stage denoted by the offset.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
int getNumStages() const
Return the total number stages in this person's plan.
int getCurrentStageIndex() const
Return the index of the current stage.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
double getMaxSpeed() const
Returns the maximum speed (the minimum of desired and physical maximum speed)
The class responsible for building and deletion of vehicles.
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, ConstMSRoutePtr route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true, bool addRouteStops=true)
Builds a vehicle, increases the number of built vehicles.
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false, bool wasKept=false)
Deletes the vehicle.
The car-following model and parameter.
Definition: MSVehicleType.h:63
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
const std::string & getID() const
Returns the id.
Definition: Named.h:74
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setParameters(const Parameterised &params)
set the inner key/value map in map<string, string> format
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
Definition: RandHelper.cpp:94
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
Representation of a vehicle.
Definition: SUMOVehicle.h:60
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 void setArrivalPos(double arrivalPos)=0
Sets this vehicle's desired arrivalPos for its current route.
Structure representing possible vehicle parameter.
double departPos
(optional) The position the vehicle shall depart from
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
bool hasNext()
returns the information whether further substrings exist
#define M_PI
Definition: odrSpiral.cpp:45