Eclipse SUMO - Simulation of Urban MObility
MSVehicleType.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
22 // The car-following model and parameter
23 /****************************************************************************/
24 #include <config.h>
25 
26 #include <cassert>
33 #include "MSNet.h"
34 #include "cfmodels/MSCFModel_IDM.h"
45 #include "cfmodels/MSCFModel_W99.h"
46 #include "cfmodels/MSCFModel_ACC.h"
48 #include "MSInsertionControl.h"
49 #include "MSVehicleControl.h"
50 #include "cfmodels/MSCFModel_CC.h"
51 #include "MSVehicleType.h"
52 
53 
54 // ===========================================================================
55 // static members
56 // ===========================================================================
58 
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
64  myParameter(parameter),
65  myEnergyParams(&parameter),
66  myWarnedActionStepLengthTauOnce(false),
67  myWarnedActionStepLengthBallisticOnce(false),
68  myWarnedStepLengthTauOnce(false),
69  myIndex(myNextIndex++),
70  myCarFollowModel(nullptr),
71  myOriginalType(nullptr) {
72  assert(getLength() > 0);
73  assert(getMaxSpeed() > 0);
74 
75  // Check if actionStepLength was set by user, if not init to global default
78  }
80 }
81 
82 
84  delete myCarFollowModel;
85 }
86 
87 
88 double
89 MSVehicleType::computeChosenSpeedDeviation(SumoRNG* rng, const double minDev) const {
91 }
92 
93 
94 // ------------ Setter methods
95 void
96 MSVehicleType::setLength(const double& length) {
97  if (myOriginalType != nullptr && length < 0) {
99  } else {
100  myParameter.length = length;
101  }
103 }
104 
105 
106 void
107 MSVehicleType::setHeight(const double& height) {
108  if (myOriginalType != nullptr && height < 0) {
110  } else {
111  myParameter.height = height;
112  }
114 }
115 
116 
117 void
118 MSVehicleType::setMinGap(const double& minGap) {
119  if (myOriginalType != nullptr && minGap < 0) {
121  } else {
122  myParameter.minGap = minGap;
123  }
125 }
126 
127 
128 void
129 MSVehicleType::setMinGapLat(const double& minGapLat) {
130  if (myOriginalType != nullptr && minGapLat < 0) {
132  } else {
133  myParameter.minGapLat = minGapLat;
134  }
136 }
137 
138 
139 void
140 MSVehicleType::setMaxSpeed(const double& maxSpeed) {
141  if (myOriginalType != nullptr && maxSpeed < 0) {
143  } else {
144  myParameter.maxSpeed = maxSpeed;
145  }
147 }
148 
149 
150 void
151 MSVehicleType::setMaxSpeedLat(const double& maxSpeedLat) {
152  if (myOriginalType != nullptr && maxSpeedLat < 0) {
154  } else {
155  myParameter.maxSpeedLat = maxSpeedLat;
156  }
158 }
159 
160 
161 void
163  myParameter.vehicleClass = vclass;
165 }
166 
167 
168 void
169 MSVehicleType::setPreferredLateralAlignment(const LatAlignmentDefinition& latAlignment, double latAlignmentOffset) {
170  myParameter.latAlignmentProcedure = latAlignment;
171  myParameter.latAlignmentOffset = latAlignmentOffset;
173 }
174 
175 void
176 MSVehicleType::setScale(double value) {
177  myParameter.scale = value;
179  insertControl.updateScale(getID());
180 }
181 
182 void
184  if (myOriginalType != nullptr && prob < 0) {
186  } else {
188  }
190 }
191 
192 
193 void
194 MSVehicleType::setSpeedFactor(const double& factor) {
195  if (myOriginalType != nullptr && factor < 0) {
197  } else {
198  myParameter.speedFactor.getParameter()[0] = factor;
199  }
201 }
202 
203 
204 void
206  if (myOriginalType != nullptr && dev < 0) {
208  } else {
210  }
212 }
213 
214 
215 void
216 MSVehicleType::setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset) {
217  assert(actionStepLength >= 0);
219 
220  if (myParameter.actionStepLength == actionStepLength) {
221  return;
222  }
223 
224  SUMOTime previousActionStepLength = myParameter.actionStepLength;
225  myParameter.actionStepLength = actionStepLength;
227  check();
228 
229  if (isVehicleSpecific()) {
230  // don't perform vehicle lookup for singular vtype
231  return;
232  }
233 
234  // For non-singular vType reset all vehicle's actionOffsets
235  // Iterate through vehicles
237  for (auto vehIt = vc.loadedVehBegin(); vehIt != vc.loadedVehEnd(); ++vehIt) {
238  MSVehicle* veh = static_cast<MSVehicle*>(vehIt->second);
239  if (&veh->getVehicleType() == this) {
240  // Found vehicle of this type. Perform requested actionOffsetReset
241  if (resetActionOffset) {
242  veh->resetActionOffset();
243  } else {
244  veh->updateActionOffset(previousActionStepLength, actionStepLength);
245  }
246  }
247  }
248 }
249 
250 
251 void
253  myParameter.emissionClass = eclass;
255 }
256 
257 
258 void
260  myParameter.mass = mass;
262 }
263 
264 
265 void
267  myParameter.color = color;
269 }
270 
271 
272 void
273 MSVehicleType::setParkingBadges(const std::vector<std::string>& badges) {
274  myParameter.parkingBadges.assign(badges.begin(), badges.end());
276 }
277 
278 
279 void
280 MSVehicleType::setWidth(const double& width) {
281  if (myOriginalType != nullptr && width < 0) {
283  } else {
284  myParameter.width = width;
285  }
287 }
288 
289 void
290 MSVehicleType::setImpatience(const double impatience) {
291  myParameter.impatience = impatience;
293 }
294 
295 
296 void
298  if (myOriginalType != nullptr && duration < 0) {
300  } else {
301  if (isPerson) {
302  myParameter.boardingDuration = duration;
303  } else {
304  myParameter.loadingDuration = duration;
305  }
306  }
308 }
309 
310 void
312  myParameter.shape = shape;
314 }
315 
316 
317 
318 // ------------ Static methods for building vehicle types
321  if (from.hasParameter("vehicleMass")) {
322  if (from.wasSet(VTYPEPARS_MASS_SET)) {
323  WRITE_WARNINGF(TL("The vType '%' has a 'mass' attribute and a 'vehicleMass' parameter. The 'mass' attribute will take precedence."), from.id);
324  } else {
325  WRITE_WARNINGF(TL("The vType '%' has a 'vehicleMass' parameter, which is deprecated. Please use the 'mass' attribute (for the empty mass) and the 'loading' parameter, if needed."), from.id);
326  from.mass = from.getDouble("vehicleMass", from.mass);
328  }
329  }
330  MSVehicleType* vtype = new MSVehicleType(from);
333  // by default decel and apparentDecel are identical
334  const double apparentDecel = from.getCFParam(SUMO_ATTR_APPARENTDECEL, decel);
335 
336  if (emergencyDecel < decel) {
337  WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) should be higher than 'decel' (%) for vType '%'."), toString(emergencyDecel), toString(decel), from.id);
338  }
339  if (emergencyDecel < apparentDecel) {
340  WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) is lower than 'apparentDecel' (%) for vType '%' may cause collisions."), toString(emergencyDecel), toString(apparentDecel), from.id);
341  }
342 
343  switch (from.cfModel) {
344  case SUMO_TAG_CF_IDM:
345  vtype->myCarFollowModel = new MSCFModel_IDM(vtype, false);
346  break;
347  case SUMO_TAG_CF_IDMM:
348  vtype->myCarFollowModel = new MSCFModel_IDM(vtype, true);
349  break;
350  case SUMO_TAG_CF_BKERNER:
351  vtype->myCarFollowModel = new MSCFModel_Kerner(vtype);
352  break;
354  vtype->myCarFollowModel = new MSCFModel_KraussOrig1(vtype);
355  break;
357  vtype->myCarFollowModel = new MSCFModel_KraussPS(vtype);
358  break;
359  case SUMO_TAG_CF_KRAUSSX:
360  vtype->myCarFollowModel = new MSCFModel_KraussX(vtype);
361  break;
362  case SUMO_TAG_CF_EIDM:
363  vtype->myCarFollowModel = new MSCFModel_EIDM(vtype);
364  break;
366  vtype->myCarFollowModel = new MSCFModel_SmartSK(vtype);
367  break;
368  case SUMO_TAG_CF_DANIEL1:
369  vtype->myCarFollowModel = new MSCFModel_Daniel1(vtype);
370  break;
372  vtype->myCarFollowModel = new MSCFModel_PWag2009(vtype);
373  break;
375  vtype->myCarFollowModel = new MSCFModel_Wiedemann(vtype);
376  break;
377  case SUMO_TAG_CF_W99:
378  vtype->myCarFollowModel = new MSCFModel_W99(vtype);
379  break;
380  case SUMO_TAG_CF_RAIL:
381  vtype->myCarFollowModel = new MSCFModel_Rail(vtype);
382  break;
383  case SUMO_TAG_CF_ACC:
384  vtype->myCarFollowModel = new MSCFModel_ACC(vtype);
385  break;
386  case SUMO_TAG_CF_CACC:
387  vtype->myCarFollowModel = new MSCFModel_CACC(vtype);
388  break;
389  case SUMO_TAG_CF_CC:
390  vtype->myCarFollowModel = new MSCFModel_CC(vtype);
391  break;
392  case SUMO_TAG_CF_KRAUSS:
393  default:
394  vtype->myCarFollowModel = new MSCFModel_Krauss(vtype);
395  break;
396  }
397  // init Rail visualization parameters
399  return vtype;
400 }
401 
402 SUMOTime
403 MSVehicleType::getEntryManoeuvreTime(const int angle) const {
404  return (getParameter().getEntryManoeuvreTime(angle));
405 }
406 
407 SUMOTime
408 MSVehicleType::getExitManoeuvreTime(const int angle) const {
409  return (getParameter().getExitManoeuvreTime(angle));
410 }
411 
413 MSVehicleType::buildSingularType(const std::string& id) const {
414  return duplicateType(id, false);
415 }
416 
417 
419 MSVehicleType::duplicateType(const std::string& id, bool persistent) const {
421  vtype->myParameter.id = id;
423  if (!persistent) {
424  vtype->myOriginalType = this;
425  }
426  if (!MSNet::getInstance()->getVehicleControl().addVType(vtype)) {
427  std::string singular = persistent ? "" : "singular ";
428  throw ProcessError("could not add " + singular + "type " + vtype->getID());
429  }
430  return vtype;
431 }
432 
433 void
437  && STEPS2TIME(myParameter.actionStepLength) > getCarFollowModel().getHeadwayTime()) {
439  std::stringstream s;
440  s << "Given action step length " << STEPS2TIME(myParameter.actionStepLength) << " for vehicle type '" << getID()
441  << "' is larger than its parameter tau (=" << getCarFollowModel().getHeadwayTime() << ")!"
442  << " This may lead to collisions. (This warning is only issued once per vehicle type).";
443  WRITE_WARNING(s.str());
444  }
449  std::string warning2;
450  if (OptionsCont::getOptions().isDefault("step-method.ballistic")) {
451  warning2 = " Setting it now to avoid collisions.";
453  } else {
454  warning2 = " This may cause collisions.";
455  }
456  WRITE_WARNINGF("Action step length '%' is used for vehicle type '%' but step-method.ballistic was not set." + warning2
458  }
459  if (!myWarnedStepLengthTauOnce && TS > getCarFollowModel().getHeadwayTime()
462  WRITE_WARNINGF(TL("Value of tau=% in vehicle type '%' lower than simulation step size may cause collisions."),
463  getCarFollowModel().getHeadwayTime(), getID());
464  }
465  if (MSGlobals::gUseMesoSim && getVehicleClass() != SVC_PEDESTRIAN && !OptionsCont::getOptions().getBool("meso-lane-queue")) {
466  SVCPermissions ignoreVClasses = parseVehicleClasses(OptionsCont::getOptions().getStringVector("meso-ignore-lanes-by-vclass"));
467  if ((ignoreVClasses & getVehicleClass()) != 0) {
468  WRITE_WARNINGF(TL("Vehicle class '%' of vType '%' is set as ignored by option --meso-ignore-lanes-by-vclass to ensure default vehicle capacity. Set option --meso-lane-queue for multi-modal meso simulation"),
470  }
471  }
472  if (!myParameter.wasSet(VTYPEPARS_EMISSIONCLASS_SET) && !OptionsCont::getOptions().getBool("device.battery.track-fuel")
473  && (OptionsCont::getOptions().getFloat("device.battery.probability") == 1.
474  || myParameter.getDouble("device.battery.probability", -1.) == 1.
475  || StringUtils::toBool(myParameter.getParameter("has.battery.device", "false")))) {
478  WRITE_MESSAGEF(TL("The battery device is active for vType '%' but no emission class is set. The emission class Energy/unknown will be used, please consider setting an explicit emission class!"),
479  getID());
480  }
481 }
482 
483 
484 void
485 MSVehicleType::setAccel(double accel) {
486  if (myOriginalType != nullptr && accel < 0) {
488  }
491 }
492 
493 void
494 MSVehicleType::setDecel(double decel) {
495  if (myOriginalType != nullptr && decel < 0) {
497  }
500 }
501 
502 void
503 MSVehicleType::setEmergencyDecel(double emergencyDecel) {
504  if (myOriginalType != nullptr && emergencyDecel < 0) {
505  emergencyDecel = myOriginalType->getCarFollowModel().getEmergencyDecel();
506  }
507  myCarFollowModel->setEmergencyDecel(emergencyDecel);
509 }
510 
511 void
512 MSVehicleType::setApparentDecel(double apparentDecel) {
513  if (myOriginalType != nullptr && apparentDecel < 0) {
515  }
516  myCarFollowModel->setApparentDecel(apparentDecel);
518 }
519 
520 void
521 MSVehicleType::setImperfection(double imperfection) {
522  if (myOriginalType != nullptr && imperfection < 0) {
524  }
525  myCarFollowModel->setImperfection(imperfection);
527 }
528 
529 void
531  if (myOriginalType != nullptr && tau < 0) {
533  }
536 }
537 
538 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
#define WRITE_WARNINGF(...)
Definition: MsgHandler.h:296
#define WRITE_MESSAGEF(...)
Definition: MsgHandler.h:298
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:295
#define TL(string)
Definition: MsgHandler.h:315
SUMOTime DELTA_T
Definition: SUMOTime.cpp:38
#define STEPS2TIME(x)
Definition: SUMOTime.h:55
#define TS
Definition: SUMOTime.h:42
const long long int VTYPEPARS_SHAPE_SET
const long long int VTYPEPARS_WIDTH_SET
const long long int VTYPEPARS_ACTIONSTEPLENGTH_SET
const long long int VTYPEPARS_MAXSPEED_LAT_SET
const long long int VTYPEPARS_MAXSPEED_SET
const long long int VTYPEPARS_EMISSIONCLASS_SET
const long long int VTYPEPARS_LATALIGNMENT_SET
const long long int VTYPEPARS_COLOR_SET
const long long int VTYPEPARS_SPEEDFACTOR_SET
const long long int VTYPEPARS_MINGAP_SET
const long long int VTYPEPARS_PROBABILITY_SET
const long long int VTYPEPARS_HEIGHT_SET
const long long int VTYPEPARS_PARKING_BADGES_SET
const long long int VTYPEPARS_MASS_SET
const long long int VTYPEPARS_BOARDING_DURATION
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
const long long int VTYPEPARS_VEHICLECLASS_SET
const long long int VTYPEPARS_IMPATIENCE_SET
const long long int VTYPEPARS_LENGTH_SET
const long long int VTYPEPARS_MINGAP_LAT_SET
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
int SUMOEmissionClass
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_CF_KRAUSS
@ SUMO_TAG_CF_BKERNER
@ SUMO_TAG_CF_KRAUSSX
@ SUMO_TAG_CF_CACC
@ SUMO_TAG_CF_CC
@ SUMO_TAG_CF_KRAUSS_PLUS_SLOPE
@ SUMO_TAG_CF_IDM
@ SUMO_TAG_CF_W99
@ SUMO_TAG_CF_RAIL
@ SUMO_TAG_CF_SMART_SK
@ SUMO_TAG_CF_EIDM
@ SUMO_TAG_CF_PWAGNER2009
@ SUMO_TAG_CF_KRAUSS_ORIG1
@ SUMO_TAG_CF_WIEDEMANN
@ SUMO_TAG_CF_IDMM
@ SUMO_TAG_CF_DANIEL1
@ SUMO_TAG_CF_ACC
@ SUMO_ATTR_APPARENTDECEL
@ SUMO_ATTR_DECEL
@ SUMO_ATTR_EMERGENCYDECEL
@ SUMO_ATTR_ACCEL
@ SUMO_ATTR_SIGMA
@ SUMO_ATTR_TAU
int gPrecisionRandom
Definition: StdDefs.cpp:28
double roundDecimal(double x, int precision)
round to the given number of decimal digits
Definition: StdDefs.cpp:52
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
double sample(SumoRNG *which=0) const
Draw a sample of the distribution.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
The ACC car-following model.
Definition: MSCFModel_ACC.h:47
The CACC car-following model.
A set of automatic Cruise Controllers, including classic Cruise Control (CC), Adaptive Cruise Control...
Definition: MSCFModel_CC.h:57
The original Krauss (1998) car-following model and parameter.
The Extended Intelligent Driver Model (EIDM) car-following model.
The Intelligent Driver Model (IDM) car-following model.
Definition: MSCFModel_IDM.h:39
car-following model by B. Kerner
Krauss car-following model, with acceleration decrease and faster start.
The original Krauss (1998) car-following model and parameter.
Krauss car-following model, changing accel and speed by slope.
Krauss car-following model, changing accel and speed by slope.
Scalable model based on Krauss by Peter Wagner.
The original Krauss (1998) car-following model and parameter.
The W99 Model car-following model.
Definition: MSCFModel_W99.h:40
The Wiedemann Model car-following model.
virtual void setImperfection(double imperfection)
Sets a new value for driver imperfection.
Definition: MSCFModel.h:566
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
Definition: MSCFModel.h:272
virtual void setHeadwayTime(double headwayTime)
Sets a new value for desired headway [s].
Definition: MSCFModel.h:574
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const =0
Duplicates the car-following model.
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
Definition: MSCFModel.h:544
virtual void setMaxAccel(double accel)
Sets a new value for maximum acceleration [m/s^2].
Definition: MSCFModel.h:528
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:536
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
Definition: MSCFModel.h:280
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:256
virtual double getImperfection() const
Get the driver's imperfection.
Definition: MSCFModel.h:303
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:264
virtual void setApparentDecel(double decel)
Sets a new value for the apparent deceleration [m/s^2].
Definition: MSCFModel.h:552
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
Definition: MSCFModel.h:311
static bool gUseMesoSim
Definition: MSGlobals.h:103
static double gDefaultEmergencyDecel
encoding of the string-option default.emergencydecel
Definition: MSGlobals.h:127
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:53
static SUMOTime gActionStepLength
default value for the interval between two action points for MSVehicle (defaults to DELTA_T)
Definition: MSGlobals.h:115
Inserts vehicles into the network when their departure time is reached.
void updateScale(const std::string vtypeid)
updates the flow scale value to keep track of TraCI-induced change
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:182
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:378
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:431
The class responsible for building and deletion of vehicles.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:2052
void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength)
Process an updated action step length value (only affects the vehicle's action offset,...
Definition: MSVehicle.cpp:2058
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 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.
SUMOTime getBoardingDuration(const bool isPerson) const
Get this vehicle type's boarding duration.
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.
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].
MSVehicleType(const SUMOVTypeParameter &parameter)
Constructor.
void setDefaultProbability(const double &prob)
Set a new value for this type's default probability.
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...
void setParkingBadges(const std::vector< std::string > &badges)
Set a new value for parking access rights of this type.
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
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.
void setBoardingDuration(SUMOTime duration, bool isPerson=true)
Set a new value for this type's boardingDuration.
const MSVehicleType * myOriginalType
The original type.
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.
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.
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.
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.
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:91
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].
void setMass(double mass)
Set a new value for this type's mass.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
void setMinGap(const double &minGap)
Set a new value for this type's minimum gap.
SUMOTime getEntryManoeuvreTime(const int angle) const
Accessor function for parameter equivalent returning entry time for a specific manoeuver angle.
const SUMOVTypeParameter & getParameter() const
double computeChosenSpeedDeviation(SumoRNG *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
virtual ~MSVehicleType()
Destructor.
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
void check()
Checks whether vehicle type parameters may be problematic (Currently, only the value for the action s...
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.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
double getDouble(const std::string &key, const double defaultValue) const
Returns the value for a given key converted to a double.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
Structure representing possible vehicle parameter.
double width
This class' width.
SubParams cfParameter
Car-following parameter.
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....
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double height
This class' height.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double latAlignmentOffset
(optional) The vehicle's desired lateral alignment as offset in m from center line
std::vector< std::string > parkingBadges
the parking access rights
double length
The physical vehicle length.
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
static double getDefaultDecel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default deceleration for the given vehicle class This needs to be a function because the ...
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.
void initRailVisualizationParameters()
init Rail Visualization Parameters
SUMOVehicleShape shape
This class' shape.
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
double scale
individual scaling factor (-1 for undefined)
double maxSpeed
The vehicle type's (technical) maximum speed [m/s].
static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption)
Returns the default emergency deceleration for the given vehicle class This needs to be a function be...
SUMOTime boardingDuration
The time a person needs to board the vehicle.
double getCFParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
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.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
LatAlignmentDefinition latAlignmentProcedure
Information on how the vehicle shall choose the lateral alignment.
double impatience
The vehicle's impatience (willingness to obstruct others)
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter