SUMO - Simulation of Urban MObility
MSVehicleType.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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // The car-following model and parameter
21 /****************************************************************************/
22 #ifndef MSVehicleType_h
23 #define MSVehicleType_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <cassert>
36 #include <map>
37 #include <string>
39 #include <utils/common/SUMOTime.h>
40 #include <utils/common/StdDefs.h>
44 #include <utils/common/RGBColor.h>
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
50 class MSLane;
51 class BinaryInputDevice;
52 class MSCFModel;
53 class SUMOVTypeParameter;
54 
55 
56 // ===========================================================================
57 // class definitions
58 // ===========================================================================
73 public:
78  MSVehicleType(const SUMOVTypeParameter& parameter);
79 
80 
82  virtual ~MSVehicleType();
83 
84 
89  bool wasSet(int what) const {
90  return (myParameter.parametersSet & what) != 0;
91  }
92 
93 
96 
100  const std::string& getID() const {
101  return myParameter.id;
102  }
103 
104 
108  int getNumericalID() const {
109  return myIndex;
110  }
111 
112 
116  double getLength() const {
117  return myParameter.length;
118  }
119 
120 
124  double getLengthWithGap() const {
126  }
127 
128 
132  double getMinGap() const {
133  return myParameter.minGap;
134  }
135 
139  double getMinGapLat() const {
140  return myParameter.minGapLat;
141  }
142 
143 
147  inline const MSCFModel& getCarFollowModel() const {
148  return *myCarFollowModel;
149  }
150 
151 
156  return *myCarFollowModel;
157  }
158 
159 
161  return myParameter.lcModel;
162  }
163 
164 
168  double getMaxSpeed() const {
169  return myParameter.maxSpeed;
170  }
171 
172 
176  double computeChosenSpeedDeviation(std::mt19937* rng, const double minDev = -1.) const;
177 
178 
182  double getDefaultProbability() const {
184  }
185 
186 
192  return myParameter.vehicleClass;
193  }
194 
195 
201  return myParameter.emissionClass;
202  }
203 
204 
208  const RGBColor& getColor() const {
209  return myParameter.color;
210  }
211 
212 
217  return myParameter.speedFactor;
218  }
219 
220 
226  }
227 
228 
232  double getActionStepLengthSecs() const {
234  }
235 
236 
240  double getImpatience() const {
241  return myParameter.impatience;
242  }
244 
245 
246 
249 
253  double getWidth() const {
254  return myParameter.width;
255  }
256 
260  double getHeight() const {
261  return myParameter.height;
262  }
263 
269  return myParameter.shape;
270  }
271 
275  std::string getOSGFile() const {
276  return myParameter.osgFile;
277  }
278 
279 
283  std::string getImgFile() const {
284  return myParameter.imgFile;
285  }
286 
287 
291  int getPersonCapacity() const {
293  }
294 
295 
299  int getContainerCapacity() const {
301  }
302 
308  }
309 
315  }
316 
320  double getMaxSpeedLat() const {
321  return myParameter.maxSpeedLat;
322  }
323 
328  return myParameter.latAlignment;
329  }
331 
332 
335 
343  void setLength(const double& length);
344 
345 
353  void setHeight(const double& height);
354 
355 
363  void setMinGap(const double& minGap);
364 
365 
373  void setMinGapLat(const double& minGapLat);
374 
382  void setMaxSpeed(const double& maxSpeed);
383 
391  void setMaxSpeedLat(const double& maxSpeedLat);
392 
396  void setVClass(SUMOVehicleClass vclass);
397 
398 
406  void setDefaultProbability(const double& prob);
407 
408 
416  void setSpeedFactor(const double& factor);
417 
418 
426  void setSpeedDeviation(const double& dev);
427 
428 
442  void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset);
443 
444 
448  void setEmissionClass(SUMOEmissionClass eclass);
449 
450 
454  void setColor(const RGBColor& color);
455 
456 
464  void setWidth(const double& width);
465 
466 
470  void setShape(SUMOVehicleShape shape);
471 
475  void setImpatience(const double impatience);
476 
481 
482 
483 
486 
492  static MSVehicleType* build(SUMOVTypeParameter& from);
493 
494 
502  MSVehicleType* buildSingularType(const std::string& id) const;
503 
504 
512  MSVehicleType* duplicateType(const std::string& id, bool persistent) const;
514 
515 
519  bool isVehicleSpecific() const {
520  return myOriginalType != 0;
521  }
522 
523 
525  return myParameter;
526  }
527 
532  void check();
533 
534 private:
537 
540 
544 
546  const int myIndex;
547 
550 
553 
555  static int myNextIndex;
556 
557 
558 private:
561 
564 
565 };
566 
567 
568 #endif
569 
570 /****************************************************************************/
571 
void setMinGap(const double &minGap)
Set a new value for this type&#39;s minimum gap.
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
SUMOVehicleShape getGuiShape() const
Get this vehicle type&#39;s shape.
double impatience
The vehicle&#39;s impatience (willingness to obstruct others)
MSCFModel & getCarFollowModel()
Returns the vehicle type&#39;s car following model definition (non-const version)
void setDefaultProbability(const double &prob)
Set a new value for this type&#39;s default probability.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void setShape(SUMOVehicleShape shape)
Set a new value for this type&#39;s shape.
SUMOVehicleShape shape
This class&#39; shape.
Structure representing possible vehicle parameter.
LateralAlignment getPreferredLateralAlignment() const
Get vehicle&#39;s preferred lateral alignment.
double defaultProbability
The probability when being added to a distribution without an explicit probability.
The car-following model abstraction.
Definition: MSCFModel.h:59
int containerCapacity
The container capacity of the vehicle.
std::string getImgFile() const
Get this vehicle type&#39;s raster model file name.
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
MSVehicleType & operator=(const MSVehicleType &)
Invalidated assignment operator.
int getNumericalID() const
Returns the running index of the vehicle type.
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
const MSVehicleType * myOriginalType
The original type.
void setLength(const double &length)
Set a new value for this type&#39;s length.
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type&#39;s maximum speed.
int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
MSVehicleType * duplicateType(const std::string &id, bool persistent) const
Duplicates the microsim vehicle type giving the newly created type the given id.
int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
LateralAlignment
Numbers representing special SUMO-XML-attribute values Information how vehicles align themselves with...
The car-following model and parameter.
Definition: MSVehicleType.h:72
double height
This class&#39; height.
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
const int myIndex
the running index
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:89
double getDefaultProbability() const
Get the default probability of this vehicle type.
void setMinGapLat(const double &minGapLat)
Set a new value for this type&#39;s minimum lataral gap.
LaneChangeModel
LaneChangeModel getLaneChangeModel() const
double maxSpeed
The vehicle type&#39;s maximum speed [m/s].
double width
This class&#39; width.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
SUMOTime boardingDuration
The time a person needs to board the vehicle.
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
std::string osgFile
3D model file for this class
int SUMOEmissionClass
SUMOTime getLoadingDuration() const
Get this vehicle type&#39;s loading duration.
void setHeight(const double &height)
Set a new value for this type&#39;s height.
std::string imgFile
Image file for this class.
virtual ~MSVehicleType()
Destructor.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
SUMOTime getActionStepLength() const
Returns this type&#39;s default action step length.
void setImpatience(const double impatience)
Set a new value for this type&#39;s impatience.
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type&#39;s emission class.
double getMinGap() const
Get the free space in front of vehicles of this class.
void setSpeedDeviation(const double &dev)
Set a new value for this type&#39;s speed deviation.
void setSpeedFactor(const double &factor)
Set a new value for this type&#39;s speed factor.
const SUMOVTypeParameter & getParameter() const
const RGBColor & getColor() const
Returns this type&#39;s color.
void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset)
Set a new value for this type&#39;s action step length.
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
int parametersSet
Information for the router which parameter were set.
SUMOVTypeParameter myParameter
the parameter container
double getMaxSpeedLat() const
Get vehicle&#39;s maximum lateral speed [m/s].
int personCapacity
The person capacity of the vehicle.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSCFModel * myCarFollowModel
instance of the car following model.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
double minGapLat
The vehicle type&#39;s minimum lateral gap [m].
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
RGBColor color
The color.
static int myNextIndex
next value for the running index
const std::string & getID() const
Returns the name of the vehicle type.
void setWidth(const double &width)
Set a new value for this type&#39;s width.
double getActionStepLengthSecs() const
Returns this type&#39;s default action step length in seconds.
std::string id
The vehicle type&#39;s id.
double getLength() const
Get vehicle&#39;s length [m].
MSVehicleType(const SUMOVTypeParameter &parameter)
Constructor.
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type&#39;s vehicle class.
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.
void setColor(const RGBColor &color)
Set a new value for this type&#39;s color.
long long int SUMOTime
Definition: TraCIDefs.h:51
bool myWarnedActionStepLengthTauOnce
Indicator whether the user was already warned once about an action step length larger than the desire...
double getImpatience() const
Returns this type&#39;s impatience.
std::string getOSGFile() const
Get this vehicle type&#39;s 3D model file name.
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
LaneChangeModel lcModel
The lane-change model to use.
void setMaxSpeedLat(const double &maxSpeedLat)
Set a new value for this type&#39;s maximum lateral speed.
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle&#39;s preferred lateral alignment.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
Encapsulates binary reading operations on a file.
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
const Distribution_Parameterized & getSpeedFactor() const
Returns this type&#39;s speed factor.
double length
The physical vehicle length.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
double myCachedActionStepLengthSecs
the vtypes actionsStepLength in seconds (cached because needed very often)