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>
47 
48 
49 // ===========================================================================
50 // class declarations
51 // ===========================================================================
52 class MSLane;
53 class BinaryInputDevice;
54 class MSCFModel;
55 class SUMOVTypeParameter;
56 
57 
58 // ===========================================================================
59 // class definitions
60 // ===========================================================================
75 public:
80  MSVehicleType(const SUMOVTypeParameter& parameter);
81 
82 
84  virtual ~MSVehicleType();
85 
86 
91  bool wasSet(int what) const {
92  return (myParameter.setParameter & what) != 0;
93  }
94 
95 
98 
102  const std::string& getID() const {
103  return myParameter.id;
104  }
105 
106 
110  int getNumericalID() const {
111  return myIndex;
112  }
113 
114 
118  double getLength() const {
119  return myParameter.length;
120  }
121 
122 
126  double getLengthWithGap() const {
128  }
129 
130 
134  double getMinGap() const {
135  return myParameter.minGap;
136  }
137 
141  double getMinGapLat() const {
142  return myParameter.minGapLat;
143  }
144 
145 
149  inline const MSCFModel& getCarFollowModel() const {
150  return *myCarFollowModel;
151  }
152 
153 
158  return *myCarFollowModel;
159  }
160 
161 
163  return myParameter.lcModel;
164  }
165 
166 
170  double getMaxSpeed() const {
171  return myParameter.maxSpeed;
172  }
173 
174 
178  double computeChosenSpeedDeviation(MTRand* rng, const double minDev = -1.) const;
179 
180 
184  double getDefaultProbability() const {
186  }
187 
188 
194  return myParameter.vehicleClass;
195  }
196 
197 
203  return myParameter.emissionClass;
204  }
205 
206 
210  const RGBColor& getColor() const {
211  return myParameter.color;
212  }
213 
214 
219  return myParameter.speedFactor;
220  }
221 
222 
226  double getImpatience() const {
227  return myParameter.impatience;
228  }
230 
231 
232 
235 
239  double getWidth() const {
240  return myParameter.width;
241  }
242 
246  double getHeight() const {
247  return myParameter.height;
248  }
249 
255  return myParameter.shape;
256  }
257 
261  std::string getOSGFile() const {
262  return myParameter.osgFile;
263  }
264 
265 
269  std::string getImgFile() const {
270  return myParameter.imgFile;
271  }
272 
273 
277  int getPersonCapacity() const {
279  }
280 
281 
285  int getContainerCapacity() const {
287  }
288 
294  }
295 
301  }
302 
306  double getMaxSpeedLat() const {
307  return myParameter.maxSpeedLat;
308  }
309 
314  return myParameter.latAlignment;
315  }
317 
318 
321 
329  void setLength(const double& length);
330 
331 
339  void setHeight(const double& height);
340 
341 
349  void setMinGap(const double& minGap);
350 
351 
359  void setMinGapLat(const double& minGapLat);
360 
368  void setMaxSpeed(const double& maxSpeed);
369 
377  void setMaxSpeedLat(const double& maxSpeedLat);
378 
382  void setVClass(SUMOVehicleClass vclass);
383 
384 
392  void setDefaultProbability(const double& prob);
393 
394 
402  void setSpeedFactor(const double& factor);
403 
404 
412  void setSpeedDeviation(const double& dev);
413 
414 
418  void setEmissionClass(SUMOEmissionClass eclass);
419 
420 
424  void setColor(const RGBColor& color);
425 
426 
434  void setWidth(const double& width);
435 
436 
440  void setShape(SUMOVehicleShape shape);
441 
442 
446  void setImpatience(const double impatience);
447 
452 
453 
454 
457 
463  static MSVehicleType* build(SUMOVTypeParameter& from);
464 
465 
471  static MSVehicleType* buildSingularType(const std::string& id, const MSVehicleType* from);
473 
474 
478  bool amVehicleSpecific() const {
479  return myOriginalType != 0;
480  }
481 
482 
484  return myParameter;
485  }
486 
487 
488 private:
491 
493  const int myIndex;
494 
497 
500 
502  static int myNextIndex;
503 
504 
505 private:
508 
511 
512 };
513 
514 
515 #endif
516 
517 /****************************************************************************/
518 
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:60
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.
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:74
double height
This class&#39; height.
SUMOTime getBoardingDuration() const
Get this vehicle type&#39;s boarding duration.
const int myIndex
the running index
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:91
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
static MSVehicleType * buildSingularType(const std::string &id, const MSVehicleType *from)
Duplicates the microsim vehicle type giving it a the given id.
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.
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.
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
virtual ~MSVehicleType()
Destructor.
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
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.
double maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
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.
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.
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.
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.
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:52
double computeChosenSpeedDeviation(MTRand *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
double getImpatience() const
Returns this type&#39;s impatience.
std::string getOSGFile() const
Get this vehicle type&#39;s 3D model file name.
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:79
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.