Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
ROPerson.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2002-2025 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// A vehicle as used by router
22/****************************************************************************/
23#include <config.h>
24
25#include <string>
26#include <iostream>
35#include "RORouteDef.h"
36#include "RORoute.h"
37#include "ROVehicle.h"
38#include "ROHelper.h"
39#include "RONet.h"
40#include "ROLane.h"
41#include "ROPerson.h"
42
45
46// ===========================================================================
47// method definitions
48// ===========================================================================
50 : RORoutable(pars, type) {
51}
52
53
55 for (PlanItem* const it : myPlan) {
56 delete it;
57 }
58}
59
60
61void
62ROPerson::addTrip(std::vector<PlanItem*>& plan, const std::string& id,
63 const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet,
64 const std::string& vTypes,
65 const double departPos, const std::string& stopOrigin,
66 const double arrivalPos, const std::string& busStop,
67 double walkFactor, const std::string& group) {
68 PersonTrip* trip = new PersonTrip(from, to, modeSet, departPos, stopOrigin, arrivalPos, busStop, walkFactor, group);
72 if (departPos != 0) {
74 pars.departPos = departPos;
76 }
77 for (StringTokenizer st(vTypes); st.hasNext();) {
78 pars.vtypeid = st.next();
80 const SUMOVTypeParameter* type = net->getVehicleTypeSecure(pars.vtypeid);
81 if (type == nullptr) {
82 delete trip;
83 throw InvalidArgument("The vehicle type '" + pars.vtypeid + "' in a trip for person '" + id + "' is not known.");
84 }
85 pars.id = id + "_" + toString(trip->getVehicles().size());
86 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), type, net));
87 // update modeset with routing-category vClass
88 if (type->vehicleClass == SVC_BICYCLE) {
90 } else {
92 }
93 }
94 if (trip->getVehicles().empty()) {
95 if ((modeSet & SVC_PASSENGER) != 0) {
96 pars.id = id + "_0";
97 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_VTYPE_ID), net));
98 }
99 if ((modeSet & SVC_BICYCLE) != 0) {
100 pars.id = id + "_b0";
103 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_BIKETYPE_ID), net));
104 }
105 if ((modeSet & SVC_TAXI) != 0) {
106 // add dummy taxi for routing (never added to output)
107 pars.id = "taxi"; // id is written as 'line'
109 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_TAXITYPE_ID), net));
110 }
111 }
112 plan.push_back(trip);
113}
114
115
116void
117ROPerson::addRide(std::vector<PlanItem*>& plan, const ROEdge* const from, const ROEdge* const to, const std::string& lines,
118 double arrivalPos, const std::string& destStop, const std::string& group) {
119 plan.push_back(new PersonTrip(to, destStop));
120 plan.back()->addTripItem(new Ride(-1, from, to, lines, group, -1., arrivalPos, -1., destStop));
121}
122
123
124void
125ROPerson::addWalk(std::vector<PlanItem*>& plan, const ConstROEdgeVector& edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string& busStop) {
126 if (plan.empty() || plan.back()->isStop()) {
127 plan.push_back(new PersonTrip(edges.back(), busStop));
128 }
129 plan.back()->addTripItem(new Walk(-1, edges, -1., duration, speed, departPos, arrivalPos, busStop));
130}
131
132
133void
134ROPerson::addStop(std::vector<PlanItem*>& plan, const SUMOVehicleParameter::Stop& stopPar, const ROEdge* const stopEdge) {
135 plan.push_back(new Stop(stopPar, stopEdge));
136}
137
138
139void
140ROPerson::Ride::saveAsXML(OutputDevice& os, const bool extended, OptionsCont& options) const {
142 std::string comment = "";
143 if ((extended || options.getBool("write-costs")) && myCost >= 0.) {
145 }
146 if (from != nullptr) {
148 }
149 if (to != nullptr) {
151 }
152 if (destStop != "") {
153 const std::string element = RONet::getInstance()->getStoppingPlaceElement(destStop);
154 os.writeAttr(element, destStop);
155 const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
156 if (name != "") {
157 comment = " <!-- " + name + " -->";
158 }
159 } else if (arrPos != 0 && arrPos != std::numeric_limits<double>::infinity()) {
161 }
162 if (lines != LINE_ANY) {
163 // no need to write the default
165 }
166 if (group != "") {
168 }
169 if (intended != "" && intended != lines) {
171 }
172 if (depart >= 0) {
174 }
175 if (options.getBool("exit-times")) {
176 os.writeAttr("started", time2string(getStart()));
177 os.writeAttr("ended", time2string(getStart() + getDuration()));
178 }
179 if (options.getBool("route-length") && length != -1) {
180 os.writeAttr("routeLength", length);
181 }
182 os.closeTag(comment);
183}
184
185
186void
187ROPerson::Stop::saveAsXML(OutputDevice& os, const bool /*extended*/, const bool /*asTrip*/, OptionsCont& /*options*/) const {
188 stopDesc.write(os, false);
189 std::string comment = "";
190 for (std::string sID : stopDesc.getStoppingPlaceIDs()) {
191 const std::string name = RONet::getInstance()->getStoppingPlaceName(sID);
192 if (name != "") {
193 comment += name + " ";
194 }
195 }
196 if (comment != "") {
197 comment = " <!-- " + comment + " -->";
198 }
199 stopDesc.writeParams(os);
200 os.closeTag(comment);
201}
202
203void
204ROPerson::Walk::saveAsXML(OutputDevice& os, const bool extended, OptionsCont& options) const {
206 std::string comment = "";
207 if ((extended || options.getBool("write-costs")) && myCost >= 0.) {
208 os.writeAttr(SUMO_ATTR_COST, myCost);
209 }
210 if (dur > 0) {
212 }
213 if (v > 0) {
215 }
216 os.writeAttr(SUMO_ATTR_EDGES, edges);
217 if (options.getBool("exit-times")) {
218 os.writeAttr("started", time2string(getStart()));
219 os.writeAttr("ended", time2string(getStart() + getDuration()));
220 if (!exitTimes.empty()) {
221 os.writeAttr("exitTimes", exitTimes);
222 }
223 }
224 if (options.getBool("route-length")) {
225 double length = 0;
226 for (const ROEdge* roe : edges) {
227 length += roe->getLength();
228 }
229 os.writeAttr("routeLength", length);
230 }
231 if (destStop != "") {
232 const std::string element = RONet::getInstance()->getStoppingPlaceElement(destStop);
233 os.writeAttr(element, destStop);
234 const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
235 if (name != "") {
236 comment = " <!-- " + name + " -->";
237 }
238 } else if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
240 }
241 os.closeTag(comment);
242}
243
246 PersonTrip* result = new PersonTrip(from, to, modes, dep, stopOrigin, arr, stopDest, walkFactor, group);
247 for (auto* item : myTripItems) {
248 result->myTripItems.push_back(item->clone());
249 }
250 return result;
251}
252
253void
254ROPerson::PersonTrip::saveVehicles(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const {
255 for (ROVehicle* veh : myVehicles) {
256 if (!RONet::getInstance()->knowsVehicle(veh->getID())) {
257 veh->saveAsXML(os, typeos, asAlternatives, options);
258 }
259 }
260}
261
262void
263ROPerson::PersonTrip::saveAsXML(OutputDevice& os, const bool extended, const bool asTrip, OptionsCont& options) const {
264 if ((asTrip || extended) && from != nullptr) {
265 const bool writeGeoTrip = asTrip && options.getBool("write-trips.geo");
267 if (writeGeoTrip) {
268 Position fromPos = from->getLanes()[0]->getShape().positionAtOffset2D(getDepartPos());
269 if (GeoConvHelper::getFinal().usingGeoProjection()) {
272 os.writeAttr(SUMO_ATTR_FROMLONLAT, fromPos);
274 } else {
275 os.writeAttr(SUMO_ATTR_FROMXY, fromPos);
276 }
277 } else {
278 os.writeAttr(SUMO_ATTR_FROM, from->getID());
279 }
280 if (writeGeoTrip) {
281 Position toPos = to->getLanes()[0]->getShape().positionAtOffset2D(MIN2(getArrivalPos(), to->getLanes()[0]->getShape().length2D()));
282 if (GeoConvHelper::getFinal().usingGeoProjection()) {
285 os.writeAttr(SUMO_ATTR_TOLONLAT, toPos);
287 } else {
288 os.writeAttr(SUMO_ATTR_TOXY, toPos);
289 }
290 } else {
291 os.writeAttr(SUMO_ATTR_TO, to->getID());
292 }
293 std::vector<std::string> allowedModes;
294 if ((modes & SVC_BUS) != 0) {
295 allowedModes.push_back("public");
296 }
297 if ((modes & SVC_PASSENGER) != 0) {
298 allowedModes.push_back("car");
299 }
300 if ((modes & SVC_TAXI) != 0) {
301 allowedModes.push_back("taxi");
302 }
303 if ((modes & SVC_BICYCLE) != 0) {
304 allowedModes.push_back("bicycle");
305 }
306 if (allowedModes.size() > 0) {
307 os.writeAttr(SUMO_ATTR_MODES, toString(allowedModes));
308 }
309 if (!writeGeoTrip) {
310 if (dep != 0 && dep != std::numeric_limits<double>::infinity()) {
312 }
313 if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
315 }
316 }
317 if (getStopDest() != "") {
318 os.writeAttr(SUMO_ATTR_BUS_STOP, getStopDest());
319 }
320 if (walkFactor != 1) {
321 os.writeAttr(SUMO_ATTR_WALKFACTOR, walkFactor);
322 }
323 if (extended && myTripItems.size() != 0) {
324 std::vector<double> costs;
325 for (const TripItem* const tripItem : myTripItems) {
326 costs.push_back(tripItem->getCost());
327 }
328 os.writeAttr(SUMO_ATTR_COSTS, costs);
329 }
330 os.closeTag();
331 } else {
332 for (const TripItem* const it : myTripItems) {
333 it->saveAsXML(os, extended, options);
334 }
335 }
336}
337
340 SUMOTime result = 0;
341 for (TripItem* tItem : myTripItems) {
342 result += tItem->getDuration();
343 }
344 return result;
345}
346
347bool
349 const PersonTrip* const trip, const ROVehicle* const veh,
350 std::vector<TripItem*>& resultItems, MsgHandler* const errorHandler) {
351 const double speed = getMaxSpeed() * trip->getWalkFactor();
352 std::vector<ROIntermodalRouter::TripItem> result;
353 provider.getIntermodalRouter().compute(trip->getOrigin(), trip->getDestination(),
354 trip->getDepartPos(), trip->getStopOrigin(),
355 trip->getArrivalPos(), trip->getStopDest(),
356 speed, veh, *getType(), trip->getModes(), time, result);
357 bool carUsed = false;
358 SUMOTime start = time;
359 int index = 0;
360 const int lastIndex = (int)result.size() - 1;
361 for (const ROIntermodalRouter::TripItem& item : result) {
362 if (!item.edges.empty()) {
363 if (item.line == "") {
364 double depPos = trip->getDepartPos(false);
365 double arrPos = trip->getArrivalPos(false);
366 if (trip->getOrigin()->isTazConnector()) {
367 // walk the whole length of the first edge
368 const ROEdge* first = item.edges.front();
369 if (std::find(first->getPredecessors().begin(), first->getPredecessors().end(), trip->getOrigin()) != first->getPredecessors().end()) {
370 depPos = 0;
371 } else {
372 depPos = first->getLength();
373 }
374 }
375 if (trip->getDestination()->isTazConnector()) {
376 // walk the whole length of the last edge
377 const ROEdge* last = item.edges.back();
378 if (std::find(last->getSuccessors().begin(), last->getSuccessors().end(), trip->getDestination()) != last->getSuccessors().end()) {
379 arrPos = last->getLength();
380 } else {
381 arrPos = 0;
382 }
383 }
384 if (&item == &result.back() && trip->getStopDest() == "") {
385 resultItems.push_back(new Walk(start, item.edges, item.cost, item.exitTimes, depPos, arrPos));
386 } else {
387 resultItems.push_back(new Walk(start, item.edges, item.cost, item.exitTimes, depPos, arrPos, item.destStop));
388 }
389 } else if (veh != nullptr && item.line == veh->getID()) {
390 double cost = item.cost;
391 if (veh->getVClass() != SVC_TAXI) {
392 RORoute* route = new RORoute(veh->getID() + "_RouteDef", item.edges);
393 route->setProbability(1);
395 carUsed = true;
396 } else if (resultItems.empty()) {
397 // if this is the first plan item the initial taxi waiting time wasn't added yet
398 const double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
399 cost += taxiWait;
400 }
401 double arrPos = index == lastIndex ? trip->getArrivalPos(false) : item.arrivalPos;
402 resultItems.push_back(new Ride(start, item.edges.front(), item.edges.back(), veh->getID(), trip->getGroup(), cost, arrPos, item.length, item.destStop));
403 } else {
404 // write origin for first element of the plan
405 const ROEdge* origin = trip == myPlan.front() && resultItems.empty() ? trip->getOrigin() : nullptr;
406 const std::string line = OptionsCont::getOptions().getBool("persontrip.ride-public-line") ? item.line : LINE_ANY;
407 resultItems.push_back(new Ride(start, origin, nullptr, line, trip->getGroup(), item.cost, item.arrivalPos, item.length, item.destStop, item.intended, TIME2STEPS(item.depart)));
408 }
409 }
410 start += TIME2STEPS(item.cost);
411 index++;
412 }
413 if (result.empty()) {
414 errorHandler->inform("No route for trip in person '" + getID() + "'.");
415 myRoutingSuccess = false;
416 }
417 return carUsed;
418}
419
420
421void
423 const bool /* removeLoops */, MsgHandler* errorHandler) {
424 myRoutingSuccess = true;
426 for (PlanItem* const it : myPlan) {
427 if (it->needsRouting()) {
428 PersonTrip* trip = static_cast<PersonTrip*>(it);
429 const std::vector<ROVehicle*>& vehicles = trip->getVehicles();
430 std::vector<TripItem*> resultItems;
431 std::vector<TripItem*> best;
432 const ROVehicle* bestVeh = nullptr;
433 if (vehicles.empty()) {
434 computeIntermodal(time, provider, trip, nullptr, best, errorHandler);
435 } else {
436 double bestCost = std::numeric_limits<double>::infinity();
437 for (const ROVehicle* const v : vehicles) {
438 const bool carUsed = computeIntermodal(time, provider, trip, v, resultItems, errorHandler);
439 double cost = 0.;
440 for (const TripItem* const tripIt : resultItems) {
441 cost += tripIt->getCost();
442 }
443 if (cost < bestCost) {
444 bestCost = cost;
445 bestVeh = carUsed ? v : nullptr;
446 best.swap(resultItems);
447 }
448 for (const TripItem* const tripIt : resultItems) {
449 delete tripIt;
450 }
451 resultItems.clear();
452 }
453 }
454 trip->setItems(best, bestVeh);
455
456 // test after routing to ensuer network was initialized
457 if (!myHaveWarnedPTMissing && (trip->getModes() & SVC_BUS) != 0) {
459 if (!provider.getIntermodalRouter().getNetwork()->hasPTSchedules()) {
460 WRITE_WARNINGF("Person '%' is configured to use public transport but no schedules are loaded.", getID());
461 }
462 }
463 }
464 time += it->getDuration();
465 }
466 if (RONet::getInstance()->getMaxTraveltime() > 0) {
467 double costs = STEPS2TIME(time - getParameter().depart);
468 if (costs > RONet::getInstance()->getMaxTraveltime()) {
469 errorHandler->inform("Person '" + getID() + "' has no valid route (traveltime " + time2string(TIME2STEPS(costs)) + " exceeds max-traveltime)");
470 myRoutingSuccess = false;
471 return;
472 }
473 }
474}
475
476
477void
478ROPerson::saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options, int cloneIndex) const {
479 // write the person's vehicles
480 const bool writeTrip = options.exists("write-trips") && options.getBool("write-trips");
481 const bool writeFlow = options.exists("keep-flows") && options.getBool("keep-flows") && isPartOfFlow();
482 if (!writeTrip) {
483 for (const PlanItem* const it : myPlan) {
484 it->saveVehicles(os, typeos, asAlternatives, options);
485 }
486 }
487
488 if (typeos != nullptr && getType() != nullptr && !getType()->saved) {
489 getType()->write(*typeos);
490 getType()->saved = true;
491 }
492 if (getType() != nullptr && !getType()->saved) {
493 getType()->write(os);
494 getType()->saved = asAlternatives;
495 }
496 const SumoXMLTag tag = writeFlow ? SUMO_TAG_PERSONFLOW : SUMO_TAG_PERSON;
497 // write the person
498 if (cloneIndex == 0) {
499 getParameter().write(os, options, tag);
500 } else {
502 // @note id collisions may occur if scale-suffic occurs in other vehicle ids
503 p.id += options.getString("scale-suffix") + toString(cloneIndex);
504 p.write(os, options, tag);
505 }
506
507 for (const PlanItem* const it : myPlan) {
508 it->saveAsXML(os, asAlternatives, writeTrip, options);
509 }
510
511 // write params
513 os.closeTag();
514}
515
516
517/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:57
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#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
const std::string DEFAULT_VTYPE_ID
@ 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 position is given.
const std::string LINE_ANY
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_VTYPE_SET
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_WALK
@ SUMO_TAG_RIDE
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ SUMO_TAG_PERSONFLOW
@ SUMO_ATTR_COSTS
@ SUMO_ATTR_LINES
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_TOLONLAT
@ SUMO_ATTR_MODES
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_GROUP
@ SUMO_ATTR_COST
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_FROMXY
@ SUMO_ATTR_WALKFACTOR
@ SUMO_ATTR_TOXY
@ SUMO_ATTR_DURATION
@ SUMO_ATTR_FROMLONLAT
@ SUMO_ATTR_INTENDED
int gPrecision
the precision for floating point outputs
Definition StdDefs.cpp:27
int gPrecisionGeo
Definition StdDefs.cpp:29
T MIN2(T a, T b)
Definition StdDefs.h:80
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
const std::string & getID() const
Returns the id.
Definition Named.h:74
A storage for options typed value containers)
Definition OptionsCont.h:89
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A basic edge for routing applications.
Definition ROEdge.h:73
bool isTazConnector() const
Definition ROEdge.h:174
const ROEdgeVector & getPredecessors() const
Returns the edge at the given position from the list of incoming edges.
Definition ROEdge.h:361
const ROEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition ROEdge.cpp:389
double getLength() const
Returns the length of the edge.
Definition ROEdge.h:225
The router's network representation.
Definition RONet.h:63
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition RONet.cpp:411
static RONet * getInstance()
Returns the pointer to the unique instance of RONet (singleton).
Definition RONet.cpp:56
bool knowsVehicle(const std::string &id) const
returns whether a vehicle with the given id was already loaded
Definition RONet.cpp:535
const std::string getStoppingPlaceElement(const std::string &id) const
return the element name for the given stopping place id
Definition RONet.cpp:967
const std::string getStoppingPlaceName(const std::string &id) const
return the name for the given stopping place id
Definition RONet.cpp:955
A planItem can be a Trip which contains multiple tripItems.
Definition ROPerson.h:298
double getDepartPos(bool replaceDefault=true) const
Definition ROPerson.h:340
void saveVehicles(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Definition ROPerson.cpp:254
const std::string & getStopOrigin() const
Definition ROPerson.h:357
SVCPermissions getModes() const
Definition ROPerson.h:346
const std::string & getStopDest() const
Definition ROPerson.h:361
double getWalkFactor() const
Definition ROPerson.h:385
const ROEdge * getDestination() const
Definition ROPerson.h:330
SUMOTime getDuration() const
return duration sum of all trip items
Definition ROPerson.cpp:339
double getArrivalPos(bool replaceDefault=true) const
Definition ROPerson.h:343
std::vector< ROVehicle * > & getVehicles()
Definition ROPerson.h:324
const std::string & getGroup() const
Definition ROPerson.h:353
void saveAsXML(OutputDevice &os, const bool extended, const bool asTrip, OptionsCont &options) const
Definition ROPerson.cpp:263
const ROEdge * getOrigin() const
Definition ROPerson.h:327
PlanItem * clone() const
Definition ROPerson.cpp:245
std::vector< TripItem * > myTripItems
the fully specified trips
Definition ROPerson.h:400
void setItems(std::vector< TripItem * > &newItems, const ROVehicle *const veh)
Definition ROPerson.h:368
void addVehicle(ROVehicle *veh)
Definition ROPerson.h:321
void updateModes(SVCPermissions additionalModes)
Definition ROPerson.h:349
Every person has a plan comprising of multiple planItems.
Definition ROPerson.h:83
static const std::string UNDEFINED_STOPPING_PLACE
Definition ROPerson.h:113
A ride is part of a trip, e.g., go from here to here by car or bus.
Definition ROPerson.h:202
const double length
Definition ROPerson.h:243
const std::string lines
Definition ROPerson.h:237
const std::string destStop
Definition ROPerson.h:239
const std::string group
Definition ROPerson.h:238
const std::string intended
Definition ROPerson.h:240
const SUMOTime depart
Definition ROPerson.h:241
const ROEdge *const to
Definition ROPerson.h:236
void saveAsXML(OutputDevice &os, const bool extended, OptionsCont &options) const
Definition ROPerson.cpp:140
const double arrPos
Definition ROPerson.h:242
const ROEdge *const from
Definition ROPerson.h:235
A planItem can be a Stop.
Definition ROPerson.h:120
void saveAsXML(OutputDevice &os, const bool extended, const bool asTrip, OptionsCont &options) const
Definition ROPerson.cpp:187
A TripItem is part of a trip, e.g., go from here to here by car.
Definition ROPerson.h:167
SUMOTime getStart() const
Definition ROPerson.h:182
SUMOTime getDuration() const
Definition ROPerson.h:186
const double myCost
Definition ROPerson.h:195
A walk is part of a trip, e.g., go from here to here by foot.
Definition ROPerson.h:255
void saveAsXML(OutputDevice &os, const bool extended, OptionsCont &options) const
Definition ROPerson.cpp:204
static bool myHaveWarnedPTMissing
Definition ROPerson.h:455
virtual ~ROPerson()
Destructor.
Definition ROPerson.cpp:54
bool computeIntermodal(SUMOTime time, const RORouterProvider &provider, const PersonTrip *const trip, const ROVehicle *const veh, std::vector< TripItem * > &resultItems, MsgHandler *const errorHandler)
Definition ROPerson.cpp:348
ROPerson(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition ROPerson.cpp:49
static void addTrip(std::vector< PlanItem * > &plan, const std::string &id, const ROEdge *const from, const ROEdge *const to, const SVCPermissions modeSet, const std::string &vTypes, const double departPos, const std::string &stopOrigin, const double arrivalPos, const std::string &busStop, double walkFactor, const std::string &group)
Definition ROPerson.cpp:62
static void addStop(std::vector< PlanItem * > &plan, const SUMOVehicleParameter::Stop &stopPar, const ROEdge *const stopEdge)
Definition ROPerson.cpp:134
static void addRide(std::vector< PlanItem * > &plan, const ROEdge *const from, const ROEdge *const to, const std::string &lines, double arrivalPos, const std::string &destStop, const std::string &group)
Definition ROPerson.cpp:117
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition ROPerson.cpp:422
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options, int cloneIndex=0) const
Saves the complete person description.
Definition ROPerson.cpp:478
static void addWalk(std::vector< PlanItem * > &plan, const ConstROEdgeVector &edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string &busStop)
Definition ROPerson.cpp:125
std::vector< PlanItem * > myPlan
The plan of the person.
Definition ROPerson.h:453
A routable thing such as a vehicle or person.
Definition RORoutable.h:53
SUMOVehicleClass getVClass() const
Definition RORoutable.h:124
bool isPartOfFlow() const
Definition RORoutable.h:148
bool myRoutingSuccess
Whether the last routing was successful.
Definition RORoutable.h:211
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition RORoutable.h:86
const std::string & getID() const
Returns the id of the routable.
Definition RORoutable.h:95
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition RORoutable.h:75
double getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition RORoutable.h:136
Base class for a vehicle's route definition.
Definition RORouteDef.h:53
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA.
A complete router's route.
Definition RORoute.h:52
void setProbability(double prob)
Sets the probability of the route.
Definition RORoute.cpp:70
A vehicle as used by router.
Definition ROVehicle.h:50
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
Definition ROVehicle.h:73
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
Structure representing possible vehicle parameter.
void write(OutputDevice &dev) const
Writes the vtype.
bool saved
Information whether this type was already saved (needed by routers)
SUMOVehicleClass vehicleClass
The vehicle's class.
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.
std::string vtypeid
The vehicle's type id.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
double departPos
(optional) The position the vehicle shall depart from
std::string id
The vehicle's id.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
bool hasNext()
returns the information whether further substrings exist