Eclipse SUMO - Simulation of Urban MObility
SUMOVTypeParameter.h
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 #pragma once
23 #include <config.h>
24 
25 #include <string>
26 #include <map>
28 #include <utils/common/RGBColor.h>
29 #include <utils/common/SUMOTime.h>
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class OutputDevice;
37 class OptionsCont;
38 
39 
40 // ===========================================================================
41 // value definitions
42 // ===========================================================================
43 const long long int VTYPEPARS_LENGTH_SET = 1;
44 const long long int VTYPEPARS_MINGAP_SET = 1 << 1;
45 const long long int VTYPEPARS_MAXSPEED_SET = 1 << 2;
46 const long long int VTYPEPARS_PROBABILITY_SET = 1 << 3;
47 const long long int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
48 const long long int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
49 const long long int VTYPEPARS_COLOR_SET = 1 << 6;
50 const long long int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
51 const long long int VTYPEPARS_WIDTH_SET = 1 << 8;
52 const long long int VTYPEPARS_HEIGHT_SET = 1 << 9;
53 const long long int VTYPEPARS_SHAPE_SET = 1 << 10;
54 const long long int VTYPEPARS_OSGFILE_SET = 1 << 11;
55 const long long int VTYPEPARS_IMGFILE_SET = 1 << 12;
56 const long long int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
57 const long long int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
58 const long long int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
59 const long long int VTYPEPARS_BOARDING_DURATION = 1 << 16;
60 const long long int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
61 const long long int VTYPEPARS_LOADING_DURATION = 1 << 18;
62 const long long int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
63 const long long int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
64 const long long int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
65 const long long int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
66 const long long int VTYPEPARS_ACTIONSTEPLENGTH_SET = 1 << 23;
67 const long long int VTYPEPARS_DESIRED_MAXSPEED_SET = 1 << 24;
68 const long long int VTYPEPARS_CARRIAGE_LENGTH_SET = 1 << 25;
69 const long long int VTYPEPARS_LOCOMOTIVE_LENGTH_SET = 1 << 26;
70 const long long int VTYPEPARS_CARRIAGE_GAP_SET = 1 << 27;
71 const long long int VTYPEPARS_CARRIAGE_DOORS_SET = 1 << 28;
72 const long long int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET = 1 << 29;
73 const long long int VTYPEPARS_FRONT_SEAT_POS_SET = 1 << 30;
74 const long long int VTYPEPARS_SCALE_SET = (long long int)1 << 31;
75 const long long int VTYPEPARS_MASS_SET = (long long int)1 << 32;
76 const long long int VTYPEPARS_TTT_SET = (long long int)1 << 33;
77 const long long int VTYPEPARS_TTT_BIDI_SET = (long long int)1 << 34;
78 const long long int VTYPEPARS_SEATING_WIDTH_SET = (long long int)1 << 35;
79 const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET = (long long int)1 << 36;
80 const long long int VTYPEPARS_PARKING_BADGES_SET = (long long int)1 << 37;
81 
82 
85 
86 
87 // ===========================================================================
88 // enum definitions
89 // ===========================================================================
96  DEFAULT,
98  GIVEN,
100  RIGHT,
102  CENTER,
104  ARBITRARY,
106  NICE,
108  COMPACT,
110  LEFT
111 };
112 
113 
114 // ===========================================================================
115 // struct definitions
116 // ===========================================================================
122 
123 public:
128 
130  double length;
131 
133  double minGap;
134 
136  double minGapLat;
137 
139  double maxSpeed;
140 
143 
145  double width;
146 
148  double height;
149 
152 
155 
157  double mass;
158 
161 
164 
167 
169  std::string osgFile;
170 
173 
176 
179 
182 
183  private:
186  };
187 
192  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
193 
195  virtual ~SUMOVTypeParameter() {};
196 
201  bool wasSet(long long int what) const {
202  return (parametersSet & what) != 0;
203  }
204 
210  void write(OutputDevice& dev) const;
211 
217  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
218 
224  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
225 
231  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
232 
238  std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
239 
241  typedef std::map<SumoXMLAttr, std::string> SubParams;
242 
244  const SubParams& getLCParams() const;
245 
251  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
252 
258  std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
259 
260  void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
261 
264 
266  std::string id;
267 
269  double length;
270 
272  double minGap;
273 
275  double maxSpeed;
276 
279 
283 
286 
289 
292 
294  double mass;
295 
298 
301 
303  double impatience;
304 
307 
310 
313 
316 
318  double scale;
319 
322 
324  double width;
325 
327  double height;
328 
331 
333  std::string osgFile;
334 
336  std::string imgFile;
338 
339 
342 
345 
348 
351 
354 
356  double maxSpeedLat;
357 
360 
363 
365  double minGapLat;
366 
370  double carriageGap;
371 
374 
377 
380 
383 
385  double frontSeatPos;
386 
388  double seatingWidth;
389 
391  std::vector<std::string> parkingBadges;
392 
394  long long int parametersSet;
395 
397  mutable bool saved;
398 
401 
403  std::vector<double> paramRestrictions;
404 
406  static std::set<SumoXMLAttr> AllowedJMAttrs;
407 
409  inline double getLength() const {
410  return length;
411  }
412 
418  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
419 
425  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
426 
433  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
434 
440  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
441 
443  static const SUMOVTypeParameter& getDefault();
444 
451  static bool parseLatAlignment(const std::string& val, double& lao, LatAlignmentDefinition& lad);
452 
453  static inline bool isValidLatAlignment(const std::string& val) {
454  double lao;
456  return SUMOVTypeParameter::parseLatAlignment(val, lao, lad);
457  }
458 
460  // XXX: does not include valid float strings
461  static inline std::vector<std::string> getLatAlignmentStrings() {
462  std::vector<std::string> result;
463  result.push_back("right");
464  result.push_back("center");
465  result.push_back("arbitrary");
466  result.push_back("nice");
467  result.push_back("compact");
468  result.push_back("left");
469  return result;
470  }
471 
473  std::map<int, std::pair<SUMOTime, SUMOTime>> myManoeuverAngleTimes;
474 
484  void setManoeuverAngleTimes(const SUMOVehicleClass vclass);
485 
490  SUMOTime getEntryManoeuvreTime(const int angle) const;
491 
496  SUMOTime getExitManoeuvreTime(const int angle) const;
497 
501  std::string getManoeuverAngleTimesS() const;
502 
504  SUMOTime getTimeToTeleport(SUMOTime defaultValue) const;
505 
507  SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const;
508 };
long long int SUMOTime
Definition: GUI.h:35
const long long int VTYPEPARS_TTT_SET
const long long int VTYPEPARS_SHAPE_SET
const long long int VTYPEPARS_LOADING_DURATION
const long long int VTYPEPARS_TTT_BIDI_SET
const long long int VTYPEPARS_SCALE_SET
const long long int VTYPEPARS_PERSON_CAPACITY
const long long int VTYPEPARS_CAR_FOLLOW_MODEL
const long long int VTYPEPARS_FRONT_SEAT_POS_SET
const long long int VTYPEPARS_WIDTH_SET
const long long int VTYPEPARS_CARRIAGE_LENGTH_SET
const long long int VTYPEPARS_ACTIONSTEPLENGTH_SET
const long long int VTYPEPARS_MAXSPEED_LAT_SET
const long long int VTYPEPARS_MAXSPEED_SET
const long long int VTYPEPARS_EMISSIONCLASS_SET
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const long long int VTYPEPARS_LATALIGNMENT_SET
const long long int VTYPEPARS_COLOR_SET
const long long int VTYPEPARS_LANE_CHANGE_MODEL_SET
const long long int VTYPEPARS_DESIRED_MAXSPEED_SET
const long long int VTYPEPARS_OSGFILE_SET
const long long int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET
const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET
const long long int VTYPEPARS_SPEEDFACTOR_SET
const long long int VTYPEPARS_CARRIAGE_GAP_SET
const long long int VTYPEPARS_MINGAP_SET
const long long int VTYPEPARS_PROBABILITY_SET
const long long int VTYPEPARS_HEIGHT_SET
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
const long long int VTYPEPARS_PARKING_BADGES_SET
const long long int VTYPEPARS_MASS_SET
const long long int VTYPEPARS_BOARDING_DURATION
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
@ RIGHT
drive on the right side
@ DEFAULT
No information given; use default.
@ LEFT
drive on the left side
@ ARBITRARY
maintain the current alignment
@ NICE
align with the closest sublane border
@ COMPACT
align with the rightmost sublane that allows keeping the current speed
@ CENTER
drive in the middle
const long long int VTYPEPARS_VEHICLECLASS_SET
const long long int VTYPEPARS_IMPATIENCE_SET
const long long int VTYPEPARS_LENGTH_SET
const long long int VTYPEPARS_SEATING_WIDTH_SET
const long long int VTYPEPARS_IMGFILE_SET
const long long int VTYPEPARS_CONTAINER_CAPACITY
const long long int VTYPEPARS_MINGAP_LAT_SET
const long long int VTYPEPARS_CARRIAGE_DOORS_SET
const long long int VTYPEPARS_LOCOMOTIVE_LENGTH_SET
int SUMOEmissionClass
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ GIVEN
The time is given.
SumoXMLTag
Numbers representing SUMO-XML - element names.
LaneChangeModel
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A storage for options typed value containers)
Definition: OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
Structure representing possible vehicle parameter.
static bool isValidLatAlignment(const std::string &val)
SUMOTime getExitManoeuvreTime(const int angle) const
Returns the time that will be needed for the vehicle type to execute the (exit) manoeuvre (and be blo...
double width
This class' width.
SubParams cfParameter
Car-following parameter.
void write(OutputDevice &dev) const
Writes the vtype.
static std::vector< std::string > getLatAlignmentStrings()
return all valid strings for latAlignment
double defaultProbability
The probability when being added to a distribution without an explicit probability.
SUMOTime actionStepLength
The vehicle type's default actionStepLength [ms], i.e. the interval between two control actions....
void cacheParamRestrictions(const std::vector< std::string > &restrictionKeys)
bool saved
Information whether this type was already saved (needed by routers)
SUMOTime getTimeToTeleport(SUMOTime defaultValue) const
return time-to-teleport (either custom or default)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double height
This class' height.
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double frontSeatPos
the offset of the first person seat from the front of the vehicle
double latAlignmentOffset
(optional) The vehicle's desired lateral alignment as offset in m from center line
std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
double carriageLength
the length of train carriages and locomotive
std::vector< std::string > parkingBadges
the parking access rights
static std::set< SumoXMLAttr > AllowedJMAttrs
allowed attrs for the junction model
double seatingWidth
width to be used when comping seats
SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const
return time-to-teleport.bidi (either custom or default)
double length
The physical vehicle length.
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
virtual ~SUMOVTypeParameter()
virtual destructor
double speedFactorPremature
the possible speed reduction when a train is ahead of schedule
std::vector< double > paramRestrictions
cached value of parameters which may restrict access to certain edges
static double getDefaultDecel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default deceleration for the given vehicle class This needs to be a function because the ...
SUMOTime getEntryManoeuvreTime(const int angle) const
Returns the time that will be needed for the vehicle type to execute the (entry) manoeuvre (and be bl...
RGBColor color
The color.
long long int parametersSet
Information for the router which parameter were set.
double minGap
This class' free space in front of the vehicle itself.
std::map< SumoXMLAttr, std::string > SubParams
sub-model parameters
std::string imgFile
Image file for this class.
void initRailVisualizationParameters()
init Rail Visualization Parameters
SUMOVehicleShape shape
This class' shape.
int personCapacity
The person capacity of the vehicle.
int carriageDoors
the number of doors per carriage
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers)
double getLength() const
satisfy vType / router template requirements
double scale
individual scaling factor (-1 for undefined)
double getLCParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SUMOTime timeToTeleport
the custom time-to-teleport for this type
std::string osgFile
3D model file for this class
double maxSpeed
The vehicle type's (technical) maximum speed [m/s].
static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption)
Returns the default emergency deceleration for the given vehicle class This needs to be a function be...
SUMOTime timeToTeleportBidi
the custom time-to-teleport.bidi for this type
void setManoeuverAngleTimes(const SUMOVehicleClass vclass)
Initialise the default mapping between manoeuver angle and times dependant on vehicle class.
int containerCapacity
The container capacity of the vehicle.
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift....
SUMOTime boardingDuration
The time a person needs to board the vehicle.
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
double minGapLat
The vehicle type's minimum lateral gap [m].
SUMOVehicleClass vehicleClass
The vehicle's class.
SUMOVTypeParameter(const std::string &vtid, const SUMOVehicleClass vc=SVC_IGNORING)
Constructor.
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
double mass
The mass.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
std::string id
The vehicle type's id.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
const SubParams & getLCParams() const
Returns the LC parameter.
std::string getLCParamString(const SumoXMLAttr attr, const std::string &defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SubParams lcParameter
Lane-changing parameter.
LatAlignmentDefinition latAlignmentProcedure
Information on how the vehicle shall choose the lateral alignment.
static double getDefaultImperfection(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default driver's imperfection (sigma or epsilon in Krauss' model) for the given vehicle c...
SubParams jmParameter
Junction-model parameter.
double impatience
The vehicle's impatience (willingness to obstruct others)
std::string getManoeuverAngleTimesS() const
Returns myManoeuverAngleTimes as a string for xml output.
std::map< int, std::pair< SUMOTime, SUMOTime > > myManoeuverAngleTimes
Map of manoeuver angles versus the times (entry, exit) to execute the manoeuver.
LaneChangeModel lcModel
The lane-change model to use.
static bool parseLatAlignment(const std::string &val, double &lao, LatAlignmentDefinition &lad)
Parses and validates a given latAlignment value.
static double getDefaultAccel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default acceleration for the given vehicle class This needs to be a function because the ...
struct for default values that depend of VClass
int carriageDoors
the number of doors per carriage
int personCapacity
The person capacity of the vehicle.
double carriageLength
the length of train carriages
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
std::string osgFile
3D model file for this class
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double minGap
This class' free space in front of the vehicle itself.
int containerCapacity
The container capacity of the vehicle.
double maxSpeed
The vehicle type's maximum speed [m/s] (technical limit, not subject to speed deviation)
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
double length
The physical vehicle length.
SUMOVehicleShape shape
This class' shape.
double minGapLat
The vehicle type's minimum lateral gap [m].
LatAlignmentDefinition latAlignmentProcedure
the lateral alignment procedure
double locomotiveLength
the length of train locomotive