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 
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:89
void setMinGap(const double &minGap)
Set a new value for this type&#39;s minimum gap.
double getMinGap() const
Get the free space in front of vehicles of this class.
double getImpatience() const
Returns this type&#39;s impatience.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
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...
std::string getOSGFile() const
Get this vehicle type&#39;s 3D model file name.
SUMOTime getLoadingDuration() const
Get this vehicle type&#39;s loading duration.
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.
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.
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
double getDefaultProbability() const
Get the default probability of this vehicle type.
MSVehicleType & operator=(const MSVehicleType &)
Invalidated assignment operator.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
const MSVehicleType * myOriginalType
The original type.
void setLength(const double &length)
Set a new value for this type&#39;s length.
LateralAlignment getPreferredLateralAlignment() const
Get vehicle&#39;s preferred lateral alignment.
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type&#39;s maximum speed.
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.
const int myIndex
the running index
const MSCFModel & getCarFollowModel() const
Returns the vehicle type&#39;s car following model definition (const version)
int getPersonCapacity() const
Get this vehicle type&#39;s person capacity.
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
void setMinGapLat(const double &minGapLat)
Set a new value for this type&#39;s minimum lataral gap.
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
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.
const SUMOVTypeParameter & getParameter() const
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
std::string osgFile
3D model file for this class
int SUMOEmissionClass
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.
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 getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOTime getActionStepLength() const
Returns this type&#39;s default action step length.
double getActionStepLengthSecs() const
Returns this type&#39;s default action step length in seconds.
void setSpeedDeviation(const double &dev)
Set a new value for this type&#39;s speed deviation.
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
void setSpeedFactor(const double &factor)
Set a new value for this type&#39;s speed factor.
SUMOVehicleShape getGuiShape() const
Get this vehicle type&#39;s shape.
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 getNumericalID() const
Returns the running index of the vehicle type.
int parametersSet
Information for the router which parameter were set.
SUMOVTypeParameter myParameter
the parameter container
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
int personCapacity
The person capacity of the vehicle.
MSCFModel * myCarFollowModel
instance of the car following model.
double getLength() const
Get vehicle&#39;s length [m].
const Distribution_Parameterized & getSpeedFactor() const
Returns this type&#39;s speed factor.
double minGapLat
The vehicle type&#39;s minimum lateral gap [m].
LaneChangeModel getLaneChangeModel() const
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
void setWidth(const double &width)
Set a new value for this type&#39;s width.
const std::string & getID() const
Returns the name of the vehicle type.
std::string id
The vehicle type&#39;s id.
MSVehicleType(const SUMOVTypeParameter &parameter)
Constructor.
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
const RGBColor & getColor() const
Returns this type&#39;s color.
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.
std::string getImgFile() const
Get this vehicle type&#39;s raster model file name.
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...
int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
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.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle&#39;s preferred lateral alignment.
MSVehicleType * duplicateType(const std::string &id, bool persistent) const
Duplicates the microsim vehicle type giving the newly created type the given id.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
double getMaxSpeedLat() const
Get vehicle&#39;s maximum lateral speed [m/s].
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...
double length
The physical vehicle length.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double myCachedActionStepLengthSecs
the vtypes actionsStepLength in seconds (cached because needed very often)