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-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// 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
44
45// ===========================================================================
46// method definitions
47// ===========================================================================
49 : RORoutable(pars, type) {
50}
51
52
54 for (PlanItem* const it : myPlan) {
55 delete it;
56 }
57}
58
59
60void
61ROPerson::addTrip(std::vector<PlanItem*>& plan, const std::string& id,
62 const ROEdge* const from, const ROEdge* const to, const SVCPermissions modeSet,
63 const std::string& vTypes,
64 const double departPos, const std::string& stopOrigin,
65 const double arrivalPos, const std::string& busStop,
66 double walkFactor, const std::string& group) {
67 PersonTrip* trip = new PersonTrip(from, to, modeSet, departPos, stopOrigin, arrivalPos, busStop, walkFactor, group);
71 if (departPos != 0) {
73 pars.departPos = departPos;
75 }
76 for (StringTokenizer st(vTypes); st.hasNext();) {
77 pars.vtypeid = st.next();
79 const SUMOVTypeParameter* type = net->getVehicleTypeSecure(pars.vtypeid);
80 if (type == nullptr) {
81 delete trip;
82 throw InvalidArgument("The vehicle type '" + pars.vtypeid + "' in a trip for person '" + id + "' is not known.");
83 }
84 pars.id = id + "_" + toString(trip->getVehicles().size());
85 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), type, net));
86 // update modeset with routing-category vClass
87 if (type->vehicleClass == SVC_BICYCLE) {
89 } else {
91 }
92 }
93 if (trip->getVehicles().empty()) {
94 if ((modeSet & SVC_PASSENGER) != 0) {
95 pars.id = id + "_0";
96 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_VTYPE_ID), net));
97 }
98 if ((modeSet & SVC_BICYCLE) != 0) {
99 pars.id = id + "_b0";
102 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_BIKETYPE_ID), net));
103 }
104 if ((modeSet & SVC_TAXI) != 0) {
105 // add dummy taxi for routing (never added to output)
106 pars.id = "taxi"; // id is written as 'line'
108 trip->addVehicle(new ROVehicle(pars, new RORouteDef("!" + pars.id, 0, false, false), net->getVehicleTypeSecure(DEFAULT_TAXITYPE_ID), net));
109 }
110 }
111 plan.push_back(trip);
112}
113
114
115void
116ROPerson::addRide(std::vector<PlanItem*>& plan, const ROEdge* const from, const ROEdge* const to, const std::string& lines,
117 double arrivalPos, const std::string& destStop, const std::string& group) {
118 plan.push_back(new PersonTrip(to, destStop));
119 plan.back()->addTripItem(new Ride(-1, from, to, lines, group, -1., arrivalPos, -1., destStop));
120}
121
122
123void
124ROPerson::addWalk(std::vector<PlanItem*>& plan, const ConstROEdgeVector& edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string& busStop) {
125 if (plan.empty() || plan.back()->isStop()) {
126 plan.push_back(new PersonTrip(edges.back(), busStop));
127 }
128 plan.back()->addTripItem(new Walk(-1, edges, -1., duration, speed, departPos, arrivalPos, busStop));
129}
130
131
132void
133ROPerson::addStop(std::vector<PlanItem*>& plan, const SUMOVehicleParameter::Stop& stopPar, const ROEdge* const stopEdge) {
134 plan.push_back(new Stop(stopPar, stopEdge));
135}
136
137
138void
139ROPerson::Ride::saveAsXML(OutputDevice& os, const bool extended, OptionsCont& options) const {
141 std::string comment = "";
142 if ((extended || options.getBool("write-costs")) && myCost >= 0.) {
144 }
145 if (from != nullptr) {
147 }
148 if (to != nullptr) {
150 }
151 if (destStop != "") {
152 const std::string element = RONet::getInstance()->getStoppingPlaceElement(destStop);
153 os.writeAttr(element, destStop);
154 const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
155 if (name != "") {
156 comment = " <!-- " + name + " -->";
157 }
158 } else if (arrPos != 0 && arrPos != std::numeric_limits<double>::infinity()) {
160 }
162 if (group != "") {
164 }
165 if (intended != "" && intended != lines) {
167 }
168 if (depart >= 0) {
170 }
171 if (options.getBool("exit-times")) {
172 os.writeAttr("started", time2string(getStart()));
173 os.writeAttr("ended", time2string(getStart() + getDuration()));
174 }
175 if (options.getBool("route-length") && length != -1) {
176 os.writeAttr("routeLength", length);
177 }
178 os.closeTag(comment);
179}
180
181
182void
183ROPerson::Stop::saveAsXML(OutputDevice& os, const bool /*extended*/, const bool /*asTrip*/, OptionsCont& /*options*/) const {
184 stopDesc.write(os, false);
185 std::string comment = "";
186 for (std::string sID : stopDesc.getStoppingPlaceIDs()) {
187 const std::string name = RONet::getInstance()->getStoppingPlaceName(sID);
188 if (name != "") {
189 comment += name + " ";
190 }
191 }
192 if (comment != "") {
193 comment = " <!-- " + comment + " -->";
194 }
195 stopDesc.writeParams(os);
196 os.closeTag(comment);
197}
198
199void
200ROPerson::Walk::saveAsXML(OutputDevice& os, const bool extended, OptionsCont& options) const {
202 std::string comment = "";
203 if ((extended || options.getBool("write-costs")) && myCost >= 0.) {
204 os.writeAttr(SUMO_ATTR_COST, myCost);
205 }
206 if (dur > 0) {
208 }
209 if (v > 0) {
211 }
212 os.writeAttr(SUMO_ATTR_EDGES, edges);
213 if (options.getBool("exit-times")) {
214 os.writeAttr("started", time2string(getStart()));
215 os.writeAttr("ended", time2string(getStart() + getDuration()));
216 if (!exitTimes.empty()) {
217 os.writeAttr("exitTimes", exitTimes);
218 }
219 }
220 if (options.getBool("route-length")) {
221 double length = 0;
222 for (const ROEdge* roe : edges) {
223 length += roe->getLength();
224 }
225 os.writeAttr("routeLength", length);
226 }
227 if (destStop != "") {
228 const std::string element = RONet::getInstance()->getStoppingPlaceElement(destStop);
229 os.writeAttr(element, destStop);
230 const std::string name = RONet::getInstance()->getStoppingPlaceName(destStop);
231 if (name != "") {
232 comment = " <!-- " + name + " -->";
233 }
234 } else if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
236 }
237 os.closeTag(comment);
238}
239
242 PersonTrip* result = new PersonTrip(from, to, modes, dep, stopOrigin, arr, stopDest, walkFactor, group);
243 for (auto* item : myTripItems) {
244 result->myTripItems.push_back(item->clone());
245 }
246 return result;
247}
248
249void
250ROPerson::PersonTrip::saveVehicles(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const {
251 for (ROVehicle* veh : myVehicles) {
252 if (!RONet::getInstance()->knowsVehicle(veh->getID())) {
253 veh->saveAsXML(os, typeos, asAlternatives, options);
254 }
255 }
256}
257
258void
259ROPerson::PersonTrip::saveAsXML(OutputDevice& os, const bool extended, const bool asTrip, OptionsCont& options) const {
260 if ((asTrip || extended) && from != nullptr) {
261 const bool writeGeoTrip = asTrip && options.getBool("write-trips.geo");
263 if (writeGeoTrip) {
264 Position fromPos = from->getLanes()[0]->getShape().positionAtOffset2D(getDepartPos());
265 if (GeoConvHelper::getFinal().usingGeoProjection()) {
268 os.writeAttr(SUMO_ATTR_FROMLONLAT, fromPos);
270 } else {
271 os.writeAttr(SUMO_ATTR_FROMXY, fromPos);
272 }
273 } else {
274 os.writeAttr(SUMO_ATTR_FROM, from->getID());
275 }
276 if (writeGeoTrip) {
277 Position toPos = to->getLanes()[0]->getShape().positionAtOffset2D(MIN2(getArrivalPos(), to->getLanes()[0]->getShape().length2D()));
278 if (GeoConvHelper::getFinal().usingGeoProjection()) {
281 os.writeAttr(SUMO_ATTR_TOLONLAT, toPos);
283 } else {
284 os.writeAttr(SUMO_ATTR_TOXY, toPos);
285 }
286 } else {
287 os.writeAttr(SUMO_ATTR_TO, to->getID());
288 }
289 std::vector<std::string> allowedModes;
290 if ((modes & SVC_BUS) != 0) {
291 allowedModes.push_back("public");
292 }
293 if ((modes & SVC_PASSENGER) != 0) {
294 allowedModes.push_back("car");
295 }
296 if ((modes & SVC_TAXI) != 0) {
297 allowedModes.push_back("taxi");
298 }
299 if ((modes & SVC_BICYCLE) != 0) {
300 allowedModes.push_back("bicycle");
301 }
302 if (allowedModes.size() > 0) {
303 os.writeAttr(SUMO_ATTR_MODES, toString(allowedModes));
304 }
305 if (!writeGeoTrip) {
306 if (dep != 0 && dep != std::numeric_limits<double>::infinity()) {
308 }
309 if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
311 }
312 }
313 if (getStopDest() != "") {
314 os.writeAttr(SUMO_ATTR_BUS_STOP, getStopDest());
315 }
316 if (walkFactor != 1) {
317 os.writeAttr(SUMO_ATTR_WALKFACTOR, walkFactor);
318 }
319 if (extended && myTripItems.size() != 0) {
320 std::vector<double> costs;
321 for (const TripItem* const tripItem : myTripItems) {
322 costs.push_back(tripItem->getCost());
323 }
324 os.writeAttr(SUMO_ATTR_COSTS, costs);
325 }
326 os.closeTag();
327 } else {
328 for (const TripItem* const it : myTripItems) {
329 it->saveAsXML(os, extended, options);
330 }
331 }
332}
333
336 SUMOTime result = 0;
337 for (TripItem* tItem : myTripItems) {
338 result += tItem->getDuration();
339 }
340 return result;
341}
342
343bool
345 const PersonTrip* const trip, const ROVehicle* const veh,
346 std::vector<TripItem*>& resultItems, MsgHandler* const errorHandler) {
347 const double speed = getMaxSpeed() * trip->getWalkFactor();
348 std::vector<ROIntermodalRouter::TripItem> result;
349 provider.getIntermodalRouter().compute(trip->getOrigin(), trip->getDestination(),
350 trip->getDepartPos(), trip->getStopOrigin(),
351 trip->getArrivalPos(), trip->getStopDest(),
352 speed, veh, trip->getModes(), time, result);
353 bool carUsed = false;
354 SUMOTime start = time;
355 for (const ROIntermodalRouter::TripItem& item : result) {
356 if (!item.edges.empty()) {
357 if (item.line == "") {
358 double depPos = trip->getDepartPos(false);
359 double arrPos = trip->getArrivalPos(false);
360 if (trip->getOrigin()->isTazConnector()) {
361 // walk the whole length of the first edge
362 const ROEdge* first = item.edges.front();
363 if (std::find(first->getPredecessors().begin(), first->getPredecessors().end(), trip->getOrigin()) != first->getPredecessors().end()) {
364 depPos = 0;
365 } else {
366 depPos = first->getLength();
367 }
368 }
369 if (trip->getDestination()->isTazConnector()) {
370 // walk the whole length of the last edge
371 const ROEdge* last = item.edges.back();
372 if (std::find(last->getSuccessors().begin(), last->getSuccessors().end(), trip->getDestination()) != last->getSuccessors().end()) {
373 arrPos = last->getLength();
374 } else {
375 arrPos = 0;
376 }
377 }
378 if (&item == &result.back() && trip->getStopDest() == "") {
379 resultItems.push_back(new Walk(start, item.edges, item.cost, item.exitTimes, depPos, arrPos));
380 } else {
381 resultItems.push_back(new Walk(start, item.edges, item.cost, item.exitTimes, depPos, arrPos, item.destStop));
382 }
383 } else if (veh != nullptr && item.line == veh->getID()) {
384 double cost = item.cost;
385 if (veh->getVClass() != SVC_TAXI) {
386 RORoute* route = new RORoute(veh->getID() + "_RouteDef", item.edges);
387 route->setProbability(1);
389 carUsed = true;
390 } else if (resultItems.empty()) {
391 // if this is the first plan item the initial taxi waiting time wasn't added yet
392 const double taxiWait = STEPS2TIME(string2time(OptionsCont::getOptions().getString("persontrip.taxi.waiting-time")));
393 cost += taxiWait;
394 }
395 resultItems.push_back(new Ride(start, item.edges.front(), item.edges.back(), veh->getID(), trip->getGroup(), cost, item.arrivalPos, item.length, item.destStop));
396 } else {
397 // write origin for first element of the plan
398 const ROEdge* origin = trip == myPlan.front() && resultItems.empty() ? trip->getOrigin() : nullptr;
399 resultItems.push_back(new Ride(start, origin, nullptr, item.line, trip->getGroup(), item.cost, item.arrivalPos, item.length, item.destStop, item.intended, TIME2STEPS(item.depart)));
400 }
401 }
402 start += TIME2STEPS(item.cost);
403 }
404 if (result.empty()) {
405 errorHandler->inform("No route for trip in person '" + getID() + "'.");
406 myRoutingSuccess = false;
407 }
408 return carUsed;
409}
410
411
412void
414 const bool /* removeLoops */, MsgHandler* errorHandler) {
415 myRoutingSuccess = true;
417 for (PlanItem* const it : myPlan) {
418 if (it->needsRouting()) {
419 PersonTrip* trip = static_cast<PersonTrip*>(it);
420 const std::vector<ROVehicle*>& vehicles = trip->getVehicles();
421 std::vector<TripItem*> resultItems;
422 std::vector<TripItem*> best;
423 const ROVehicle* bestVeh = nullptr;
424 if (vehicles.empty()) {
425 computeIntermodal(time, provider, trip, nullptr, best, errorHandler);
426 } else {
427 double bestCost = std::numeric_limits<double>::infinity();
428 for (const ROVehicle* const v : vehicles) {
429 const bool carUsed = computeIntermodal(time, provider, trip, v, resultItems, errorHandler);
430 double cost = 0.;
431 for (const TripItem* const tripIt : resultItems) {
432 cost += tripIt->getCost();
433 }
434 if (cost < bestCost) {
435 bestCost = cost;
436 bestVeh = carUsed ? v : nullptr;
437 best.swap(resultItems);
438 }
439 for (const TripItem* const tripIt : resultItems) {
440 delete tripIt;
441 }
442 resultItems.clear();
443 }
444 }
445 trip->setItems(best, bestVeh);
446 }
447 time += it->getDuration();
448 }
449}
450
451
452void
453ROPerson::saveAsXML(OutputDevice& os, OutputDevice* const typeos, bool asAlternatives, OptionsCont& options) const {
454 // write the person's vehicles
455 const bool writeTrip = options.exists("write-trips") && options.getBool("write-trips");
456 if (!writeTrip) {
457 for (const PlanItem* const it : myPlan) {
458 it->saveVehicles(os, typeos, asAlternatives, options);
459 }
460 }
461
462 if (typeos != nullptr && getType() != nullptr && !getType()->saved) {
463 getType()->write(*typeos);
464 getType()->saved = true;
465 }
466 if (getType() != nullptr && !getType()->saved) {
467 getType()->write(os);
468 getType()->saved = asAlternatives;
469 }
470
471 // write the person
472 getParameter().write(os, options, SUMO_TAG_PERSON);
473
474 for (const PlanItem* const it : myPlan) {
475 it->saveAsXML(os, asAlternatives, writeTrip, options);
476 }
477
478 // write params
480 os.closeTag();
481}
482
483
484/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
std::vector< const ROEdge * > ConstROEdgeVector
Definition ROEdge.h:54
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:69
#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 long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_VTYPE_SET
@ TRIGGERED
The departure is person triggered.
@ SUMO_TAG_WALK
@ SUMO_TAG_RIDE
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONTRIP
@ 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:26
int gPrecisionGeo
Definition StdDefs.cpp:27
T MIN2(T a, T b)
Definition StdDefs.h:76
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
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:70
bool isTazConnector() const
Definition ROEdge.h:168
const ROEdgeVector & getPredecessors() const
Returns the edge at the given position from the list of incoming edges.
Definition ROEdge.h:370
const ROEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition ROEdge.cpp:366
double getLength() const
Returns the length of the edge.
Definition ROEdge.h:219
The router's network representation.
Definition RONet.h:62
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
Definition RONet.cpp:364
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:488
const std::string getStoppingPlaceElement(const std::string &id) const
return the element name for the given stopping place id
Definition RONet.cpp:896
const std::string getStoppingPlaceName(const std::string &id) const
return the name for the given stopping place id
Definition RONet.cpp:884
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:250
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:335
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:259
const ROEdge * getOrigin() const
Definition ROPerson.h:327
PlanItem * clone() const
Definition ROPerson.cpp:241
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:139
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:183
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:200
virtual ~ROPerson()
Destructor.
Definition ROPerson.cpp:53
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:344
ROPerson(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
Definition ROPerson.cpp:48
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:61
static void addStop(std::vector< PlanItem * > &plan, const SUMOVehicleParameter::Stop &stopPar, const ROEdge *const stopEdge)
Definition ROPerson.cpp:133
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:116
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Definition ROPerson.cpp:413
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:124
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete person description.
Definition ROPerson.cpp:453
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:52
SUMOVehicleClass getVClass() const
Definition RORoutable.h:109
bool myRoutingSuccess
Whether the last routing was successful.
Definition RORoutable.h:191
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
Definition RORoutable.h:82
const std::string & getID() const
Returns the id of the routable.
Definition RORoutable.h:91
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
Definition RORoutable.h:71
double getMaxSpeed() const
Returns the vehicle's maximum speed.
Definition RORoutable.h:121
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