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.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // Structure representing possible vehicle parameter
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include <config.h>
29 #include <utils/common/ToString.h>
32 
33 #include "SUMOVehicleParameter.h"
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(DEPART_GIVEN),
42  departLane(0), departLaneProcedure(DEPART_LANE_DEFAULT),
43  departPos(0), departPosProcedure(DEPART_POS_DEFAULT),
44  departPosLat(0), departPosLatProcedure(DEPART_POSLAT_DEFAULT),
45  departSpeed(-1), departSpeedProcedure(DEPART_SPEED_DEFAULT),
46  arrivalLane(0), arrivalLaneProcedure(ARRIVAL_LANE_DEFAULT),
47  arrivalPos(0), arrivalPosProcedure(ARRIVAL_POS_DEFAULT),
48  arrivalPosLat(0), arrivalPosLatProcedure(ARRIVAL_POSLAT_DEFAULT),
49  arrivalSpeed(-1), arrivalSpeedProcedure(ARRIVAL_SPEED_DEFAULT),
50  repetitionNumber(-1), repetitionsDone(-1), repetitionOffset(-1), repetitionProbability(-1), repetitionEnd(-1),
51  line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0), parametersSet(0) {
52 }
53 
54 
56 }
57 
58 
59 bool
60 SUMOVehicleParameter::defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const {
61  return oc.exists(optionName) && oc.isSet(optionName) && oc.getBool("defaults-override");
62 }
63 
64 
65 void
66 SUMOVehicleParameter::write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag, const std::string& typeID) const {
67  dev.openTag(tag).writeAttr(SUMO_ATTR_ID, id);
68  if (typeID == "") {
71  }
72  } else {
73  dev.writeAttr(SUMO_ATTR_TYPE, typeID);
74  }
75  // write depart depending of tag
76  if ((tag == SUMO_TAG_FLOW) || (tag == SUMO_TAG_PERSONFLOW)) {
78  } else {
80  }
81  // optional parameter
82  // departlane
83  if (wasSet(VEHPARS_DEPARTLANE_SET) && !defaultOptionOverrides(oc, "departlane")) {
85  } else if (oc.exists("departlane") && oc.isSet("departlane")) {
86  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTLANE, oc.getString("departlane"));
87  }
88  // departpos
89  if (wasSet(VEHPARS_DEPARTPOS_SET) && !defaultOptionOverrides(oc, "departpos")) {
91  } else if (oc.exists("departpos") && oc.isSet("departpos")) {
92  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTPOS, oc.getString("departpos"));
93  }
94  // departPosLat
97  }
98 
99  // departspeed
100  if (wasSet(VEHPARS_DEPARTSPEED_SET) && !defaultOptionOverrides(oc, "departspeed")) {
102  } else if (oc.exists("departspeed") && oc.isSet("departspeed")) {
103  dev.writeNonEmptyAttr(SUMO_ATTR_DEPARTSPEED, oc.getString("departspeed"));
104  }
105  // arrivallane
106  if (wasSet(VEHPARS_ARRIVALLANE_SET) && !defaultOptionOverrides(oc, "arrivallane")) {
108  } else if (oc.exists("arrivallane") && oc.isSet("arrivallane")) {
109  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALLANE, oc.getString("arrivallane"));
110  }
111  // arrivalpos
112  if (wasSet(VEHPARS_ARRIVALPOS_SET) && !defaultOptionOverrides(oc, "arrivalpos")) {
114  } else if (oc.exists("arrivalpos") && oc.isSet("arrivalpos")) {
115  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALPOS, oc.getString("arrivalpos"));
116  }
117  // arrivalPosLat
120  }
121  // arrivalspeed
122  if (wasSet(VEHPARS_ARRIVALSPEED_SET) && !defaultOptionOverrides(oc, "arrivalspeed")) {
124  } else if (oc.exists("arrivalspeed") && oc.isSet("arrivalspeed")) {
125  dev.writeNonEmptyAttr(SUMO_ATTR_ARRIVALSPEED, oc.getString("arrivalspeed"));
126  }
127  // color
128  if (wasSet(VEHPARS_COLOR_SET)) {
130  }
131  // line
132  if (wasSet(VEHPARS_LINE_SET)) {
134  }
135  // from TAZ
138  }
139  // to TAZ
140  if (wasSet(VEHPARS_TO_TAZ_SET)) {
142  }
143  // person number
146  }
147  // container number
150  }
151 }
152 
153 
155  Parameterised(),
156  startPos(0),
157  endPos(0),
158  duration(0),
159  until(0),
160  triggered(false),
161  containerTriggered(false),
162  parking(false) {
163 }
164 
165 
166 void
168  dev.openTag(SUMO_TAG_STOP);
169  if (busstop != "") {
171  }
172  if (containerstop != "") {
174  }
175  if (parkingarea != "") {
177  }
178  if (busstop == "" && containerstop == "" && parkingarea == "") {
180  if ((parametersSet & STOP_START_SET) != 0) {
182  }
183  if ((parametersSet & STOP_END_SET) != 0) {
185  }
186  }
187  if (duration >= 0) {
189  }
190  if (until >= 0) {
192  }
193  if ((parametersSet & STOP_TRIGGER_SET) != 0) {
195  }
198  }
199  if ((parametersSet & STOP_PARKING_SET) != 0) {
201  }
202  if ((parametersSet & STOP_EXPECTED_SET) != 0) {
204  }
207  }
208  if ((parametersSet & STOP_TRIP_ID_SET) != 0) {
210  }
211  if ((parametersSet & STOP_LINE_SET) != 0) {
213  }
214  dev.closeTag();
215 }
216 
217 
218 bool
219 SUMOVehicleParameter::parseDepart(const std::string& val, const std::string& element, const std::string& id,
220  SUMOTime& depart, DepartDefinition& dd, std::string& error) {
221  if (val == "triggered") {
222  dd = DEPART_TRIGGERED;
223  } else if (val == "containerTriggered") {
225  } else if (val == "now") {
226  // only used via TraCI. depart must be set by the calling code
227  dd = DEPART_NOW;
228  } else {
229  try {
230  depart = string2time(val);
231  dd = DEPART_GIVEN;
232  if (depart < 0) {
233  error = "Negative departure time in the definition of '" + id + "'.";
234  return false;
235  }
236  } catch (...) {
237  if (id.empty()) {
238  error = "Invalid departure time for " + element + ". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
239  } else {
240  error = "Invalid departure time for " + element + " '" + id + "';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
241  }
242  return false;
243  }
244  }
245  return true;
246 }
247 
248 
249 bool
250 SUMOVehicleParameter::parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
251  int& lane, DepartLaneDefinition& dld, std::string& error) {
252  bool ok = true;
253  if (val == "random") {
254  dld = DEPART_LANE_RANDOM;
255  } else if (val == "free") {
256  dld = DEPART_LANE_FREE;
257  } else if (val == "allowed") {
259  } else if (val == "best") {
260  dld = DEPART_LANE_BEST_FREE;
261  } else if (val == "first") {
263  } else {
264  try {
265  lane = StringUtils::toInt(val);
266  dld = DEPART_LANE_GIVEN;
267  if (lane < 0) {
268  ok = false;
269  }
270  } catch (...) {
271  ok = false;
272  lane = 0;
273  }
274  }
275  if (!ok) {
276  if (id.empty()) {
277  error = "Invalid departLane definition for " + element + ". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
278  } else {
279  error = "Invalid departLane definition for " + element + " '" + id + "';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
280  }
281  }
282  return ok;
283 }
284 
285 
286 bool
287 SUMOVehicleParameter::parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
288  double& pos, DepartPosDefinition& dpd, std::string& error) {
289  bool ok = true;
290  if (val == "random") {
291  dpd = DEPART_POS_RANDOM;
292  } else if (val == "random_free") {
294  } else if (val == "free") {
295  dpd = DEPART_POS_FREE;
296  } else if (val == "base") {
297  dpd = DEPART_POS_BASE;
298  } else if (val == "last") {
299  dpd = DEPART_POS_LAST;
300  } else {
301  try {
302  pos = StringUtils::toDouble(val);
303  dpd = DEPART_POS_GIVEN;
304  } catch (...) {
305  ok = false;
306  pos = 0;
307  }
308  }
309  if (!ok) {
310  if (id.empty()) {
311  error = "Invalid departPos definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
312  } else {
313  error = "Invalid departPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
314  }
315  }
316  return ok;
317 }
318 
319 
320 bool
321 SUMOVehicleParameter::parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
322  double& pos, DepartPosLatDefinition& dpd, std::string& error) {
323  bool ok = true;
324  if (val == "random") {
325  dpd = DEPART_POSLAT_RANDOM;
326  } else if (val == "random_free") {
328  } else if (val == "free") {
329  dpd = DEPART_POSLAT_FREE;
330  } else if (val == "right") {
331  dpd = DEPART_POSLAT_RIGHT;
332  } else if (val == "center") {
333  dpd = DEPART_POSLAT_CENTER;
334  } else if (val == "left") {
335  dpd = DEPART_POSLAT_LEFT;
336  } else {
337  try {
338  pos = StringUtils::toDouble(val);
339  dpd = DEPART_POSLAT_GIVEN;
340  } catch (...) {
341  ok = false;
342  pos = 0;
343  }
344  }
345  if (!ok) {
346  if (id.empty()) {
347  error = "Invalid departPosLat definition for " + element + ". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
348  } else {
349  error = "Invalid departPosLat definition for " + element + " '" + id + "';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
350  }
351  }
352  return ok;
353 }
354 
355 
356 bool
357 SUMOVehicleParameter::parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
358  double& speed, DepartSpeedDefinition& dsd, std::string& error) {
359  bool ok = true;
360  if (val == "random") {
361  dsd = DEPART_SPEED_RANDOM;
362  } else if (val == "max") {
363  dsd = DEPART_SPEED_MAX;
364  } else if (val == "desired") {
365  dsd = DEPART_SPEED_DESIRED;
366  } else if (val == "speedLimit") {
367  dsd = DEPART_SPEED_LIMIT;
368  } else {
369  try {
370  speed = StringUtils::toDouble(val);
371  dsd = DEPART_SPEED_GIVEN;
372  if (speed < 0) {
373  ok = false;
374  }
375  } catch (...) {
376  ok = false;
377  speed = -1;
378  }
379  }
380  if (!ok) {
381  if (id.empty()) {
382  error = "Invalid departSpeed definition for " + element + ". Must be one of (\"random\", \"max\", or a float>=0)";
383  } else {
384  error = "Invalid departSpeed definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float>=0)";
385  }
386  }
387  return ok;
388 }
389 
390 
391 bool
392 SUMOVehicleParameter::parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
393  int& lane, ArrivalLaneDefinition& ald, std::string& error) {
394  bool ok = true;
395  if (val == "current") {
396  ald = ARRIVAL_LANE_CURRENT;
397  } else {
398  try {
399  lane = StringUtils::toInt(val);
400  ald = ARRIVAL_LANE_GIVEN;
401  if (lane < 0) {
402  ok = false;
403  }
404  } catch (...) {
405  ok = false;
406  lane = 0;
407  }
408  }
409  if (!ok) {
410  if (id.empty()) {
411  error = "Invalid arrivalLane definition for " + element + ". Must be one of (\"current\", or an int>=0)";
412  } else {
413  error = "Invalid arrivalLane definition for " + element + " '" + id + "';\n must be one of (\"current\", or an int>=0)";
414  }
415  }
416  return ok;
417 }
418 
419 
420 bool
421 SUMOVehicleParameter::parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
422  double& pos, ArrivalPosDefinition& apd, std::string& error) {
423  bool ok = true;
424  if (val == "random") {
425  apd = ARRIVAL_POS_RANDOM;
426  } else if (val == "center") {
427  apd = ARRIVAL_POS_CENTER;
428  } else if (val == "max") {
429  apd = ARRIVAL_POS_MAX;
430  } else {
431  try {
432  pos = StringUtils::toDouble(val);
433  apd = ARRIVAL_POS_GIVEN;
434  } catch (...) {
435  ok = false;
436  pos = 0;
437  }
438  }
439  if (!ok) {
440  if (id.empty()) {
441  error = "Invalid arrivalPos definition for " + element + ". Must be one of (\"random\", \"max\", or a float)";
442  } else {
443  error = "Invalid arrivalPos definition for " + element + " '" + id + "';\n must be one of (\"random\", \"max\", or a float)";
444  }
445  }
446  return ok;
447 }
448 
449 
450 bool
451 SUMOVehicleParameter::parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
452  double& pos, ArrivalPosLatDefinition& apd, std::string& error) {
453  bool ok = true;
454  if (val == "right") {
455  apd = ARRIVAL_POSLAT_RIGHT;
456  } else if (val == "center") {
457  apd = ARRIVAL_POSLAT_CENTER;
458  } else if (val == "left") {
459  apd = ARRIVAL_POSLAT_LEFT;
460  } else {
461  try {
462  pos = StringUtils::toDouble(val);
463  apd = ARRIVAL_POSLAT_GIVEN;
464  } catch (...) {
465  ok = false;
466  pos = 0;
467  }
468  }
469  if (!ok) {
470  if (id.empty()) {
471  error = "Invalid arrivalPosLat definition for " + element + ". Must be one of (\"right\", \"center\", \"left\", or a float)";
472  } else {
473  error = "Invalid arrivalPosLat definition for " + element + " '" + id + "';\n must be one of (\"right\", \"center\", \"left\", or a float)";
474  }
475  }
476  return ok;
477 }
478 
479 
480 bool
481 SUMOVehicleParameter::parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
482  double& speed, ArrivalSpeedDefinition& asd, std::string& error) {
483  bool ok = true;
484  if (val == "current") {
485  asd = ARRIVAL_SPEED_CURRENT;
486  } else {
487  try {
488  speed = StringUtils::toDouble(val);
489  if (speed < 0) {
490  ok = false;
491  }
492  asd = ARRIVAL_SPEED_GIVEN;
493  } catch (...) {
494  ok = false;
495  speed = -1;
496  }
497  }
498  if (!ok) {
499  if (id.empty()) {
500  error = "Invalid arrivalSpeed definition for " + element + ". Must be one of (\"current\", or a float>=0)";
501  } else {
502  error = "Invalid arrivalSpeed definition for " + element + " '" + id + "';\n must be one of (\"current\", or a float>=0)";
503  }
504  }
505  return ok;
506 }
507 
508 
509 double
510 SUMOVehicleParameter::interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id) {
511  if (pos < 0) {
512  pos = maximumValue + pos;
513  }
514  if (pos > maximumValue) {
515  WRITE_WARNING("Invalid " + toString(attr) + " " + toString(pos) + " given for " + id + ". Using edge end instead.");
516  pos = maximumValue;
517  }
518  return pos;
519 }
520 
521 
522 bool
523 SUMOVehicleParameter::parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error) {
524  // separte modes in different strings, and check if modes are valid
525  for (StringTokenizer st(modes); st.hasNext();) {
526  const std::string mode = st.next();
527  if (mode == "car") {
528  modeSet |= SVC_PASSENGER;
529  } else if (mode == "bicycle") {
530  modeSet |= SVC_BICYCLE;
531  } else if (mode == "public") {
532  modeSet |= SVC_BUS;
533  } else {
534  if (id.empty()) {
535  error = "Unknown person mode '" + mode + "'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
536  } else {
537  error = "Unknown person mode '" + mode + "' for " + element + " '" + id + "';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
538  }
539  return false;
540  }
541  }
542  return true;
543 }
544 
545 
546 std::string
549  return "triggered";
551  return "containerTriggered";
552  } else {
553  return time2string(depart);
554  }
555 }
556 
557 
558 std::string
560  std::string val;
561  switch (departLaneProcedure) {
562  case DEPART_LANE_GIVEN:
563  val = toString(departLane);
564  break;
565  case DEPART_LANE_RANDOM:
566  val = "random";
567  break;
568  case DEPART_LANE_FREE:
569  val = "free";
570  break;
572  val = "allowed";
573  break;
575  val = "best";
576  break;
578  val = "first";
579  break;
580  case DEPART_LANE_DEFAULT:
581  default:
582  break;
583  }
584  return val;
585 }
586 
587 
588 std::string
590  std::string val;
591  switch (departPosProcedure) {
592  case DEPART_POS_GIVEN:
593  val = toString(departPos);
594  break;
595  case DEPART_POS_RANDOM:
596  val = "random";
597  break;
599  val = "random_free";
600  break;
601  case DEPART_POS_FREE:
602  val = "free";
603  break;
604  case DEPART_POS_LAST:
605  val = "last";
606  break;
607  case DEPART_POS_BASE:
608  val = "base";
609  break;
610  case DEPART_POS_DEFAULT:
611  default:
612  break;
613  }
614  return val;
615 }
616 
617 
618 std::string
620  std::string val;
621  switch (departPosLatProcedure) {
622  case DEPART_POSLAT_GIVEN:
623  val = toString(departPos);
624  break;
626  val = "random";
627  break;
629  val = "random_free";
630  break;
631  case DEPART_POSLAT_FREE:
632  val = "free";
633  break;
634  case DEPART_POSLAT_RIGHT:
635  val = "right";
636  break;
638  val = "center";
639  break;
640  case DEPART_POSLAT_LEFT:
641  val = "left";
642  break;
644  default:
645  break;
646  }
647  return val;
648 }
649 
650 
651 std::string
653  std::string val;
654  switch (departSpeedProcedure) {
655  case DEPART_SPEED_GIVEN:
656  val = toString(departSpeed);
657  break;
658  case DEPART_SPEED_RANDOM:
659  val = "random";
660  break;
661  case DEPART_SPEED_MAX:
662  val = "max";
663  break;
665  val = "desired";
666  break;
667  case DEPART_SPEED_LIMIT:
668  val = "speedLimit";
669  break;
671  default:
672  break;
673  }
674  return val;
675 }
676 
677 
678 std::string
680  std::string val;
681  switch (arrivalLaneProcedure) {
682  case ARRIVAL_LANE_GIVEN:
683  val = toString(arrivalLane);
684  break;
686  val = "current";
687  break;
689  default:
690  break;
691  }
692  return val;
693 }
694 
695 
696 std::string
698  std::string val;
699  switch (arrivalPosProcedure) {
700  case ARRIVAL_POS_GIVEN:
701  val = toString(arrivalPos);
702  break;
703  case ARRIVAL_POS_RANDOM:
704  val = "random";
705  break;
706  case ARRIVAL_POS_CENTER:
707  val = "center";
708  break;
709  case ARRIVAL_POS_MAX:
710  val = "max";
711  break;
712  case ARRIVAL_POS_DEFAULT:
713  default:
714  break;
715  }
716  return val;
717 }
718 
719 
720 std::string
722  std::string val;
723  switch (arrivalPosLatProcedure) {
725  val = toString(arrivalPos);
726  break;
728  val = "right";
729  break;
731  val = "center";
732  break;
733  case ARRIVAL_POSLAT_LEFT:
734  val = "left";
735  break;
737  default:
738  break;
739  }
740  return val;
741 }
742 
743 
744 std::string
746  std::string val;
747  switch (arrivalSpeedProcedure) {
748  case ARRIVAL_SPEED_GIVEN:
749  val = toString(arrivalSpeed);
750  break;
752  val = "current";
753  break;
755  default:
756  break;
757  }
758  return val;
759 }
760 
761 /****************************************************************************/
The departure is person triggered.
const int VEHPARS_TO_TAZ_SET
The current lane shall be used.
const int STOP_CONTAINER_TRIGGER_SET
virtual ~SUMOVehicleParameter()
Destructor.
No information given; use default.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
SumoXMLTag
Numbers representing SUMO-XML - element names.
RGBColor color
The vehicle&#39;s color, TraCI may change this.
A free lateral position is chosen.
std::string lane
The lane to stop at.
The position is given.
long long int SUMOTime
Definition: SUMOTime.h:35
At the leftmost side of the lane.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
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.
The time is given.
The vehicle is discarded if emission fails (not fully implemented yet)
bool defaultOptionOverrides(const OptionsCont &oc, const std::string &optionName) const
Returns whether the defaults shall be used.
std::string vtypeid
The vehicle&#39;s type id.
a flow definitio nusing a from-to edges instead of a route (used by router)
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
The speed is given.
The departure is container triggered.
At the leftmost side of the lane.
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
vehicle is a bicycle
The position is given.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
std::string line
the new line id of the trip within a cyclical public transport route
The lateral position is chosen randomly.
The least occupied lane is used.
If a fixed number of random choices fails, a free lateral position is chosen.
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
weights: time range begin
std::string busstop
(Optional) bus stop if one is assigned to the stop
int parametersSet
Information for the output which parameter were set.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
The position is given.
const int VEHPARS_ARRIVALLANE_SET
The speed is chosen randomly.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
The lane is chosen randomly.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle&#39;s end speed shall be chosen.
The arrival position is given.
bool hasNext()
returns the information whether further substrings exist
DepartPosLatDefinition
ArrivalPosLatDefinition
Possible ways to choose the departure position.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
const std::string DEFAULT_VTYPE_ID
The least occupied lane from best lanes.
The position is chosen randomly.
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
The speed is given.
bool triggered
whether an arriving person lets the vehicle continue
std::string toTaz
The vehicle&#39;s destination zone (district)
The lane is given.
std::string tripId
id of the trip within a cyclical public transport route
const int VEHPARS_ARRIVALSPEED_SET
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
double departSpeed
(optional) The initial speed of the vehicle
SUMOVehicleParameter()
Constructor.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Half the road length.
No information given; use default.
const int STOP_START_SET
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle&#39;s initial speed shall be chosen.
DepartLaneDefinition
Possible ways to choose a lane on depart.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
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:289
At the center of the lane.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
The least occupied lane from lanes which allow the continuation.
const int VEHPARS_DEPARTSPEED_SET
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
std::string getDepartPos() const
obtain depart pos parameter in string format
The current speed is used.
SUMOTime until
The time at which the vehicle may continue its journey.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
std::string getArrivalPos() const
obtain arrival pos parameter in string format
At the rightmost side of the lane.
const int VEHPARS_DEPARTPOSLAT_SET
bool exists(const std::string &name) const
Returns the information whether the named option is known.
The maximum safe speed is used.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:42
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
const int STOP_TRIP_ID_SET
The maximum lane speed is used (speedLimit * speedFactor)
std::string fromTaz
The vehicle&#39;s origin zone (district)
No information given; use default.
const int STOP_EXPECTED_SET
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.
void write(OutputDevice &dev) const
Writes the stop as XML.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
double endPos
The stopping position end.
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
const int VEHPARS_COLOR_SET
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
If a fixed number of random choices fails, a free position is chosen.
vehicle is a passenger car (a "normal" car)
std::string getArrivalLane() const
obtain arrival lane parameter in string format
const int VEHPARS_FROM_TAZ_SET
The rightmost lane the vehicle may use.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle&#39;s line (mainly for public transport)
The maximum lane speed is used (speedLimit)
double arrivalPos
(optional) The position the vehicle shall arrive on
DepartSpeedDefinition
Possible ways to choose the departure speed.
const int STOP_END_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int VEHPARS_LINE_SET
const int VEHPARS_ARRIVALPOS_SET
No information given; use default.
const int STOP_PARKING_SET
vehicle is a bus
stop for vehicles
double departPos
(optional) The position the vehicle shall depart from
double startPos
The stopping position start.
const int STOP_TRIGGER_SET
std::string getDepartLane() const
obtain depart lane parameter in string format
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.
const int STOP_EXPECTED_CONTAINERS_SET
bool containerTriggered
whether an arriving container lets the vehicle continue
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.
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.
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.
At the rightmost side of the lane.
At the center of the lane.
SumoXMLTag tag
The vehicle tag.
A storage for options typed value containers)
Definition: OptionsCont.h:90
const int VEHPARS_DEPARTLANE_SET
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.
No information given; use default.
The arrival lane is given.
int containerNumber
The static number of containers in the vehicle when it departs.
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.
No information given; use default.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
bool wasSet(int what) const
Returns whether the given parameter was set.
const int VEHPARS_VTYPE_SET
No information given; use default.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
ArrivalPosDefinition
Possible ways to choose the arrival position.
const int STOP_LINE_SET
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
std::string getDepart() const
obtain depart parameter in string format
std::string containerstop
(Optional) container stop if one is assigned to the stop
No information given; use default.
A free position is chosen.
const int VEHPARS_DEPARTPOS_SET
Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DEPART_POS_BASE if there is no vehicle on the departLane yet.
const int VEHPARS_PERSON_NUMBER_SET
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
DepartPosDefinition
Possible ways to choose the departure position.
const int VEHPARS_CONTAINER_NUMBER_SET
A color information.
The maximum arrival position is used.
SUMOTime duration
The stopping duration.
Back-at-zero position.
DepartDefinition
Possible ways to depart.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
bool parking
whether the vehicle is removed from the net while stopping
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
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.
The arrival position is chosen randomly.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.