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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // Structure representing possible vehicle parameter
21 /****************************************************************************/
22 #ifndef SUMOVehicleParameter_h
23 #define SUMOVehicleParameter_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <string>
37 #include <utils/common/RGBColor.h>
38 #include <utils/common/SUMOTime.h>
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
45 class OutputDevice;
46 class OptionsCont;
47 
48 
49 // ===========================================================================
50 // value definitions
51 // ===========================================================================
52 const int VEHPARS_COLOR_SET = 1;
53 const int VEHPARS_VTYPE_SET = 2;
54 const int VEHPARS_DEPARTLANE_SET = 2 << 1;
55 const int VEHPARS_DEPARTPOS_SET = 2 << 2;
56 const int VEHPARS_DEPARTSPEED_SET = 2 << 3;
57 const int VEHPARS_PERIODNUM_SET = 2 << 4;
58 const int VEHPARS_PERIODFREQ_SET = 2 << 5;
59 const int VEHPARS_ROUTE_SET = 2 << 6;
60 const int VEHPARS_ARRIVALLANE_SET = 2 << 7;
61 const int VEHPARS_ARRIVALPOS_SET = 2 << 8;
62 const int VEHPARS_ARRIVALSPEED_SET = 2 << 9;
63 const int VEHPARS_LINE_SET = 2 << 10;
64 const int VEHPARS_FROM_TAZ_SET = 2 << 11;
65 const int VEHPARS_TO_TAZ_SET = 2 << 12;
66 const int VEHPARS_FORCE_REROUTE = 2 << 13;
67 const int VEHPARS_PERSON_CAPACITY_SET = 2 << 14;
68 const int VEHPARS_PERSON_NUMBER_SET = 2 << 15;
69 const int VEHPARS_CONTAINER_NUMBER_SET = 2 << 16;
70 const int VEHPARS_DEPARTPOSLAT_SET = 2 << 17;
71 const int VEHPARS_ARRIVALPOSLAT_SET = 2 << 18;
72 const int VEHPARS_VIA_SET = 2 << 19;
73 
74 const int STOP_INDEX_END = -1;
75 const int STOP_INDEX_FIT = -2;
76 
77 const int STOP_END_SET = 1;
78 const int STOP_START_SET = 2;
79 const int STOP_TRIGGER_SET = 2 << 1;
80 const int STOP_PARKING_SET = 2 << 2;
81 const int STOP_EXPECTED_SET = 2 << 3;
82 const int STOP_CONTAINER_TRIGGER_SET = 2 << 4;
83 const int STOP_EXPECTED_CONTAINERS_SET = 2 << 5;
84 
85 
86 // ===========================================================================
87 // enum definitions
88 // ===========================================================================
104 };
105 
106 
128 };
129 
130 
152 };
153 
154 
178 };
179 
180 
196 };
197 
198 
212 };
213 
214 
230 };
231 
232 
250 };
251 
252 
266 };
267 
268 
269 // ===========================================================================
270 // struct definitions
271 // ===========================================================================
285 public:
291 
294 
299  bool wasSet(int what) const {
300  return (parametersSet & what) != 0;
301  }
302 
303 
312  void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag tag = SUMO_TAG_VEHICLE, const std::string& typeID = "") const;
313 
314 
320  bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const;
321 
322 
323 
326 
336  static bool parseDepart(const std::string& val, const std::string& element, const std::string& id,
337  SUMOTime& depart, DepartDefinition& dd, std::string& error);
338 
339 
349  static bool parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
350  int& lane, DepartLaneDefinition& dld, std::string& error);
351 
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 
365 
375  static bool parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
376  double& pos, DepartPosLatDefinition& dpd, std::string& error);
377 
378 
388  static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
389  double& speed, DepartSpeedDefinition& dsd, std::string& error);
390 
391 
401  static bool parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
402  int& lane, ArrivalLaneDefinition& ald, std::string& error);
403 
404 
414  static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
415  double& pos, ArrivalPosDefinition& apd, std::string& error);
416 
417 
427  static bool parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
428  double& pos, ArrivalPosLatDefinition& apd, std::string& error);
429 
430 
440  static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
441  double& speed, ArrivalSpeedDefinition& asd, std::string& error);
443 
444 
452  static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id);
453 
455  std::string id;
456 
458  std::string routeid;
460  std::string vtypeid;
462  mutable RGBColor color;
463 
466 
476  double departPos;
480  double departPosLat;
484  double departSpeed;
488 
489 
492 
498  double arrivalPos;
506  double arrivalSpeed;
510 
511 
514 
526 
527 
529  mutable std::string line;
530 
532  std::string fromTaz;
533 
535  std::string toTaz;
536 
540  struct Stop {
542  std::string lane;
544  std::string busstop;
546  std::string containerstop;
548  std::string parkingarea;
550  std::string chargingStation;
552  double startPos;
554  double endPos;
560  bool triggered;
564  bool parking;
566  std::set<std::string> awaitedPersons;
568  std::set<std::string> awaitedContainers;
570  std::multimap<std::string, double> accessPos;
572  int index;
574  int parametersSet = 0;
575 
581  void write(OutputDevice& dev) const;
582  };
583 
585  mutable std::vector<Stop> stops;
586 
588  mutable std::vector<std::string> via;
589 
592 
595 
597  mutable int parametersSet;
598 
599 };
600 
601 #endif
602 
603 /****************************************************************************/
604 
605 
The departure is person triggered.
const int VEHPARS_TO_TAZ_SET
The current lane shall be used.
const int STOP_CONTAINER_TRIGGER_SET
~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.
A free lateral position is chosen.
The position is given.
const int VEHPARS_FORCE_REROUTE
At the leftmost side of the lane.
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.
std::string containerstop
(Optional) container stop if one is assigned to the stop
The vehicle is discarded if emission fails (not fully implemented yet)
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
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.
bool parking
whether the vehicle is removed from the net while stopping
Tag for the last element in the enum for safe int casting.
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
SUMOTime duration
The stopping duration.
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.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
The position is given.
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.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
const int VEHPARS_PERIODNUM_SET
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.
SUMOTime until
The time at which the vehicle may continue its journey.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const int STOP_INDEX_FIT
The lane is chosen randomly.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
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.
The least occupied lane from best lanes.
The position is chosen randomly.
Tag for the last element in the enum for safe int casting.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
The speed is given.
std::string toTaz
The vehicle&#39;s destination zone (district)
The lane is given.
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.
std::string busstop
(Optional) bus stop if one is assigned to the stop
double departSpeed
(optional) The initial speed of the vehicle
SUMOVehicleParameter()
Constructor.
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.
double startPos
The stopping position start.
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.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
const int VEHPARS_DEPARTSPEED_SET
std::multimap< std::string, double > accessPos
lanes and positions connected to this stop
std::string chargingStation
(Optional) charging station if one is assigned to the stop
The current speed is used.
bool triggered
whether an arriving person lets the vehicle continue
const int STOP_INDEX_END
At the rightmost side of the lane.
int parametersSet
Information for the output which parameter were set.
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
const int VEHPARS_DEPARTPOSLAT_SET
SUMOTime depart
The vehicle&#39;s departure time.
The maximum 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 VEHPARS_ROUTE_SET
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.
double endPos
The stopping position end.
An upper class for objects with additional parameters.
Definition: Parameterised.h:50
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.
bool containerTriggered
whether an arriving container lets the vehicle continue
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)
double arrivalPos
(optional) The position the vehicle shall arrive on
DepartSpeedDefinition
Possible ways to choose the departure speed.
std::string lane
The lane to stop at.
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
void write(OutputDevice &dev) const
Writes the stop as XML.
No information given; use default.
const int STOP_PARKING_SET
double departPos
(optional) The position the vehicle shall depart from
const int STOP_TRIGGER_SET
Structure representing possible vehicle parameter.
const int VEHPARS_PERIODFREQ_SET
const int STOP_EXPECTED_CONTAINERS_SET
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.
Definition of vehicle stop (position and duration)
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.
A storage for options typed value containers)
Definition: OptionsCont.h:98
Tag for the last element in the enum for safe int casting.
const int VEHPARS_DEPARTLANE_SET
int index
at which position in the stops list
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.
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:70
ArrivalPosDefinition
Possible ways to choose the arrival position.
long long int SUMOTime
Definition: TraCIDefs.h:51
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
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.
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.
std::string id
The vehicle&#39;s id.
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.