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>
34#include "MSNet.h"
49#include "MSInsertionControl.h"
50#include "MSVehicleControl.h"
52#include "MSVehicleType.h"
53
54
55// ===========================================================================
56// static members
57// ===========================================================================
59
60
61// ===========================================================================
62// method definitions
63// ===========================================================================
65 myParameter(parameter),
66 myEnergyParams(&parameter),
67 myWarnedActionStepLengthTauOnce(false),
68 myWarnedActionStepLengthBallisticOnce(false),
69 myWarnedStepLengthTauOnce(false),
70 myIndex(myNextIndex++),
71 myCarFollowModel(nullptr),
72 myOriginalType(nullptr) {
73 assert(getLength() > 0);
74 assert(getMaxSpeed() > 0);
75
76 // Check if actionStepLength was set by user, if not init to global default
79 }
81}
82
83
87
88
89double
93
94
95// ------------ Setter methods
96void
97MSVehicleType::setLength(const double& length) {
98 if (myOriginalType != nullptr && length < 0) {
100 } else {
101 myParameter.length = length;
102 }
104}
105
106
107void
108MSVehicleType::setHeight(const double& height) {
109 if (myOriginalType != nullptr && height < 0) {
111 } else {
112 myParameter.height = height;
113 }
115}
116
117
118void
119MSVehicleType::setMinGap(const double& minGap) {
120 if (myOriginalType != nullptr && minGap < 0) {
122 } else {
123 myParameter.minGap = minGap;
124 }
126}
127
128
129void
130MSVehicleType::setMinGapLat(const double& minGapLat) {
131 if (myOriginalType != nullptr && minGapLat < 0) {
133 } else {
134 myParameter.minGapLat = minGapLat;
135 }
137}
138
139
140void
141MSVehicleType::setMaxSpeed(const double& maxSpeed) {
142 if (myOriginalType != nullptr && maxSpeed < 0) {
144 } else {
145 myParameter.maxSpeed = maxSpeed;
146 }
148}
149
150
151void
152MSVehicleType::setMaxSpeedLat(const double& maxSpeedLat) {
153 if (myOriginalType != nullptr && maxSpeedLat < 0) {
155 } else {
156 myParameter.maxSpeedLat = maxSpeedLat;
157 }
159}
160
161
162void
167
168
169void
174
175void
181
182void
184 myParameter.scale = value;
186 insertControl.updateScale(getID());
187}
188
189void
193
194void
203
204
205void
214
215
216void
225
226
227void
228MSVehicleType::setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset) {
229 assert(actionStepLength >= 0);
231
232 if (myParameter.actionStepLength == actionStepLength) {
233 return;
234 }
235
236 SUMOTime previousActionStepLength = myParameter.actionStepLength;
237 myParameter.actionStepLength = actionStepLength;
239 check();
240
241 if (isVehicleSpecific()) {
242 // don't perform vehicle lookup for singular vtype
243 return;
244 }
245
246 // For non-singular vType reset all vehicle's actionOffsets
247 // Iterate through vehicles
249 for (auto vehIt = vc.loadedVehBegin(); vehIt != vc.loadedVehEnd(); ++vehIt) {
250 MSVehicle* veh = static_cast<MSVehicle*>(vehIt->second);
251 if (&veh->getVehicleType() == this) {
252 // Found vehicle of this type. Perform requested actionOffsetReset
253 if (resetActionOffset) {
254 veh->resetActionOffset();
255 } else {
256 veh->updateActionOffset(previousActionStepLength, actionStepLength);
257 }
258 }
259 }
260}
261
262
263void
268
269
270void
276
277
278void
283
284
285void
286MSVehicleType::setParkingBadges(const std::vector<std::string>& badges) {
287 myParameter.parkingBadges.assign(badges.begin(), badges.end());
289}
290
291
292void
293MSVehicleType::setWidth(const double& width) {
294 if (myOriginalType != nullptr && width < 0) {
296 } else {
297 myParameter.width = width;
298 }
300}
301
302void
307
308
309void
311 if (myOriginalType != nullptr && duration < 0) {
313 } else {
314 if (isPerson) {
315 myParameter.boardingDuration = duration;
316 } else {
317 myParameter.loadingDuration = duration;
318 }
319 }
321}
322
323void
328
329
330
331// ------------ Static methods for building vehicle types
333MSVehicleType::build(SUMOVTypeParameter& from, const std::string& fileName) {
334 if (from.hasParameter("vehicleMass")) {
335 if (from.wasSet(VTYPEPARS_MASS_SET)) {
336 WRITE_WARNINGF(TL("The vType '%' has a 'mass' attribute and a 'vehicleMass' parameter. The 'mass' attribute will take precedence."), from.id);
337 } else {
338 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);
339 from.mass = from.getDouble("vehicleMass", from.mass);
341 }
342 }
343 MSVehicleType* vtype = new MSVehicleType(from);
346 // by default decel and apparentDecel are identical
347 const double apparentDecel = from.getCFParam(SUMO_ATTR_APPARENTDECEL, decel);
348
349 if (emergencyDecel < decel) {
350 WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) should be higher than 'decel' (%) for vType '%'."), toString(emergencyDecel), toString(decel), from.id);
351 }
352 if (emergencyDecel < apparentDecel) {
353 WRITE_WARNINGF(TL("Value of 'emergencyDecel' (%) is lower than 'apparentDecel' (%) for vType '%' may cause collisions."), toString(emergencyDecel), toString(apparentDecel), from.id);
354 }
355
356 switch (from.cfModel) {
357 case SUMO_TAG_CF_IDM:
358 vtype->myCarFollowModel = new MSCFModel_IDM(vtype, false);
359 break;
360 case SUMO_TAG_CF_IDMM:
361 vtype->myCarFollowModel = new MSCFModel_IDM(vtype, true);
362 break;
364 vtype->myCarFollowModel = new MSCFModel_Kerner(vtype);
365 break;
367 vtype->myCarFollowModel = new MSCFModel_KraussOrig1(vtype);
368 break;
370 vtype->myCarFollowModel = new MSCFModel_KraussPS(vtype);
371 break;
373 vtype->myCarFollowModel = new MSCFModel_KraussX(vtype);
374 break;
375 case SUMO_TAG_CF_EIDM:
376 vtype->myCarFollowModel = new MSCFModel_EIDM(vtype);
377 break;
379 vtype->myCarFollowModel = new MSCFModel_SmartSK(vtype);
380 break;
382 vtype->myCarFollowModel = new MSCFModel_Daniel1(vtype);
383 break;
385 vtype->myCarFollowModel = new MSCFModel_PWag2009(vtype);
386 break;
388 vtype->myCarFollowModel = new MSCFModel_Wiedemann(vtype);
389 break;
390 case SUMO_TAG_CF_W99:
391 vtype->myCarFollowModel = new MSCFModel_W99(vtype);
392 break;
393 case SUMO_TAG_CF_RAIL:
394 vtype->myCarFollowModel = new MSCFModel_Rail(vtype);
395 break;
396 case SUMO_TAG_CF_ACC:
397 vtype->myCarFollowModel = new MSCFModel_ACC(vtype);
398 break;
399 case SUMO_TAG_CF_CACC:
400 vtype->myCarFollowModel = new MSCFModel_CACC(vtype);
401 break;
402 case SUMO_TAG_CF_CC:
403 vtype->myCarFollowModel = new MSCFModel_CC(vtype);
404 break;
406 default:
407 vtype->myCarFollowModel = new MSCFModel_Krauss(vtype);
408 break;
409 }
410 // init Rail visualization parameters
412 return vtype;
413}
414
417 return (getParameter().getEntryManoeuvreTime(angle));
418}
419
422 return (getParameter().getExitManoeuvreTime(angle));
423}
424
426MSVehicleType::buildSingularType(const std::string& id) const {
427 return duplicateType(id, false);
428}
429
430
432MSVehicleType::duplicateType(const std::string& id, bool persistent) const {
434 vtype->myParameter.id = id;
436 if (!persistent) {
437 vtype->myOriginalType = this;
438 }
439 if (!MSNet::getInstance()->getVehicleControl().addVType(vtype)) {
440 std::string singular = persistent ? "" : TL("singular ");
441 throw ProcessError(TLF("could not add %type %", singular, vtype->getID()));
442 }
443 return vtype;
444}
445
446void
450 && STEPS2TIME(myParameter.actionStepLength) > getCarFollowModel().getHeadwayTime()) {
452 std::stringstream s;
453 s << "Given action step length " << STEPS2TIME(myParameter.actionStepLength) << " for vehicle type '" << getID()
454 << "' is larger than its parameter tau (=" << getCarFollowModel().getHeadwayTime() << ")!"
455 << " This may lead to collisions. (This warning is only issued once per vehicle type).";
456 WRITE_WARNING(s.str());
457 }
462 std::string warning2;
463 if (OptionsCont::getOptions().isDefault("step-method.ballistic")) {
464 warning2 = " Setting it now to avoid collisions.";
466 } else {
467 warning2 = " This may cause collisions.";
468 }
469 WRITE_WARNINGF("Action step length '%' is used for vehicle type '%' but step-method.ballistic was not set." + warning2
471 }
472 if (!myWarnedStepLengthTauOnce && TS > getCarFollowModel().getHeadwayTime()
475 WRITE_WARNINGF(TL("Value of tau=% in vehicle type '%' lower than simulation step size may cause collisions."),
476 getCarFollowModel().getHeadwayTime(), getID());
477 }
478 if (MSGlobals::gUseMesoSim && getVehicleClass() != SVC_PEDESTRIAN && !OptionsCont::getOptions().getBool("meso-lane-queue")) {
479 SVCPermissions ignoreVClasses = parseVehicleClasses(OptionsCont::getOptions().getStringVector("meso-ignore-lanes-by-vclass"));
480 if ((ignoreVClasses & getVehicleClass()) != 0) {
481 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"),
483 }
484 }
485 if (!myParameter.wasSet(VTYPEPARS_EMISSIONCLASS_SET) && !OptionsCont::getOptions().getBool("device.battery.track-fuel")
486 && (OptionsCont::getOptions().getFloat("device.battery.probability") == 1.
487 || myParameter.getDouble("device.battery.probability", -1.) == 1.
488 || StringUtils::toBool(myParameter.getParameter("has.battery.device", "false")))) {
491 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!"),
492 getID());
493 }
494}
495
496
497void
499 if (myOriginalType != nullptr && accel < 0) {
501 }
504}
505
506void
508 if (myOriginalType != nullptr && decel < 0) {
510 }
513}
514
515void
516MSVehicleType::setEmergencyDecel(double emergencyDecel) {
517 if (myOriginalType != nullptr && emergencyDecel < 0) {
519 }
520 myCarFollowModel->setEmergencyDecel(emergencyDecel);
522}
523
524void
525MSVehicleType::setApparentDecel(double apparentDecel) {
526 if (myOriginalType != nullptr && apparentDecel < 0) {
528 }
529 myCarFollowModel->setApparentDecel(apparentDecel);
531}
532
533void
534MSVehicleType::setMaxAccelProfile(std::vector<std::pair<double, double> > /* accelProfile */) {
535 /*
536 if (myOriginalType != nullptr) {
537 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
538 } else {
539 if (accelProfile[0].first > 0.) {
540 accelProfile.insert(accelProfile.begin(), std::make_pair(0.0, accelProfile[0].second));
541 }
542 if (accelProfile.back().first < (10000 / 3.6)) {
543 accelProfile.push_back(std::make_pair((10000 / 3.6), accelProfile.back().second));
544 }
545 double prevSpeed = 0.0;
546 for (const auto& accelPair : accelProfile) {
547 if (accelPair.first < 0.) {
548 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
549 break;
550 } else if (accelPair.second < 0.) {
551 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
552 break;
553 } else if (accelPair.first < prevSpeed) {
554 accelProfile = myOriginalType->getCarFollowModel().getMaxAccelProfile();
555 break;
556 }
557 prevSpeed = accelPair.first;
558 }
559 }
560 myCarFollowModel->setMaxAccelProfile(accelProfile);
561
562 std::stringstream accelProfileString;
563 accelProfileString << std::fixed << std::setprecision(2);
564 int count = 0;
565 for (const auto& accelPair : accelProfile) {
566 if (count > 0) {
567 accelProfileString << " ";
568 }
569 accelProfileString << toString(accelPair.first) + "," << accelPair.second;
570 count++;
571 }
572 myParameter.cfParameter[SUMO_ATTR_MAXACCEL_PROFILE] = accelProfileString.str();
573 */
574}
575
576void
577MSVehicleType::setDesAccelProfile(std::vector<std::pair<double, double> > /* accelProfile */) {
578 /*
579 if (myOriginalType != nullptr) {
580 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
581 } else {
582 if (accelProfile[0].first > 0.) {
583 accelProfile.insert(accelProfile.begin(), std::make_pair(0.0, accelProfile[0].second));
584 }
585 if (accelProfile.back().first < (10000 / 3.6)) {
586 accelProfile.push_back(std::make_pair((10000 / 3.6), accelProfile.back().second));
587 }
588 double prevSpeed = 0.0;
589 for (const auto& accelPair : accelProfile) {
590 if (accelPair.first < 0.) {
591 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
592 break;
593 } else if (accelPair.second < 0.) {
594 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
595 break;
596 } else if (accelPair.first < prevSpeed) {
597 accelProfile = myOriginalType->getCarFollowModel().getDesAccelProfile();
598 break;
599 }
600 prevSpeed = accelPair.first;
601 }
602 }
603 myCarFollowModel->setDesAccelProfile(accelProfile);
604
605 std::stringstream accelProfileString;
606 accelProfileString << std::fixed << std::setprecision(2);
607 int count = 0;
608 for (const auto& accelPair : accelProfile) {
609 if (count > 0) {
610 accelProfileString << " ";
611 }
612 accelProfileString << toString(accelPair.first) + "," << accelPair.second;
613 count++;
614 }
615 myParameter.cfParameter[SUMO_ATTR_DESACCEL_PROFILE] = accelProfileString.str();
616 */
617}
618
619void
620MSVehicleType::setImperfection(double imperfection) {
621 if (myOriginalType != nullptr && imperfection < 0) {
623 }
624 myCarFollowModel->setImperfection(imperfection);
626}
627
628void
630 if (myOriginalType != nullptr && tau < 0) {
632 }
635}
636
637
638/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:289
#define WRITE_WARNING(msg)
Definition MsgHandler.h:286
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
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:30
double roundDecimal(double x, int precision)
round to the given number of decimal digits
Definition StdDefs.cpp:60
T MAX2(T a, T b)
Definition StdDefs.h:86
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:445
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:392
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