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-2026 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
179 if (color.isRandom()) {
180 dev.writeAttr(SUMO_ATTR_COLOR, "random");
181 } else {
183 }
184 }
185 // line
188 }
189 // from TAZ
192 }
193 // to TAZ
196 }
197 // person number
200 }
201 // container number
204 }
205 // individual speedFactor
207 // might be saving state with custom precision
208 const int precision = dev.getPrecision();
209 dev.setPrecision(MAX2(gPrecisionRandom, precision));
211 dev.setPrecision(precision);
212 }
213 // speed (only used by calibrators)
216 }
217 // insertionChecks
219 std::vector<std::string> checks;
221 checks.push_back(toString(InsertionCheck::NONE));
222 } else {
224 if (((int)it & insertionChecks) != 0) {
225 checks.push_back(toString(it));
226 }
227 }
228 }
230 }
231 // parking access rights
234 }
235}
236
237
238void
239SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
240 if (writeTagAndParents) {
242 if (busstop != "") {
244 }
245 if (containerstop != "") {
247 }
248 if (chargingStation != "") {
250 }
251 if (parkingarea != "") {
253 }
254 if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
255 if (lane != "") {
257 } else {
259 }
260 if ((parametersSet & STOP_START_SET) != 0) {
262 }
263 if ((parametersSet & STOP_END_SET) != 0) {
265 }
266 }
267 }
268 if (index > 0) {
270 }
273 }
274 if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
276 }
277 if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
279 }
280 if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
282 }
283 if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
285 }
286 if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
288 }
289 if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
291 }
292 if ((parametersSet & STOP_TRIGGER_SET) != 0) {
293 const std::vector<std::string> triggers = getTriggers();
294 if (triggers.size() > 0) {
295 dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
296 }
297 }
298 if ((parametersSet & STOP_PARKING_SET) != 0) {
300 }
301 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
303 }
304 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
306 }
309 }
310 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
312 }
313 if ((parametersSet & STOP_LINE_SET) != 0) {
315 }
316 if ((parametersSet & STOP_SPLIT_SET) != 0) {
318 }
319 if ((parametersSet & STOP_JOIN_SET) != 0) {
321 }
322 if ((parametersSet & STOP_SPEED_SET) != 0) {
324 }
325 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
327 }
328 if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
330 }
331 if ((parametersSet & STOP_JUMP_UNTIL_SET) != 0 && jumpUntil >= 0) {
333 }
334 if ((parametersSet & STOP_PRIORITY_SET) != 0 && priority >= 0) {
336 }
337 if (collision) {
339 }
340 // only write friendly position if is true
341 if (friendlyPos) {
343 }
344 // only write act type if isn't empty
345 if (!actType.empty()) {
347 }
348 if (close) {
349 // the user is closing the stop it is responsible for writing params
350 writeParams(dev);
351 dev.closeTag();
352 }
353}
354
355std::vector<std::string>
357 std::vector<std::string> result;
358 if (busstop != "") {
359 result.push_back(busstop);
360 }
361 if (containerstop != "") {
362 result.push_back(containerstop);
363 }
364 if (chargingStation != "") {
365 result.push_back(chargingStation);
366 }
367 if (parkingarea != "") {
368 result.push_back(parkingarea);
369 }
370 return result;
371}
372
373bool
374SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
375 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
376 if (val == "triggered") {
378 } else if (val == "containerTriggered") {
380 } else if (val == "now") {
381 // only used via TraCI. depart must be set by the calling code
383 } else if (val == "split") {
385 } else if (val == "begin") {
387 } else {
388 try {
389 depart = string2time(val);
391 if (depart < 0) {
392 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
393 return false;
394 }
395 } catch (...) {
396 if (id.empty()) {
397 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
398 } else {
399 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
400 }
401 return false;
402 }
403 }
404 return true;
405}
406
407
408bool
409SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
410 int& lane, DepartLaneDefinition& dld, std::string& error) {
411 bool ok = true;
412 lane = 0;
414 if (val == "random") {
416 } else if (val == "free") {
418 } else if (val == "allowed") {
420 } else if (val == "best") {
422 } else if (val == "best_prob") {
424 } else if (val == "first") {
426 } else {
427 try {
428 lane = StringUtils::toInt(val);
429 if (lane < 0) {
430 ok = false;
431 }
432 } catch (...) {
433 ok = false;
434 }
435 }
436 if (!ok) {
437 if (id.empty()) {
438 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
439 } else {
440 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
441 }
442 }
443 return ok;
444}
445
446
447bool
448SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
449 double& pos, DepartPosDefinition& dpd, std::string& error) {
450 bool ok = true;
451 pos = 0.;
453 if (val == "random") {
455 } else if (val == "random_free") {
457 } else if (val == "random_location") {
459 } else if (val == "free") {
461 } else if (val == "base") {
463 } else if (val == "last") {
465 } else if (val == "splitFront") {
467 } else if (val == "stop") {
469 } else {
470 try {
471 pos = StringUtils::toDouble(val);
472 } catch (...) {
473 ok = false;
474 }
475 }
476 if (!ok) {
477 if (id.empty()) {
478 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
479 } else {
480 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
481 }
482 }
483 return ok;
484}
485
486
487bool
488SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
489 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
490 bool ok = true;
491 pos = 0.;
493 if (val == "random") {
495 } else if (val == "random_free") {
497 } else if (val == "free") {
499 } else if (val == "right") {
501 } else if (val == "center") {
503 } else if (val == "left") {
505 } else {
506 try {
507 pos = StringUtils::toDouble(val);
508 } catch (...) {
509 ok = false;
510 }
511 }
512 if (!ok) {
513 if (id.empty()) {
514 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
515 } else {
516 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
517 }
518 }
519 return ok;
520}
521
522
523bool
524SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
525 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
526 bool ok = true;
527 speed = -1.;
529 if (val == "random") {
531 } else if (val == "max") {
533 } else if (val == "desired") {
535 } else if (val == "speedLimit") {
537 } else if (val == "last") {
539 } else if (val == "avg") {
541 } else {
542 try {
543 speed = StringUtils::toDouble(val);
544 if (speed < 0) {
545 ok = false;
546 }
547 } catch (...) {
548 ok = false;
549 }
550 }
551 if (!ok) {
552 if (id.empty()) {
553 error = "Invalid departSpeed '" + val + "' definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
554 } else {
555 error = "Invalid departSpeed definition '" + val + "' for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
556 }
557 }
558 return ok;
559}
560
561
562bool
563SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
564 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
565 bool ok = true;
566 edgeIndex = -1;
568 if (val == "random") {
570 } else {
571 try {
572 edgeIndex = StringUtils::toInt(val);
573 if (edgeIndex < 0) {
574 ok = false;
575 }
576 } catch (...) {
577 ok = false;
578 }
579 }
580 if (!ok) {
581 if (id.empty()) {
582 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
583 } else {
584 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
585 }
586 }
587 return ok;
588}
589
590
591bool
592SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
593 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
594 bool ok = true;
595 lane = 0;
597 if (val == "current") {
599 } else if (val == "random") {
601 } else if (val == "first") {
603 } else {
604 try {
605 lane = StringUtils::toInt(val);
606 if (lane < 0) {
607 ok = false;
608 }
609 } catch (...) {
610 ok = false;
611 }
612 }
613 if (!ok) {
614 if (id.empty()) {
615 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
616 } else {
617 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
618 }
619 }
620 return ok;
621}
622
623
624bool
625SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
626 double& pos, ArrivalPosDefinition& apd, std::string& error) {
627 bool ok = true;
628 pos = 0.;
630 if (val == "random") {
632 } else if (val == "center") {
634 } else if (val == "max") {
636 } else {
637 try {
638 pos = StringUtils::toDouble(val);
639 } catch (...) {
640 ok = false;
641 }
642 }
643 if (!ok) {
644 if (id.empty()) {
645 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
646 } else {
647 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
648 }
649 }
650 return ok;
651}
652
653
654bool
655SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
656 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
657 bool ok = true;
658 pos = 0.;
660 if (val == "right") {
662 } else if (val == "center") {
664 } else if (val == "left") {
666 } else {
667 try {
668 pos = StringUtils::toDouble(val);
669 } catch (...) {
670 ok = false;
671 }
672 }
673 if (!ok) {
674 if (id.empty()) {
675 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
676 } else {
677 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
678 }
679 }
680 return ok;
681}
682
683
684bool
685SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
686 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
687 bool ok = true;
688 speed = -1.;
690 if (val == "current") {
692 } else {
693 try {
694 speed = StringUtils::toDouble(val);
695 if (speed < 0) {
696 ok = false;
697 }
698 } catch (...) {
699 ok = false;
700 }
701 }
702 if (!ok) {
703 if (id.empty()) {
704 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
705 } else {
706 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
707 }
708 }
709 return ok;
710}
711
712
713double
714SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
715 if (pos < 0) {
716 pos = maximumValue + pos;
717 }
718 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
719 if (!silent) {
720 WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
721 }
722 pos = maximumValue;
723 }
724 return pos;
725}
726
727
728bool
729SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
730 // separte modes in different strings, and check if modes are valid
731 for (StringTokenizer st(modes); st.hasNext();) {
732 const std::string mode = st.next();
733 if (mode == "car") {
734 modeSet |= SVC_PASSENGER;
735 } else if (mode == "taxi") {
736 modeSet |= SVC_TAXI;
737 } else if (mode == "bicycle") {
738 modeSet |= SVC_BICYCLE;
739 } else if (mode == "public") {
740 modeSet |= SVC_BUS;
741 } else {
742 if (id.empty()) {
743 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
744 } else {
745 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
746 }
747 return false;
748 }
749 }
750 return true;
751}
752
753
754void
755SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
756 if (triggers.size() == 0 && expectTrigger) {
757 stop.triggered = true;
758 }
759 for (std::string val : triggers) {
760 if (val == toString(SUMO_TAG_PERSON)) {
761 stop.triggered = true;
762 } else if (val == toString(SUMO_TAG_CONTAINER)) {
763 stop.containerTriggered = true;
764 } else if (val == toString(SUMO_ATTR_JOIN)) {
765 stop.joinTriggered = true;
766 } else {
767 try {
768 stop.triggered = StringUtils::toBool(val);
769 } catch (BoolFormatException&) {
770 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
771 }
772 }
773 }
774}
775
776
778SUMOVehicleParameter::parseParkingType(const std::string& value) {
779 if (value == toString(ParkingType::OPPORTUNISTIC)) {
781 } else {
783 }
784}
785
786
787std::vector<std::string>
789 std::vector<std::string> triggers;
790 if (triggered) {
791 triggers.push_back(toString(SUMO_TAG_PERSON));
792 }
793 if (containerTriggered) {
794 triggers.push_back(toString(SUMO_TAG_CONTAINER));
795 }
796 if (joinTriggered) {
797 triggers.push_back(toString(SUMO_ATTR_JOIN));
798 }
799 return triggers;
800}
801
802int
804 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
805 (triggered ? 2 : 0) +
806 (containerTriggered ? 4 : 0) +
807 (busstop != "" ? 8 : 0) +
808 (containerstop != "" ? 16 : 0) +
809 (chargingStation != "" ? 32 : 0) +
810 (parkingarea != "" ? 64 : 0) +
811 (overheadWireSegment != "" ? 128 : 0));
812}
813
814
815std::string
818 return "triggered";
820 return "containerTriggered";
821// } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
822// return "now";
824 return "split";
826 return "begin";
827 } else {
828 return time2string(depart);
829 }
830}
831
832
833std::string
835 std::string val;
836 switch (departLaneProcedure) {
838 val = toString(departLane);
839 break;
841 val = "random";
842 break;
844 val = "free";
845 break;
847 val = "allowed";
848 break;
850 val = "best";
851 break;
853 val = "best_prob";
854 break;
856 val = "first";
857 break;
859 default:
860 break;
861 }
862 return val;
863}
864
865
866std::string
868 std::string val;
869 switch (departPosProcedure) {
871 val = toString(departPos);
872 break;
875 break;
877 val = "random";
878 break;
880 val = "random_free";
881 break;
883 val = "random_location";
884 break;
886 val = "free";
887 break;
889 val = "last";
890 break;
892 val = "base";
893 break;
895 val = "splitFront";
896 break;
898 val = "stop";
899 break;
901 default:
902 break;
903 }
904 return val;
905}
906
907
908std::string
910 std::string val;
911 switch (departPosLatProcedure) {
913 val = toString(departPosLat);
914 break;
917 break;
919 val = "random";
920 break;
922 val = "random_free";
923 break;
925 val = "free";
926 break;
928 val = "right";
929 break;
931 val = "center";
932 break;
934 val = "left";
935 break;
937 default:
938 break;
939 }
940 return val;
941}
942
943
944std::string
946 std::string val;
947 switch (departSpeedProcedure) {
949 val = toString(departSpeed);
950 break;
953 break;
955 val = "random";
956 break;
958 val = "max";
959 break;
961 val = "desired";
962 break;
964 val = "speedLimit";
965 break;
967 val = "last";
968 break;
970 val = "avg";
971 break;
973 default:
974 break;
975 }
976 return val;
977}
978
979
980std::string
982 std::string val;
983 switch (departEdgeProcedure) {
985 val = toString(departEdge);
986 break;
988 val = "random";
989 break;
991 default:
992 break;
993 }
994 return val;
995}
996
997std::string
999 std::string val;
1000 switch (arrivalEdgeProcedure) {
1002 val = toString(arrivalEdge);
1003 break;
1005 val = "random";
1006 break;
1008 default:
1009 break;
1010 }
1011 return val;
1012}
1013
1014
1015
1016
1017std::string
1019 std::string val;
1020 switch (arrivalLaneProcedure) {
1022 val = toString(arrivalLane);
1023 break;
1025 val = "current";
1026 break;
1028 val = "random";
1029 break;
1031 val = "first";
1032 break;
1034 default:
1035 break;
1036 }
1037 return val;
1038}
1039
1040
1041std::string
1043 std::string val;
1044 switch (arrivalPosProcedure) {
1046 val = toString(arrivalPos);
1047 break;
1049 val = "random";
1050 break;
1052 val = "center";
1053 break;
1055 val = "max";
1056 break;
1058 default:
1059 break;
1060 }
1061 return val;
1062}
1063
1064
1065std::string
1067 std::string val;
1068 switch (arrivalPosLatProcedure) {
1070 val = toString(arrivalPosLat);
1071 break;
1073 val = "right";
1074 break;
1076 val = "center";
1077 break;
1079 val = "left";
1080 break;
1082 default:
1083 break;
1084 }
1085 return val;
1086}
1087
1088
1089std::string
1091 std::string val;
1092 switch (arrivalSpeedProcedure) {
1094 val = toString(arrivalSpeed);
1095 break;
1097 val = "current";
1098 break;
1100 default:
1101 break;
1102 }
1103 return val;
1104}
1105
1106
1107void
1110 // equidistant or exponential offset (for poisson distributed arrivals)
1111 if (repetitionProbability < 0) {
1112 if (repetitionOffset >= 0) {
1113 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1114 } else {
1115 assert(poissonRate > 0);
1116 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1117 const double r = RandHelper::randExp(poissonRate, rng);
1118 repetitionTotalOffset += TIME2STEPS(r / scale);
1119 }
1120 }
1121}
1122
1123
1124std::string
1126 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1128 } else {
1129 std::vector<std::string> insertionChecksStrs;
1130 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1131 // iterate over values
1132 for (const auto insertionCheckValue : insertionCheckValues) {
1133 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1134 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1135 }
1136 }
1137 return toString(insertionChecksStrs);
1138 }
1139}
1140
1141
1142bool
1143SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1144 if (value.empty()) {
1145 return true;
1146 } else {
1147 // split value in substrinsg
1148 StringTokenizer valueStrs(value, " ");
1149 // iterate over values
1150 while (valueStrs.hasNext()) {
1151 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1152 return false;
1153 }
1154 }
1155 return true;
1156 }
1157}
1158
1159
1160int
1162 // first reset insertionChecks
1163 int result = 0;
1164 if (value.empty()) {
1165 return (int)InsertionCheck::ALL;
1166 } else {
1167 // split value in substrinsg
1168 StringTokenizer insertionCheckStrs(value, " ");
1169 while (insertionCheckStrs.hasNext()) {
1170 std::string val = insertionCheckStrs.next();
1171 if (SUMOXMLDefinitions::InsertionChecks.hasString(val)) {
1172 result |= (int)SUMOXMLDefinitions::InsertionChecks.get(val);
1173 } else {
1174 throw InvalidArgument("Unknown value '" + val + "' in " + toString(SUMO_ATTR_INSERTIONCHECKS) + ".");
1175 }
1176 }
1177 }
1178 return result;
1179}
1180
1181/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ DEFAULT
default cursor
#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:58
#define TIME2STEPS(x)
Definition SUMOTime.h:60
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:314
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:49
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 & 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.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
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
bool isRandom() const
check if color is random
Definition RGBColor.cpp:130
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)
long long int repetitionsDone
The number of times the vehicle was already inserted.
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.
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