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-2016 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  SUMOReal getLength() const {
119  return myParameter.length;
120  }
121 
122 
128  }
129 
130 
134  SUMOReal getMinGap() const {
135  return myParameter.minGap;
136  }
137 
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 
171  return myParameter.maxSpeed;
172  }
173 
174 
178  SUMOReal computeChosenSpeedDeviation(MTRand* rng, const SUMOReal minDevFactor = 0.2) const;
179 
180 
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 
227  return myParameter.speedDev;
228  }
229 
230 
235  return myParameter.impatience;
236  }
238 
239 
240 
243 
247  SUMOReal getWidth() const {
248  return myParameter.width;
249  }
250 
254  SUMOReal getHeight() const {
255  return myParameter.height;
256  }
257 
263  return myParameter.shape;
264  }
265 
269  std::string getOSGFile() const {
270  return myParameter.osgFile;
271  }
272 
273 
277  std::string getImgFile() const {
278  return myParameter.imgFile;
279  }
280 
281 
285  int getPersonCapacity() const {
287  }
288 
289 
293  int getContainerCapacity() const {
295  }
296 
302  }
303 
309  }
310 
315  return myParameter.maxSpeedLat;
316  }
317 
322  return myParameter.latAlignment;
323  }
325 
326 
329 
337  void setLength(const SUMOReal& length);
338 
339 
347  void setMinGap(const SUMOReal& minGap);
348 
349 
357  void setMaxSpeed(const SUMOReal& maxSpeed);
358 
359 
363  void setVClass(SUMOVehicleClass vclass);
364 
365 
373  void setDefaultProbability(const SUMOReal& prob);
374 
375 
383  void setSpeedFactor(const SUMOReal& factor);
384 
385 
393  void setSpeedDeviation(const SUMOReal& dev);
394 
395 
399  void setEmissionClass(SUMOEmissionClass eclass);
400 
401 
405  void setColor(const RGBColor& color);
406 
407 
415  void setWidth(const SUMOReal& width);
416 
417 
421  void setShape(SUMOVehicleShape shape);
422 
423 
427  void setImpatience(const SUMOReal impatience);
429 
430 
431 
434 
440  static MSVehicleType* build(SUMOVTypeParameter& from);
441 
442 
448  static MSVehicleType* build(const std::string& id, const MSVehicleType* from);
450 
451 
455  bool amVehicleSpecific() const {
456  return myOriginalType != 0;
457  }
458 
459 
461  return myParameter;
462  }
463 
464 
465 private:
468 
470  const int myIndex;
471 
474 
477 
479  static int myNextIndex;
480 
481 
482 private:
485 
488 
489 };
490 
491 
492 #endif
493 
494 /****************************************************************************/
495 
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:91
void setImpatience(const SUMOReal impatience)
Set a new value for this type&#39;s impatience.
SUMOReal getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
long long int SUMOTime
Definition: SUMOTime.h:43
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOVehicleClass getVehicleClass() const
Get this vehicle type&#39;s vehicle class.
MSCFModel & getCarFollowModel()
Returns the vehicle type&#39;s car following model definition (non-const version)
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.
SUMOReal getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
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.
void setSpeedFactor(const SUMOReal &factor)
Set a new value for this type&#39;s speed factor.
SUMOReal speedDev
The standard deviation for speed variations.
The car-following model abstraction.
Definition: MSCFModel.h:59
void setLength(const SUMOReal &length)
Set a new value for this type&#39;s length.
int containerCapacity
The container capacity of the vehicle.
SUMOReal length
The physical vehicle length.
SUMOReal getLength() const
Get vehicle&#39;s length [m].
SUMOReal getImpatience() const
Returns this type&#39;s impatience.
SUMOVehicleClass vehicleClass
The vehicle&#39;s class.
MSVehicleType & operator=(const MSVehicleType &)
Invalidated assignment operator.
SUMOReal getMaxSpeedLat() const
Get vehicle&#39;s maximum lateral speed [m/s].
SUMOReal computeChosenSpeedDeviation(MTRand *rng, const SUMOReal minDevFactor=0.2) const
Computes and returns the speed deviation.
const MSVehicleType * myOriginalType
The original type.
void setWidth(const SUMOReal &width)
Set a new value for this type&#39;s width.
SUMOReal width
This class&#39; width.
LateralAlignment getPreferredLateralAlignment() const
Get vehicle&#39;s preferred lateral alignment.
SUMOReal getHeight() const
Get the height which vehicles of this class shall have when being drawn.
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
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.
LaneChangeModel
SUMOReal speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
void setSpeedDeviation(const SUMOReal &dev)
Set a new value for this type&#39;s speed deviation.
SUMOReal getSpeedDeviation() const
Returns this type&#39;s speed deviation.
SUMOTime boardingDuration
The time a person needs to board the vehicle.
const SUMOVTypeParameter & getParameter() const
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
std::string osgFile
3D model file for this class
int SUMOEmissionClass
SUMOReal maxSpeedLat
The vehicle type&#39;s maximum lateral speed [m/s].
std::string imgFile
Image file for this class.
virtual ~MSVehicleType()
Destructor.
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type&#39;s emission class.
void setMinGap(const SUMOReal &minGap)
Set a new value for this type&#39;s minimum gap.
SUMOVehicleShape getGuiShape() const
Get this vehicle type&#39;s shape.
int getNumericalID() const
Returns the running index of the vehicle type.
SUMOVTypeParameter myParameter
the parameter container
SUMOReal maxSpeed
The vehicle type&#39;s maximum speed [m/s].
SUMOReal getSpeedFactor() const
Returns this type&#39;s speed factor.
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
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.
LaneChangeModel getLaneChangeModel() const
SUMOReal impatience
The vehicle&#39;s impatience (willingness to obstruct others)
SUMOReal minGapLat
The vehicle type&#39;s minimum lateral gap [m].
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
SUMOReal defaultProbability
The probability when being added to a distribution without an explicit probability.
SUMOReal getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
SUMOReal getDefaultProbability() const
Get the default probability of this vehicle type.
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.
std::string id
The vehicle type&#39;s id.
MSVehicleType(const SUMOVTypeParameter &parameter)
Constructor.
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.
void setDefaultProbability(const SUMOReal &prob)
Set a new value for this type&#39;s default probability.
void setMaxSpeed(const SUMOReal &maxSpeed)
Set a new value for this type&#39;s maximum speed.
void setColor(const RGBColor &color)
Set a new value for this type&#39;s color.
#define SUMOReal
Definition: config.h:213
std::string getImgFile() const
Get this vehicle type&#39;s raster model file name.
int getContainerCapacity() const
Get this vehicle type&#39;s container capacity.
LaneChangeModel lcModel
The lane-change model to use.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type&#39;s emission class.
SUMOReal height
This class&#39; height.
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
Encapsulates binary reading operations on a file.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
SUMOReal minGap
This class&#39; free space in front of the vehicle itself.