Eclipse 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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The car-following model and parameter
19 /****************************************************************************/
20 #ifndef MSVehicleType_h
21 #define MSVehicleType_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <cassert>
30 #include <map>
31 #include <string>
33 #include <utils/common/SUMOTime.h>
34 #include <utils/common/StdDefs.h>
38 #include <utils/common/RGBColor.h>
39 
40 
41 // ===========================================================================
42 // class declarations
43 // ===========================================================================
44 class MSLane;
45 class BinaryInputDevice;
46 class MSCFModel;
47 class SUMOVTypeParameter;
48 
49 
50 // ===========================================================================
51 // class definitions
52 // ===========================================================================
67 public:
72  MSVehicleType(const SUMOVTypeParameter& parameter);
73 
74 
76  virtual ~MSVehicleType();
77 
78 
83  bool wasSet(int what) const {
84  return (myParameter.parametersSet & what) != 0;
85  }
86 
87 
90 
94  const std::string& getID() const {
95  return myParameter.id;
96  }
97 
98 
102  int getNumericalID() const {
103  return myIndex;
104  }
105 
106 
110  double getLength() const {
111  return myParameter.length;
112  }
113 
114 
118  double getLengthWithGap() const {
120  }
121 
122 
126  double getMinGap() const {
127  return myParameter.minGap;
128  }
129 
133  double getMinGapLat() const {
134  return myParameter.minGapLat;
135  }
136 
137 
141  inline const MSCFModel& getCarFollowModel() const {
142  return *myCarFollowModel;
143  }
144 
145 
150  return *myCarFollowModel;
151  }
152 
153 
155  return myParameter.lcModel;
156  }
157 
158 
162  double getMaxSpeed() const {
163  return myParameter.maxSpeed;
164  }
165 
166 
170  double computeChosenSpeedDeviation(std::mt19937* rng, const double minDev = -1.) const;
171 
172 
176  double getDefaultProbability() const {
178  }
179 
180 
186  return myParameter.vehicleClass;
187  }
188 
189 
195  return myParameter.emissionClass;
196  }
197 
198 
202  const RGBColor& getColor() const {
203  return myParameter.color;
204  }
205 
206 
211  return myParameter.speedFactor;
212  }
213 
214 
220  }
221 
222 
226  double getActionStepLengthSecs() const {
228  }
229 
230 
234  double getImpatience() const {
235  return myParameter.impatience;
236  }
238 
239 
240 
243 
247  double getWidth() const {
248  return myParameter.width;
249  }
250 
254  double 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 
314  double getMaxSpeedLat() const {
315  return myParameter.maxSpeedLat;
316  }
317 
322  return myParameter.latAlignment;
323  }
325 
326 
329 
333  void setAccel(double accel);
334 
338  void setDecel(double decel);
339 
343  void setEmergencyDecel(double emergencyDecel);
344 
348  void setApparentDecel(double apparentDecel);
349 
353  void setImperfection(double imperfection);
354 
358  void setTau(double tau);
359 
367  void setLength(const double& length);
368 
369 
377  void setHeight(const double& height);
378 
379 
387  void setMinGap(const double& minGap);
388 
389 
397  void setMinGapLat(const double& minGapLat);
398 
406  void setMaxSpeed(const double& maxSpeed);
407 
415  void setMaxSpeedLat(const double& maxSpeedLat);
416 
420  void setVClass(SUMOVehicleClass vclass);
421 
422 
430  void setDefaultProbability(const double& prob);
431 
432 
440  void setSpeedFactor(const double& factor);
441 
442 
450  void setSpeedDeviation(const double& dev);
451 
452 
466  void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset);
467 
468 
472  void setEmissionClass(SUMOEmissionClass eclass);
473 
474 
478  void setColor(const RGBColor& color);
479 
480 
488  void setWidth(const double& width);
489 
490 
494  void setShape(SUMOVehicleShape shape);
495 
499  void setImpatience(const double impatience);
500 
505 
506 
507 
510 
516  static MSVehicleType* build(SUMOVTypeParameter& from);
517 
518 
526  MSVehicleType* buildSingularType(const std::string& id) const;
527 
528 
536  MSVehicleType* duplicateType(const std::string& id, bool persistent) const;
538 
539 
543  bool isVehicleSpecific() const {
544  return myOriginalType != nullptr;
545  }
546 
547 
551  const std::string& getOriginalID() const {
552  return myOriginalType != nullptr ? myOriginalType->getID() : getID();
553  }
554 
555 
557  return myParameter;
558  }
559 
564  void check();
565 
566 protected:
569 
570 private:
573 
576 
580 
582  const int myIndex;
583 
586 
589 
591  static int myNextIndex;
592 
593 
594 private:
596  MSVehicleType(const MSVehicleType&) = delete;
597 
599  MSVehicleType& operator=(const MSVehicleType&) = delete;
600 };
601 
602 
603 #endif
604 
605 /****************************************************************************/
606 
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.
const std::string & getOriginalID() const
Returns the id of the original vehicle type if this is a vehicle specific type, the id otherwise...
long long int SUMOTime
Definition: SUMOTime.h:35
double impatience
The vehicle&#39;s impatience (willingness to obstruct others)
MSVehicleType & operator=(const MSVehicleType &)=delete
Invalidated assignment operator.
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 setTau(double tau)
Set a new value for this type&#39;s headway.
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:57
void setDecel(double decel)
Set a new value for this type&#39;s deceleration.
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.
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 setApparentDecel(double apparentDecel)
Set a new value for this type&#39;s apparent deceleration.
void initRailVisualizationParameters()
init Rail Visualization Parameters
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.
void setImperfection(double imperfection)
Set a new value for this type&#39;s imperfection.
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:66
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:83
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 setAccel(double accel)
Set a new value for this type&#39;s acceleration.
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].
void setEmergencyDecel(double emergencyDecel)
Set a new value for this type&#39;s emergency deceleration.
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.
Definition: MSVehicleType.h:94
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.
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:83
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)