Eclipse SUMO - Simulation of Urban MObility
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-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 // Structure representing possible vehicle parameter
21 /****************************************************************************/
22 #include <config.h>
26 #include <utils/common/ToString.h>
30 
31 #include "SUMOVehicleParameter.h"
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 
66 }
67 
68 
69 bool
70 SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const {
71  return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override");
72 }
73 
74 
75 void
76 SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag, const std::string& typeID) const {
77  if (!id.empty()) {
78  // only used by calibrator flows
79  dev.openTag(altTag).writeAttr(SUMO_ATTR_ID, id);
80  }
81  if (typeID == "") {
84  }
85  } else {
86  dev.writeAttr(SUMO_ATTR_TYPE, typeID);
87  }
88  // write depart depending of tag
89  if (altTag == SUMO_TAG_FLOW
90  || altTag == SUMO_TAG_PERSONFLOW
91  || altTag == SUMO_TAG_CONTAINERFLOW
92  || altTag == GNE_TAG_FLOW_ROUTE
93  || altTag == GNE_TAG_FLOW_WITHROUTE
94  || altTag == SUMO_TAG_FLOWSTATE) {
96  } else {
98  }
99  // optional parameter
100  // departlane
101  if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
103  } else if (oc.exists("departlane") && oc.isSet("departlane")) {
104  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
105  }
106  // departpos
107  if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
109  } else if (oc.exists("departpos") && oc.isSet("departpos")) {
110  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
111  }
112  // departPosLat
115  }
116  // departspeed
117  if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
119  } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
120  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
121  }
122  // departedge
123  if (wasSet(VEHPARS_DEPARTEDGE_SET) && !defaultOptionOverrides(oc, "departedge")) {
125  } else if (oc.exists("departedge") && oc.isSet("departedge")) {
126  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTEDGE, oc.getString("departedge"));
127  }
128  // arrivallane
129  if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
131  } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
132  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
133  }
134  // arrivalpos
135  if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
137  } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
138  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
139  }
140  // arrivalPosLat
143  }
144  // arrivalspeed
145  if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
147  } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
148  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
149  }
150  // arrivalEdge
151  if (wasSet(VEHPARS_ARRIVALEDGE_SET) && !defaultOptionOverrides(oc, "arrivaledge") && arrivalEdge >= 0) {
153  } else if (oc.exists("arrivaledge") && oc.isSet("arrivaledge")) {
154  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALEDGE, oc.getString("arrivaledge"));
155  }
156  // color
157  if (wasSet(VEHPARS_COLOR_SET)) {
159  }
160  // line
161  if (wasSet(VEHPARS_LINE_SET)) {
163  }
164  // from TAZ
167  }
168  // to TAZ
169  if (wasSet(VEHPARS_TO_TAZ_SET)) {
171  }
172  // person number
175  }
176  // container number
179  }
180  // individual speedFactor
182  // might be saving state with custom precision
183  const int precision = dev.precision();
184  dev.setPrecision(MAX2(gPrecisionRandom, precision));
186  dev.setPrecision(precision);
187  }
188  // speed (only used by calibrators)
191  }
192  // speed (only used by calibrators)
193  if (insertionChecks != (int)InsertionCheck::ALL) {
194  std::vector<std::string> checks;
196  checks.push_back(toString(InsertionCheck::NONE));
197  } else {
198  for (auto it : SUMOXMLDefinitions::InsertionChecks.getValues()) {
199  if (((int)it & insertionChecks) != 0) {
200  checks.push_back(toString(it));
201  }
202  }
203  }
205  }
206  // parking access rights
209  }
210 }
211 
212 
213 void
214 SUMOVehicleParameter::Stop::write(OutputDevice& dev, const bool close, const bool writeTagAndParents) const {
215  if (writeTagAndParents) {
216  dev.openTag(SUMO_TAG_STOP);
217  if (busstop != "") {
219  }
220  if (containerstop != "") {
222  }
223  if (chargingStation != "") {
225  }
226  if (parkingarea != "") {
228  }
229  if ((busstop == "") && (containerstop == "") && (parkingarea == "") && (chargingStation == "")) {
230  if (lane != "") {
232  } else {
234  }
235  if ((parametersSet & STOP_START_SET) != 0) {
237  }
238  if ((parametersSet & STOP_END_SET) != 0) {
240  }
241  }
242  }
243  if ((parametersSet & STOP_POSLAT_SET) != 0 && posLat != INVALID_DOUBLE) {
245  }
246  if ((parametersSet & STOP_ARRIVAL_SET) && (arrival >= 0)) {
248  }
249  if ((parametersSet & STOP_DURATION_SET) && (duration >= 0)) {
251  }
252  if ((parametersSet & STOP_UNTIL_SET) && (until >= 0)) {
254  }
255  if ((parametersSet & STOP_STARTED_SET) && (started >= 0)) {
257  }
258  if ((parametersSet & STOP_ENDED_SET) && (ended >= 0)) {
260  }
261  if ((parametersSet & STOP_EXTENSION_SET) && (extension >= 0)) {
263  }
264  if ((parametersSet & STOP_TRIGGER_SET) != 0) {
265  const std::vector<std::string> triggers = getTriggers();
266  if (triggers.size() > 0) {
267  dev.writeAttr(SUMO_ATTR_TRIGGERED, triggers);
268  }
269  }
270  if ((parametersSet & STOP_PARKING_SET) != 0) {
272  }
273  if ((parametersSet & STOP_EXPECTED_SET) != 0 && awaitedPersons.size() > 0) {
275  }
276  if ((parametersSet & STOP_PERMITTED_SET) != 0 && permitted.size() > 0) {
278  }
279  if ((parametersSet & STOP_EXPECTED_CONTAINERS_SET) != 0 && awaitedContainers.size() > 0) {
281  }
282  if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
284  }
285  if ((parametersSet & STOP_LINE_SET) != 0) {
287  }
288  if ((parametersSet & STOP_SPLIT_SET) != 0) {
290  }
291  if ((parametersSet & STOP_JOIN_SET) != 0) {
293  }
294  if ((parametersSet & STOP_SPEED_SET) != 0) {
296  }
297  if ((parametersSet & STOP_ONDEMAND_SET) != 0) {
299  }
300  if ((parametersSet & STOP_JUMP_SET) != 0 && jump >= 0) {
302  }
303  if (collision) {
305  }
306  // only write friendly position if is true
307  if (friendlyPos) {
309  }
310  // only write act type if isn't empty
311  if (!actType.empty()) {
313  }
314  if (close) {
315  // the user is closing the stop it is responsible for writing params
316  writeParams(dev);
317  dev.closeTag();
318  }
319 }
320 
321 std::vector<std::string>
323  std::vector<std::string> result;
324  if (busstop != "") {
325  result.push_back(busstop);
326  }
327  if (containerstop != "") {
328  result.push_back(containerstop);
329  }
330  if (chargingStation != "") {
331  result.push_back(chargingStation);
332  }
333  if (parkingarea != "") {
334  result.push_back(parkingarea);
335  }
336  return result;
337 }
338 
339 bool
340 SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
341  SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr) {
342  if (val == "triggered") {
344  } else if (val == "containerTriggered") {
346  } else if (val == "now") {
347  // only used via TraCI. depart must be set by the calling code
349  } else if (val == "split") {
351  } else if (val == "begin") {
353  } else {
354  try {
355  depart = string2time(val);
357  if (depart < 0) {
358  error = "Negative " + attr + " time in the definition of " + element + " '" + id + "'.";
359  return false;
360  }
361  } catch (...) {
362  if (id.empty()) {
363  error = "Invalid " + attr + " time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
364  } else {
365  error = "Invalid " + attr + " time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
366  }
367  return false;
368  }
369  }
370  return true;
371 }
372 
373 
374 bool
375 SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
376  int& lane, DepartLaneDefinition& dld, std::string& error) {
377  bool ok = true;
378  lane = 0;
380  if (val == "random") {
382  } else if (val == "free") {
384  } else if (val == "allowed") {
386  } else if (val == "best") {
388  } else if (val == "first") {
390  } else {
391  try {
392  lane = StringUtils::toInt(val);
393  if (lane < 0) {
394  ok = false;
395  }
396  } catch (...) {
397  ok = false;
398  }
399  }
400  if (!ok) {
401  if (id.empty()) {
402  error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
403  } else {
404  error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
405  }
406  }
407  return ok;
408 }
409 
410 
411 bool
412 SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
413  double& pos, DepartPosDefinition& dpd, std::string& error) {
414  bool ok = true;
415  pos = 0.;
417  if (val == "random") {
419  } else if (val == "random_free") {
421  } else if (val == "random_location") {
423  } else if (val == "free") {
425  } else if (val == "base") {
427  } else if (val == "last") {
429  } else if (val == "splitFront") {
431  } else if (val == "stop") {
433  } else {
434  try {
435  pos = StringUtils::toDouble(val);
436  } catch (...) {
437  ok = false;
438  }
439  }
440  if (!ok) {
441  if (id.empty()) {
442  error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
443  } else {
444  error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
445  }
446  }
447  return ok;
448 }
449 
450 
451 bool
452 SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
453  double& pos, DepartPosLatDefinition& dpd, std::string& error) {
454  bool ok = true;
455  pos = 0.;
457  if (val == "random") {
459  } else if (val == "random_free") {
461  } else if (val == "free") {
463  } else if (val == "right") {
465  } else if (val == "center") {
467  } else if (val == "left") {
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 departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
479  } else {
480  error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
481  }
482  }
483  return ok;
484 }
485 
486 
487 bool
488 SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
489  double& speed, DepartSpeedDefinition& dsd, std::string& error) {
490  bool ok = true;
491  speed = -1.;
493  if (val == "random") {
495  } else if (val == "max") {
497  } else if (val == "desired") {
499  } else if (val == "speedLimit") {
501  } else if (val == "last") {
503  } else if (val == "avg") {
505  } else {
506  try {
507  speed = StringUtils::toDouble(val);
508  if (speed < 0) {
509  ok = false;
510  }
511  } catch (...) {
512  ok = false;
513  }
514  }
515  if (!ok) {
516  if (id.empty()) {
517  error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
518  } else {
519  error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
520  }
521  }
522  return ok;
523 }
524 
525 
526 bool
527 SUMOVehicleParameter::parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
528  const SumoXMLAttr attr, int& edgeIndex, RouteIndexDefinition& rid, std::string& error) {
529  bool ok = true;
530  edgeIndex = -1;
532  if (val == "random") {
534  } else {
535  try {
536  edgeIndex = StringUtils::toInt(val);
537  if (edgeIndex < 0) {
538  ok = false;
539  }
540  } catch (...) {
541  ok = false;
542  }
543  }
544  if (!ok) {
545  if (id.empty()) {
546  error = "Invalid " + toString(attr) + " definition for " + element + ". Must be one of (\"random\", \"free\", or an int>=0)";
547  } else {
548  error = "Invalid " + toString(attr) + " definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", or an int>=0)";
549  }
550  }
551  return ok;
552 }
553 
554 
555 bool
556 SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
557  int& lane, ArrivalLaneDefinition& ald, std::string& error) {
558  bool ok = true;
559  lane = 0;
561  if (val == "current") {
563  } else if (val == "random") {
565  } else if (val == "first") {
567  } else {
568  try {
569  lane = StringUtils::toInt(val);
570  if (lane < 0) {
571  ok = false;
572  }
573  } catch (...) {
574  ok = false;
575  }
576  }
577  if (!ok) {
578  if (id.empty()) {
579  error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
580  } else {
581  error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
582  }
583  }
584  return ok;
585 }
586 
587 
588 bool
589 SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
590  double& pos, ArrivalPosDefinition& apd, std::string& error) {
591  bool ok = true;
592  pos = 0.;
594  if (val == "random") {
596  } else if (val == "center") {
598  } else if (val == "max") {
600  } else {
601  try {
602  pos = StringUtils::toDouble(val);
603  } catch (...) {
604  ok = false;
605  }
606  }
607  if (!ok) {
608  if (id.empty()) {
609  error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
610  } else {
611  error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
612  }
613  }
614  return ok;
615 }
616 
617 
618 bool
619 SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
620  double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
621  bool ok = true;
622  pos = 0.;
624  if (val == "right") {
626  } else if (val == "center") {
628  } else if (val == "left") {
630  } else {
631  try {
632  pos = StringUtils::toDouble(val);
633  } catch (...) {
634  ok = false;
635  }
636  }
637  if (!ok) {
638  if (id.empty()) {
639  error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
640  } else {
641  error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
642  }
643  }
644  return ok;
645 }
646 
647 
648 bool
649 SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
650  double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
651  bool ok = true;
652  speed = -1.;
654  if (val == "current") {
656  } else {
657  try {
658  speed = StringUtils::toDouble(val);
659  if (speed < 0) {
660  ok = false;
661  }
662  } catch (...) {
663  ok = false;
664  }
665  }
666  if (!ok) {
667  if (id.empty()) {
668  error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
669  } else {
670  error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
671  }
672  }
673  return ok;
674 }
675 
676 
677 double
678 SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent) {
679  if (pos < 0) {
680  pos = maximumValue + pos;
681  }
682  if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
683  if (!silent) {
684  WRITE_WARNINGF(TL("Invalid % % given for %. Using edge end instead."), toString(attr), toString(pos), id);
685  }
686  pos = maximumValue;
687  }
688  return pos;
689 }
690 
691 
692 bool
693 SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
694  // separte modes in different strings, and check if modes are valid
695  for (StringTokenizer st(modes); st.hasNext();) {
696  const std::string mode = st.next();
697  if (mode == "car") {
698  modeSet |= SVC_PASSENGER;
699  } else if (mode == "taxi") {
700  modeSet |= SVC_TAXI;
701  } else if (mode == "bicycle") {
702  modeSet |= SVC_BICYCLE;
703  } else if (mode == "public") {
704  modeSet |= SVC_BUS;
705  } else {
706  if (id.empty()) {
707  error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
708  } else {
709  error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
710  }
711  return false;
712  }
713  }
714  return true;
715 }
716 
717 
718 void
719 SUMOVehicleParameter::parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop) {
720  if (triggers.size() == 0 && expectTrigger) {
721  stop.triggered = true;
722  }
723  for (std::string val : triggers) {
724  if (val == toString(SUMO_TAG_PERSON)) {
725  stop.triggered = true;
726  } else if (val == toString(SUMO_TAG_CONTAINER)) {
727  stop.containerTriggered = true;
728  } else if (val == toString(SUMO_ATTR_JOIN)) {
729  stop.joinTriggered = true;
730  } else {
731  try {
732  stop.triggered = StringUtils::toBool(val);
733  } catch (BoolFormatException&) {
734  WRITE_ERROR(TL("Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean"));
735  }
736  }
737  }
738 }
739 
740 
742 SUMOVehicleParameter::parseParkingType(const std::string& value) {
743  if (value == toString(ParkingType::OPPORTUNISTIC)) {
745  } else {
747  }
748 }
749 
750 
751 std::vector<std::string>
753  std::vector<std::string> triggers;
754  if (triggered) {
755  triggers.push_back(toString(SUMO_TAG_PERSON));
756  }
757  if (containerTriggered) {
758  triggers.push_back(toString(SUMO_TAG_CONTAINER));
759  }
760  if (joinTriggered) {
761  triggers.push_back(toString(SUMO_ATTR_JOIN));
762  }
763  return triggers;
764 }
765 
766 int
768  return (((parking == ParkingType::OFFROAD) ? 1 : 0) +
769  (triggered ? 2 : 0) +
770  (containerTriggered ? 4 : 0) +
771  (busstop != "" ? 8 : 0) +
772  (containerstop != "" ? 16 : 0) +
773  (chargingStation != "" ? 32 : 0) +
774  (parkingarea != "" ? 64 : 0) +
775  (overheadWireSegment != "" ? 128 : 0));
776 }
777 
778 
779 std::string
782  return "triggered";
784  return "containerTriggered";
785 // } else if (departProcedure == DepartDefinition::NOW) { // TODO check whether this is useful in XML input (currently TraCI only)
786 // return "now";
788  return "split";
790  return "begin";
791  } else {
792  return time2string(depart);
793  }
794 }
795 
796 
797 std::string
799  std::string val;
800  switch (departLaneProcedure) {
802  val = toString(departLane);
803  break;
805  val = "random";
806  break;
808  val = "free";
809  break;
811  val = "allowed";
812  break;
814  val = "best";
815  break;
817  val = "first";
818  break;
820  default:
821  break;
822  }
823  return val;
824 }
825 
826 
827 std::string
829  std::string val;
830  switch (departPosProcedure) {
832  val = toString(departPos);
833  break;
836  break;
838  val = "random";
839  break;
841  val = "random_free";
842  break;
844  val = "random_location";
845  break;
847  val = "free";
848  break;
850  val = "last";
851  break;
853  val = "base";
854  break;
856  val = "splitFront";
857  break;
859  val = "stop";
860  break;
862  default:
863  break;
864  }
865  return val;
866 }
867 
868 
869 std::string
871  std::string val;
872  switch (departPosLatProcedure) {
874  val = toString(departPosLat);
875  break;
878  break;
880  val = "random";
881  break;
883  val = "random_free";
884  break;
886  val = "free";
887  break;
889  val = "right";
890  break;
892  val = "center";
893  break;
895  val = "left";
896  break;
898  default:
899  break;
900  }
901  return val;
902 }
903 
904 
905 std::string
907  std::string val;
908  switch (departSpeedProcedure) {
910  val = toString(departSpeed);
911  break;
914  break;
916  val = "random";
917  break;
919  val = "max";
920  break;
922  val = "desired";
923  break;
925  val = "speedLimit";
926  break;
928  val = "last";
929  break;
931  val = "avg";
932  break;
934  default:
935  break;
936  }
937  return val;
938 }
939 
940 
941 std::string
943  std::string val;
944  switch (departEdgeProcedure) {
946  val = toString(departEdge);
947  break;
949  val = "random";
950  break;
952  default:
953  break;
954  }
955  return val;
956 }
957 
958 std::string
960  std::string val;
961  switch (arrivalEdgeProcedure) {
963  val = toString(arrivalEdge);
964  break;
966  val = "random";
967  break;
969  default:
970  break;
971  }
972  return val;
973 }
974 
975 
976 
977 
978 std::string
980  std::string val;
981  switch (arrivalLaneProcedure) {
983  val = toString(arrivalLane);
984  break;
986  val = "current";
987  break;
989  val = "random";
990  break;
992  val = "first";
993  break;
995  default:
996  break;
997  }
998  return val;
999 }
1000 
1001 
1002 std::string
1004  std::string val;
1005  switch (arrivalPosProcedure) {
1007  val = toString(arrivalPos);
1008  break;
1010  val = "random";
1011  break;
1013  val = "center";
1014  break;
1016  val = "max";
1017  break;
1019  default:
1020  break;
1021  }
1022  return val;
1023 }
1024 
1025 
1026 std::string
1028  std::string val;
1029  switch (arrivalPosLatProcedure) {
1031  val = toString(arrivalPosLat);
1032  break;
1034  val = "right";
1035  break;
1037  val = "center";
1038  break;
1040  val = "left";
1041  break;
1043  default:
1044  break;
1045  }
1046  return val;
1047 }
1048 
1049 
1050 std::string
1052  std::string val;
1053  switch (arrivalSpeedProcedure) {
1055  val = toString(arrivalSpeed);
1056  break;
1058  val = "current";
1059  break;
1061  default:
1062  break;
1063  }
1064  return val;
1065 }
1066 
1067 
1068 void
1070  repetitionsDone++;
1071  // equidistant or exponential offset (for poisson distributed arrivals)
1072  if (repetitionProbability < 0) {
1073  if (repetitionOffset >= 0) {
1074  repetitionTotalOffset += (SUMOTime)((double)repetitionOffset / scale);
1075  } else {
1076  assert(poissonRate > 0);
1077  // we need to cache this do avoid double generation of the rng in the TIME2STEPS macro
1078  const double r = RandHelper::randExp(poissonRate, rng);
1079  repetitionTotalOffset += TIME2STEPS(r / scale);
1080  }
1081  }
1082 }
1083 
1084 
1085 std::string
1087  if ((insertionChecks == 0) || (insertionChecks == (int)InsertionCheck::ALL)) {
1089  } else {
1090  std::vector<std::string> insertionChecksStrs;
1091  const auto insertionCheckValues = SUMOXMLDefinitions::InsertionChecks.getValues();
1092  // iterate over values
1093  for (const auto insertionCheckValue : insertionCheckValues) {
1094  if ((insertionCheckValue != InsertionCheck::ALL) && (insertionChecks & (int)insertionCheckValue) != 0) {
1095  insertionChecksStrs.push_back(SUMOXMLDefinitions::InsertionChecks.getString(insertionCheckValue));
1096  }
1097  }
1098  return toString(insertionChecksStrs);
1099  }
1100 }
1101 
1102 
1103 bool
1104 SUMOVehicleParameter::areInsertionChecksValid(const std::string& value) const {
1105  if (value.empty()) {
1106  return true;
1107  } else {
1108  // split value in substrinsg
1109  StringTokenizer valueStrs(value, " ");
1110  // iterate over values
1111  while (valueStrs.hasNext()) {
1112  if (!SUMOXMLDefinitions::InsertionChecks.hasString(valueStrs.next())) {
1113  return false;
1114  }
1115  }
1116  return true;
1117  }
1118 }
1119 
1120 
1121 void
1123  // first reset insertionChecks
1124  insertionChecks = 0;
1125  if (value.empty()) {
1127  } else {
1128  // split value in substrinsg
1129  StringTokenizer insertionCheckStrs(value, " ");
1130  while (insertionCheckStrs.hasNext()) {
1131  insertionChecks |= (int)SUMOXMLDefinitions::InsertionChecks.get(insertionCheckStrs.next());
1132  }
1133  }
1134 }
1135 
1136 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
@ DEFAULT
default cursor
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:304
#define TL(string)
Definition: MsgHandler.h:315
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition: SUMOTime.cpp:69
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_VTYPE_ID
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const int VEHPARS_DEPARTEDGE_SET
const int VEHPARS_ARRIVALEDGE_SET
const int VEHPARS_PARKING_BADGES_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 VEHPARS_COLOR_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.
const int VEHPARS_TO_TAZ_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.
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_UNTIL_SET
const int VEHPARS_SPEEDFACTOR_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 int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_SET
const int STOP_PERMITTED_SET
const int VEHPARS_ARRIVALLANE_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 VEHPARS_DEPARTLANE_SET
const int STOP_SPLIT_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int STOP_START_SET
const int VEHPARS_FROM_TAZ_SET
const int STOP_JOIN_SET
const int VEHPARS_ARRIVALSPEED_SET
const int VEHPARS_CALIBRATORSPEED_SET
const int STOP_EXTENSION_SET
const int STOP_ENDED_SET
const int STOP_TRIGGER_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 VEHPARS_LINE_SET
const int STOP_STARTED_SET
const int VEHPARS_PERSON_NUMBER_SET
const int STOP_EXPECTED_CONTAINERS_SET
const int VEHPARS_DEPARTSPEED_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 int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_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.
const int VEHPARS_DEPARTPOSLAT_SET
InsertionCheck
different checking levels for vehicle insertion
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_FLOWSTATE
a flow state definition (used when saving and loading simulatino state)
@ SUMO_TAG_STOP
stop for vehicles
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_PERSON
@ SUMO_TAG_PERSONFLOW
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_PARKING
@ SUMO_ATTR_EXTENSION
@ SUMO_ATTR_ARRIVALSPEED
@ SUMO_ATTR_LANE
@ SUMO_ATTR_ARRIVALLANE
@ SUMO_ATTR_DEPART
@ SUMO_ATTR_DEPARTEDGE
@ SUMO_ATTR_COLLISION
@ SUMO_ATTR_ARRIVALEDGE
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_STARTED
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_PARKING_AREA
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_PARKING_BADGES
@ SUMO_ATTR_BUS_STOP
@ SUMO_ATTR_ENDPOS
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_SPLIT
@ SUMO_ATTR_ACTTYPE
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_EXPECTED
@ SUMO_ATTR_LINE
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_ENDED
@ SUMO_ATTR_ONDEMAND
@ SUMO_ATTR_ARRIVAL
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_DEPARTSPEED
@ SUMO_ATTR_TRIP_ID
@ SUMO_ATTR_PERMITTED
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_DEPARTLANE
@ SUMO_ATTR_JOIN
@ SUMO_ATTR_JUMP
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_SPEEDFACTOR
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_UNTIL
@ SUMO_ATTR_ARRIVALPOS_LAT
@ SUMO_ATTR_INSERTIONCHECKS
@ SUMO_ATTR_TRIGGERED
@ SUMO_ATTR_DURATION
int gPrecision
the precision for floating point outputs
Definition: StdDefs.cpp:26
int gPrecisionRandom
Definition: StdDefs.cpp:28
const double INVALID_DOUBLE
invalid double
Definition: StdDefs.h:64
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Definition: ToString.h:283
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A storage for options typed value containers)
Definition: OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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"
Definition: OutputDevice.h:306
int precision()
return precision set on the device
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
static double randExp(double rate, SumoRNG *rng=nullptr)
Access to a random number from an exponential distribution.
Definition: RandHelper.cpp:150
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.
int parametersSet
Information for the output which parameter were set.
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)
void parseInsertionChecks(const std::string &value)
parses insertion checks
SUMOVehicleParameter()
Constructor.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
int repetitionsDone
The number of times the vehicle was already inserted.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOTime repetitionTotalOffset
The offset between depart and the time for the next vehicle insertions.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
double poissonRate
The rate for emitting vehicles with a poisson distribution.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
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
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.
bool wasSet(int what) const
Returns whether the given parameter was set.
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
std::vector< T > getValues() const
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')
Definition: StringUtils.cpp:67
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
Definition: json.hpp:4451