Eclipse SUMO - Simulation of Urban MObility
SUMOVehicleParameter.h
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 /****************************************************************************/
18 // Structure representing possible vehicle parameter
19 /****************************************************************************/
20 #ifndef SUMOVehicleParameter_h
21 #define SUMOVehicleParameter_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
31 #include <utils/common/RGBColor.h>
32 #include <utils/common/SUMOTime.h>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class OutputDevice;
40 class OptionsCont;
41 
42 
43 // ===========================================================================
44 // value definitions
45 // ===========================================================================
46 const int VEHPARS_COLOR_SET = 1;
47 const int VEHPARS_VTYPE_SET = 2;
48 const int VEHPARS_DEPARTLANE_SET = 2 << 1;
49 const int VEHPARS_DEPARTPOS_SET = 2 << 2;
50 const int VEHPARS_DEPARTSPEED_SET = 2 << 3;
51 const int VEHPARS_END_SET = 2 << 4;
52 const int VEHPARS_NUMBER_SET = 2 << 5;
53 const int VEHPARS_PERIOD_SET = 2 << 6;
54 const int VEHPARS_VPH_SET = 2 << 7;
55 const int VEHPARS_PROB_SET = 2 << 8;
56 const int VEHPARS_ROUTE_SET = 2 << 9;
57 const int VEHPARS_ARRIVALLANE_SET = 2 << 10;
58 const int VEHPARS_ARRIVALPOS_SET = 2 << 11;
59 const int VEHPARS_ARRIVALSPEED_SET = 2 << 12;
60 const int VEHPARS_LINE_SET = 2 << 13;
61 const int VEHPARS_FROM_TAZ_SET = 2 << 14;
62 const int VEHPARS_TO_TAZ_SET = 2 << 15;
63 const int VEHPARS_FORCE_REROUTE = 2 << 16;
64 const int VEHPARS_PERSON_CAPACITY_SET = 2 << 17;
65 const int VEHPARS_PERSON_NUMBER_SET = 2 << 18;
66 const int VEHPARS_CONTAINER_NUMBER_SET = 2 << 19;
67 const int VEHPARS_DEPARTPOSLAT_SET = 2 << 20;
68 const int VEHPARS_ARRIVALPOSLAT_SET = 2 << 21;
69 const int VEHPARS_VIA_SET = 2 << 22;
70 
71 const int STOP_INDEX_END = -1;
72 const int STOP_INDEX_FIT = -2;
73 
74 const int STOP_END_SET = 1;
75 const int STOP_START_SET = 2;
76 const int STOP_TRIGGER_SET = 2 << 1;
77 const int STOP_PARKING_SET = 2 << 2;
78 const int STOP_EXPECTED_SET = 2 << 3;
79 const int STOP_CONTAINER_TRIGGER_SET = 2 << 4;
80 const int STOP_EXPECTED_CONTAINERS_SET = 2 << 5;
81 const int STOP_TRIP_ID_SET = 2 << 6;
82 const int STOP_LINE_SET = 2 << 7;
83 
84 const double MIN_STOP_LENGTH = 2 * POSITION_EPS;
85 
86 
87 // ===========================================================================
88 // enum definitions
89 // ===========================================================================
105 };
106 
107 
129 };
130 
131 
153 };
154 
155 
179 };
180 
181 
201 };
202 
203 
217 };
218 
219 
237 };
238 
239 
257 };
258 
259 
273 };
274 
275 
276 // ===========================================================================
277 // struct definitions
278 // ===========================================================================
292 public:
298 
300  virtual ~SUMOVehicleParameter();
301 
306  bool wasSet(int what) const {
307  return (parametersSet & what) != 0;
308  }
309 
318  void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag = SUMO_TAG_VEHICLE, const std::string& typeID = "") const;
319 
325  bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const;
326 
329 
338  static bool parseDepart(const std::string& val, const std::string& element, const std::string& id,
339  SUMOTime& depart, DepartDefinition& dd, std::string& error);
340 
350  static bool parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
351  int& lane, DepartLaneDefinition& dld, std::string& error);
352 
362  static bool parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
363  double& pos, DepartPosDefinition& dpd, std::string& error);
364 
374  static bool parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
375  double& pos, DepartPosLatDefinition& dpd, std::string& error);
376 
386  static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
387  double& speed, DepartSpeedDefinition& dsd, std::string& error);
388 
398  static bool parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
399  int& lane, ArrivalLaneDefinition& ald, std::string& error);
400 
410  static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
411  double& pos, ArrivalPosDefinition& apd, std::string& error);
412 
422  static bool parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
423  double& pos, ArrivalPosLatDefinition& apd, std::string& error);
424 
425 
435  static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
436  double& speed, ArrivalSpeedDefinition& asd, std::string& error);
438 
446  static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id);
447 
456  static bool parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error);
457 
460 
462  std::string id;
463 
465  std::string routeid;
466 
468  std::string vtypeid;
469 
471  mutable RGBColor color;
472 
477 
480 
483 
486 
488  double departPos;
489 
492 
494  double departPosLat;
495 
498 
500  double departSpeed;
501 
504 
506 
511 
514 
516  double arrivalPos;
517 
520 
523 
526 
528  double arrivalSpeed;
529 
532 
534 
539 
542 
545 
548 
551 
553 
555  mutable std::string line;
556 
558  std::string fromTaz;
559 
561  std::string toTaz;
562 
566  class Stop : public Parameterised {
567 
568  public:
570  Stop();
571 
577  void write(OutputDevice& dev) const;
578 
580  std::string lane;
581 
583  std::string busstop;
584 
586  std::string containerstop;
587 
589  std::string parkingarea;
590 
592  std::string chargingStation;
593 
595  double startPos;
596 
598  double endPos;
599 
602 
605 
607  bool triggered;
608 
611 
613  bool parking;
614 
616  std::set<std::string> awaitedPersons;
617 
619  std::set<std::string> awaitedContainers;
620 
622  std::string tripId;
623 
625  std::string line;
626 
628  std::vector<std::tuple<std::string, double, double> > accessPos;
629 
631  int index;
632 
634  int parametersSet = 0;
635  };
636 
638  mutable std::vector<Stop> stops;
639 
641  mutable std::vector<std::string> via;
642 
645 
648 
650  mutable int parametersSet;
651 
652 protected:
654  std::string getDepart() const;
655 
657  std::string getDepartLane() const;
658 
660  std::string getDepartPos() const;
661 
663  std::string getDepartPosLat() const;
664 
666  std::string getDepartSpeed() const;
667 
669  std::string getArrivalLane() const;
670 
672  std::string getArrivalPos() const;
673 
675  std::string getArrivalPosLat() const;
676 
678  std::string getArrivalSpeed() const;
679 };
680 
681 #endif
682 
683 /****************************************************************************/
684 
685 
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.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
No information given; use default.
SumoXMLTag
Numbers representing SUMO-XML - element names.
RGBColor color
The vehicle&#39;s color, TraCI may change this.
const double MIN_STOP_LENGTH
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
const int VEHPARS_FORCE_REROUTE
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.
Tag for the last element in the enum for safe int casting.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
Tag for the last element in the enum for safe int casting.
The speed is given.
The departure is container triggered.
At the leftmost side of the lane.
const int VEHPARS_PROB_SET
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
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
double repetitionProbability
The probability for emitting a vehicle per second.
The lateral position is chosen randomly.
Tag for the last element in the enum for safe int casting.
The least occupied lane is used.
If a fixed number of random choices fails, a free lateral position is chosen.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
int repetitionsDone
The number of times the vehicle was already inserted.
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
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.
Tag for the last element in the enum for safe int casting.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const int STOP_INDEX_FIT
The lane is chosen randomly.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle&#39;s end speed shall be chosen.
The arrival position is given.
DepartPosLatDefinition
ArrivalPosLatDefinition
Possible ways to choose the departure position.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
const int VEHPARS_NUMBER_SET
The least occupied lane from best lanes.
The position is chosen randomly.
Tag for the last element in the enum for safe int casting.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
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
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
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.
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 routeid
The vehicle&#39;s route id.
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
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.
const int STOP_INDEX_END
std::string getArrivalPos() const
obtain arrival pos parameter in string format
At the rightmost side of the lane.
const int VEHPARS_DEPARTPOSLAT_SET
The maximum safe speed is used.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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)
const int VEHPARS_ROUTE_SET
#define POSITION_EPS
Definition: config.h:169
std::string fromTaz
The vehicle&#39;s origin zone (district)
No information given; use default.
Tag for the last element in the enum for safe int casting.
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.
const int VEHPARS_PERIOD_SET
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.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
const int VEHPARS_FROM_TAZ_SET
The rightmost lane the vehicle may use.
const int VEHPARS_END_SET
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.
Definition of vehicle stop (position and duration)
int index
at which position in the stops list
const int STOP_END_SET
const int VEHPARS_VIA_SET
std::vector< std::string > via
List of the via-edges the vehicle must visit.
const int VEHPARS_ARRIVALPOSLAT_SET
double departPosLat
(optional) The lateral position the vehicle shall depart from
const int VEHPARS_LINE_SET
const int VEHPARS_ARRIVALPOS_SET
No information given; use default.
const int STOP_PARKING_SET
double departPos
(optional) The position the vehicle shall depart from
double startPos
The stopping position start.
const int STOP_TRIGGER_SET
Structure representing possible vehicle parameter.
std::string getDepartLane() const
obtain depart lane parameter in string format
std::vector< std::tuple< std::string, double, double > > accessPos
lanes and positions connected to this stop (only used by duarouter where Stop is used to store stoppi...
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
Tag for the last element in the enum for safe int casting.
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
description of a vehicle
No information given; use default.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
ArrivalPosDefinition
Possible ways to choose the arrival position.
const int STOP_LINE_SET
const int VEHPARS_VPH_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 chargingStation
(Optional) charging station if one is assigned to the stop
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.
Tag for the last element in the enum for safe int casting.
Tag for the last element in the enum for safe int casting.
DepartPosDefinition
Possible ways to choose the departure position.
const int VEHPARS_CONTAINER_NUMBER_SET
The maximum arrival position is used.
SUMOTime duration
The stopping duration.
Back-at-zero position.
const int VEHPARS_PERSON_CAPACITY_SET
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.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
bool parking
whether the vehicle is removed from the net while stopping
std::string id
The vehicle&#39;s id.
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.