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>
23
32
34
35// ===========================================================================
36// member method definitions
37// ===========================================================================
38
40 : tag(SUMO_TAG_NOTHING), vtypeid(DEFAULT_VTYPE_ID), color(RGBColor::DEFAULT_COLOR),
41 depart(-1), departProcedure(DepartDefinition::GIVEN),
42 departLane(0), departLaneProcedure(DepartLaneDefinition::DEFAULT),
43 departPos(0), departPosProcedure(DepartPosDefinition::DEFAULT),
44 departPosLat(0), departPosLatProcedure(DepartPosLatDefinition::DEFAULT),
45 departSpeed(-1), departSpeedProcedure(DepartSpeedDefinition::DEFAULT),
46 departEdge(0), departEdgeProcedure(RouteIndexDefinition::DEFAULT),
47 arrivalLane(0), arrivalLaneProcedure(ArrivalLaneDefinition::DEFAULT),
48 arrivalPos(0), arrivalPosProcedure(ArrivalPosDefinition::DEFAULT),
49 arrivalPosLat(0), arrivalPosLatProcedure(ArrivalPosLatDefinition::DEFAULT),
50 arrivalSpeed(-1), arrivalSpeedProcedure(ArrivalSpeedDefinition::DEFAULT),
51 arrivalEdge(-1), arrivalEdgeProcedure(RouteIndexDefinition::DEFAULT),
52 repetitionNumber(-1),
53 repetitionsDone(-1),
54 repetitionOffset(-1),
55 repetitionTotalOffset(0),
56 repetitionProbability(-1),
57 poissonRate(0),
58 repetitionEnd(-1),
59 line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0),
60 speedFactor(-1),
61 calibratorSpeed(-1),
62 insertionChecks((int)InsertionCheck::ALL),
63 parametersSet(0)
64{ }
65
66
69
70
71bool
72SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const {
73 return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override");
74}
75
76
77void
78SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag, const std::string& typeID) const {
79 if (!id.empty()) {
80 // only used by calibrator flows
81 dev.openTag(altTag).writeAttr(SUMO_ATTR_ID, id);
82 }
83 if (typeID == "") {
86 }
87 } else {
88 dev.writeAttr(SUMO_ATTR_TYPE, typeID);
89 }
90 // write depart depending of tag
91 if (altTag == SUMO_TAG_FLOW
92 || altTag == SUMO_TAG_PERSONFLOW
93 || altTag == SUMO_TAG_CONTAINERFLOW
94 || altTag == GNE_TAG_FLOW_ROUTE
95 || altTag == GNE_TAG_FLOW_WITHROUTE
96 || altTag == SUMO_TAG_FLOWSTATE) {
98
101 }
104 }
105 if (wasSet(VEHPARS_VPH_SET)) {
107 }
108 // netedit uses VEHPARS_POISSON_SET
112 } else {
114 }
115 }
118 }
119 } else {
121 }
122 // optional parameter
123 // departlane
124 if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
126 } else if (oc.exists("departlane") && oc.isSet("departlane")) {
127 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
128 }
129 // departpos
130 if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
132 } else if (oc.exists("departpos") && oc.isSet("departpos")) {
133 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
134 }
135 // departPosLat
138 }
139 // departspeed
140 if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
142 } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
143 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
144 }
145 // departedge
146 if (wasSet(VEHPARS_DEPARTEDGE_SET) && !defaultOptionOverrides(oc, "departedge")) {
148 } else if (oc.exists("departedge") && oc.isSet("departedge")) {
149 dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTEDGE, oc.getString("departedge"));
150 }
151 // arrivallane
152 if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
154 } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
155 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
156 }
157 // arrivalpos
158 if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
160 } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
161 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
162 }
163 // arrivalPosLat
166 }
167 // arrivalspeed
168 if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
170 } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
171 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
172 }
173 // arrivalEdge
174 if (wasSet(VEHPARS_ARRIVALEDGE_SET) && !defaultOptionOverrides(oc, "arrivaledge") && arrivalEdge >= 0) {
176 } else if (oc.exists("arrivaledge") && oc.isSet("arrivaledge")) {
177 dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALEDGE, oc.getString("arrivaledge"));
178 }
179 // color
181 if (color.isRandom()) {
182 dev.writeAttr(SUMO_ATTR_COLOR, "random");
183 } else {
185 }
186 }
187 // line
190 }
191 // from TAZ
194 }
195 // to TAZ
198 }
199 // person number
202 }
203 // container number
206 }
207 // individual speedFactor
209 // might be saving state with custom precision
210 const int precision = dev.getPrecision();
211 dev.setPrecision(MAX2(gPrecisionRandom, precision));
213 dev.setPrecision(precision);
214 }
215 // speed (only used by calibrators)
218 }
219 // insertionChecks
221 std::vector<std::string> checks;
223 checks.push_back(toString(InsertionCheck::NONE));
224 } else {
226 if (((int)it & insertionChecks) != 0) {
227 checks.push_back(toString(it));
228 }
229 }
230 }
232 }
233 // parking access rights
236 }
237}
238
239
240void
241SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
242 if (writeTagAndParents) {
244 if (busstop != "") {
246 }
247 if (containerstop != "") {
249 }
250 if (chargingStation != "") {
252 }
253 if (parkingarea != "") {
255 }
256 if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
257 if (lane != "") {
259 } else {
261 }
262 if ((parametersSet & STOP_START_SET) != 0) {
264 }
265 if ((parametersSet & STOP_END_SET) != 0) {
267 }
268 }
269 }
270 if (index > 0) {
272 }
275 }
276 if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
278 }
279 if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
281 }
282 if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
284 }
285 if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
287 }
288 if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
290 }
291 if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
293 }
294 if ((parametersSet & STOP_TRIGGER_SET) != 0) {
295 const std::vector<std::string> triggers = getTriggers();
296 if (triggers.size() > 0) {
297 dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
298 }
299 }
300 if ((parametersSet & STOP_PARKING_SET) != 0) {
302 }
303 if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
305 }
306 if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
308 }
311 }
312 if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
314 }
315 if ((parametersSet & STOP_LINE_SET) != 0) {
317 }
318 if ((parametersSet & STOP_SPLIT_SET) != 0) {
320 }
321 if ((parametersSet & STOP_JOIN_SET) != 0) {
323 }
324 if ((parametersSet & STOP_SPEED_SET) != 0) {
326 }
327 if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
329 }
330 if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
332 }
333 if ((parametersSet & STOP_JUMP_UNTIL_SET) != 0 && jumpUntil >= 0) {
335 }
336 if ((parametersSet & STOP_PRIORITY_SET) != 0 && priority >= 0) {
338 }
339 if (collision) {
341 }
342 // only write friendly position if is true
343 if (friendlyPos) {
345 }
346 // only write act type if isn't empty
347 if (!actType.empty()) {
349 }
350 if (close) {
351 // the user is closing the stop it is responsible for writing params
352 XMLHelpers::writeParams(dev, *this);
353 dev.closeTag();
354 }
355}
356
357std::vector<std::string>
359 std::vector<std::string> result;
360 if (busstop != "") {
361 result.push_back(busstop);
362 }
363 if (containerstop != "") {
364 result.push_back(containerstop);
365 }
366 if (chargingStation != "") {
367 result.push_back(chargingStation);
368 }
369 if (parkingarea != "") {
370 result.push_back(parkingarea);
371 }
372 return result;
373}
374
375bool
376SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
377 SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
378 if (val == "triggered") {
380 } else if (val == "containerTriggered") {
382 } else if (val == "now") {
383 // only used via TraCI. depart must be set by the calling code
385 } else if (val == "split") {
387 } else if (val == "begin") {
389 } else {
390 try {
391 depart = string2time(val);
393 if (depart < 0) {
394 error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
395 return false;
396 }
397 } catch (...) {
398 if (id.empty()) {
399 error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
400 } else {
401 error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
402 }
403 return false;
404 }
405 }
406 return true;
407}
408
409
410bool
411SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
412 int& lane, DepartLaneDefinition& dld, std::string& error) {
413 bool ok = true;
414 lane = 0;
416 if (val == "random") {
418 } else if (val == "free") {
420 } else if (val == "allowed") {
422 } else if (val == "best") {
424 } else if (val == "best_prob") {
426 } else if (val == "first") {
428 } else {
429 try {
430 lane = StringUtils::toInt(val);
431 if (lane < 0) {
432 ok = false;
433 }
434 } catch (...) {
435 ok = false;
436 }
437 }
438 if (!ok) {
439 if (id.empty()) {
440 error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
441 } else {
442 error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"best_prob\", \"first\", or an int>=0)";
443 }
444 }
445 return ok;
446}
447
448
449bool
450SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
451 double& pos, DepartPosDefinition& dpd, std::string& error) {
452 bool ok = true;
453 pos = 0.;
455 if (val == "random") {
457 } else if (val == "random_free") {
459 } else if (val == "random_location") {
461 } else if (val == "free") {
463 } else if (val == "base") {
465 } else if (val == "last") {
467 } else if (val == "splitFront") {
469 } else if (val == "stop") {
471 } else {
472 try {
473 pos = StringUtils::toDouble(val);
474 } catch (...) {
475 ok = false;
476 }
477 }
478 if (!ok) {
479 if (id.empty()) {
480 error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
481 } else {
482 error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
483 }
484 }
485 return ok;
486}
487
488
489bool
490SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
491 double& pos, DepartPosLatDefinition& dpd, std::string& error) {
492 bool ok = true;
493 pos = 0.;
495 if (val == "random") {
497 } else if (val == "random_free") {
499 } else if (val == "free") {
501 } else if (val == "right") {
503 } else if (val == "center") {
505 } else if (val == "left") {
507 } else {
508 try {
509 pos = StringUtils::toDouble(val);
510 } catch (...) {
511 ok = false;
512 }
513 }
514 if (!ok) {
515 if (id.empty()) {
516 error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
517 } else {
518 error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
519 }
520 }
521 return ok;
522}
523
524
525bool
526SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
527 double& speed, DepartSpeedDefinition& dsd, std::string& error) {
528 bool ok = true;
529 speed = -1.;
531 if (val == "random") {
533 } else if (val == "max") {
535 } else if (val == "desired") {
537 } else if (val == "speedLimit") {
539 } else if (val == "last") {
541 } else if (val == "avg") {
543 } else {
544 try {
545 speed = StringUtils::toDouble(val);
546 if (speed < 0) {
547 ok = false;
548 }
549 } catch (...) {
550 ok = false;
551 }
552 }
553 if (!ok) {
554 if (id.empty()) {
555 error = "Invalid departSpeed '" + val + "' definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
556 } else {
557 error = "Invalid departSpeed definition '" + val + "' for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
558 }
559 }
560 return ok;
561}
562
563
564bool
565SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
566 const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
567 bool ok = true;
568 edgeIndex = -1;
570 if (val == "random") {
572 } else {
573 try {
574 edgeIndex = StringUtils::toInt(val);
575 if (edgeIndex < 0) {
576 ok = false;
577 }
578 } catch (...) {
579 ok = false;
580 }
581 }
582 if (!ok) {
583 if (id.empty()) {
584 error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
585 } else {
586 error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
587 }
588 }
589 return ok;
590}
591
592
593bool
594SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
595 int& lane, ArrivalLaneDefinition& ald, std::string& error) {
596 bool ok = true;
597 lane = 0;
599 if (val == "current") {
601 } else if (val == "random") {
603 } else if (val == "first") {
605 } else {
606 try {
607 lane = StringUtils::toInt(val);
608 if (lane < 0) {
609 ok = false;
610 }
611 } catch (...) {
612 ok = false;
613 }
614 }
615 if (!ok) {
616 if (id.empty()) {
617 error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
618 } else {
619 error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
620 }
621 }
622 return ok;
623}
624
625
626bool
627SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
628 double& pos, ArrivalPosDefinition& apd, std::string& error) {
629 bool ok = true;
630 pos = 0.;
632 if (val == "random") {
634 } else if (val == "center") {
636 } else if (val == "max") {
638 } else {
639 try {
640 pos = StringUtils::toDouble(val);
641 } catch (...) {
642 ok = false;
643 }
644 }
645 if (!ok) {
646 if (id.empty()) {
647 error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
648 } else {
649 error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
650 }
651 }
652 return ok;
653}
654
655
656bool
657SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
658 double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
659 bool ok = true;
660 pos = 0.;
662 if (val == "right") {
664 } else if (val == "center") {
666 } else if (val == "left") {
668 } else {
669 try {
670 pos = StringUtils::toDouble(val);
671 } catch (...) {
672 ok = false;
673 }
674 }
675 if (!ok) {
676 if (id.empty()) {
677 error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
678 } else {
679 error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
680 }
681 }
682 return ok;
683}
684
685
686bool
687SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
688 double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
689 bool ok = true;
690 speed = -1.;
692 if (val == "current") {
694 } else {
695 try {
696 speed = StringUtils::toDouble(val);
697 if (speed < 0) {
698 ok = false;
699 }
700 } catch (...) {
701 ok = false;
702 }
703 }
704 if (!ok) {
705 if (id.empty()) {
706 error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
707 } else {
708 error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
709 }
710 }
711 return ok;
712}
713
714
715double
716SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
717 if (pos < 0) {
718 pos = maximumValue + pos;
719 }
720 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
721 if (!silent) {
722 WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
723 }
724 pos = maximumValue;
725 }
726 return pos;
727}
728
729
730bool
731SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
732 // separte modes in different strings, and check if modes are valid
733 for (StringTokenizer st(modes); st.hasNext();) {
734 const std::string mode = st.next();
735 if (mode == "car") {
736 modeSet |= SVC_PASSENGER;
737 } else if (mode == "taxi") {
738 modeSet |= SVC_TAXI;
739 } else if (mode == "bicycle") {
740 modeSet |= SVC_BICYCLE;
741 } else if (mode == "public") {
742 modeSet |= SVC_BUS;
743 } else {
744 if (id.empty()) {
745 error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
746 } else {
747 error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"taxi\", \"bicycle\" or \"public\")";
748 }
749 return false;
750 }
751 }
752 return true;
753}
754
755
756void
757SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
758 if (triggers.size() == 0 && expectTrigger) {
759 stop.triggered = true;
760 }
761 for (std::string val : triggers) {
762 if (val == toString(SUMO_TAG_PERSON)) {
763 stop.triggered = true;
764 } else if (val == toString(SUMO_TAG_CONTAINER)) {
765 stop.containerTriggered = true;
766 } else if (val == toString(SUMO_ATTR_JOIN)) {
767 stop.joinTriggered = true;
768 } else {
769 try {
770 stop.triggered = StringUtils::toBool(val);
771 } catch (BoolFormatException&) {
772 WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
773 }
774 }
775 }
776}
777
778
780SUMOVehicleParameter::parseParkingType(const std::string& value) {
781 if (value == toString(ParkingType::OPPORTUNISTIC)) {
783 } else {
785 }
786}
787
788
789std::vector<std::string>
791 std::vector<std::string> triggers;
792 if (triggered) {
793 triggers.push_back(toString(SUMO_TAG_PERSON));
794 }
795 if (containerTriggered) {
796 triggers.push_back(toString(SUMO_TAG_CONTAINER));
797 }
798 if (joinTriggered) {
799 triggers.push_back(toString(SUMO_ATTR_JOIN));
800 }
801 return triggers;
802}
803
804int
806 return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
807 (triggered ? 2 : 0) +
808 (containerTriggered ? 4 : 0) +
809 (busstop != "" ? 8 : 0) +
810 (containerstop != "" ? 16 : 0) +
811 (chargingStation != "" ? 32 : 0) +
812 (parkingarea != "" ? 64 : 0) +
813 (overheadWireSegment != "" ? 128 : 0));
814}
815
816
817std::string
820 return "triggered";
822 return "containerTriggered";
823// } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
824// return "now";
826 return "split";
828 return "begin";
829 } else {
830 return time2string(depart);
831 }
832}
833
834
835std::string
837 std::string val;
838 switch (departLaneProcedure) {
840 val = toString(departLane);
841 break;
843 val = "random";
844 break;
846 val = "free";
847 break;
849 val = "allowed";
850 break;
852 val = "best";
853 break;
855 val = "best_prob";
856 break;
858 val = "first";
859 break;
861 default:
862 break;
863 }
864 return val;
865}
866
867
868std::string
870 std::string val;
871 switch (departPosProcedure) {
873 val = toString(departPos);
874 break;
877 break;
879 val = "random";
880 break;
882 val = "random_free";
883 break;
885 val = "random_location";
886 break;
888 val = "free";
889 break;
891 val = "last";
892 break;
894 val = "base";
895 break;
897 val = "splitFront";
898 break;
900 val = "stop";
901 break;
903 default:
904 break;
905 }
906 return val;
907}
908
909
910std::string
912 std::string val;
913 switch (departPosLatProcedure) {
915 val = toString(departPosLat);
916 break;
919 break;
921 val = "random";
922 break;
924 val = "random_free";
925 break;
927 val = "free";
928 break;
930 val = "right";
931 break;
933 val = "center";
934 break;
936 val = "left";
937 break;
939 default:
940 break;
941 }
942 return val;
943}
944
945
946std::string
948 std::string val;
949 switch (departSpeedProcedure) {
951 val = toString(departSpeed);
952 break;
955 break;
957 val = "random";
958 break;
960 val = "max";
961 break;
963 val = "desired";
964 break;
966 val = "speedLimit";
967 break;
969 val = "last";
970 break;
972 val = "avg";
973 break;
975 default:
976 break;
977 }
978 return val;
979}
980
981
982std::string
984 std::string val;
985 switch (departEdgeProcedure) {
987 val = toString(departEdge);
988 break;
990 val = "random";
991 break;
993 default:
994 break;
995 }
996 return val;
997}
998
999std::string
1001 std::string val;
1002 switch (arrivalEdgeProcedure) {
1004 val = toString(arrivalEdge);
1005 break;
1007 val = "random";
1008 break;
1010 default:
1011 break;
1012 }
1013 return val;
1014}
1015
1016
1017
1018
1019std::string
1021 std::string val;
1022 switch (arrivalLaneProcedure) {
1024 val = toString(arrivalLane);
1025 break;
1027 val = "current";
1028 break;
1030 val = "random";
1031 break;
1033 val = "first";
1034 break;
1036 default:
1037 break;
1038 }
1039 return val;
1040}
1041
1042
1043std::string
1045 std::string val;
1046 switch (arrivalPosProcedure) {
1048 val = toString(arrivalPos);
1049 break;
1051 val = "random";
1052 break;
1054 val = "center";
1055 break;
1057 val = "max";
1058 break;
1060 default:
1061 break;
1062 }
1063 return val;
1064}
1065
1066
1067std::string
1069 std::string val;
1070 switch (arrivalPosLatProcedure) {
1072 val = toString(arrivalPosLat);
1073 break;
1075 val = "right";
1076 break;
1078 val = "center";
1079 break;
1081 val = "left";
1082 break;
1084 default:
1085 break;
1086 }
1087 return val;
1088}
1089
1090
1091std::string
1093 std::string val;
1094 switch (arrivalSpeedProcedure) {
1096 val = toString(arrivalSpeed);
1097 break;
1099 val = "current";
1100 break;
1102 default:
1103 break;
1104 }
1105 return val;
1106}
1107
1108
1109void
1112 // equidistant or exponential offset (for poisson distributed arrivals)
1113 if (repetitionProbability < 0) {
1114 if (repetitionOffset >= 0) {
1115 repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1116 } else {
1117 assert(poissonRate > 0);
1118 // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1119 const double r = RandHelper::randExp(poissonRate, rng);
1120 repetitionTotalOffset += TIME2STEPS(r / scale);
1121 }
1122 }
1123}
1124
1125
1126std::string
1128 if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1130 } else {
1131 std::vector<std::string> insertionChecksStrs;
1132 const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1133 // iterate over values
1134 for (const auto insertionCheckValue : insertionCheckValues) {
1135 if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1136 insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1137 }
1138 }
1139 return toString(insertionChecksStrs);
1140 }
1141}
1142
1143
1144bool
1145SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1146 if (value.empty()) {
1147 return true;
1148 } else {
1149 // split value in substrinsg
1150 StringTokenizer valueStrs(value, " ");
1151 // iterate over values
1152 while (valueStrs.hasNext()) {
1153 if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1154 return false;
1155 }
1156 }
1157 return true;
1158 }
1159}
1160
1161
1162int
1164 // first reset insertionChecks
1165 int result = 0;
1166 if (value.empty()) {
1167 return (int)InsertionCheck::ALL;
1168 } else {
1169 // split value in substrinsg
1170 StringTokenizer insertionCheckStrs(value, " ");
1171 while (insertionCheckStrs.hasNext()) {
1172 std::string val = insertionCheckStrs.next();
1173 if (SUMOXMLDefinitions::InsertionChecks.hasString(val)) {
1174 result |= (int)SUMOXMLDefinitions::InsertionChecks.get(val);
1175 } else {
1176 throw InvalidArgument("Unknown value '" + val + "' in " + toString(SUMO_ATTR_INSERTIONCHECKS) + ".");
1177 }
1178 }
1179 }
1180 return result;
1181}
1182
1183/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ DEFAULT
default cursor
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define WRITE_ERROR(msg)
Definition MsgHandler.h:307
#define TL(string)
Definition MsgHandler.h:316
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:47
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#define STEPS2TIME(x)
Definition SUMOTime.h:58
constexpr SUMOTime TIME2STEPS(double 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:322
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
A storage for options typed value containers)
Definition OptionsCont.h:92
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.
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
static OutputDevice & writeParams(OutputDevice &device, const Parameterised &params)
write the parameters of the given object as param tags