Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOVTypeParameter.h
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/****************************************************************************/
20// Structure representing possible vehicle parameter
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
25#include <string>
26#include <map>
33
34// ===========================================================================
35// class declarations
36// ===========================================================================
37class OutputDevice;
38class OptionsCont;
39
40
41// ===========================================================================
42// value definitions
43// ===========================================================================
44const long long int VTYPEPARS_LENGTH_SET = 1;
45const long long int VTYPEPARS_MINGAP_SET = 1 << 1;
46const long long int VTYPEPARS_MAXSPEED_SET = 1 << 2;
47const long long int VTYPEPARS_PROBABILITY_SET = 1 << 3;
48const long long int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
49const long long int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
50const long long int VTYPEPARS_COLOR_SET = 1 << 6;
51const long long int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
52const long long int VTYPEPARS_WIDTH_SET = 1 << 8;
53const long long int VTYPEPARS_HEIGHT_SET = 1 << 9;
54const long long int VTYPEPARS_SHAPE_SET = 1 << 10;
55const long long int VTYPEPARS_OSGFILE_SET = 1 << 11;
56const long long int VTYPEPARS_IMGFILE_SET = 1 << 12;
57const long long int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
58const long long int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
59const long long int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
60const long long int VTYPEPARS_BOARDING_DURATION = 1 << 16;
61const long long int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
62const long long int VTYPEPARS_LOADING_DURATION = 1 << 18;
63const long long int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
64const long long int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
65const long long int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
66const long long int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
67const long long int VTYPEPARS_ACTIONSTEPLENGTH_SET = 1 << 23;
68const long long int VTYPEPARS_DESIRED_MAXSPEED_SET = 1 << 24;
69const long long int VTYPEPARS_CARRIAGE_LENGTH_SET = 1 << 25;
70const long long int VTYPEPARS_LOCOMOTIVE_LENGTH_SET = 1 << 26;
71const long long int VTYPEPARS_CARRIAGE_GAP_SET = 1 << 27;
72const long long int VTYPEPARS_CARRIAGE_DOORS_SET = 1 << 28;
73const long long int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET = 1 << 29;
74const long long int VTYPEPARS_FRONT_SEAT_POS_SET = 1 << 30;
75const long long int VTYPEPARS_SCALE_SET = (long long int)1 << 31;
76const long long int VTYPEPARS_MASS_SET = (long long int)1 << 32;
77const long long int VTYPEPARS_TTT_SET = (long long int)1 << 33;
78const long long int VTYPEPARS_TTT_BIDI_SET = (long long int)1 << 34;
79const long long int VTYPEPARS_SEATING_WIDTH_SET = (long long int)1 << 35;
80const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET = (long long int)1 << 36;
81const long long int VTYPEPARS_PARKING_BADGES_SET = (long long int)1 << 37;
82const long long int VTYPEPARS_BOARDING_FACTOR_SET = (long long int)1 << 38;
83
84
87
88
89// ===========================================================================
90// enum definitions
91// ===========================================================================
114
115
116// ===========================================================================
117// struct definitions
118// ===========================================================================
124
125public:
195
200 SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
201
204
209 bool wasSet(long long int what) const {
210 return (parametersSet & what) != 0;
211 }
212
218 void write(OutputDevice& dev) const;
219
225 double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
226
228 std::vector<double> getCFValueTable(SumoXMLAttr attr) const;
229
235 std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
236
242 double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
243
249 std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
250
252 typedef std::map<SumoXMLAttr, std::string> SubParams;
253
255 const SubParams& getLCParams() const;
256
262 double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
263
269 std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
270
271 void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
272
274 void initRailVisualizationParameters(const std::string fileName = "");
275
277 std::string id;
278
280 double length;
281
283 double minGap;
284
286 double maxSpeed;
287
290
294
297
300
303
305 double mass;
306
309
312
315
318
321
324
327
329 double scale;
330
333
335 double width;
336
338 double height;
339
342
344 std::string osgFile;
345
347 std::string imgFile;
348
350 std::vector<std::string> carriageImages;
352
353
356
359
362
365
368
371
374
377
379 double minGapLat;
380
383
386
389
392
395
398
401
404
407
410
413
416
418 std::vector<std::string> parkingBadges;
419
422
424 long long int parametersSet;
425
427 mutable bool saved;
428
431
433 std::vector<double> paramRestrictions;
434
436 static std::set<SumoXMLAttr> AllowedJMAttrs;
437
439 inline double getLength() const {
440 return length;
441 }
442
448 static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
449
455 static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
456
463 static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
464
470 static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
471
473 static const SUMOVTypeParameter& getDefault();
474
481 static bool parseLatAlignment(const std::string& val, double& lao, LatAlignmentDefinition& lad);
482
483 static inline bool isValidLatAlignment(const std::string& val) {
484 double lao;
486 return SUMOVTypeParameter::parseLatAlignment(val, lao, lad);
487 }
488
490 // XXX: does not include valid float strings
491 static inline std::vector<std::string> getLatAlignmentStrings() {
492 std::vector<std::string> result;
493 result.push_back("right");
494 result.push_back("center");
495 result.push_back("arbitrary");
496 result.push_back("nice");
497 result.push_back("compact");
498 result.push_back("left");
499 return result;
500 }
501
503 std::map<int, std::pair<SUMOTime, SUMOTime>> myManoeuverAngleTimes;
504
514 void setManoeuverAngleTimes(const SUMOVehicleClass vclass);
515
520 SUMOTime getEntryManoeuvreTime(const int angle) const;
521
526 SUMOTime getExitManoeuvreTime(const int angle) const;
527
531 std::string getManoeuverAngleTimesS() const;
532
534 SUMOTime getTimeToTeleport(SUMOTime defaultValue) const;
535
537 SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const;
538
546
554
561
566 std::vector<std::pair<double, double> > createCFProfile(const SumoXMLAttr attr, const std::string profile) const;
567};
long long int SUMOTime
Definition GUI.h:36
const long long int VTYPEPARS_TTT_SET
const long long int VTYPEPARS_SHAPE_SET
const long long int VTYPEPARS_LOADING_DURATION
const long long int VTYPEPARS_TTT_BIDI_SET
const long long int VTYPEPARS_SCALE_SET
const long long int VTYPEPARS_PERSON_CAPACITY
const long long int VTYPEPARS_CAR_FOLLOW_MODEL
const long long int VTYPEPARS_FRONT_SEAT_POS_SET
const long long int VTYPEPARS_WIDTH_SET
const long long int VTYPEPARS_CARRIAGE_LENGTH_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 int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DEFAULT
const long long int VTYPEPARS_LATALIGNMENT_SET
const long long int VTYPEPARS_COLOR_SET
const long long int VTYPEPARS_LANE_CHANGE_MODEL_SET
const long long int VTYPEPARS_DESIRED_MAXSPEED_SET
const long long int VTYPEPARS_OSGFILE_SET
const long long int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET
const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET
const long long int VTYPEPARS_SPEEDFACTOR_SET
const long long int VTYPEPARS_CARRIAGE_GAP_SET
const long long int VTYPEPARS_MINGAP_SET
const long long int VTYPEPARS_PROBABILITY_SET
const long long int VTYPEPARS_HEIGHT_SET
const int VTYPEPARS_DEFAULT_EMERGENCYDECEL_DECEL
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.
@ RIGHT
drive on the right side
@ GIVEN
The alignment as offset is given.
@ DEFAULT
No information given; use default.
@ LEFT
drive on the left side
@ ARBITRARY
maintain the current alignment
@ NICE
align with the closest sublane border
@ COMPACT
align with the rightmost sublane that allows keeping the current speed
@ CENTER
drive in the middle
const long long int VTYPEPARS_BOARDING_FACTOR_SET
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_SEATING_WIDTH_SET
const long long int VTYPEPARS_IMGFILE_SET
const long long int VTYPEPARS_CONTAINER_CAPACITY
const long long int VTYPEPARS_MINGAP_LAT_SET
const long long int VTYPEPARS_CARRIAGE_DOORS_SET
const long long int VTYPEPARS_LOCOMOTIVE_LENGTH_SET
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_IGNORING
vehicles ignoring classes
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::map< double, double > LinearApproxMap
A storage for options typed value containers).
Definition OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
Parameterised()
Default constructor.
Structure representing possible vehicle parameter.
double locomotiveLength
the length of the locomotive
static bool isValidLatAlignment(const std::string &val)
SUMOTime getExitManoeuvreTime(const int angle) const
Returns the time that will be needed for the vehicle type to execute the (exit) manoeuvre (and be blo...
double scaleVisual
the scaling factor when drawing the object
double width
This class' width.
SubParams cfParameter
Car-following parameter.
void write(OutputDevice &dev) const
Writes the vtype.
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....
void cacheParamRestrictions(const std::vector< std::string > &restrictionKeys)
bool saved
Information whether this type was already saved (needed by routers).
std::vector< double > getCFValueTable(SumoXMLAttr attr) const
retrieve value table from cfParameter
SUMOTime getTimeToTeleport(SUMOTime defaultValue) const
return time-to-teleport (either custom or default)
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double height
This class' height.
static LinearApproxHelpers::LinearApproxMap getDefaultDesAccelProfile(const SUMOVehicleClass vc, double desAccel)
Returns the default desired acceleration profile for the given vehicle class This needs to be a funct...
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
std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
double carriageLength
the length of train carriages
std::vector< std::string > parkingBadges
the parking access rights
static std::set< SumoXMLAttr > AllowedJMAttrs
allowed attrs for the junction model
double seatingWidth
width to be used when comping seats
SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const
return time-to-teleport.bidi (either custom or default)
double length
The physical vehicle length.
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
std::vector< std::string > carriageImages
Image files for additional carriages.
virtual ~SUMOVTypeParameter()
virtual destructor
double speedFactorPremature
the possible speed reduction when a train is ahead of schedule
std::vector< double > paramRestrictions
cached value of parameters which may restrict access to certain edges
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 ...
SUMOTime getEntryManoeuvreTime(const int angle) const
Returns the time that will be needed for the vehicle type to execute the (entry) manoeuvre (and be bl...
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.
std::vector< std::pair< double, double > > createCFProfile(const SumoXMLAttr attr, const std::string profile) const
Creates a vector of pairs from a string.
double maxPlatformDistance
the maximum distance between platform and train
std::map< SumoXMLAttr, std::string > SubParams
sub-model parameters
std::string imgFile
Image file for this class.
SUMOVehicleShape shape
This class' shape.
int personCapacity
The person capacity of the vehicle.
int carriageDoors
the number of doors per carriage
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers).
LinearApproxHelpers::LinearApproxMap getCFProfile(const SumoXMLAttr attr, const LinearApproxHelpers::LinearApproxMap &defaultProfile) const
Returns the named value from the map, or the default if it is not contained there.
double getLength() const
satisfy vType / router template requirements
double scale
individual scaling factor (-1 for undefined)
double getLCParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SUMOTime timeToTeleport
the custom time-to-teleport for this type
std::string osgFile
3D model file for this class
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 timeToTeleportBidi
the custom time-to-teleport.bidi for this type
void setManoeuverAngleTimes(const SUMOVehicleClass vclass)
Initialise the default mapping between manoeuver angle and times dependant on vehicle class.
double carriageGap
the length of the gap between carriages
int containerCapacity
The container capacity of the vehicle.
static const SUMOVTypeParameter & getDefault()
return the default parameters, this is a function due to the http://www.parashift....
SUMOTime boardingDuration
The time a person needs to board the vehicle.
static LinearApproxHelpers::LinearApproxMap getDefaultMaxAccelProfile(const SUMOVehicleClass vc, double maxAccel)
Returns the default maximum acceleration profile for the given vehicle class This needs to be a funct...
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.
static std::vector< std::string > getLatAlignmentStrings()
return all valid strings for latAlignment
double minGapLat
The vehicle type's minimum lateral gap [m].
double boardingFactor
factor for boardingDuration / loadingDuration
SUMOVehicleClass vehicleClass
The vehicle's class.
SUMOVTypeParameter(const std::string &vtid, const SUMOVehicleClass vc=SVC_IGNORING)
Constructor.
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
std::string id
The vehicle type's id.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
const SubParams & getLCParams() const
Returns the LC parameter.
std::string getLCParamString(const SumoXMLAttr attr, const std::string &defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
SubParams lcParameter
Lane-changing parameter.
LatAlignmentDefinition latAlignmentProcedure
Information on how the vehicle shall choose the lateral alignment.
static double getDefaultImperfection(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default driver's imperfection (sigma or epsilon in Krauss' model) for the given vehicle c...
double carriageDoorWidth
the width of the carriage doors
SubParams jmParameter
Junction-model parameter.
double impatience
The vehicle's impatience (willingness to obstruct others).
std::string getManoeuverAngleTimesS() const
Returns myManoeuverAngleTimes as a string for xml output.
std::map< int, std::pair< SUMOTime, SUMOTime > > myManoeuverAngleTimes
Map of manoeuver angles versus the times (entry, exit) to execute the manoeuver.
LaneChangeModel lcModel
The lane-change model to use.
static bool parseLatAlignment(const std::string &val, double &lao, LatAlignmentDefinition &lad)
Parses and validates a given latAlignment value.
static double getDefaultAccel(const SUMOVehicleClass vc=SVC_IGNORING)
Returns the default acceleration for the given vehicle class This needs to be a function because the ...
int carriageDoors
the number of doors per carriage
int personCapacity
The person capacity of the vehicle.
double maxPlatformDistance
the maximum distance between platform and train
double carriageLength
the length of train carriages
double desiredMaxSpeed
The vehicle type's desired maximum speed [m/s].
std::string osgFile
3D model file for this class
SUMOEmissionClass emissionClass
The emission class of this vehicle.
double minGap
This class' free space in front of the vehicle itself.
int containerCapacity
The container capacity of the vehicle.
double maxSpeed
The vehicle type's maximum speed [m/s] (technical limit, not subject to speed deviation).
VClassDefaultValues(SUMOVehicleClass vClass)
parameter constructor
double carriageDoorWidth
the width of the carriage doors
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
double length
The physical vehicle length.
SUMOVehicleShape shape
This class' shape.
double minGapLat
The vehicle type's minimum lateral gap [m].
LatAlignmentDefinition latAlignmentProcedure
the lateral alignment procedure
double locomotiveLength
the length of train locomotive