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-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 #ifndef SUMOVTypeParameter_h
20 #define SUMOVTypeParameter_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <map>
31 #include <utils/common/RGBColor.h>
32 #include <utils/common/SUMOTime.h>
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class OutputDevice;
40 class OptionsCont;
41 
42 
43 // ===========================================================================
44 // value definitions
45 // ===========================================================================
46 const int VTYPEPARS_LENGTH_SET = 1;
47 const int VTYPEPARS_MINGAP_SET = 1 << 1;
48 const int VTYPEPARS_MAXSPEED_SET = 1 << 2;
49 const int VTYPEPARS_PROBABILITY_SET = 1 << 3;
50 const int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
51 const int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
52 const int VTYPEPARS_COLOR_SET = 1 << 6;
53 const int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
54 const int VTYPEPARS_WIDTH_SET = 1 << 8;
55 const int VTYPEPARS_HEIGHT_SET = 1 << 9;
56 const int VTYPEPARS_SHAPE_SET = 1 << 10;
57 const int VTYPEPARS_OSGFILE_SET = 1 << 11;
58 const int VTYPEPARS_IMGFILE_SET = 1 << 12;
59 const int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
60 const int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
61 const int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
62 const int VTYPEPARS_BOARDING_DURATION = 1 << 16;
63 const int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
64 const int VTYPEPARS_LOADING_DURATION = 1 << 18;
65 const int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
66 const int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
67 const int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
68 const int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
69 const int VTYPEPARS_ACTIONSTEPLENGTH_SET = 1 << 23;
70 const int VTYPEPARS_HASDRIVERSTATE_SET = 1 << 24;
71 const int VTYPEPARS_CARRIAGE_LENGTH_SET = 1 << 25;
72 const int VTYPEPARS_LOCOMOTIVE_LENGTH_SET = 1 << 26;
73 const int VTYPEPARS_CARRIAGE_GAP_SET = 1 << 27;
74 
75 
78 
79 // ===========================================================================
80 // struct definitions
81 // ===========================================================================
87 public:
92 
94  double length;
95 
97  double minGap;
98 
100  double maxSpeed;
101 
103  double width;
104 
106  double height;
107 
110 
113 
116 
119 
122 
124  std::string osgFile;
125 
128 
131 
132  private:
135  };
136 
141  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
142 
144  virtual ~SUMOVTypeParameter() {};
145 
150  bool wasSet(int what) const {
151  return (parametersSet & what) != 0;
152  }
153 
159  void write(OutputDevice& dev) const;
160 
166  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
167 
173  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
174 
180  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
181 
187  std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
188 
190  typedef std::map<SumoXMLAttr, std::string> SubParams;
191 
193  const SubParams& getLCParams() const;
194 
200  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
201 
207  std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
208 
210  std::string id;
211 
213  double length;
214 
216  double minGap;
217 
219  double maxSpeed;
220 
224 
227 
230 
233 
236 
239 
241  double impatience;
242 
245 
248 
251 
254 
257 
259  double width;
260 
262  double height;
263 
266 
268  std::string osgFile;
269 
271  std::string imgFile;
273 
274 
277 
280 
283 
286 
289 
292 
294  double maxSpeedLat;
295 
298 
300  double minGapLat;
301 
305  double carriageGap;
306 
309 
311  mutable bool saved;
312 
315 
321  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
322 
328  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
329 
336  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
337 
343  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
344 
346  static const SUMOVTypeParameter& getDefault();
347 };
348 
349 #endif
350 
351 /****************************************************************************/
352 
VTYPEPARS_LATALIGNMENT_SET
const int VTYPEPARS_LATALIGNMENT_SET
Definition: SUMOVTypeParameter.h:67
SUMOVTypeParameter::SubParams
std::map< SumoXMLAttr, std::string > SubParams
sub-model parameters
Definition: SUMOVTypeParameter.h:190
VTYPEPARS_HASDRIVERSTATE_SET
const int VTYPEPARS_HASDRIVERSTATE_SET
Definition: SUMOVTypeParameter.h:70
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
SUMOVTypeParameter::lcParameter
SubParams lcParameter
Lane-changing parameter.
Definition: SUMOVTypeParameter.h:285
Distribution_Parameterized
Definition: Distribution_Parameterized.h:43
SUMOVTypeParameter::VClassDefaultValues::carriageLength
double carriageLength
the length of train carriages
Definition: SUMOVTypeParameter.h:127
VTYPEPARS_CARRIAGE_LENGTH_SET
const int VTYPEPARS_CARRIAGE_LENGTH_SET
Definition: SUMOVTypeParameter.h:71
SUMOVTypeParameter::locomotiveLength
double locomotiveLength
Definition: SUMOVTypeParameter.h:304
SUMOVTypeParameter::SUMOVTypeParameter
SUMOVTypeParameter(const std::string &vtid, const SUMOVehicleClass vc=SVC_IGNORING)
Constructor.
Definition: SUMOVTypeParameter.cpp:255
SUMOVTypeParameter::length
double length
The physical vehicle length.
Definition: SUMOVTypeParameter.h:213
VTYPEPARS_MINGAP_SET
const int VTYPEPARS_MINGAP_SET
Definition: SUMOVTypeParameter.h:47
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
SUMOTime.h
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
SUMOVTypeParameter::actionStepLength
SUMOTime actionStepLength
The vehicle type's default actionStepLength [ms], i.e. the interval between two control actions....
Definition: SUMOVTypeParameter.h:223
SUMOVTypeParameter::VClassDefaultValues::emissionClass
SUMOEmissionClass emissionClass
The emission class of this vehicle.
Definition: SUMOVTypeParameter.h:112
LateralAlignment
LateralAlignment
Numbers representing special SUMO-XML-attribute values Information how vehicles align themselves with...
Definition: SUMOXMLDefinitions.h:1323
SUMOVTypeParameter::cfModel
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
Definition: SUMOVTypeParameter.h:276
LaneChangeModel
LaneChangeModel
Definition: SUMOXMLDefinitions.h:1298
VTYPEPARS_BOARDING_DURATION
const int VTYPEPARS_BOARDING_DURATION
Definition: SUMOVTypeParameter.h:62
SUMOVTypeParameter::impatience
double impatience
The vehicle's impatience (willingness to obstruct others)
Definition: SUMOVTypeParameter.h:241
SUMOVTypeParameter::~SUMOVTypeParameter
virtual ~SUMOVTypeParameter()
virtual destructor
Definition: SUMOVTypeParameter.h:144
SUMOVTypeParameter::osgFile
std::string osgFile
3D model file for this class
Definition: SUMOVTypeParameter.h:268
VTYPEPARS_MINGAP_LAT_SET
const int VTYPEPARS_MINGAP_LAT_SET
Definition: SUMOVTypeParameter.h:68
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
SUMOVTypeParameter::saved
bool saved
Information whether this type was already saved (needed by routers)
Definition: SUMOVTypeParameter.h:311
SUMOEmissionClass
int SUMOEmissionClass
Definition: SUMOVehicleClass.h:232
VTYPEPARS_OSGFILE_SET
const int VTYPEPARS_OSGFILE_SET
Definition: SUMOVTypeParameter.h:57
SUMOVTypeParameter::carriageLength
double carriageLength
the length of train carriages and locomotive
Definition: SUMOVTypeParameter.h:303
VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
Definition: SUMOVTypeParameter.h:77
SUMOVTypeParameter::shape
SUMOVehicleShape shape
This class' shape.
Definition: SUMOVTypeParameter.h:265
VTYPEPARS_PROBABILITY_SET
const int VTYPEPARS_PROBABILITY_SET
Definition: SUMOVTypeParameter.h:49
SUMOVTypeParameter::getDefaultImperfection
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...
Definition: SUMOVTypeParameter.cpp:584
SUMOVTypeParameter::VClassDefaultValues::length
double length
The physical vehicle length.
Definition: SUMOVTypeParameter.h:94
VTYPEPARS_LOCOMOTIVE_LENGTH_SET
const int VTYPEPARS_LOCOMOTIVE_LENGTH_SET
Definition: SUMOVTypeParameter.h:72
SUMOVTypeParameter::containerCapacity
int containerCapacity
The container capacity of the vehicle.
Definition: SUMOVTypeParameter.h:247
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
RGBColor.h
SUMOVTypeParameter::getLCParams
const SubParams & getLCParams() const
Returns the LC parameter.
Definition: SUMOVTypeParameter.cpp:446
VTYPEPARS_CAR_FOLLOW_MODEL
const int VTYPEPARS_CAR_FOLLOW_MODEL
Definition: SUMOVTypeParameter.h:65
SUMOVTypeParameter::onlyReferenced
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers)
Definition: SUMOVTypeParameter.h:314
SUMOVTypeParameter::wasSet
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: SUMOVTypeParameter.h:150
SUMOVTypeParameter::parametersSet
int parametersSet
Information for the router which parameter were set.
Definition: SUMOVTypeParameter.h:308
VTYPEPARS_MAXSPEED_LAT_SET
const int VTYPEPARS_MAXSPEED_LAT_SET
Definition: SUMOVTypeParameter.h:66
RGBColor
Definition: RGBColor.h:40
VTYPEPARS_LANE_CHANGE_MODEL_SET
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
Definition: SUMOVTypeParameter.h:60
SUMOVTypeParameter::imgFile
std::string imgFile
Image file for this class.
Definition: SUMOVTypeParameter.h:271
SUMOVTypeParameter::getLCParamString
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.
Definition: SUMOVTypeParameter.cpp:436
SUMOVTypeParameter::VClassDefaultValues::containerCapacity
int containerCapacity
The container capacity of the vehicle.
Definition: SUMOVTypeParameter.h:121
SUMOVTypeParameter::height
double height
This class' height.
Definition: SUMOVTypeParameter.h:262
SUMOVTypeParameter
Structure representing possible vehicle parameter.
Definition: SUMOVTypeParameter.h:86
SUMOVTypeParameter::jmParameter
SubParams jmParameter
Junction-model parameter.
Definition: SUMOVTypeParameter.h:288
Parameterised.h
SUMOVTypeParameter::getDefaultAccel
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 ...
Definition: SUMOVTypeParameter.cpp:472
SUMOVehicleShape
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
Definition: SUMOVehicleClass.h:51
SUMOVTypeParameter::cfParameter
SubParams cfParameter
Car-following parameter.
Definition: SUMOVTypeParameter.h:282
SUMOVTypeParameter::defaultProbability
double defaultProbability
The probability when being added to a distribution without an explicit probability.
Definition: SUMOVTypeParameter.h:226
SUMOVTypeParameter::VClassDefaultValues::maxSpeed
double maxSpeed
The vehicle type's maximum speed [m/s].
Definition: SUMOVTypeParameter.h:100
SUMOVehicleClass.h
SUMOVTypeParameter::getDefaultDecel
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 ...
Definition: SUMOVTypeParameter.cpp:508
VTYPEPARS_ACTIONSTEPLENGTH_SET
const int VTYPEPARS_ACTIONSTEPLENGTH_SET
Definition: SUMOVTypeParameter.h:69
SUMOVTypeParameter::VClassDefaultValues::width
double width
This class' width.
Definition: SUMOVTypeParameter.h:103
VTYPEPARS_CARRIAGE_GAP_SET
const int VTYPEPARS_CARRIAGE_GAP_SET
Definition: SUMOVTypeParameter.h:73
SUMOVTypeParameter::boardingDuration
SUMOTime boardingDuration
The time a person needs to board the vehicle.
Definition: SUMOVTypeParameter.h:250
SUMOVTypeParameter::VClassDefaultValues::minGap
double minGap
This class' free space in front of the vehicle itself.
Definition: SUMOVTypeParameter.h:97
SUMOVTypeParameter::minGap
double minGap
This class' free space in front of the vehicle itself.
Definition: SUMOVTypeParameter.h:216
SUMOVTypeParameter::getJMParamString
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.
Definition: SUMOVTypeParameter.cpp:462
SUMOVTypeParameter::width
double width
This class' width.
Definition: SUMOVTypeParameter.h:259
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
SUMOVTypeParameter::maxSpeedLat
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
Definition: SUMOVTypeParameter.h:294
SUMOVTypeParameter::getCFParam
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.
Definition: SUMOVTypeParameter.cpp:406
SUMOVTypeParameter::maxSpeed
double maxSpeed
The vehicle type's maximum speed [m/s].
Definition: SUMOVTypeParameter.h:219
SUMOVTypeParameter::personCapacity
int personCapacity
The person capacity of the vehicle.
Definition: SUMOVTypeParameter.h:244
SUMOVTypeParameter::VClassDefaultValues::shape
SUMOVehicleShape shape
This class' shape.
Definition: SUMOVTypeParameter.h:109
SUMOVTypeParameter::hasDriverState
bool hasDriverState
Whether vehicles of this type are equipped with a driver (i.e. MSDriverState))
Definition: SUMOVTypeParameter.h:279
VTYPEPARS_SPEEDFACTOR_SET
const int VTYPEPARS_SPEEDFACTOR_SET
Definition: SUMOVTypeParameter.h:50
SUMOVTypeParameter::write
void write(OutputDevice &dev) const
Writes the vtype.
Definition: SUMOVTypeParameter.cpp:301
Distribution_Parameterized.h
SUMOVTypeParameter::speedFactor
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
Definition: SUMOVTypeParameter.h:229
SUMOVTypeParameter::VClassDefaultValues::osgFile
std::string osgFile
3D model file for this class
Definition: SUMOVTypeParameter.h:124
VTYPEPARS_LOADING_DURATION
const int VTYPEPARS_LOADING_DURATION
Definition: SUMOVTypeParameter.h:64
SUMOVTypeParameter::VClassDefaultValues::locomotiveLength
double locomotiveLength
the length of train locomotive
Definition: SUMOVTypeParameter.h:130
VTYPEPARS_CONTAINER_CAPACITY
const int VTYPEPARS_CONTAINER_CAPACITY
Definition: SUMOVTypeParameter.h:63
SUMOVTypeParameter::carriageGap
double carriageGap
Definition: SUMOVTypeParameter.h:305
SUMOVTypeParameter::getLCParam
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.
Definition: SUMOVTypeParameter.cpp:426
SUMOVTypeParameter::getDefaultEmergencyDecel
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...
Definition: SUMOVTypeParameter.cpp:539
SUMOVTypeParameter::latAlignment
LateralAlignment latAlignment
The vehicles desired lateral alignment.
Definition: SUMOVTypeParameter.h:297
SUMOVTypeParameter::id
std::string id
The vehicle type's id.
Definition: SUMOVTypeParameter.h:210
SUMOVTypeParameter::VClassDefaultValues
struct for default values that depend of VClass
Definition: SUMOVTypeParameter.h:89
VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
Definition: SUMOVTypeParameter.h:76
VTYPEPARS_PERSON_CAPACITY
const int VTYPEPARS_PERSON_CAPACITY
Definition: SUMOVTypeParameter.h:61
VTYPEPARS_HEIGHT_SET
const int VTYPEPARS_HEIGHT_SET
Definition: SUMOVTypeParameter.h:55
SUMOVTypeParameter::VClassDefaultValues::personCapacity
int personCapacity
The person capacity of the vehicle.
Definition: SUMOVTypeParameter.h:118
SUMOVTypeParameter::lcModel
LaneChangeModel lcModel
The lane-change model to use.
Definition: SUMOVTypeParameter.h:291
VTYPEPARS_IMGFILE_SET
const int VTYPEPARS_IMGFILE_SET
Definition: SUMOVTypeParameter.h:58
config.h
SUMOVTypeParameter::getCFParamString
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.
Definition: SUMOVTypeParameter.cpp:416
SUMOVTypeParameter::loadingDuration
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
Definition: SUMOVTypeParameter.h:253
SUMOVTypeParameter::color
RGBColor color
The color.
Definition: SUMOVTypeParameter.h:235
VTYPEPARS_LENGTH_SET
const int VTYPEPARS_LENGTH_SET
Definition: SUMOVTypeParameter.h:46
SUMOVTypeParameter::emissionClass
SUMOEmissionClass emissionClass
The emission class of this vehicle.
Definition: SUMOVTypeParameter.h:232
VTYPEPARS_EMISSIONCLASS_SET
const int VTYPEPARS_EMISSIONCLASS_SET
Definition: SUMOVTypeParameter.h:51
VTYPEPARS_COLOR_SET
const int VTYPEPARS_COLOR_SET
Definition: SUMOVTypeParameter.h:52
VTYPEPARS_SHAPE_SET
const int VTYPEPARS_SHAPE_SET
Definition: SUMOVTypeParameter.h:56
SUMOVTypeParameter::VClassDefaultValues::height
double height
This class' height.
Definition: SUMOVTypeParameter.h:106
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:136
VTYPEPARS_WIDTH_SET
const int VTYPEPARS_WIDTH_SET
Definition: SUMOVTypeParameter.h:54
SUMOVTypeParameter::vehicleClass
SUMOVehicleClass vehicleClass
The vehicle's class.
Definition: SUMOVTypeParameter.h:238
VTYPEPARS_IMPATIENCE_SET
const int VTYPEPARS_IMPATIENCE_SET
Definition: SUMOVTypeParameter.h:59
SUMOVTypeParameter::getJMParam
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.
Definition: SUMOVTypeParameter.cpp:452
SUMOVTypeParameter::VClassDefaultValues::speedFactor
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
Definition: SUMOVTypeParameter.h:115
VTYPEPARS_MAXSPEED_SET
const int VTYPEPARS_MAXSPEED_SET
Definition: SUMOVTypeParameter.h:48
VTYPEPARS_VEHICLECLASS_SET
const int VTYPEPARS_VEHICLECLASS_SET
Definition: SUMOVTypeParameter.h:53
SUMOVTypeParameter::getDefault
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift....
Definition: SUMOVTypeParameter.cpp:600
SUMOVTypeParameter::minGapLat
double minGapLat
The vehicle type's minimum lateral gap [m].
Definition: SUMOVTypeParameter.h:300
SUMOVTypeParameter::VClassDefaultValues::VClassDefaultValues
VClassDefaultValues()
default constructor
Definition: SUMOVTypeParameter.cpp:251