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-2023 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>
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36class OutputDevice;
37class OptionsCont;
38
39
40// ===========================================================================
41// value definitions
42// ===========================================================================
43const long long int VTYPEPARS_LENGTH_SET = 1;
44const long long int VTYPEPARS_MINGAP_SET = 1 << 1;
45const long long int VTYPEPARS_MAXSPEED_SET = 1 << 2;
46const long long int VTYPEPARS_PROBABILITY_SET = 1 << 3;
47const long long int VTYPEPARS_SPEEDFACTOR_SET = 1 << 4;
48const long long int VTYPEPARS_EMISSIONCLASS_SET = 1 << 5;
49const long long int VTYPEPARS_COLOR_SET = 1 << 6;
50const long long int VTYPEPARS_VEHICLECLASS_SET = 1 << 7;
51const long long int VTYPEPARS_WIDTH_SET = 1 << 8;
52const long long int VTYPEPARS_HEIGHT_SET = 1 << 9;
53const long long int VTYPEPARS_SHAPE_SET = 1 << 10;
54const long long int VTYPEPARS_OSGFILE_SET = 1 << 11;
55const long long int VTYPEPARS_IMGFILE_SET = 1 << 12;
56const long long int VTYPEPARS_IMPATIENCE_SET = 1 << 13;
57const long long int VTYPEPARS_LANE_CHANGE_MODEL_SET = 1 << 14;
58const long long int VTYPEPARS_PERSON_CAPACITY = 1 << 15;
59const long long int VTYPEPARS_BOARDING_DURATION = 1 << 16;
60const long long int VTYPEPARS_CONTAINER_CAPACITY = 1 << 17;
61const long long int VTYPEPARS_LOADING_DURATION = 1 << 18;
62const long long int VTYPEPARS_CAR_FOLLOW_MODEL = 1 << 19;
63const long long int VTYPEPARS_MAXSPEED_LAT_SET = 1 << 20;
64const long long int VTYPEPARS_LATALIGNMENT_SET = 1 << 21;
65const long long int VTYPEPARS_MINGAP_LAT_SET = 1 << 22;
66const long long int VTYPEPARS_ACTIONSTEPLENGTH_SET = 1 << 23;
67const long long int VTYPEPARS_DESIRED_MAXSPEED_SET = 1 << 24;
68const long long int VTYPEPARS_CARRIAGE_LENGTH_SET = 1 << 25;
69const long long int VTYPEPARS_LOCOMOTIVE_LENGTH_SET = 1 << 26;
70const long long int VTYPEPARS_CARRIAGE_GAP_SET = 1 << 27;
71const long long int VTYPEPARS_MANEUVER_ANGLE_TIMES_SET = 1 << 28;
72const long long int VTYPEPARS_FRONT_SEAT_POS_SET = 1 << 29;
73const long long int VTYPEPARS_SCALE_SET = 1 << 30;
74const long long int VTYPEPARS_MASS_SET = (long long int)1 << 31;
75const long long int VTYPEPARS_TTT_SET = (long long int)1 << 32;
76const long long int VTYPEPARS_TTT_BIDI_SET = (long long int)1 << 33;
77const long long int VTYPEPARS_SEATING_WIDTH_SET = (long long int)1 << 34;
78const long long int VTYPEPARS_SPEEDFACTOR_PREMATURE_SET = (long long int)1 << 35;
79
80
83
84
85// ===========================================================================
86// enum definitions
87// ===========================================================================
94 DEFAULT,
96 GIVEN,
98 RIGHT,
100 CENTER,
102 ARBITRARY,
104 NICE,
106 COMPACT,
108 LEFT
109};
110
111
112// ===========================================================================
113// struct definitions
114// ===========================================================================
120
121public:
182
187 SUMOVTypeParameter(const std::string& vtid, const SUMOVehicleClass vc = SVC_IGNORING);
188
191
196 bool wasSet(long long int what) const {
197 return (parametersSet & what) != 0;
198 }
199
205 void write(OutputDevice& dev) const;
206
212 double getCFParam(const SumoXMLAttr attr, const double defaultValue) const;
213
219 std::string getCFParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
220
226 double getLCParam(const SumoXMLAttr attr, const double defaultValue) const;
227
233 std::string getLCParamString(const SumoXMLAttr attr, const std::string& defaultValue) const;
234
236 typedef std::map<SumoXMLAttr, std::string> SubParams;
237
239 const SubParams& getLCParams() const;
240
246 double getJMParam(const SumoXMLAttr attr, const double defaultValue) const;
247
253 std::string getJMParamString(const SumoXMLAttr attr, const std::string defaultValue) const;
254
255 void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
256
259
261 std::string id;
262
264 double length;
265
267 double minGap;
268
270 double maxSpeed;
271
274
278
281
284
287
289 double mass;
290
293
296
299
302
305
308
311
313 double scale;
314
317
319 double width;
320
322 double height;
323
326
328 std::string osgFile;
329
331 std::string imgFile;
333
334
337
340
343
346
349
352
355
358
360 double minGapLat;
361
366
369
372
375
378
381
383 long long int parametersSet;
384
386 mutable bool saved;
387
390
392 std::vector<double> paramRestrictions;
393
395 static std::set<SumoXMLAttr> AllowedJMAttrs;
396
398 inline double getLength() const {
399 return length;
400 }
401
407 static double getDefaultAccel(const SUMOVehicleClass vc = SVC_IGNORING);
408
414 static double getDefaultDecel(const SUMOVehicleClass vc = SVC_IGNORING);
415
422 static double getDefaultEmergencyDecel(const SUMOVehicleClass vc, double decel, double defaultOption);
423
429 static double getDefaultImperfection(const SUMOVehicleClass vc = SVC_IGNORING);
430
432 static const SUMOVTypeParameter& getDefault();
433
440 static bool parseLatAlignment(const std::string& val, double& lao, LatAlignmentDefinition& lad);
441
442 static inline bool isValidLatAlignment(const std::string& val) {
443 double lao;
445 return SUMOVTypeParameter::parseLatAlignment(val, lao, lad);
446 }
447
449 // XXX: does not include valid float strings
450 static inline std::vector<std::string> getLatAlignmentStrings() {
451 std::vector<std::string> result;
452 result.push_back("right");
453 result.push_back("center");
454 result.push_back("arbitrary");
455 result.push_back("nice");
456 result.push_back("compact");
457 result.push_back("left");
458 return result;
459 }
460
462 std::map<int, std::pair<SUMOTime, SUMOTime>> myManoeuverAngleTimes;
463
473 void setManoeuverAngleTimes(const SUMOVehicleClass vclass);
474
479 SUMOTime getEntryManoeuvreTime(const int angle) const;
480
485 SUMOTime getExitManoeuvreTime(const int angle) const;
486
490 std::string getManoeuverAngleTimesS() const;
491
493 SUMOTime getTimeToTeleport(SUMOTime defaultValue) const;
494
496 SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const;
497};
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_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_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_LOCOMOTIVE_LENGTH_SET
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
int SUMOEmissionClass
SUMOVehicleShape
Definition of vehicle classes to differ between different appearances.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A storage for options typed value containers)
Definition OptionsCont.h:89
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
Structure representing possible vehicle parameter.
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 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)
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.
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 and locomotive
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].
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...
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::map< SumoXMLAttr, std::string > SubParams
sub-model parameters
std::string imgFile
Image file for this class.
void initRailVisualizationParameters()
init Rail Visualization Parameters
SUMOVehicleShape shape
This class' shape.
int personCapacity
The person capacity of the vehicle.
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street.
bool onlyReferenced
Information whether this is a type-stub, being only referenced but not defined (needed by routers)
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.
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.
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].
SUMOVehicleClass vehicleClass
The vehicle's class.
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...
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 ...
struct for default values that depend of VClass
int personCapacity
The person capacity of the vehicle.
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)
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