SUMO - Simulation of Urban MObility
SUMOVTypeParameter.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Structure representing possible vehicle parameter
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef SUMOVTypeParameter_h
23 #define SUMOVTypeParameter_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 
33 #include <config.h>
34 
35 #endif
36 
37 #include <string>
38 #include <map>
40 #include <utils/common/RGBColor.h>
41 #include <utils/common/SUMOTime.h>
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class OutputDevice;
49 class OptionsCont;
50 
51 
52 // ===========================================================================
53 // value definitions
54 // ===========================================================================
55 const int VTYPEPARS_LENGTH_SET = 1;
56 const int VTYPEPARS_MINGAP_SET = 1 << 1;
57 const int VTYPEPARS_MAXSPEED_SET = 1 << 2;
58 const int VTYPEPARS_PROBABILITY_SET = 1 << 3;
59 const int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
60 const int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
61 const int VTYPEPARS_COLOR_SET = 1 << 6;
62 const int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
63 const int VTYPEPARS_WIDTH_SET = 1 << 8;
64 const int VTYPEPARS_HEIGHT_SET = 1 << 9;
65 const int VTYPEPARS_SHAPE_SET = 1 << 10;
66 const int VTYPEPARS_OSGFILE_SET = 1 << 11;
67 const int VTYPEPARS_IMGFILE_SET = 1 << 12;
68 const int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
69 const int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
70 const int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
71 const int VTYPEPARS_BOARDING_DURATION = 1 << 16;
72 const int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
73 const int VTYPEPARS_LOADING_DURATION = 1 << 18;
74 const int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
75 const int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
76 const int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
77 const int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
78 
79 
80 // ===========================================================================
81 // struct definitions
82 // ===========================================================================
88 public:
93  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
94 
95 
100  bool wasSet(int what) const {
101  return (setParameter & what) != 0;
102  }
103 
104 
110  void write(OutputDevice& dev) const;
111 
114  void validateCFParameter() const;
115 
116 
122  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
123 
129  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
130 
136  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
137 
143  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
144 
145 
147  std::string id;
148 
150  double length;
152  double minGap;
154  double maxSpeed;
166  double impatience;
175 
178 
180  double width;
181 
183  double height;
184 
187 
189  std::string osgFile;
190 
192  std::string imgFile;
194 
195 
198 
200  typedef std::map<SumoXMLAttr, std::string> SubParams;
202  SubParams cfParameter;
204  SubParams lcParameter;
206  SubParams jmParameter;
207 
210 
212  double maxSpeedLat;
216  double minGapLat;
217 
220 
221 
223  mutable bool saved;
224 
226  mutable bool onlyReferenced;
227 
233  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
234 
240  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
241 
247  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc = SVC_IGNORING);
248 
254  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
255 
257  static const SUMOVTypeParameter& getDefault();
258 
259 };
260 
261 #endif
262 
263 /****************************************************************************/
264 
const int VTYPEPARS_MAXSPEED_SET
const int VTYPEPARS_MINGAP_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
const int VTYPEPARS_LATALIGNMENT_SET
double impatience
The vehicle&#39;s impatience (willingness to obstruct others)
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.
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...
LaneChangeModel
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.
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 osgFile
3D model file for this class
int SUMOEmissionClass
std::string imgFile
Image file for this class.
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:51
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers) ...
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.
static double getDefaultEmergencyDecel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default emergency deceleration for the given vehicle class This needs to be a function be...
const int VTYPEPARS_SPEEDFACTOR_SET
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
void write(OutputDevice &dev) const
Writes the vtype.
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 personCapacity
The person capacity of the vehicle.
int setParameter
Information for the router which parameter were set.
double minGapLat
The vehicle type&#39;s minimum lateral gap [m].
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
bool wasSet(int what) const
Returns whether the given parameter was set.
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:99
std::string id
The vehicle type&#39;s id.
const int VTYPEPARS_PERSON_CAPACITY
LateralAlignment latAlignment
The vehicles desired lateral alignment.
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:71
long long int SUMOTime
Definition: TraCIDefs.h:52
void validateCFParameter() const
Validates stored car-following parameter.
const int VTYPEPARS_WIDTH_SET
LaneChangeModel lcModel
The lane-change model to use.
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.
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