Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SUMOVehicleParameter.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-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/****************************************************************************/
20// Structure representing possible vehicle parameter
21/****************************************************************************/
22#include <config.h>
30
32
33// ===========================================================================
34// member method definitions
35// ===========================================================================
36
38 : tag(SUMO_TAG_NOTHING), vtypeid(DEFAULT_VTYPE_ID), color(RGBColor::DEFAULT_COLOR),
39 depart(-1), departProcedure(DepartDefinition::GIVEN),
40 departLane(0), departLaneProcedure(DepartLaneDefinition::DEFAULT),
41 departPos(0), departPosProcedure(DepartPosDefinition::DEFAULT),
42 departPosLat(0), departPosLatProcedure(DepartPosLatDefinition::DEFAULT),
43 departSpeed(-1), departSpeedProcedure(DepartSpeedDefinition::DEFAULT),
44 departEdge(0), departEdgeProcedure(RouteIndexDefinition::DEFAULT),
45 arrivalLane(0), arrivalLaneProcedure(ArrivalLaneDefinition::DEFAULT),
46 arrivalPos(0), arrivalPosProcedure(ArrivalPosDefinition::DEFAULT),
47 arrivalPosLat(0), arrivalPosLatProcedure(ArrivalPosLatDefinition::DEFAULT),
48 arrivalSpeed(-1), arrivalSpeedProcedure(ArrivalSpeedDefinition::DEFAULT),
49 arrivalEdge(-1), arrivalEdgeProcedure(RouteIndexDefinition::DEFAULT),
50 repetitionNumber(-1),
51 repetitionsDone(-1),
52 repetitionOffset(-1),
53 repetitionTotalOffset(0),
54 repetitionProbability(-1),
55 poissonRate(0),
56 repetitionEnd(-1),
57 line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0),
58 speedFactor(-1),
59 calibratorSpeed(-1),
60 insertionChecks((int)InsertionCheck::ALL),
61 parametersSet(0)
62{ }
63
64
67
68
69bool
70SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const {
71 return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override");
72}
73
74
75void
76SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag, const std::string& typeID) const {
77 if (!id.empty()) {
78 // only used by calibrator flows
79 dev.openTag(altTag).writeAttr(SUMO_ATTR_ID, id);
80 }
81 if (typeID == "") {
84 }
85 } else {
86 dev.writeAttr(SUMO_ATTR_TYPE, typeID);
87 }
88 // write depart depending of tag
89 if (altTag == SUMO_TAG_FLOW
90 || altTag == SUMO_TAG_PERSONFLOW
91 || altTag == SUMO_TAG_CONTAINERFLOW
92 || altTag == GNE_TAG_FLOW_ROUTE
93 || altTag == GNE_TAG_FLOW_WITHROUTE
94 || altTag == SUMO_TAG_FLOWSTATE) {
96 } else {
98 }
99 // optional parameter
100 // departlane
101 if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
103 } else if (oc.exists("departlane") && oc.isSet("departlane")) {
104 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
105 }
106 // departpos
107 if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
109 } else if (oc.exists("departpos") && oc.isSet("departpos")) {
110 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
111 }
112 // departPosLat
115 }
116 // departspeed
117 if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
119 } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
120 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
121 }
122 // departedge
123 if (wasSet(VEHPARS_DEPARTEDGE_SET) && !defaultOptionOverrides(oc, "departedge")) {
125 } else if (oc.exists("departedge") && oc.isSet("departedge")) {
126 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTEDGE, oc.getString("departedge"));
127 }
128 // arrivallane
129 if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
131 } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
132 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
133 }
134 // arrivalpos
135 if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
137 } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
138 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
139 }
140 // arrivalPosLat
143 }
144 // arrivalspeed
145 if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
147 } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
148 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
149 }
150 // arrivalEdge
151 if (wasSet(VEHPARS_ARRIVALEDGE_SET) && !defaultOptionOverrides(oc, "arrivaledge") && arrivalEdge >= 0) {
153 } else if (oc.exists("arrivaledge") && oc.isSet("arrivaledge")) {
154 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALEDGE, oc.getString("arrivaledge"));
155 }
156 // color
159 }
160 // line
163 }
164 // from TAZ
167 }
168 // to TAZ
171 }
172 // person number
175 }
176 // container number
179 }
180 // individual speedFactor
182 // might be saving state with custom precision
183 const int precision = dev.precision();
184 dev.setPrecision(MAX2(gPrecisionRandom, precision));
186 dev.setPrecision(precision);
187 }
188 // speed (only used by calibrators)
191 }
192 // insertionChecks
194 std::vector<std::string> checks;
196 checks.push_back(toString(InsertionCheck::NONE));
197 } else {
199 if (((int)it & insertionChecks) != 0) {
200 checks.push_back(toString(it));
201 }
202 }
203 }
205 }
206 // parking access rights
209 }
210}
211
212
213void
214SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
215 if (writeTagAndParents) {
217 if (busstop != "") {
219 }
220 if (containerstop != "") {
222 }
223 if (chargingStation != "") {
225 }
226 if (parkingarea != "") {
228 }
229 if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
230 if (lane != "") {
232 } else {
234 }
235 if ((parametersSet & STOP_START_SET) != 0) {
237 }
238 if ((parametersSet & STOP_END_SET) != 0) {
240 }
241 }
242 }
243 if (index > 0) {
245 }
248 }
249 if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
251 }
252 if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
254 }
255 if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
257 }
258 if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
260 }
261 if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
263 }
264 if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
266 }
267 if ((parametersSet & STOP_TRIGGER_SET) != 0) {
268 const std::vector<std::string> triggers = getTriggers();
269 if (triggers.size() > 0) {
270 dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
271 }
272 }
273 if ((parametersSet & STOP_PARKING_SET) != 0) {
275 }
276 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
278 }
279 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
281 }
284 }
285 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
287 }
288 if ((parametersSet & STOP_LINE_SET) != 0) {
290 }
291 if ((parametersSet & STOP_SPLIT_SET) != 0) {
293 }
294 if ((parametersSet & STOP_JOIN_SET) != 0) {
296 }
297 if ((parametersSet & STOP_SPEED_SET) != 0) {
299 }
300 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
302 }
303 if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
305 }
306 if ((parametersSet & STOP_JUMP_UNTIL_SET) != 0 && jumpUntil >= 0) {
308 }
309 if (collision) {
311 }
312 // only write friendly position if is true
313 if (friendlyPos) {
315 }
316 // only write act type if isn't empty
317 if (!actType.empty()) {
319 }
320 if (close) {
321 // the user is closing the stop it is responsible for writing params
322 writeParams(dev);
323 dev.closeTag();
324 }
325}
326
327std::vector<std::string>
329 std::vector<std::string> result;
330 if (busstop != "") {
331 result.push_back(busstop);
332 }
333 if (containerstop != "") {
334 result.push_back(containerstop);
335 }
336 if (chargingStation != "") {
337 result.push_back(chargingStation);
338 }
339 if (parkingarea != "") {
340 result.push_back(parkingarea);
341 }
342 return result;
343}
344
345bool
346SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
347 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
348 if (val == "triggered") {
350 } else if (val == "containerTriggered") {
352 } else if (val == "now") {
353 // only used via TraCI. depart must be set by the calling code
355 } else if (val == "split") {
357 } else if (val == "begin") {
359 } else {
360 try {
361 depart = string2time(val);
363 if (depart < 0) {
364 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
365 return false;
366 }
367 } catch (...) {
368 if (id.empty()) {
369 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
370 } else {
371 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
372 }
373 return false;
374 }
375 }
376 return true;
377}
378
379
380bool
381SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
382 int& lane, DepartLaneDefinition& dld, std::string& error) {
383 bool ok = true;
384 lane = 0;
386 if (val == "random") {
388 } else if (val == "free") {
390 } else if (val == "allowed") {
392 } else if (val == "best") {
394 } else if (val == "best_prob") {
396 } else if (val == "first") {
398 } else {
399 try {
400 lane = StringUtils::toInt(val);
401 if (lane < 0) {
402 ok = false;
403 }
404 } catch (...) {
405 ok = false;
406 }
407 }
408 if (!ok) {
409 if (id.empty()) {
410 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
411 } else {
412 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
413 }
414 }
415 return ok;
416}
417
418
419bool
420SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
421 double& pos, DepartPosDefinition& dpd, std::string& error) {
422 bool ok = true;
423 pos = 0.;
425 if (val == "random") {
427 } else if (val == "random_free") {
429 } else if (val == "random_location") {
431 } else if (val == "free") {
433 } else if (val == "base") {
435 } else if (val == "last") {
437 } else if (val == "splitFront") {
439 } else if (val == "stop") {
441 } else {
442 try {
443 pos = StringUtils::toDouble(val);
444 } catch (...) {
445 ok = false;
446 }
447 }
448 if (!ok) {
449 if (id.empty()) {
450 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
451 } else {
452 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
453 }
454 }
455 return ok;
456}
457
458
459bool
460SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
461 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
462 bool ok = true;
463 pos = 0.;
465 if (val == "random") {
467 } else if (val == "random_free") {
469 } else if (val == "free") {
471 } else if (val == "right") {
473 } else if (val == "center") {
475 } else if (val == "left") {
477 } else {
478 try {
479 pos = StringUtils::toDouble(val);
480 } catch (...) {
481 ok = false;
482 }
483 }
484 if (!ok) {
485 if (id.empty()) {
486 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
487 } else {
488 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
489 }
490 }
491 return ok;
492}
493
494
495bool
496SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
497 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
498 bool ok = true;
499 speed = -1.;
501 if (val == "random") {
503 } else if (val == "max") {
505 } else if (val == "desired") {
507 } else if (val == "speedLimit") {
509 } else if (val == "last") {
511 } else if (val == "avg") {
513 } else {
514 try {
515 speed = StringUtils::toDouble(val);
516 if (speed < 0) {
517 ok = false;
518 }
519 } catch (...) {
520 ok = false;
521 }
522 }
523 if (!ok) {
524 if (id.empty()) {
525 error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
526 } else {
527 error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
528 }
529 }
530 return ok;
531}
532
533
534bool
535SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
536 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
537 bool ok = true;
538 edgeIndex = -1;
540 if (val == "random") {
542 } else {
543 try {
544 edgeIndex = StringUtils::toInt(val);
545 if (edgeIndex < 0) {
546 ok = false;
547 }
548 } catch (...) {
549 ok = false;
550 }
551 }
552 if (!ok) {
553 if (id.empty()) {
554 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
555 } else {
556 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
557 }
558 }
559 return ok;
560}
561
562
563bool
564SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
565 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
566 bool ok = true;
567 lane = 0;
569 if (val == "current") {
571 } else if (val == "random") {
573 } else if (val == "first") {
575 } else {
576 try {
577 lane = StringUtils::toInt(val);
578 if (lane < 0) {
579 ok = false;
580 }
581 } catch (...) {
582 ok = false;
583 }
584 }
585 if (!ok) {
586 if (id.empty()) {
587 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
588 } else {
589 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
590 }
591 }
592 return ok;
593}
594
595
596bool
597SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
598 double& pos, ArrivalPosDefinition& apd, std::string& error) {
599 bool ok = true;
600 pos = 0.;
602 if (val == "random") {
604 } else if (val == "center") {
606 } else if (val == "max") {
608 } else {
609 try {
610 pos = StringUtils::toDouble(val);
611 } catch (...) {
612 ok = false;
613 }
614 }
615 if (!ok) {
616 if (id.empty()) {
617 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
618 } else {
619 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
620 }
621 }
622 return ok;
623}
624
625
626bool
627SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
628 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
629 bool ok = true;
630 pos = 0.;
632 if (val == "right") {
634 } else if (val == "center") {
636 } else if (val == "left") {
638 } else {
639 try {
640 pos = StringUtils::toDouble(val);
641 } catch (...) {
642 ok = false;
643 }
644 }
645 if (!ok) {
646 if (id.empty()) {
647 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
648 } else {
649 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
650 }
651 }
652 return ok;
653}
654
655
656bool
657SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
658 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
659 bool ok = true;
660 speed = -1.;
662 if (val == "current") {
664 } else {
665 try {
666 speed = StringUtils::toDouble(val);
667 if (speed < 0) {
668 ok = false;
669 }
670 } catch (...) {
671 ok = false;
672 }
673 }
674 if (!ok) {
675 if (id.empty()) {
676 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
677 } else {
678 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
679 }
680 }
681 return ok;
682}
683
684
685double
686SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
687 if (pos < 0) {
688 pos = maximumValue + pos;
689 }
690 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
691 if (!silent) {
692 WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
693 }
694 pos = maximumValue;
695 }
696 return pos;
697}
698
699
700bool
701SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
702 // separte modes in different strings, and check if modes are valid
703 for (StringTokenizer st(modes); st.hasNext();) {
704 const std::string mode = st.next();
705 if (mode == "car") {
706 modeSet |= SVC_PASSENGER;
707 } else if (mode == "taxi") {
708 modeSet |= SVC_TAXI;
709 } else if (mode == "bicycle") {
710 modeSet |= SVC_BICYCLE;
711 } else if (mode == "public") {
712 modeSet |= SVC_BUS;
713 } else {
714 if (id.empty()) {
715 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
716 } else {
717 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
718 }
719 return false;
720 }
721 }
722 return true;
723}
724
725
726void
727SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
728 if (triggers.size() == 0 && expectTrigger) {
729 stop.triggered = true;
730 }
731 for (std::string val : triggers) {
732 if (val == toString(SUMO_TAG_PERSON)) {
733 stop.triggered = true;
734 } else if (val == toString(SUMO_TAG_CONTAINER)) {
735 stop.containerTriggered = true;
736 } else if (val == toString(SUMO_ATTR_JOIN)) {
737 stop.joinTriggered = true;
738 } else {
739 try {
740 stop.triggered = StringUtils::toBool(val);
741 } catch (BoolFormatException&) {
742 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
743 }
744 }
745 }
746}
747
748
750SUMOVehicleParameter::parseParkingType(const std::string& value) {
751 if (value == toString(ParkingType::OPPORTUNISTIC)) {
753 } else {
755 }
756}
757
758
759std::vector<std::string>
761 std::vector<std::string> triggers;
762 if (triggered) {
763 triggers.push_back(toString(SUMO_TAG_PERSON));
764 }
765 if (containerTriggered) {
766 triggers.push_back(toString(SUMO_TAG_CONTAINER));
767 }
768 if (joinTriggered) {
769 triggers.push_back(toString(SUMO_ATTR_JOIN));
770 }
771 return triggers;
772}
773
774int
776 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
777 (triggered ? 2 : 0) +
778 (containerTriggered ? 4 : 0) +
779 (busstop != "" ? 8 : 0) +
780 (containerstop != "" ? 16 : 0) +
781 (chargingStation != "" ? 32 : 0) +
782 (parkingarea != "" ? 64 : 0) +
783 (overheadWireSegment != "" ? 128 : 0));
784}
785
786
787std::string
790 return "triggered";
792 return "containerTriggered";
793// } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
794// return "now";
796 return "split";
798 return "begin";
799 } else {
800 return time2string(depart);
801 }
802}
803
804
805std::string
807 std::string val;
808 switch (departLaneProcedure) {
810 val = toString(departLane);
811 break;
813 val = "random";
814 break;
816 val = "free";
817 break;
819 val = "allowed";
820 break;
822 val = "best";
823 break;
825 val = "best_prob";
826 break;
828 val = "first";
829 break;
831 default:
832 break;
833 }
834 return val;
835}
836
837
838std::string
840 std::string val;
841 switch (departPosProcedure) {
843 val = toString(departPos);
844 break;
847 break;
849 val = "random";
850 break;
852 val = "random_free";
853 break;
855 val = "random_location";
856 break;
858 val = "free";
859 break;
861 val = "last";
862 break;
864 val = "base";
865 break;
867 val = "splitFront";
868 break;
870 val = "stop";
871 break;
873 default:
874 break;
875 }
876 return val;
877}
878
879
880std::string
882 std::string val;
883 switch (departPosLatProcedure) {
885 val = toString(departPosLat);
886 break;
889 break;
891 val = "random";
892 break;
894 val = "random_free";
895 break;
897 val = "free";
898 break;
900 val = "right";
901 break;
903 val = "center";
904 break;
906 val = "left";
907 break;
909 default:
910 break;
911 }
912 return val;
913}
914
915
916std::string
918 std::string val;
919 switch (departSpeedProcedure) {
921 val = toString(departSpeed);
922 break;
925 break;
927 val = "random";
928 break;
930 val = "max";
931 break;
933 val = "desired";
934 break;
936 val = "speedLimit";
937 break;
939 val = "last";
940 break;
942 val = "avg";
943 break;
945 default:
946 break;
947 }
948 return val;
949}
950
951
952std::string
954 std::string val;
955 switch (departEdgeProcedure) {
957 val = toString(departEdge);
958 break;
960 val = "random";
961 break;
963 default:
964 break;
965 }
966 return val;
967}
968
969std::string
971 std::string val;
972 switch (arrivalEdgeProcedure) {
974 val = toString(arrivalEdge);
975 break;
977 val = "random";
978 break;
980 default:
981 break;
982 }
983 return val;
984}
985
986
987
988
989std::string
991 std::string val;
992 switch (arrivalLaneProcedure) {
994 val = toString(arrivalLane);
995 break;
997 val = "current";
998 break;
1000 val = "random";
1001 break;
1003 val = "first";
1004 break;
1006 default:
1007 break;
1008 }
1009 return val;
1010}
1011
1012
1013std::string
1015 std::string val;
1016 switch (arrivalPosProcedure) {
1018 val = toString(arrivalPos);
1019 break;
1021 val = "random";
1022 break;
1024 val = "center";
1025 break;
1027 val = "max";
1028 break;
1030 default:
1031 break;
1032 }
1033 return val;
1034}
1035
1036
1037std::string
1039 std::string val;
1040 switch (arrivalPosLatProcedure) {
1042 val = toString(arrivalPosLat);
1043 break;
1045 val = "right";
1046 break;
1048 val = "center";
1049 break;
1051 val = "left";
1052 break;
1054 default:
1055 break;
1056 }
1057 return val;
1058}
1059
1060
1061std::string
1063 std::string val;
1064 switch (arrivalSpeedProcedure) {
1066 val = toString(arrivalSpeed);
1067 break;
1069 val = "current";
1070 break;
1072 default:
1073 break;
1074 }
1075 return val;
1076}
1077
1078
1079void
1082 // equidistant or exponential offset (for poisson distributed arrivals)
1083 if (repetitionProbability < 0) {
1084 if (repetitionOffset >= 0) {
1085 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1086 } else {
1087 assert(poissonRate > 0);
1088 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1089 const double r = RandHelper::randExp(poissonRate, rng);
1090 repetitionTotalOffset += TIME2STEPS(r / scale);
1091 }
1092 }
1093}
1094
1095
1096std::string
1098 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1100 } else {
1101 std::vector<std::string> insertionChecksStrs;
1102 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1103 // iterate over values
1104 for (const auto insertionCheckValue : insertionCheckValues) {
1105 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1106 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1107 }
1108 }
1109 return toString(insertionChecksStrs);
1110 }
1111}
1112
1113
1114bool
1115SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1116 if (value.empty()) {
1117 return true;
1118 } else {
1119 // split value in substrinsg
1120 StringTokenizer valueStrs(value, " ");
1121 // iterate over values
1122 while (valueStrs.hasNext()) {
1123 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1124 return false;
1125 }
1126 }
1127 return true;
1128 }
1129}
1130
1131
1132int
1134 // first reset insertionChecks
1135 int result = 0;
1136 if (value.empty()) {
1137 return (int)InsertionCheck::ALL;
1138 } else {
1139 // split value in substrinsg
1140 StringTokenizer insertionCheckStrs(value, " ");
1141 while (insertionCheckStrs.hasNext()) {
1142 std::string val = insertionCheckStrs.next();
1143 if (SUMOXMLDefinitions::InsertionChecks.hasString(val)) {
1144 result |= (int)SUMOXMLDefinitions::InsertionChecks.get(val);
1145 } else {
1146 throw InvalidArgument("Unknown value '" + val + "' in " + toString(SUMO_ATTR_INSERTIONCHECKS) + ".");
1147 }
1148 }
1149 }
1150 return result;
1151}
1152
1153/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ DEFAULT
default cursor
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:288
#define WRITE_ERROR(msg)
Definition MsgHandler.h:296
#define TL(string)
Definition MsgHandler.h:305
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 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_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 long long int VEHPARS_ARRIVALSPEED_SET
const long long int VEHPARS_DEPARTPOSLAT_SET
const long long int VEHPARS_ARRIVALPOSLAT_SET
const long long int VEHPARS_PERSON_NUMBER_SET
const long long int VEHPARS_DEPARTSPEED_SET
RouteIndexDefinition
Possible ways to choose the departure and arrival edge.
@ RANDOM
The edge is chosen randomly.
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ RANDOM
The lane is chosen randomly.
@ BEST_FREE
The least occupied lane from best lanes.
@ GIVEN
The lane is given.
@ ALLOWED_FREE
The least occupied lane from lanes which allow the continuation.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ FREE
The least occupied lane is used.
@ BEST_PROB
The lane most likely according the speedFactor (from best lanes)
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
@ GIVEN
The speed is given.
@ DEFAULT
No information given; use default.
@ CURRENT
The current speed is used.
DepartPosLatDefinition
Possible ways to choose the lateral departure position.
@ RANDOM
The lateral position is chosen randomly.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ GIVEN_VEHROUTE
The position is set by the vehroute device.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ FREE
A free lateral position is chosen.
@ CENTER
At the center of the lane.
@ RANDOM_FREE
If a fixed number of random choices fails, a free lateral position is chosen.
DepartPosDefinition
Possible ways to choose the departure position.
@ RANDOM
A random position is chosen.
@ GIVEN
The position is given.
@ GIVEN_VEHROUTE
The position is set by the vehroute device.
@ DEFAULT
No information given; use default.
@ STOP
depart position is endPos of first stop
@ FREE
A free position is chosen.
@ SPLIT_FRONT
depart position for a split vehicle is in front of the continuing vehicle
@ RANDOM_LOCATION
The position may be chosen freely in a polygon defined by a taz.
@ BASE
Back-at-zero position.
@ LAST
Insert behind the last vehicle as close as possible to still allow the specified departSpeed....
@ RANDOM_FREE
If a fixed number of random choices fails, a free position is chosen.
const int STOP_SPEED_SET
const int STOP_JUMP_UNTIL_SET
const int STOP_UNTIL_SET
const int STOP_LINE_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
@ RANDOM
The lane is chosen randomly.
@ GIVEN
The arrival lane is given.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ CURRENT
The current lane shall be used.
const long long int VEHPARS_COLOR_SET
const int STOP_PERMITTED_SET
DepartSpeedDefinition
Possible ways to choose the departure speed.
@ RANDOM
The speed is chosen randomly.
@ MAX
The maximum safe speed is used.
@ GIVEN
The speed is given.
@ GIVEN_VEHROUTE
The speed is set by the vehroute device.
@ LIMIT
The maximum lane speed is used (speedLimit)
@ DEFAULT
No information given; use default.
@ DESIRED
The maximum lane speed is used (speedLimit * speedFactor)
@ LAST
The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
@ AVG
The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
const int STOP_SPLIT_SET
const long long int VEHPARS_TO_TAZ_SET
const long long int VEHPARS_ARRIVALLANE_SET
const long long int VEHPARS_DEPARTLANE_SET
const int STOP_START_SET
const long long int VEHPARS_DEPARTPOS_SET
const int STOP_JOIN_SET
const long long int VEHPARS_ARRIVALPOS_SET
const long long int VEHPARS_ARRIVALEDGE_SET
const int STOP_EXTENSION_SET
const long long int VEHPARS_CONTAINER_NUMBER_SET
const long long int VEHPARS_FROM_TAZ_SET
const long long int VEHPARS_PARKING_BADGES_SET
const int STOP_ENDED_SET
const long long int VEHPARS_SPEEDFACTOR_SET
const int STOP_TRIGGER_SET
const long long int VEHPARS_VTYPE_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
@ RANDOM
The arrival position is chosen randomly.
@ MAX
The maximum arrival position is used.
@ GIVEN
The arrival position is given.
@ DEFAULT
No information given; use default.
@ CENTER
Half the road length.
const int STOP_JUMP_SET
const int STOP_ONDEMAND_SET
const int STOP_END_SET
const int STOP_STARTED_SET
const int STOP_EXPECTED_CONTAINERS_SET
const long long int VEHPARS_CALIBRATORSPEED_SET
ArrivalPosLatDefinition
Possible ways to choose the lateral arrival position.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ CENTER
At the center of the lane.
const long long int VEHPARS_LINE_SET
const long long int VEHPARS_DEPARTEDGE_SET
const long long int VEHPARS_INSERTION_CHECKS_SET
DepartDefinition
Possible ways to depart.
@ BEGIN
The departure is at simulation start.
@ GIVEN
The time is given.
@ NOW
The vehicle is discarded if emission fails (not fully implemented yet)
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
InsertionCheck
different checking levels for vehicle insertion
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag, must be the last one
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_FLOWSTATE
a flow state definition (used when saving and loading simulatino state)
@ SUMO_TAG_STOP
stop for vehicles
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONFLOW
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_ARRIVALSPEED
@ SUMO_ATTR_LANE
@ SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_DEPARTEDGE
@ SUMO_ATTR_COLLISION
@ SUMO_ATTR_ARRIVALEDGE
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_STARTED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_PARKING_BADGES
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_ACTTYPE
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_PERMITTED
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_SPEEDFACTOR
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_ARRIVALPOS_LAT
@ SUMO_ATTR_JUMP_UNTIL
@ SUMO_ATTR_INSERTIONCHECKS
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
int gPrecision
the precision for floating point outputs
Definition StdDefs.cpp:26
int gPrecisionRandom
Definition StdDefs.cpp:28
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition ToString.h:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
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 storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & writeNonEmptyAttr(const SumoXMLAttr attr, const std::string &val)
writes a string attribute only if it is not the empty string and not the string "default"
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
int precision()
return precision set on the device
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
static double randExp(double rate, SumoRNG *rng=nullptr)
Access to a random number from an exponential distribution.
Definition of vehicle stop (position and duration)
int getFlags() const
return flags as per Vehicle::getStops
SUMOTime started
the time at which this stop was reached
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.
SUMOTime extension
The maximum time extension for boarding / loading.
bool friendlyPos
enable or disable friendly position (used by netedit)
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
double startPos
The stopping position start.
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
bool onDemand
whether the stop may be skipped
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::vector< std::string > getTriggers() const
write trigger attribute
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
SUMOTime jumpUntil
earlierst jump end if there shall be a jump from this stop to the next route edge
int parametersSet
Information for the output which parameter were set.
int index
at which position in the stops list
SUMOTime jump
transfer time if there shall be a jump from this stop to the next route edge
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by netedit)
bool triggered
whether an arriving person lets the vehicle continue
void write(OutputDevice &dev, const bool close=true, const bool writeTagAndParents=true) const
Writes the stop as XML.
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
std::vector< std::string > getStoppingPlaceIDs() const
return list of stopping place ids
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool joinTriggered
whether an joined vehicle lets this vehicle continue
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
bool collision
Whether this stop was triggered by a collision.
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
double departPosLat
(optional) The lateral position the vehicle shall depart from
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
virtual ~SUMOVehicleParameter()
Destructor.
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
double repetitionProbability
The probability for emitting a vehicle per second.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
void incrementFlow(double scale, SumoRNG *rng=nullptr)
increment flow
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
double speedFactor
individual speedFactor (overriding distribution from vType)
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
int repetitionsDone
The number of times the vehicle was already inserted.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOTime repetitionTotalOffset
The offset between depart and the time for the next vehicle insertions.
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.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
double poissonRate
The rate for emitting vehicles with a poisson distribution.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
SVCPermissions modes
The modes a person or container can use.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
std::string getDepart() const
obtain depart parameter in string format
double departPos
(optional) The position the vehicle shall depart from
std::string getDepartEdge() const
obtain depart edge parameter in string format
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
bool areInsertionChecksValid(const std::string &value) const
check if given insertion checks are valid
double arrivalPos
(optional) The position the vehicle shall arrive on
static int parseInsertionChecks(const std::string &value)
parses insertion checks
double calibratorSpeed
speed (used by calibrator flows
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string getInsertionChecks() const
get insertion checks in string format
std::string getArrivalEdge() const
obtain arrival edge parameter in string format
std::vector< std::string > parkingBadges
The parking access rights.
int departEdge
(optional) The initial edge within the route of the vehicle
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
Validates a given depart value.
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseRouteIndex(const std::string &val, const std::string &element, const std::string &id, const SumoXMLAttr attr, int &edgeIndex, RouteIndexDefinition &rid, std::string &error)
Validates a given departEdge or arrivalEdge value.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
std::string toTaz
The vehicle's destination zone (district)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
int insertionChecks
bitset of InsertionCheck
bool defaultOptionOverrides(const OptionsCont &oc, const std::string &optionName) const
Returns whether the defaults shall be used.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
static ParkingType parseParkingType(const std::string &value)
parses parking type value
static void parseStopTriggers(const std::vector< std::string > &triggers, bool expectTrigger, Stop &stop)
parses stop trigger values
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
static StringBijection< InsertionCheck > InsertionChecks
traffic light layouts
const std::string & getString(const T key) const
get string
std::vector< T > getValues() const
get all keys
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static std::string pruneZeros(const std::string &str, int max)
Removes trailing zeros (at most 'max')
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter