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-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
21// The car-following model and parameter
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <cassert>
27#include <map>
28#include <string>
37
38
39// ===========================================================================
40// class declarations
41// ===========================================================================
42class MSLane;
43class MSCFModel;
45
46
47// ===========================================================================
48// class definitions
49// ===========================================================================
64public:
69 MSVehicleType(const SUMOVTypeParameter& parameter);
70
71
73 virtual ~MSVehicleType();
74
75
80 bool wasSet(int what) const {
81 return (myParameter.parametersSet & what) != 0;
82 }
83
84
87
91 const std::string& getID() const {
92 return myParameter.id;
93 }
94
95
99 int getNumericalID() const {
100 return myIndex;
101 }
102
103
107 double getLength() const {
108 return myParameter.length;
109 }
110
111
115 double getLengthWithGap() const {
117 }
118
119
123 double getMinGap() const {
124 return myParameter.minGap;
125 }
126
130 double getMinGapLat() const {
131 return myParameter.minGapLat;
132 }
133
134
138 inline const MSCFModel& getCarFollowModel() const {
139 return *myCarFollowModel;
140 }
141
142
147 return *myCarFollowModel;
148 }
149
150
152 return myParameter.lcModel;
153 }
154
155
159 double getMaxSpeed() const {
160 return myParameter.maxSpeed;
161 }
162
166 double getDesiredMaxSpeed() const {
168 }
169
170
174 double computeChosenSpeedDeviation(SumoRNG* rng, const double minDev = -1.) const;
175
176
180 double getDefaultProbability() const {
182 }
183
184
191 }
192
193
200 }
201
202
206 inline double getMass() const {
207 return myParameter.mass;
208 }
209
210
214 const RGBColor& getColor() const {
215 return myParameter.color;
216 }
217
218
224 }
225
226
232 }
233
234
238 double getActionStepLengthSecs() const {
240 }
241
242
246 double getImpatience() const {
247 return myParameter.impatience;
248 }
250
251
252
255
259 double getWidth() const {
260 return myParameter.width;
261 }
262
266 double getHeight() const {
267 return myParameter.height;
268 }
269
275 return myParameter.shape;
276 }
277
281 std::string getOSGFile() const {
282 return myParameter.osgFile;
283 }
284
285
289 std::string getImgFile() const {
290 return myParameter.imgFile;
291 }
292
293
297 int getPersonCapacity() const {
299 }
300
301
307 }
308
312 SUMOTime getLoadingDuration(const bool isPerson) const {
314 }
315
319 double getMaxSpeedLat() const {
321 }
322
328 }
329
335 }
336
338 double getFrontSeatPos() const {
340 }
342
343
346
350 void setAccel(double accel);
351
355 void setDecel(double decel);
356
360 void setEmergencyDecel(double emergencyDecel);
361
365 void setApparentDecel(double apparentDecel);
366
370 void setImperfection(double imperfection);
371
375 void setTau(double tau);
376
384 void setLength(const double& length);
385
386
394 void setHeight(const double& height);
395
396
404 void setMinGap(const double& minGap);
405
406
414 void setMinGapLat(const double& minGapLat);
415
423 void setMaxSpeed(const double& maxSpeed);
424
432 void setMaxSpeedLat(const double& maxSpeedLat);
433
437 void setVClass(SUMOVehicleClass vclass);
438
439
447 void setDefaultProbability(const double& prob);
448
449
457 void setSpeedFactor(const double& factor);
458
459
467 void setSpeedDeviation(const double& dev);
468
469
483 void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset);
484
485
490
491
495 void setMass(double mass);
496
497
501 void setColor(const RGBColor& color);
502
503
511 void setWidth(const double& width);
512
513
517 void setShape(SUMOVehicleShape shape);
518
522 void setImpatience(const double impatience);
523
526 void setPreferredLateralAlignment(const LatAlignmentDefinition& latAlignment, double latAlignmentOffset = 0.0);
527
530 void setScale(double value);
532
533
534
537
544
546 SUMOTime getEntryManoeuvreTime(const int angle) const;
548 SUMOTime getExitManoeuvreTime(const int angle) const;
549
550
558 MSVehicleType* buildSingularType(const std::string& id) const;
559
560
568 MSVehicleType* duplicateType(const std::string& id, bool persistent) const;
570
571
575 bool isVehicleSpecific() const {
576 return myOriginalType != nullptr;
577 }
578
579
583 const std::string& getOriginalID() const {
584 return myOriginalType != nullptr ? myOriginalType->getID() : getID();
585 }
586
587
589 return myParameter;
590 }
591
596 void check();
597
599 inline const EnergyParams* getEmissionParameters() const {
600 return &myEnergyParams;
601 }
602
603private:
606
608
611
617
619 const int myIndex;
620
623
626
628 static int myNextIndex;
629
630
631private:
633 MSVehicleType(const MSVehicleType&) = delete;
634
637};
long long int SUMOTime
Definition: GUI.h:36
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
int SUMOEmissionClass
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
LaneChangeModel
An upper class for objects with additional parameters.
Definition: EnergyParams.h:41
The car-following model abstraction.
Definition: MSCFModel.h:55
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
The car-following model and parameter.
Definition: MSVehicleType.h:63
void setHeight(const double &height)
Set a new value for this type's height.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
double getDefaultProbability() const
Get the default probability of this vehicle type.
void setMaxSpeedLat(const double &maxSpeedLat)
Set a new value for this type's maximum lateral speed.
const EnergyParams * getEmissionParameters() const
retrieve parameters for the energy consumption model
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSCFModel & getCarFollowModel()
Returns the vehicle type's car following model definition (non-const version)
double myCachedActionStepLengthSecs
the vtypes actionsStepLength in seconds (cached because needed very often)
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
void setSpeedFactor(const double &factor)
Set a new value for this type's speed factor.
static MSVehicleType * build(SUMOVTypeParameter &from)
Builds the microsim vehicle type described by the given parameter.
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type's emission class.
double getMaxSpeed() const
Get vehicle's (technical) maximum speed [m/s].
const int myIndex
the running index
MSVehicleType(const MSVehicleType &)=delete
Invalidated copy constructor.
std::string getOSGFile() const
Get this vehicle type's 3D model file name.
MSVehicleType(const SUMOVTypeParameter &parameter)
Constructor.
void setDefaultProbability(const double &prob)
Set a new value for this type's default probability.
double getDesiredMaxSpeed() const
Returns the vehicles's desired maximum speed.
const LatAlignmentDefinition & getPreferredLateralAlignment() const
Get vehicle's preferred lateral alignment procedure.
int getPersonCapacity() const
Get this vehicle type's person capacity.
void setEmergencyDecel(double emergencyDecel)
Set a new value for this type's emergency deceleration.
void setSpeedDeviation(const double &dev)
Set a new value for this type's speed deviation.
bool myWarnedActionStepLengthTauOnce
Indicator whether the user was already warned once about an action step length larger than the desire...
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
MSCFModel * myCarFollowModel
instance of the car following model.
void setMinGapLat(const double &minGapLat)
Set a new value for this type's minimum lataral gap.
double getMinGap() const
Get the free space in front of vehicles of this class.
MSVehicleType * duplicateType(const std::string &id, bool persistent) const
Duplicates the microsim vehicle type giving the newly created type the given id.
SUMOVTypeParameter myParameter
the parameter container
bool myWarnedStepLengthTauOnce
LaneChangeModel getLaneChangeModel() const
SUMOTime getLoadingDuration(const bool isPerson) const
Get this vehicle type's loading duration.
void setApparentDecel(double apparentDecel)
Set a new value for this type's apparent deceleration.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
const MSVehicleType * myOriginalType
The original type.
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
void setLength(const double &length)
Set a new value for this type's length.
void setDecel(double decel)
Set a new value for this type's deceleration.
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
SUMOTime getExitManoeuvreTime(const int angle) const
Accessor function for parameter equivalent returning exit time for a specific manoeuver angle.
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
void setAccel(double accel)
Set a new value for this type's acceleration.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
void setWidth(const double &width)
Set a new value for this type's width.
void setColor(const RGBColor &color)
Set a new value for this type's color.
double getFrontSeatPos() const
Get offset of first seat from vehicle front.
MSVehicleType & operator=(const MSVehicleType &)=delete
Invalidated assignment operator.
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
void setImpatience(const double impatience)
Set a new value for this type's impatience.
void setImperfection(double imperfection)
Set a new value for this type's imperfection.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
void setPreferredLateralAlignment(const LatAlignmentDefinition &latAlignment, double latAlignmentOffset=0.0)
Set vehicle's preferred lateral alignment.
static int myNextIndex
next value for the running index
void setTau(double tau)
Set a new value for this type's headway.
void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset)
Set a new value for this type's action step length.
double getLength() const
Get vehicle's length [m].
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
void setMass(double mass)
Set a new value for this type's mass.
bool wasSet(int what) const
Returns whether the given parameter was set.
Definition: MSVehicleType.h:80
double getMass() const
Get this vehicle type's mass.
void setMinGap(const double &minGap)
Set a new value for this type's minimum gap.
const std::string & getOriginalID() const
Returns the id of the original vehicle type if this is a vehicle specific type, the id otherwise.
std::string getImgFile() const
Get this vehicle type's raster model file name.
SUMOTime getEntryManoeuvreTime(const int angle) const
Accessor function for parameter equivalent returning entry time for a specific manoeuver angle.
double getImpatience() const
Returns this type's impatience.
int getNumericalID() const
Returns the running index of the vehicle type.
Definition: MSVehicleType.h:99
const SUMOVTypeParameter & getParameter() const
double computeChosenSpeedDeviation(SumoRNG *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
SUMOTime getActionStepLength() const
Returns this type's default action step length.
virtual ~MSVehicleType()
Destructor.
double getPreferredLateralAlignmentOffset() const
Get vehicle's preferred lateral alignment offset (in m from center line)
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
const EnergyParams myEnergyParams
int getContainerCapacity() const
Get this vehicle type's container capacity.
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
const RGBColor & getColor() const
Returns this type's color.
bool myWarnedActionStepLengthBallisticOnce
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
void setScale(double value)
Set traffic scaling factor.
Structure representing possible vehicle parameter.
double width
This class' width.
double defaultProbability
The probability when being added to a distribution without an explicit probability.
SUMOTime actionStepLength
The vehicle type's default actionStepLength [ms], i.e. the interval between two control actions....
double height
This class' height.
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double frontSeatPos
the offset of the first person seat from the front of the vehicle
double latAlignmentOffset
(optional) The vehicle's desired lateral alignment as offset in m from center line
double length
The physical vehicle length.
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
RGBColor color
The color.
long long int parametersSet
Information for the router which parameter were set.
double minGap
This class' free space in front of the vehicle itself.
std::string imgFile
Image file for this class.
SUMOVehicleShape shape
This class' shape.
int personCapacity
The person capacity of the vehicle.
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
std::string osgFile
3D model file for this class
double maxSpeed
The vehicle type's (technical) maximum speed [m/s].
int containerCapacity
The container capacity of the vehicle.
SUMOTime boardingDuration
The time a person needs to board the vehicle.
double minGapLat
The vehicle type's minimum lateral gap [m].
SUMOVehicleClass vehicleClass
The vehicle's class.
double mass
The mass.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
std::string id
The vehicle type's id.
LatAlignmentDefinition latAlignmentProcedure
Information on how the vehicle shall choose the lateral alignment.
double impatience
The vehicle's impatience (willingness to obstruct others)
LaneChangeModel lcModel
The lane-change model to use.