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-2020 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 
73 
76 
77 // ===========================================================================
78 // struct definitions
79 // ===========================================================================
85 public:
90 
92  double length;
93 
95  double minGap;
96 
98  double maxSpeed;
99 
101  double width;
102 
104  double height;
105 
108 
111 
114 
117 
120 
122  std::string osgFile;
123 
126 
129 
130  private:
133  };
134 
139  SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
140 
142  virtual ~SUMOVTypeParameter() {};
143 
148  bool wasSet(int what) const {
149  return (parametersSet & what) != 0;
150  }
151 
157  void write(OutputDevice& dev) const;
158 
164  double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
165 
171  std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
172 
178  double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
179 
185  std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
186 
188  typedef std::map<SumoXMLAttr, std::string> SubParams;
189 
191  const SubParams& getLCParams() const;
192 
198  double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
199 
205  std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
206 
207  void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
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 
291  double maxSpeedLat;
292 
295 
297  double minGapLat;
298 
302  double carriageGap;
303 
306 
308  mutable bool saved;
309 
312 
314  std::vector<double> paramRestrictions;
315 
317  inline double getLength() const {
318  return length;
319  }
320 
326  static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
327 
333  static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
334 
341  static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
342 
348  static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
349 
351  static const SUMOVTypeParameter& getDefault();
352 
354  std::map<int, std::pair<SUMOTime, SUMOTime>> myManoeuverAngleTimes;
355 
365  void setManoeuverAngleTimes(const SUMOVehicleClass vclass);
366 
371  SUMOTime getEntryManoeuvreTime(const int angle) const;
372 
377  SUMOTime getExitManoeuvreTime(const int angle) const;
378 
382  std::string getManoeuverAngleTimesS() const;
383 };
long long int SUMOTime
Definition: SUMOTime.h:31
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_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
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.
SumoXMLTag
Numbers representing SUMO-XML - element names.
LateralAlignment
Numbers representing special SUMO-XML-attribute values Information how vehicles align themselves with...
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:60
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
Structure representing possible vehicle parameter.
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.
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.
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].
LateralAlignment latAlignment
The vehicles desired lateral alignment.
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.
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.
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 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