Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
99 }
102 }
103 if (wasSet(VEHPARS_VPH_SET)) {
105 }
106 // netedit uses VEHPARS_POISSON_SET
110 } else {
112 }
113 }
116 }
117 } else {
119 }
120 // optional parameter
121 // departlane
122 if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
124 } else if (oc.exists("departlane") && oc.isSet("departlane")) {
125 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
126 }
127 // departpos
128 if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
130 } else if (oc.exists("departpos") && oc.isSet("departpos")) {
131 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
132 }
133 // departPosLat
136 }
137 // departspeed
138 if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
140 } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
141 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
142 }
143 // departedge
144 if (wasSet(VEHPARS_DEPARTEDGE_SET) && !defaultOptionOverrides(oc, "departedge")) {
146 } else if (oc.exists("departedge") && oc.isSet("departedge")) {
147 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTEDGE, oc.getString("departedge"));
148 }
149 // arrivallane
150 if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
152 } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
153 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
154 }
155 // arrivalpos
156 if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
158 } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
159 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
160 }
161 // arrivalPosLat
164 }
165 // arrivalspeed
166 if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
168 } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
169 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
170 }
171 // arrivalEdge
172 if (wasSet(VEHPARS_ARRIVALEDGE_SET) && !defaultOptionOverrides(oc, "arrivaledge") && arrivalEdge >= 0) {
174 } else if (oc.exists("arrivaledge") && oc.isSet("arrivaledge")) {
175 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALEDGE, oc.getString("arrivaledge"));
176 }
177 // color
180 }
181 // line
184 }
185 // from TAZ
188 }
189 // to TAZ
192 }
193 // person number
196 }
197 // container number
200 }
201 // individual speedFactor
203 // might be saving state with custom precision
204 const int precision = dev.getPrecision();
205 dev.setPrecision(MAX2(gPrecisionRandom, precision));
207 dev.setPrecision(precision);
208 }
209 // speed (only used by calibrators)
212 }
213 // insertionChecks
215 std::vector<std::string> checks;
217 checks.push_back(toString(InsertionCheck::NONE));
218 } else {
220 if (((int)it & insertionChecks) != 0) {
221 checks.push_back(toString(it));
222 }
223 }
224 }
226 }
227 // parking access rights
230 }
231}
232
233
234void
235SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
236 if (writeTagAndParents) {
238 if (busstop != "") {
240 }
241 if (containerstop != "") {
243 }
244 if (chargingStation != "") {
246 }
247 if (parkingarea != "") {
249 }
250 if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
251 if (lane != "") {
253 } else {
255 }
256 if ((parametersSet & STOP_START_SET) != 0) {
258 }
259 if ((parametersSet & STOP_END_SET) != 0) {
261 }
262 }
263 }
264 if (index > 0) {
266 }
269 }
270 if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
272 }
273 if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
275 }
276 if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
278 }
279 if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
281 }
282 if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
284 }
285 if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
287 }
288 if ((parametersSet & STOP_TRIGGER_SET) != 0) {
289 const std::vector<std::string> triggers = getTriggers();
290 if (triggers.size() > 0) {
291 dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
292 }
293 }
294 if ((parametersSet & STOP_PARKING_SET) != 0) {
296 }
297 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
299 }
300 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
302 }
305 }
306 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
308 }
309 if ((parametersSet & STOP_LINE_SET) != 0) {
311 }
312 if ((parametersSet & STOP_SPLIT_SET) != 0) {
314 }
315 if ((parametersSet & STOP_JOIN_SET) != 0) {
317 }
318 if ((parametersSet & STOP_SPEED_SET) != 0) {
320 }
321 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
323 }
324 if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
326 }
327 if ((parametersSet & STOP_JUMP_UNTIL_SET) != 0 && jumpUntil >= 0) {
329 }
330 if ((parametersSet & STOP_PRIORITY_SET) != 0 && priority >= 0) {
332 }
333 if (collision) {
335 }
336 // only write friendly position if is true
337 if (friendlyPos) {
339 }
340 // only write act type if isn't empty
341 if (!actType.empty()) {
343 }
344 if (close) {
345 // the user is closing the stop it is responsible for writing params
346 writeParams(dev);
347 dev.closeTag();
348 }
349}
350
351std::vector<std::string>
353 std::vector<std::string> result;
354 if (busstop != "") {
355 result.push_back(busstop);
356 }
357 if (containerstop != "") {
358 result.push_back(containerstop);
359 }
360 if (chargingStation != "") {
361 result.push_back(chargingStation);
362 }
363 if (parkingarea != "") {
364 result.push_back(parkingarea);
365 }
366 return result;
367}
368
369bool
370SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
371 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
372 if (val == "triggered") {
374 } else if (val == "containerTriggered") {
376 } else if (val == "now") {
377 // only used via TraCI. depart must be set by the calling code
379 } else if (val == "split") {
381 } else if (val == "begin") {
383 } else {
384 try {
385 depart = string2time(val);
387 if (depart < 0) {
388 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
389 return false;
390 }
391 } catch (...) {
392 if (id.empty()) {
393 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
394 } else {
395 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
396 }
397 return false;
398 }
399 }
400 return true;
401}
402
403
404bool
405SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
406 int& lane, DepartLaneDefinition& dld, std::string& error) {
407 bool ok = true;
408 lane = 0;
410 if (val == "random") {
412 } else if (val == "free") {
414 } else if (val == "allowed") {
416 } else if (val == "best") {
418 } else if (val == "best_prob") {
420 } else if (val == "first") {
422 } else {
423 try {
424 lane = StringUtils::toInt(val);
425 if (lane < 0) {
426 ok = false;
427 }
428 } catch (...) {
429 ok = false;
430 }
431 }
432 if (!ok) {
433 if (id.empty()) {
434 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
435 } else {
436 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
437 }
438 }
439 return ok;
440}
441
442
443bool
444SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
445 double& pos, DepartPosDefinition& dpd, std::string& error) {
446 bool ok = true;
447 pos = 0.;
449 if (val == "random") {
451 } else if (val == "random_free") {
453 } else if (val == "random_location") {
455 } else if (val == "free") {
457 } else if (val == "base") {
459 } else if (val == "last") {
461 } else if (val == "splitFront") {
463 } else if (val == "stop") {
465 } else {
466 try {
467 pos = StringUtils::toDouble(val);
468 } catch (...) {
469 ok = false;
470 }
471 }
472 if (!ok) {
473 if (id.empty()) {
474 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
475 } else {
476 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
477 }
478 }
479 return ok;
480}
481
482
483bool
484SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
485 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
486 bool ok = true;
487 pos = 0.;
489 if (val == "random") {
491 } else if (val == "random_free") {
493 } else if (val == "free") {
495 } else if (val == "right") {
497 } else if (val == "center") {
499 } else if (val == "left") {
501 } else {
502 try {
503 pos = StringUtils::toDouble(val);
504 } catch (...) {
505 ok = false;
506 }
507 }
508 if (!ok) {
509 if (id.empty()) {
510 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
511 } else {
512 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
513 }
514 }
515 return ok;
516}
517
518
519bool
520SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
521 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
522 bool ok = true;
523 speed = -1.;
525 if (val == "random") {
527 } else if (val == "max") {
529 } else if (val == "desired") {
531 } else if (val == "speedLimit") {
533 } else if (val == "last") {
535 } else if (val == "avg") {
537 } else {
538 try {
539 speed = StringUtils::toDouble(val);
540 if (speed < 0) {
541 ok = false;
542 }
543 } catch (...) {
544 ok = false;
545 }
546 }
547 if (!ok) {
548 if (id.empty()) {
549 error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
550 } else {
551 error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
552 }
553 }
554 return ok;
555}
556
557
558bool
559SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
560 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
561 bool ok = true;
562 edgeIndex = -1;
564 if (val == "random") {
566 } else {
567 try {
568 edgeIndex = StringUtils::toInt(val);
569 if (edgeIndex < 0) {
570 ok = false;
571 }
572 } catch (...) {
573 ok = false;
574 }
575 }
576 if (!ok) {
577 if (id.empty()) {
578 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
579 } else {
580 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
581 }
582 }
583 return ok;
584}
585
586
587bool
588SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
589 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
590 bool ok = true;
591 lane = 0;
593 if (val == "current") {
595 } else if (val == "random") {
597 } else if (val == "first") {
599 } else {
600 try {
601 lane = StringUtils::toInt(val);
602 if (lane < 0) {
603 ok = false;
604 }
605 } catch (...) {
606 ok = false;
607 }
608 }
609 if (!ok) {
610 if (id.empty()) {
611 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
612 } else {
613 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
614 }
615 }
616 return ok;
617}
618
619
620bool
621SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
622 double& pos, ArrivalPosDefinition& apd, std::string& error) {
623 bool ok = true;
624 pos = 0.;
626 if (val == "random") {
628 } else if (val == "center") {
630 } else if (val == "max") {
632 } else {
633 try {
634 pos = StringUtils::toDouble(val);
635 } catch (...) {
636 ok = false;
637 }
638 }
639 if (!ok) {
640 if (id.empty()) {
641 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
642 } else {
643 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
644 }
645 }
646 return ok;
647}
648
649
650bool
651SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
652 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
653 bool ok = true;
654 pos = 0.;
656 if (val == "right") {
658 } else if (val == "center") {
660 } else if (val == "left") {
662 } else {
663 try {
664 pos = StringUtils::toDouble(val);
665 } catch (...) {
666 ok = false;
667 }
668 }
669 if (!ok) {
670 if (id.empty()) {
671 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
672 } else {
673 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
674 }
675 }
676 return ok;
677}
678
679
680bool
681SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
682 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
683 bool ok = true;
684 speed = -1.;
686 if (val == "current") {
688 } else {
689 try {
690 speed = StringUtils::toDouble(val);
691 if (speed < 0) {
692 ok = false;
693 }
694 } catch (...) {
695 ok = false;
696 }
697 }
698 if (!ok) {
699 if (id.empty()) {
700 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
701 } else {
702 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
703 }
704 }
705 return ok;
706}
707
708
709double
710SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
711 if (pos < 0) {
712 pos = maximumValue + pos;
713 }
714 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
715 if (!silent) {
716 WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
717 }
718 pos = maximumValue;
719 }
720 return pos;
721}
722
723
724bool
725SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
726 // separte modes in different strings, and check if modes are valid
727 for (StringTokenizer st(modes); st.hasNext();) {
728 const std::string mode = st.next();
729 if (mode == "car") {
730 modeSet |= SVC_PASSENGER;
731 } else if (mode == "taxi") {
732 modeSet |= SVC_TAXI;
733 } else if (mode == "bicycle") {
734 modeSet |= SVC_BICYCLE;
735 } else if (mode == "public") {
736 modeSet |= SVC_BUS;
737 } else {
738 if (id.empty()) {
739 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
740 } else {
741 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
742 }
743 return false;
744 }
745 }
746 return true;
747}
748
749
750void
751SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
752 if (triggers.size() == 0 && expectTrigger) {
753 stop.triggered = true;
754 }
755 for (std::string val : triggers) {
756 if (val == toString(SUMO_TAG_PERSON)) {
757 stop.triggered = true;
758 } else if (val == toString(SUMO_TAG_CONTAINER)) {
759 stop.containerTriggered = true;
760 } else if (val == toString(SUMO_ATTR_JOIN)) {
761 stop.joinTriggered = true;
762 } else {
763 try {
764 stop.triggered = StringUtils::toBool(val);
765 } catch (BoolFormatException&) {
766 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
767 }
768 }
769 }
770}
771
772
774SUMOVehicleParameter::parseParkingType(const std::string& value) {
775 if (value == toString(ParkingType::OPPORTUNISTIC)) {
777 } else {
779 }
780}
781
782
783std::vector<std::string>
785 std::vector<std::string> triggers;
786 if (triggered) {
787 triggers.push_back(toString(SUMO_TAG_PERSON));
788 }
789 if (containerTriggered) {
790 triggers.push_back(toString(SUMO_TAG_CONTAINER));
791 }
792 if (joinTriggered) {
793 triggers.push_back(toString(SUMO_ATTR_JOIN));
794 }
795 return triggers;
796}
797
798int
800 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
801 (triggered ? 2 : 0) +
802 (containerTriggered ? 4 : 0) +
803 (busstop != "" ? 8 : 0) +
804 (containerstop != "" ? 16 : 0) +
805 (chargingStation != "" ? 32 : 0) +
806 (parkingarea != "" ? 64 : 0) +
807 (overheadWireSegment != "" ? 128 : 0));
808}
809
810
811std::string
814 return "triggered";
816 return "containerTriggered";
817// } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
818// return "now";
820 return "split";
822 return "begin";
823 } else {
824 return time2string(depart);
825 }
826}
827
828
829std::string
831 std::string val;
832 switch (departLaneProcedure) {
834 val = toString(departLane);
835 break;
837 val = "random";
838 break;
840 val = "free";
841 break;
843 val = "allowed";
844 break;
846 val = "best";
847 break;
849 val = "best_prob";
850 break;
852 val = "first";
853 break;
855 default:
856 break;
857 }
858 return val;
859}
860
861
862std::string
864 std::string val;
865 switch (departPosProcedure) {
867 val = toString(departPos);
868 break;
871 break;
873 val = "random";
874 break;
876 val = "random_free";
877 break;
879 val = "random_location";
880 break;
882 val = "free";
883 break;
885 val = "last";
886 break;
888 val = "base";
889 break;
891 val = "splitFront";
892 break;
894 val = "stop";
895 break;
897 default:
898 break;
899 }
900 return val;
901}
902
903
904std::string
906 std::string val;
907 switch (departPosLatProcedure) {
909 val = toString(departPosLat);
910 break;
913 break;
915 val = "random";
916 break;
918 val = "random_free";
919 break;
921 val = "free";
922 break;
924 val = "right";
925 break;
927 val = "center";
928 break;
930 val = "left";
931 break;
933 default:
934 break;
935 }
936 return val;
937}
938
939
940std::string
942 std::string val;
943 switch (departSpeedProcedure) {
945 val = toString(departSpeed);
946 break;
949 break;
951 val = "random";
952 break;
954 val = "max";
955 break;
957 val = "desired";
958 break;
960 val = "speedLimit";
961 break;
963 val = "last";
964 break;
966 val = "avg";
967 break;
969 default:
970 break;
971 }
972 return val;
973}
974
975
976std::string
978 std::string val;
979 switch (departEdgeProcedure) {
981 val = toString(departEdge);
982 break;
984 val = "random";
985 break;
987 default:
988 break;
989 }
990 return val;
991}
992
993std::string
995 std::string val;
996 switch (arrivalEdgeProcedure) {
998 val = toString(arrivalEdge);
999 break;
1001 val = "random";
1002 break;
1004 default:
1005 break;
1006 }
1007 return val;
1008}
1009
1010
1011
1012
1013std::string
1015 std::string val;
1016 switch (arrivalLaneProcedure) {
1018 val = toString(arrivalLane);
1019 break;
1021 val = "current";
1022 break;
1024 val = "random";
1025 break;
1027 val = "first";
1028 break;
1030 default:
1031 break;
1032 }
1033 return val;
1034}
1035
1036
1037std::string
1039 std::string val;
1040 switch (arrivalPosProcedure) {
1042 val = toString(arrivalPos);
1043 break;
1045 val = "random";
1046 break;
1048 val = "center";
1049 break;
1051 val = "max";
1052 break;
1054 default:
1055 break;
1056 }
1057 return val;
1058}
1059
1060
1061std::string
1063 std::string val;
1064 switch (arrivalPosLatProcedure) {
1066 val = toString(arrivalPosLat);
1067 break;
1069 val = "right";
1070 break;
1072 val = "center";
1073 break;
1075 val = "left";
1076 break;
1078 default:
1079 break;
1080 }
1081 return val;
1082}
1083
1084
1085std::string
1087 std::string val;
1088 switch (arrivalSpeedProcedure) {
1090 val = toString(arrivalSpeed);
1091 break;
1093 val = "current";
1094 break;
1096 default:
1097 break;
1098 }
1099 return val;
1100}
1101
1102
1103void
1106 // equidistant or exponential offset (for poisson distributed arrivals)
1107 if (repetitionProbability < 0) {
1108 if (repetitionOffset >= 0) {
1109 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1110 } else {
1111 assert(poissonRate > 0);
1112 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1113 const double r = RandHelper::randExp(poissonRate, rng);
1114 repetitionTotalOffset += TIME2STEPS(r / scale);
1115 }
1116 }
1117}
1118
1119
1120std::string
1122 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1124 } else {
1125 std::vector<std::string> insertionChecksStrs;
1126 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1127 // iterate over values
1128 for (const auto insertionCheckValue : insertionCheckValues) {
1129 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1130 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1131 }
1132 }
1133 return toString(insertionChecksStrs);
1134 }
1135}
1136
1137
1138bool
1139SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1140 if (value.empty()) {
1141 return true;
1142 } else {
1143 // split value in substrinsg
1144 StringTokenizer valueStrs(value, " ");
1145 // iterate over values
1146 while (valueStrs.hasNext()) {
1147 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1148 return false;
1149 }
1150 }
1151 return true;
1152 }
1153}
1154
1155
1156int
1158 // first reset insertionChecks
1159 int result = 0;
1160 if (value.empty()) {
1161 return (int)InsertionCheck::ALL;
1162 } else {
1163 // split value in substrinsg
1164 StringTokenizer insertionCheckStrs(value, " ");
1165 while (insertionCheckStrs.hasNext()) {
1166 std::string val = insertionCheckStrs.next();
1167 if (SUMOXMLDefinitions::InsertionChecks.hasString(val)) {
1168 result |= (int)SUMOXMLDefinitions::InsertionChecks.get(val);
1169 } else {
1170 throw InvalidArgument("Unknown value '" + val + "' in " + toString(SUMO_ATTR_INSERTIONCHECKS) + ".");
1171 }
1172 }
1173 }
1174 return result;
1175}
1176
1177/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_ERROR(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:304
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_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)
const long long int VEHPARS_END_SET
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.
const long long int VEHPARS_PERIOD_SET
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_POISSON_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 long long int VEHPARS_PROB_SET
const int STOP_ENDED_SET
const long long int VEHPARS_SPEEDFACTOR_SET
const int STOP_TRIGGER_SET
const int STOP_PRIORITY_SET
const long long int VEHPARS_VTYPE_SET
const long long int VEHPARS_VPH_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
const long long int VEHPARS_NUMBER_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_NUMBER
@ 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_PRIORITY
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_PERHOUR
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_INDEX
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_PERMITTED
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_PROB
@ 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:27
int gPrecisionRandom
Definition StdDefs.cpp:30
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
T MAX2(T a, T b)
Definition StdDefs.h:86
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 getPrecision()
Returns the precision of the underlying stream.
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.
double priority
priority for weighting/skipping stops
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.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
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 std::string adjustDecimalValue(double value, int precision)
write with maximum precision if needed but remove trailing zeros
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