Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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"
48#include "MSInsertionControl.h"
49#include "MSVehicleControl.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
86
87
88double
92
93
94// ------------ Setter methods
95void
96MSVehicleType::setLength(const double& length) {
97 if (myOriginalType != nullptr && length < 0) {
99 } else {
100 myParameter.length = length;
101 }
103}
104
105
106void
107MSVehicleType::setHeight(const double& height) {
108 if (myOriginalType != nullptr && height < 0) {
110 } else {
111 myParameter.height = height;
112 }
114}
115
116
117void
118MSVehicleType::setMinGap(const double& minGap) {
119 if (myOriginalType != nullptr && minGap < 0) {
121 } else {
122 myParameter.minGap = minGap;
123 }
125}
126
127
128void
129MSVehicleType::setMinGapLat(const double& minGapLat) {
130 if (myOriginalType != nullptr && minGapLat < 0) {
132 } else {
133 myParameter.minGapLat = minGapLat;
134 }
136}
137
138
139void
140MSVehicleType::setMaxSpeed(const double& maxSpeed) {
141 if (myOriginalType != nullptr && maxSpeed < 0) {
143 } else {
144 myParameter.maxSpeed = maxSpeed;
145 }
147}
148
149
150void
151MSVehicleType::setMaxSpeedLat(const double& maxSpeedLat) {
152 if (myOriginalType != nullptr && maxSpeedLat < 0) {
154 } else {
155 myParameter.maxSpeedLat = maxSpeedLat;
156 }
158}
159
160
161void
166
167
168void
173
174void
180
181void
183 myParameter.scale = value;
185 insertControl.updateScale(getID());
186}
187
188void
192
193void
202
203
204void
213
214
215void
224
225
226void
227MSVehicleType::setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset) {
228 assert(actionStepLength >= 0);
230
231 if (myParameter.actionStepLength == actionStepLength) {
232 return;
233 }
234
235 SUMOTime previousActionStepLength = myParameter.actionStepLength;
236 myParameter.actionStepLength = actionStepLength;
238 check();
239
240 if (isVehicleSpecific()) {
241 // don't perform vehicle lookup for singular vtype
242 return;
243 }
244
245 // For non-singular vType reset all vehicle's actionOffsets
246 // Iterate through vehicles
248 for (auto vehIt = vc.loadedVehBegin(); vehIt != vc.loadedVehEnd(); ++vehIt) {
249 MSVehicle* veh = static_cast<MSVehicle*>(vehIt->second);
250 if (&veh->getVehicleType() == this) {
251 // Found vehicle of this type. Perform requested actionOffsetReset
252 if (resetActionOffset) {
253 veh->resetActionOffset();
254 } else {
255 veh->updateActionOffset(previousActionStepLength, actionStepLength);
256 }
257 }
258 }
259}
260
261
262void
267
268
269void
275
276
277void
282
283
284void
285MSVehicleType::setParkingBadges(const std::vector<std::string>& badges) {
286 myParameter.parkingBadges.assign(badges.begin(), badges.end());
288}
289
290
291void
292MSVehicleType::setWidth(const double& width) {
293 if (myOriginalType != nullptr && width < 0) {
295 } else {
296 myParameter.width = width;
297 }
299}
300
301void
306
307
308void
310 if (myOriginalType != nullptr && duration < 0) {
312 } else {
313 if (isPerson) {
314 myParameter.boardingDuration = duration;
315 } else {
316 myParameter.loadingDuration = duration;
317 }
318 }
320}
321
322void
327
328
329
330// ------------ Static methods for building vehicle types
332MSVehicleType::build(SUMOVTypeParameter& from, const std::string& fileName) {
333 if (from.hasParameter("vehicleMass")) {
334 if (from.wasSet(VTYPEPARS_MASS_SET)) {
335 WRITE_WARNINGF(TL("The vType '%' has a 'mass' attribute and a 'vehicleMass' parameter. The 'mass' attribute will take precedence."), from.id);
336 } else {
337 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);
338 from.mass = from.getDouble("vehicleMass", from.mass);
340 }
341 }
342 MSVehicleType* vtype = new MSVehicleType(from);
345 // by default decel and apparentDecel are identical
346 const double apparentDecel = from.getCFParam(SUMO_ATTR_APPARENTDECEL, decel);
347
348 if (emergencyDecel < decel) {
349 WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) should be higher than 'decel' (%) for vType '%'."), toString(emergencyDecel), toString(decel), from.id);
350 }
351 if (emergencyDecel < apparentDecel) {
352 WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) is lower than 'apparentDecel' (%) for vType '%' may cause collisions."), toString(emergencyDecel), toString(apparentDecel), from.id);
353 }
354
355 switch (from.cfModel) {
356 case SUMO_TAG_CF_IDM:
357 vtype->myCarFollowModel = new MSCFModel_IDM(vtype, false);
358 break;
359 case SUMO_TAG_CF_IDMM:
360 vtype->myCarFollowModel = new MSCFModel_IDM(vtype, true);
361 break;
363 vtype->myCarFollowModel = new MSCFModel_Kerner(vtype);
364 break;
366 vtype->myCarFollowModel = new MSCFModel_KraussOrig1(vtype);
367 break;
369 vtype->myCarFollowModel = new MSCFModel_KraussPS(vtype);
370 break;
372 vtype->myCarFollowModel = new MSCFModel_KraussX(vtype);
373 break;
374 case SUMO_TAG_CF_EIDM:
375 vtype->myCarFollowModel = new MSCFModel_EIDM(vtype);
376 break;
378 vtype->myCarFollowModel = new MSCFModel_SmartSK(vtype);
379 break;
381 vtype->myCarFollowModel = new MSCFModel_Daniel1(vtype);
382 break;
384 vtype->myCarFollowModel = new MSCFModel_PWag2009(vtype);
385 break;
387 vtype->myCarFollowModel = new MSCFModel_Wiedemann(vtype);
388 break;
389 case SUMO_TAG_CF_W99:
390 vtype->myCarFollowModel = new MSCFModel_W99(vtype);
391 break;
392 case SUMO_TAG_CF_RAIL:
393 vtype->myCarFollowModel = new MSCFModel_Rail(vtype);
394 break;
395 case SUMO_TAG_CF_ACC:
396 vtype->myCarFollowModel = new MSCFModel_ACC(vtype);
397 break;
398 case SUMO_TAG_CF_CACC:
399 vtype->myCarFollowModel = new MSCFModel_CACC(vtype);
400 break;
401 case SUMO_TAG_CF_CC:
402 vtype->myCarFollowModel = new MSCFModel_CC(vtype);
403 break;
405 default:
406 vtype->myCarFollowModel = new MSCFModel_Krauss(vtype);
407 break;
408 }
409 // init Rail visualization parameters
411 return vtype;
412}
413
416 return (getParameter().getEntryManoeuvreTime(angle));
417}
418
421 return (getParameter().getExitManoeuvreTime(angle));
422}
423
425MSVehicleType::buildSingularType(const std::string& id) const {
426 return duplicateType(id, false);
427}
428
429
431MSVehicleType::duplicateType(const std::string& id, bool persistent) const {
433 vtype->myParameter.id = id;
435 if (!persistent) {
436 vtype->myOriginalType = this;
437 }
438 if (!MSNet::getInstance()->getVehicleControl().addVType(vtype)) {
439 std::string singular = persistent ? "" : "singular ";
440 throw ProcessError("could not add " + singular + "type " + vtype->getID());
441 }
442 return vtype;
443}
444
445void
449 && STEPS2TIME(myParameter.actionStepLength) > getCarFollowModel().getHeadwayTime()) {
451 std::stringstream s;
452 s << "Given action step length " << STEPS2TIME(myParameter.actionStepLength) << " for vehicle type '" << getID()
453 << "' is larger than its parameter tau (=" << getCarFollowModel().getHeadwayTime() << ")!"
454 << " This may lead to collisions. (This warning is only issued once per vehicle type).";
455 WRITE_WARNING(s.str());
456 }
461 std::string warning2;
462 if (OptionsCont::getOptions().isDefault("step-method.ballistic")) {
463 warning2 = " Setting it now to avoid collisions.";
465 } else {
466 warning2 = " This may cause collisions.";
467 }
468 WRITE_WARNINGF("Action step length '%' is used for vehicle type '%' but step-method.ballistic was not set." + warning2
470 }
471 if (!myWarnedStepLengthTauOnce && TS > getCarFollowModel().getHeadwayTime()
474 WRITE_WARNINGF(TL("Value of tau=% in vehicle type '%' lower than simulation step size may cause collisions."),
475 getCarFollowModel().getHeadwayTime(), getID());
476 }
477 if (MSGlobals::gUseMesoSim && getVehicleClass() != SVC_PEDESTRIAN && !OptionsCont::getOptions().getBool("meso-lane-queue")) {
478 SVCPermissions ignoreVClasses = parseVehicleClasses(OptionsCont::getOptions().getStringVector("meso-ignore-lanes-by-vclass"));
479 if ((ignoreVClasses & getVehicleClass()) != 0) {
480 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"),
482 }
483 }
484 if (!myParameter.wasSet(VTYPEPARS_EMISSIONCLASS_SET) && !OptionsCont::getOptions().getBool("device.battery.track-fuel")
485 && (OptionsCont::getOptions().getFloat("device.battery.probability") == 1.
486 || myParameter.getDouble("device.battery.probability", -1.) == 1.
487 || StringUtils::toBool(myParameter.getParameter("has.battery.device", "false")))) {
490 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!"),
491 getID());
492 }
493}
494
495
496void
498 if (myOriginalType != nullptr && accel < 0) {
500 }
503}
504
505void
507 if (myOriginalType != nullptr && decel < 0) {
509 }
512}
513
514void
515MSVehicleType::setEmergencyDecel(double emergencyDecel) {
516 if (myOriginalType != nullptr && emergencyDecel < 0) {
518 }
519 myCarFollowModel->setEmergencyDecel(emergencyDecel);
521}
522
523void
524MSVehicleType::setApparentDecel(double apparentDecel) {
525 if (myOriginalType != nullptr && apparentDecel < 0) {
527 }
528 myCarFollowModel->setApparentDecel(apparentDecel);
530}
531
532void
533MSVehicleType::setMaxAccelProfile(std::vector<std::pair<double, double> > /* accelProfile */) {
534 /*
535 if (myOriginalType != nullptr) {
536 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
537 } else {
538 if (accelProfile[0].first > 0.) {
539 accelProfile.insert(accelProfile.begin(), std::make_pair(0.0, accelProfile[0].second));
540 }
541 if (accelProfile.back().first < (10000 / 3.6)) {
542 accelProfile.push_back(std::make_pair((10000 / 3.6), accelProfile.back().second));
543 }
544 double prevSpeed = 0.0;
545 for (const auto& accelPair : accelProfile) {
546 if (accelPair.first < 0.) {
547 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
548 break;
549 } else if (accelPair.second < 0.) {
550 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
551 break;
552 } else if (accelPair.first < prevSpeed) {
553 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
554 break;
555 }
556 prevSpeed = accelPair.first;
557 }
558 }
559 myCarFollowModel->setMaxAccelProfile(accelProfile);
560
561 std::stringstream accelProfileString;
562 accelProfileString << std::fixed << std::setprecision(2);
563 int count = 0;
564 for (const auto& accelPair : accelProfile) {
565 if (count > 0) {
566 accelProfileString << " ";
567 }
568 accelProfileString << toString(accelPair.first) + "," << accelPair.second;
569 count++;
570 }
571 myParameter.cfParameter[SUMO_ATTR_MAXACCEL_PROFILE] = accelProfileString.str();
572 */
573}
574
575void
576MSVehicleType::setDesAccelProfile(std::vector<std::pair<double, double> > /* accelProfile */) {
577 /*
578 if (myOriginalType != nullptr) {
579 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
580 } else {
581 if (accelProfile[0].first > 0.) {
582 accelProfile.insert(accelProfile.begin(), std::make_pair(0.0, accelProfile[0].second));
583 }
584 if (accelProfile.back().first < (10000 / 3.6)) {
585 accelProfile.push_back(std::make_pair((10000 / 3.6), accelProfile.back().second));
586 }
587 double prevSpeed = 0.0;
588 for (const auto& accelPair : accelProfile) {
589 if (accelPair.first < 0.) {
590 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
591 break;
592 } else if (accelPair.second < 0.) {
593 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
594 break;
595 } else if (accelPair.first < prevSpeed) {
596 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
597 break;
598 }
599 prevSpeed = accelPair.first;
600 }
601 }
602 myCarFollowModel->setDesAccelProfile(accelProfile);
603
604 std::stringstream accelProfileString;
605 accelProfileString << std::fixed << std::setprecision(2);
606 int count = 0;
607 for (const auto& accelPair : accelProfile) {
608 if (count > 0) {
609 accelProfileString << " ";
610 }
611 accelProfileString << toString(accelPair.first) + "," << accelPair.second;
612 count++;
613 }
614 myParameter.cfParameter[SUMO_ATTR_DESACCEL_PROFILE] = accelProfileString.str();
615 */
616}
617
618void
619MSVehicleType::setImperfection(double imperfection) {
620 if (myOriginalType != nullptr && imperfection < 0) {
622 }
623 myCarFollowModel->setImperfection(imperfection);
625}
626
627void
629 if (myOriginalType != nullptr && tau < 0) {
631 }
634}
635
636
637/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:288
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:290
#define WRITE_WARNING(msg)
Definition MsgHandler.h:287
#define TL(string)
Definition MsgHandler.h:305
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_LCA_CONTRIGHT
@ SUMO_ATTR_EMERGENCYDECEL
@ SUMO_ATTR_ACCEL
@ SUMO_ATTR_SIGMA
@ SUMO_ATTR_TAU
int gPrecisionRandom
Definition StdDefs.cpp:29
double roundDecimal(double x, int precision)
round to the given number of decimal digits
Definition StdDefs.cpp:55
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 getParameter(const int index) const
Returns the nth parameter of this distribution.
void setParameter(const int index, const double value)
Set a parameter of this distribution.
double sample(SumoRNG *which=nullptr) const
Draw a sample of the distribution using the given RNG.
An upper class for objects with additional parameters.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
The ACC car-following model.
The CACC car-following model.
A set of automatic Cruise Controllers, including classic Cruise Control (CC), Adaptive Cruise Control...
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.
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.
The Wiedemann Model car-following model.
virtual void setImperfection(double imperfection)
Sets a new value for driver imperfection.
Definition MSCFModel.h:611
double getEmergencyDecel() const
Get the vehicle type's maximal physically possible deceleration [m/s^2].
Definition MSCFModel.h:277
virtual void setHeadwayTime(double headwayTime)
Sets a new value for desired headway [s].
Definition MSCFModel.h:619
virtual void setEmergencyDecel(double decel)
Sets a new value for maximal physically possible deceleration [m/s^2].
Definition MSCFModel.h:572
virtual void setMaxAccel(double accel)
Sets a new value for maximum acceleration [m/s^2].
Definition MSCFModel.h:556
virtual void setMaxDecel(double decel)
Sets a new value for maximal comfortable deceleration [m/s^2].
Definition MSCFModel.h:564
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
Definition MSCFModel.h:285
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition MSCFModel.h:261
virtual double getImperfection() const
Get the driver's imperfection.
Definition MSCFModel.h:331
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition MSCFModel.h:269
virtual void setApparentDecel(double decel)
Sets a new value for the apparent deceleration [m/s^2].
Definition MSCFModel.h:580
virtual MSCFModel * duplicate(const MSVehicleType *vtype) const =0
Duplicates the car-following model.
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
Definition MSCFModel.h:339
static bool gUseMesoSim
Definition MSGlobals.h:106
static double gDefaultEmergencyDecel
encoding of the string-option default.emergencydecel
Definition MSGlobals.h:130
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:118
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:186
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:437
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:384
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.
void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength)
Process an updated action step length value (only affects the vehicle's action offset,...
The car-following model and parameter.
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.
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].
void setGUIShape(SUMOVehicleShape shape)
Set a new value for this type's gui shape.
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...
const std::string & getID() const
Returns the name of the vehicle type.
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 setDesAccelProfile(std::vector< std::pair< double, double > > accelProfile)
Set a new value for this type's desired acceleration profile.
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.
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 setLcContRight(const std::string &value)
Set lcContRight (which is the only lc-attribute not used within the laneChange model)
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.
static MSVehicleType * build(SUMOVTypeParameter &from, const std::string &fileName="")
Builds the microsim vehicle type described by the given parameter.
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 setMaxAccelProfile(std::vector< std::pair< double, double > > accelProfile)
Set a new value for this type's maximum acceleration profile.
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.
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.
const EnergyParams myEnergyParams
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.
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 ...
void initRailVisualizationParameters(const std::string fileName="")
init Rail Visualization Parameters
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.
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.
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.
SubParams lcParameter
Lane-changing parameter.
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