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.org/sumo
3 // Copyright (C) 2001-2022 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 int VTYPEPARS_LENGTH_SET = 1;
44 const int VTYPEPARS_MINGAP_SET = 1 << 1;
45 const int VTYPEPARS_MAXSPEED_SET = 1 << 2;
46 const int VTYPEPARS_PROBABILITY_SET = 1 << 3;
47 const int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
48 const int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
49 const int VTYPEPARS_COLOR_SET = 1 << 6;
50 const int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
51 const int VTYPEPARS_WIDTH_SET = 1 << 8;
52 const int VTYPEPARS_HEIGHT_SET = 1 << 9;
53 const int VTYPEPARS_SHAPE_SET = 1 << 10;
54 const int VTYPEPARS_OSGFILE_SET = 1 << 11;
55 const int VTYPEPARS_IMGFILE_SET = 1 << 12;
56 const int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
57 const int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
58 const int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
59 const int VTYPEPARS_BOARDING_DURATION = 1 << 16;
60 const int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
61 const int VTYPEPARS_LOADING_DURATION = 1 << 18;
62 const int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
63 const int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
64 const int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
65 const int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
66 const int VTYPEPARS_ACTIONSTEPLENGTH_SET = 1 << 23;
67 
68 const int VTYPEPARS_CARRIAGE_LENGTH_SET = 1 << 25;
69 const int VTYPEPARS_LOCOMOTIVE_LENGTH_SET = 1 << 26;
70 const int VTYPEPARS_CARRIAGE_GAP_SET = 1 << 27;
72 const int VTYPEPARS_FRONT_SEAT_POS_SET = 1 << 29;
73 
74 
77 
78 
79 // ===========================================================================
80 // enum definitions
81 // ===========================================================================
88  DEFAULT,
90  GIVEN,
92  RIGHT,
94  CENTER,
96  ARBITRARY,
98  NICE,
100  COMPACT,
102  LEFT
103 };
104 
105 
106 // ===========================================================================
107 // struct definitions
108 // ===========================================================================
114 
115 public:
120 
122  double length;
123 
125  double minGap;
126 
128  double maxSpeed;
129 
131  double width;
132 
134  double height;
135 
138 
141 
144 
147 
150 
152  std::string osgFile;
153 
156 
159 
160  private:
163  };
164 
169  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
170 
172  virtual ~SUMOVTypeParameter() {};
173 
178  bool wasSet(int what) const {
179  return (parametersSet & what) != 0;
180  }
181 
187  void write(OutputDevice& dev) const;
188 
194  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
195 
201  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
202 
208  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
209 
215  std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
216 
218  typedef std::map<SumoXMLAttr, std::string> SubParams;
219 
221  const SubParams& getLCParams() const;
222 
228  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
229 
235  std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
236 
237  void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
238 
241 
243  std::string id;
244 
246  double length;
247 
249  double minGap;
250 
252  double maxSpeed;
253 
257 
260 
263 
266 
269 
272 
274  double impatience;
275 
278 
281 
284 
287 
290 
292  double width;
293 
295  double height;
296 
299 
301  std::string osgFile;
302 
304  std::string imgFile;
306 
307 
310 
313 
316 
319 
322 
324  double maxSpeedLat;
325 
328 
331 
333  double minGapLat;
334 
338  double carriageGap;
339 
341  double frontSeatPos;
342 
345 
347  mutable bool saved;
348 
351 
353  std::vector<double> paramRestrictions;
354 
356  inline double getLength() const {
357  return length;
358  }
359 
365  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
366 
372  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
373 
380  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
381 
387  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
388 
390  static const SUMOVTypeParameter& getDefault();
391 
398  static bool parseLatAlignment(const std::string& val, double& lao, LatAlignmentDefinition& lad);
399 
400  static inline bool isValidLatAlignment(const std::string& val) {
401  double lao;
403  return SUMOVTypeParameter::parseLatAlignment(val, lao, lad);
404  }
405 
407  // XXX: does not include valid float strings
408  static inline std::vector<std::string> getLatAlignmentStrings() {
409  std::vector<std::string> result;
410  result.push_back("right");
411  result.push_back("center");
412  result.push_back("arbitrary");
413  result.push_back("nice");
414  result.push_back("compact");
415  result.push_back("left");
416  return result;
417  }
418 
420  std::map<int, std::pair<SUMOTime, SUMOTime>> myManoeuverAngleTimes;
421 
431  void setManoeuverAngleTimes(const SUMOVehicleClass vclass);
432 
437  SUMOTime getEntryManoeuvreTime(const int angle) const;
438 
443  SUMOTime getExitManoeuvreTime(const int angle) const;
444 
448  std::string getManoeuverAngleTimesS() const;
449 };
long long int SUMOTime
Definition: SUMOTime.h:32
const int VTYPEPARS_MAXSPEED_SET
const int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET
const int VTYPEPARS_PERSON_CAPACITY
const int VTYPEPARS_HEIGHT_SET
const int VTYPEPARS_VEHICLECLASS_SET
const int VTYPEPARS_FRONT_SEAT_POS_SET
const int VTYPEPARS_COLOR_SET
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const int VTYPEPARS_SPEEDFACTOR_SET
const int VTYPEPARS_BOARDING_DURATION
const int VTYPEPARS_IMPATIENCE_SET
const int VTYPEPARS_LATALIGNMENT_SET
const int VTYPEPARS_LENGTH_SET
const int VTYPEPARS_CARRIAGE_LENGTH_SET
const int VTYPEPARS_OSGFILE_SET
const int VTYPEPARS_LOCOMOTIVE_LENGTH_SET
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
const int VTYPEPARS_MINGAP_SET
const int VTYPEPARS_IMGFILE_SET
const int VTYPEPARS_SHAPE_SET
const int VTYPEPARS_ACTIONSTEPLENGTH_SET
const int VTYPEPARS_LOADING_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 int VTYPEPARS_CONTAINER_CAPACITY
const int VTYPEPARS_CARRIAGE_GAP_SET
const int VTYPEPARS_MAXSPEED_LAT_SET
const int VTYPEPARS_EMISSIONCLASS_SET
const int VTYPEPARS_PROBABILITY_SET
const int VTYPEPARS_CAR_FOLLOW_MODEL
const int VTYPEPARS_MINGAP_LAT_SET
const int VTYPEPARS_WIDTH_SET
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
int SUMOEmissionClass
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
@ GIVEN
The lane 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)
double height
This class' height.
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
double length
The physical vehicle length.
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
virtual ~SUMOVTypeParameter()
virtual destructor
bool wasSet(int what) const
Returns whether the given parameter was set.
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.
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.
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 getLCParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
std::string osgFile
3D model file for this class
double maxSpeed
The vehicle type's 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...
int parametersSet
Information for the router which parameter were set.
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.
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 personCapacity
The person capacity of the vehicle.
double carriageLength
the length of train carriages
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].
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 locomotiveLength
the length of train locomotive