SUMO - Simulation of Urban MObility
MSVehicleType.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The car-following model and parameter
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef MSVehicleType_h
24 #define MSVehicleType_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <cassert>
37 #include <map>
38 #include <string>
40 #include <utils/common/SUMOTime.h>
41 #include <utils/common/StdDefs.h>
45 #include <utils/common/RGBColor.h>
46 
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class MSLane;
52 class BinaryInputDevice;
53 class MSCFModel;
54 class SUMOVTypeParameter;
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
74 public:
79  MSVehicleType(const SUMOVTypeParameter& parameter);
80 
81 
83  virtual ~MSVehicleType();
84 
85 
90  bool wasSet(int what) const {
91  return (myParameter.setParameter & what) != 0;
92  }
93 
94 
97 
101  const std::string& getID() const {
102  return myParameter.id;
103  }
104 
105 
109  int getNumericalID() const {
110  return myIndex;
111  }
112 
113 
117  double getLength() const {
118  return myParameter.length;
119  }
120 
121 
125  double getLengthWithGap() const {
127  }
128 
129 
133  double getMinGap() const {
134  return myParameter.minGap;
135  }
136 
140  double getMinGapLat() const {
141  return myParameter.minGapLat;
142  }
143 
144 
148  inline const MSCFModel& getCarFollowModel() const {
149  return *myCarFollowModel;
150  }
151 
152 
157  return *myCarFollowModel;
158  }
159 
160 
162  return myParameter.lcModel;
163  }
164 
165 
169  double getMaxSpeed() const {
170  return myParameter.maxSpeed;
171  }
172 
173 
177  double computeChosenSpeedDeviation(std::mt19937* rng, const double minDev = -1.) const;
178 
179 
183  double getDefaultProbability() const {
185  }
186 
187 
193  return myParameter.vehicleClass;
194  }
195 
196 
202  return myParameter.emissionClass;
203  }
204 
205 
209  const RGBColor& getColor() const {
210  return myParameter.color;
211  }
212 
213 
218  return myParameter.speedFactor;
219  }
220 
221 
225  double getImpatience() const {
226  return myParameter.impatience;
227  }
229 
230 
231 
234 
238  double getWidth() const {
239  return myParameter.width;
240  }
241 
245  double getHeight() const {
246  return myParameter.height;
247  }
248 
254  return myParameter.shape;
255  }
256 
260  std::string getOSGFile() const {
261  return myParameter.osgFile;
262  }
263 
264 
268  std::string getImgFile() const {
269  return myParameter.imgFile;
270  }
271 
272 
276  int getPersonCapacity() const {
278  }
279 
280 
284  int getContainerCapacity() const {
286  }
287 
293  }
294 
300  }
301 
305  double getMaxSpeedLat() const {
306  return myParameter.maxSpeedLat;
307  }
308 
313  return myParameter.latAlignment;
314  }
316 
317 
320 
328  void setLength(const double& length);
329 
330 
338  void setHeight(const double& height);
339 
340 
348  void setMinGap(const double& minGap);
349 
350 
358  void setMinGapLat(const double& minGapLat);
359 
367  void setMaxSpeed(const double& maxSpeed);
368 
376  void setMaxSpeedLat(const double& maxSpeedLat);
377 
381  void setVClass(SUMOVehicleClass vclass);
382 
383 
391  void setDefaultProbability(const double& prob);
392 
393 
401  void setSpeedFactor(const double& factor);
402 
403 
411  void setSpeedDeviation(const double& dev);
412 
413 
417  void setEmissionClass(SUMOEmissionClass eclass);
418 
419 
423  void setColor(const RGBColor& color);
424 
425 
433  void setWidth(const double& width);
434 
435 
439  void setShape(SUMOVehicleShape shape);
440 
441 
445  void setImpatience(const double impatience);
446 
451 
452 
453 
456 
462  static MSVehicleType* build(SUMOVTypeParameter& from);
463 
464 
472  MSVehicleType* buildSingularType(const std::string& id) const;
473 
474 
482  MSVehicleType* duplicateType(const std::string& id, bool persistent) const;
484 
485 
489  bool isVehicleSpecific() const {
490  return myOriginalType != 0;
491  }
492 
493 
495  return myParameter;
496  }
497 
498 
499 private:
502 
504  const int myIndex;
505 
508 
511 
513  static int myNextIndex;
514 
515 
516 private:
519 
522 
523 };
524 
525 
526 #endif
527 
528 /****************************************************************************/
529 
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:90
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:60
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:73
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
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.
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.
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
int getNumericalID() const
Returns the running index of the vehicle type.
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.
int setParameter
Information for the router which parameter were set.
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.
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:52
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:79
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.