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-2018 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 
72 
75 
76 // ===========================================================================
77 // struct definitions
78 // ===========================================================================
84 public:
89  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
90 
91 
96  bool wasSet(int what) const {
97  return (parametersSet & what) != 0;
98  }
99 
100 
106  void write(OutputDevice& dev) const;
107 
110  void validateCFParameter() const;
111 
112 
118  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
119 
125  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
126 
132  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
133 
135  typedef std::map<SumoXMLAttr, std::string> SubParams;
136 
138  const SubParams& getLCParams() const;
139 
145  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
146 
147 
149  std::string id;
150 
152  double length;
154  double minGap;
156  double maxSpeed;
171  double impatience;
180 
183 
185  double width;
186 
188  double height;
189 
192 
194  std::string osgFile;
195 
197  std::string imgFile;
199 
200 
203 
206 
208  SubParams cfParameter;
210  SubParams lcParameter;
212  SubParams jmParameter;
213 
216 
218  double maxSpeedLat;
222  double minGapLat;
223 
226 
227 
229  mutable bool saved;
230 
233 
239  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
240 
246  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
247 
254  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
255 
261  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
262 
264  static const SUMOVTypeParameter& getDefault();
265 
266 };
267 
268 #endif
269 
270 /****************************************************************************/
271 
const int VTYPEPARS_MAXSPEED_SET
const int VTYPEPARS_MINGAP_SET
const SubParams & getLCParams() const
Returns the LC parameter.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
const int VTYPEPARS_LATALIGNMENT_SET
long long int SUMOTime
Definition: SUMOTime.h:36
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 impatience
The vehicle&#39;s impatience (willingness to obstruct others)
const int VTYPEPARS_HASDRIVERSTATE_SET
std::map< SumoXMLAttr, std::string > SubParams
sub-model parameters
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
SUMOVehicleShape shape
This class&#39; shape.
Structure representing possible vehicle parameter.
const int VTYPEPARS_MINGAP_LAT_SET
bool saved
Information whether this type was already saved (needed by routers)
SUMOVTypeParameter(const std::string &vtid, const SUMOVehicleClass vc=SVC_IGNORING)
Constructor.
double defaultProbability
The probability when being added to a distribution without an explicit probability.
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
int containerCapacity
The container capacity of the vehicle.
const int VTYPEPARS_BOARDING_DURATION
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
const int VTYPEPARS_CAR_FOLLOW_MODEL
const int VTYPEPARS_OSGFILE_SET
const int VTYPEPARS_MAXSPEED_LAT_SET
const int VTYPEPARS_PROBABILITY_SET
LateralAlignment
Numbers representing special SUMO-XML-attribute values Information how vehicles align themselves with...
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 ...
double height
This class&#39; height.
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
static double getDefaultImperfection(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default driver&#39;s imperfection (sigma or epsilon in Krauss&#39; model) for the given vehicle c...
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.
LaneChangeModel
bool wasSet(int what) const
Returns whether the given parameter was set.
double maxSpeed
The vehicle type&#39;s maximum speed [m/s].
double width
This class&#39; width.
SUMOTime boardingDuration
The time a person needs to board the vehicle.
const int VTYPEPARS_ACTIONSTEPLENGTH_SET
std::string osgFile
3D model file for this class
int SUMOEmissionClass
std::string imgFile
Image file for this class.
void validateCFParameter() const
Validates stored car-following parameter.
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 ...
const int VTYPEPARS_LOADING_DURATION
const int VTYPEPARS_CONTAINER_CAPACITY
An upper class for objects with additional parameters.
Definition: Parameterised.h:44
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers) ...
const int VTYPEPARS_SPEEDFACTOR_SET
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
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.
int parametersSet
Information for the router which parameter were set.
int personCapacity
The person capacity of the vehicle.
bool hasDriverState
Whether vehicles of this type are equipped with a driver (i.e. MSDriverState))
double minGapLat
The vehicle type&#39;s minimum lateral gap [m].
void write(OutputDevice &dev) const
Writes the vtype.
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.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
SubParams jmParameter
Junction-model parameter.
const int VTYPEPARS_IMGFILE_SET
SubParams cfParameter
Car-following parameter.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
RGBColor color
The color.
A storage for options typed value containers)
Definition: OptionsCont.h:92
std::string id
The vehicle type&#39;s id.
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const int VTYPEPARS_PERSON_CAPACITY
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...
LateralAlignment latAlignment
The vehicles desired lateral alignment.
SUMOTime actionStepLength
The vehicle type&#39;s default actionStepLength [ms], i.e. the interval between two control actions...
double minGap
This class&#39; free space in front of the vehicle itself.
const int VTYPEPARS_HEIGHT_SET
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
const int VTYPEPARS_WIDTH_SET
LaneChangeModel lcModel
The lane-change model to use.
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift.com/c++-faq/static-init-order.html
const int VTYPEPARS_LENGTH_SET
const int VTYPEPARS_VEHICLECLASS_SET
const int VTYPEPARS_EMISSIONCLASS_SET
const int VTYPEPARS_COLOR_SET
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
const int VTYPEPARS_SHAPE_SET
double length
The physical vehicle length.
SubParams lcParameter
Lane-changing parameter.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
vehicles ignoring classes
const int VTYPEPARS_IMPATIENCE_SET