Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/vehicle/SUMOVehicleParameter.h
169678 views
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
/****************************************************************************/
14
/// @file SUMOVehicleParameter.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Axel Wegener
18
/// @author Michael Behrisch
19
/// @date 2006-01-24
20
///
21
// Structure representing possible vehicle parameter
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <string>
27
#include <utils/common/Parameterised.h>
28
#include <utils/common/RGBColor.h>
29
#include <utils/common/SUMOTime.h>
30
#include <utils/common/SUMOVehicleClass.h>
31
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
class OutputDevice;
37
class OptionsCont;
38
39
40
// ===========================================================================
41
// value definitions
42
// ===========================================================================
43
const long long int VEHPARS_COLOR_SET = 1;
44
const long long int VEHPARS_VTYPE_SET = 2;
45
const long long int VEHPARS_DEPARTLANE_SET = 2 << 1;
46
const long long int VEHPARS_DEPARTPOS_SET = 2 << 2;
47
const long long int VEHPARS_DEPARTSPEED_SET = 2 << 3;
48
const long long int VEHPARS_END_SET = 2 << 4;
49
const long long int VEHPARS_NUMBER_SET = 2 << 5;
50
const long long int VEHPARS_PERIOD_SET = 2 << 6;
51
const long long int VEHPARS_VPH_SET = 2 << 7;
52
const long long int VEHPARS_PROB_SET = 2 << 8;
53
const long long int VEHPARS_POISSON_SET = 2 << 9;
54
const long long int VEHPARS_ROUTE_SET = 2 << 10;
55
const long long int VEHPARS_ARRIVALLANE_SET = 2 << 11;
56
const long long int VEHPARS_ARRIVALPOS_SET = 2 << 12;
57
const long long int VEHPARS_ARRIVALSPEED_SET = 2 << 13;
58
const long long int VEHPARS_LINE_SET = 2 << 14;
59
const long long int VEHPARS_FROM_TAZ_SET = 2 << 15;
60
const long long int VEHPARS_TO_TAZ_SET = 2 << 16;
61
const long long int VEHPARS_FORCE_REROUTE = 2 << 17;
62
const long long int VEHPARS_PERSON_CAPACITY_SET = 2 << 18;
63
const long long int VEHPARS_PERSON_NUMBER_SET = 2 << 19;
64
const long long int VEHPARS_CONTAINER_NUMBER_SET = 2 << 20;
65
const long long int VEHPARS_DEPARTPOSLAT_SET = 2 << 21;
66
const long long int VEHPARS_ARRIVALPOSLAT_SET = 2 << 22;
67
const long long int VEHPARS_VIA_SET = 2 << 23;
68
const long long int VEHPARS_SPEEDFACTOR_SET = 2 << 24;
69
const long long int VEHPARS_DEPARTEDGE_SET = 2 << 25;
70
const long long int VEHPARS_ARRIVALEDGE_SET = 2 << 26;
71
const long long int VEHPARS_CALIBRATORSPEED_SET = 2 << 27;
72
const long long int VEHPARS_JUNCTIONMODEL_PARAMS_SET = 2 << 28;
73
const long long int VEHPARS_CFMODEL_PARAMS_SET = 2 << 29;
74
const long long int VEHPARS_PARKING_BADGES_SET = (long long int)2 << 30;
75
const long long int VEHPARS_INSERTION_CHECKS_SET = (long long int)2 << 31;
76
77
const int STOP_INDEX_END = -1;
78
const int STOP_INDEX_FIT = -2;
79
const int STOP_INDEX_REPEAT = -3;
80
81
const int STOP_START_SET = 1;
82
const int STOP_END_SET = 2;
83
const int STOP_DURATION_SET = 2 << 1;
84
const int STOP_UNTIL_SET = 2 << 2;
85
const int STOP_EXTENSION_SET = 2 << 3;
86
const int STOP_TRIGGER_SET = 2 << 4;
87
const int STOP_PARKING_SET = 2 << 5;
88
const int STOP_EXPECTED_SET = 2 << 6;
89
const int STOP_CONTAINER_TRIGGER_SET = 2 << 7;
90
const int STOP_EXPECTED_CONTAINERS_SET = 2 << 8;
91
const int STOP_TRIP_ID_SET = 2 << 9;
92
const int STOP_LINE_SET = 2 << 10;
93
const int STOP_SPEED_SET = 2 << 11;
94
const int STOP_SPLIT_SET = 2 << 12;
95
const int STOP_JOIN_SET = 2 << 13;
96
const int STOP_ARRIVAL_SET = 2 << 14;
97
const int STOP_PERMITTED_SET = 2 << 15;
98
const int STOP_ENDED_SET = 2 << 16;
99
const int STOP_STARTED_SET = 2 << 17;
100
const int STOP_POSLAT_SET = 2 << 18;
101
const int STOP_ONDEMAND_SET = 2 << 19;
102
const int STOP_JUMP_SET = 2 << 20;
103
const int STOP_JUMP_UNTIL_SET = 2 << 21;
104
const int STOP_PRIORITY_SET = 2 << 22;
105
106
const double MIN_STOP_LENGTH = 2 * POSITION_EPS;
107
108
const std::string LINE_ANY = "ANY";
109
110
// ===========================================================================
111
// enum definitions
112
// ===========================================================================
113
/**
114
* @enum DepartDefinition
115
* @brief Possible ways to depart
116
*/
117
enum class DepartDefinition {
118
/// @brief The time is given
119
GIVEN,
120
/// @brief The departure is person triggered
121
TRIGGERED,
122
/// @brief The departure is container triggered
123
CONTAINER_TRIGGERED,
124
/// @brief The vehicle is discarded if emission fails (not fully implemented yet)
125
NOW,
126
/// @brief The departure is triggered by a train split
127
SPLIT,
128
/// @brief The departure is at simulation start
129
BEGIN,
130
/// @brief Tag for the last element in the enum for safe int casting
131
DEF_MAX
132
};
133
134
135
/**
136
* @enum DepartLaneDefinition
137
* @brief Possible ways to choose a lane on depart
138
*/
139
enum class DepartLaneDefinition {
140
/// @brief No information given; use default
141
DEFAULT,
142
/// @brief The lane is given
143
GIVEN,
144
/// @brief The lane is chosen randomly
145
RANDOM,
146
/// @brief The least occupied lane is used
147
FREE,
148
/// @brief The least occupied lane from lanes which allow the continuation
149
ALLOWED_FREE,
150
/// @brief The least occupied lane from best lanes
151
BEST_FREE,
152
/// @brief The lane most likely according the speedFactor (from best lanes)
153
BEST_PROB,
154
/// @brief The rightmost lane the vehicle may use
155
FIRST_ALLOWED
156
};
157
158
159
/**
160
* @enum DepartPosDefinition
161
* @brief Possible ways to choose the departure position
162
*/
163
enum class DepartPosDefinition {
164
/// @brief No information given; use default
165
DEFAULT,
166
/// @brief The position is given
167
GIVEN,
168
/// @brief The position is set by the vehroute device
169
GIVEN_VEHROUTE,
170
/// @brief A random position is chosen
171
RANDOM,
172
/// @brief A free position is chosen
173
FREE,
174
/// @brief Back-at-zero position
175
BASE,
176
/// @brief Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DepartPosDefinition::BASE if there is no vehicle on the departLane yet.
177
LAST,
178
/// @brief If a fixed number of random choices fails, a free position is chosen
179
RANDOM_FREE,
180
/// @brief The position may be chosen freely in a polygon defined by a taz
181
RANDOM_LOCATION,
182
/// @brief depart position for a split vehicle is in front of the continuing vehicle
183
SPLIT_FRONT,
184
/// @brief depart position is endPos of first stop
185
STOP
186
};
187
188
189
/**
190
* @enum DepartPosLatDefinition
191
* @brief Possible ways to choose the lateral departure position
192
*/
193
enum class DepartPosLatDefinition {
194
/// @brief No information given; use default
195
DEFAULT,
196
/// @brief The position is given
197
GIVEN,
198
/// @brief The position is set by the vehroute device
199
GIVEN_VEHROUTE,
200
/// @brief At the rightmost side of the lane
201
RIGHT,
202
/// @brief At the center of the lane
203
CENTER,
204
/// @brief At the leftmost side of the lane
205
LEFT,
206
/// @brief The lateral position is chosen randomly
207
RANDOM,
208
/// @brief A free lateral position is chosen
209
FREE,
210
/// @brief If a fixed number of random choices fails, a free lateral position is chosen
211
RANDOM_FREE
212
};
213
214
215
/**
216
* @enum DepartSpeedDefinition
217
* @brief Possible ways to choose the departure speed
218
*/
219
enum class DepartSpeedDefinition {
220
/// @brief No information given; use default
221
DEFAULT,
222
/// @brief The speed is given
223
GIVEN,
224
/// @brief The speed is set by the vehroute device
225
GIVEN_VEHROUTE,
226
/// @brief The speed is chosen randomly
227
RANDOM,
228
/// @brief The maximum safe speed is used
229
MAX,
230
/// @brief The maximum lane speed is used (speedLimit * speedFactor)
231
DESIRED,
232
/// @brief The maximum lane speed is used (speedLimit)
233
LIMIT,
234
/// @brief The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on the departLane yet.
235
LAST,
236
/// @brief The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on the departLane yet.
237
AVG
238
};
239
240
241
/**
242
* @enum RouteIndexDefinition
243
* @brief Possible ways to choose the departure and arrival edge
244
*/
245
enum class RouteIndexDefinition {
246
/// @brief No information given; use default
247
DEFAULT,
248
/// @brief The edge index is given
249
GIVEN,
250
/// @brief The edge is chosen randomly
251
RANDOM,
252
};
253
254
255
/**
256
* @enum ArrivalLaneDefinition
257
* @brief Possible ways to choose the arrival lane
258
*/
259
enum class ArrivalLaneDefinition {
260
/// @brief No information given; use default
261
DEFAULT = 0,
262
/// @brief The current lane shall be used
263
CURRENT = 1,
264
/// @brief The arrival lane is given
265
GIVEN = 2,
266
/// @brief The lane is chosen randomly
267
RANDOM = 3,
268
/// @brief The rightmost lane the vehicle may use
269
FIRST_ALLOWED = 4
270
};
271
272
273
/**
274
* @enum ArrivalPosDefinition
275
* @brief Possible ways to choose the arrival position
276
*/
277
enum class ArrivalPosDefinition {
278
/// @brief No information given; use default
279
DEFAULT,
280
/// @brief The arrival position is given
281
GIVEN,
282
/// @brief The arrival position is chosen randomly
283
RANDOM,
284
/// @brief Half the road length
285
CENTER,
286
/// @brief The maximum arrival position is used
287
MAX
288
};
289
290
291
/**
292
* @enum ArrivalPosLatDefinition
293
* @brief Possible ways to choose the lateral arrival position
294
*/
295
enum class ArrivalPosLatDefinition {
296
/// @brief No information given; use default
297
DEFAULT,
298
/// @brief The position is given
299
GIVEN,
300
/// @brief At the rightmost side of the lane
301
RIGHT,
302
/// @brief At the center of the lane
303
CENTER,
304
/// @brief At the leftmost side of the lane
305
LEFT
306
};
307
308
309
/**
310
* @enum ArrivalSpeedDefinition
311
* @brief Possible ways to choose the arrival speed
312
*/
313
enum class ArrivalSpeedDefinition {
314
/// @brief No information given; use default
315
DEFAULT,
316
/// @brief The speed is given
317
GIVEN,
318
/// @brief The current speed is used
319
CURRENT
320
};
321
322
323
// ===========================================================================
324
// struct definitions
325
// ===========================================================================
326
/**
327
* @class SUMOVehicleParameter
328
* @brief Structure representing possible vehicle parameter
329
*
330
* When used within a vehicle, parameter are usually const except for selected items
331
* adaptable via TraCI which are flagged as mutable below
332
* The fields yielding with "Procedure" describe whether the according value
333
* shall be used or another procedure is used to choose the value.
334
* @see DepartLaneDefinition
335
* @see DepartPosDefinition
336
* @see DepartSpeedDefinition
337
*/
338
class SUMOVehicleParameter : public Parameterised {
339
public:
340
/** @brief Constructor
341
*
342
* Initialises the structure with default values
343
*/
344
SUMOVehicleParameter();
345
346
/// @brief Destructor
347
virtual ~SUMOVehicleParameter();
348
349
/** @struct Stop
350
* @brief Definition of vehicle stop (position and duration)
351
*/
352
class Stop : public Parameterised {
353
public:
354
/// @brief Destructor
355
virtual ~Stop() {}
356
357
/** @brief Writes the stop as XML
358
*
359
* @param[in, out] dev The device to write into
360
* @exception IOError not yet implemented
361
*/
362
void write(OutputDevice& dev, const bool close = true, const bool writeTagAndParents = true) const;
363
364
/// @brief return list of stopping place ids
365
std::vector<std::string> getStoppingPlaceIDs() const;
366
367
/// @brief write trigger attribute
368
std::vector<std::string> getTriggers() const;
369
370
/// @brief The edge to stop at
371
std::string edge;
372
373
/// @brief The lane to stop at
374
std::string lane;
375
376
/// @brief (Optional) bus stop if one is assigned to the stop
377
std::string busstop;
378
379
/// @brief (Optional) container stop if one is assigned to the stop
380
std::string containerstop;
381
382
/// @brief (Optional) parking area if one is assigned to the stop
383
std::string parkingarea;
384
385
/// @brief (Optional) charging station if one is assigned to the stop
386
std::string chargingStation;
387
388
/// @brief (Optional) overhead line segment if one is assigned to the stop
389
std::string overheadWireSegment;
390
391
/// @brief The stopping position start
392
double startPos = 0.;
393
394
/// @brief The stopping position end
395
double endPos = 0.;
396
397
/// @brief The (expected) time at which the vehicle reaches the stop
398
SUMOTime arrival = -1;
399
400
/// @brief The stopping duration
401
SUMOTime duration = -1;
402
403
/// @brief The time at which the vehicle may continue its journey
404
SUMOTime until = -1;
405
406
/// @brief The maximum time extension for boarding / loading
407
SUMOTime extension = -1;
408
409
/// @brief The earliest pickup time for a taxi stop
410
SUMOTime waitUntil = -1;
411
412
/// @brief whether an arriving person lets the vehicle continue
413
bool triggered = false;
414
415
/// @brief whether an arriving container lets the vehicle continue
416
bool containerTriggered = false;
417
418
/// @brief whether an joined vehicle lets this vehicle continue
419
bool joinTriggered = false;
420
421
/// @brief whether the vehicle is removed from the net while stopping
422
ParkingType parking = ParkingType::ONROAD;
423
424
/// @brief IDs of persons the vehicle has to wait for until departing
425
std::set<std::string> awaitedPersons;
426
427
/// @brief IDs of persons or containers that may board/load at this stop
428
std::set<std::string> permitted;
429
430
/// @brief IDs of containers the vehicle has to wait for until departing
431
std::set<std::string> awaitedContainers;
432
433
/// @brief enable or disable friendly position (used by netedit)
434
bool friendlyPos = false;
435
436
/// @brief act Type (only used by Persons) (used by netedit)
437
std::string actType;
438
439
/// @brief id of the trip within a cyclical public transport route
440
std::string tripId;
441
442
/// @brief the new line id of the trip within a cyclical public transport route
443
std::string line;
444
445
/// @brief the id of the vehicle (train portion) that splits of upon reaching this stop
446
std::string split;
447
448
/// @brief the id of the vehicle (train portion) to which this vehicle shall be joined
449
std::string join;
450
451
/// @brief the speed at which this stop counts as reached (waypoint mode)
452
double speed = 0.;
453
454
/// @brief the lateral offset when stopping
455
double posLat = INVALID_DOUBLE;
456
457
/// @brief whether the stop may be skipped
458
bool onDemand = false;
459
460
/// @brief priority for weighting/skipping stops
461
double priority = -1;
462
463
/// @brief transfer time if there shall be a jump from this stop to the next route edge
464
SUMOTime jump = -1;
465
466
/// @brief earlierst jump end if there shall be a jump from this stop to the next route edge
467
SUMOTime jumpUntil = -1;
468
469
/// @brief the time at which this stop was reached
470
mutable SUMOTime started = -1;
471
472
/// @brief the time at which this stop was ended
473
mutable SUMOTime ended = -1;
474
475
/// @brief lanes and positions connected to this stop (only used by duarouter where Stop is used to store stopping places)
476
std::vector<std::tuple<std::string, double, double> > accessPos;
477
478
/// @brief at which position in the stops list
479
int index = 0;
480
481
/// @brief at which position within the route (only used for state saving)
482
mutable int routeIndex = 0;
483
484
/// @brief Information for the output which parameter were set
485
int parametersSet = 0;
486
487
/// @brief Whether this stop was triggered by a collision
488
bool collision = false;
489
490
/// @brief Whether this stop was triggered by a car failure / mechanical problem / lack of energy
491
bool breakDown = false;
492
493
/// @brief return flags as per Vehicle::getStops
494
int getFlags() const;
495
};
496
497
/** @brief Returns whether the given parameter was set
498
* @param[in] what The parameter which one asks for
499
* @return Whether the given parameter was set
500
*/
501
bool wasSet(long long int what) const {
502
return (parametersSet & what) != 0;
503
}
504
505
/** @brief Writes the parameters as a beginning element
506
*
507
* @param[in, out] dev The device to write into
508
* @param[in] oc The options to get defaults from
509
* @param[in] altTag The "root" tag to write (defaults to vehicle)
510
* @param[in] typeID The typeID to write (defaults to member vtypeid)
511
* @exception IOError not yet implemented
512
*/
513
void write(OutputDevice& dev, const OptionsCont& oc, const SumoXMLTag altTag = SUMO_TAG_VEHICLE, const std::string& typeID = "") const;
514
515
/** @brief Returns whether the defaults shall be used
516
* @param[in] oc The options to get the options from
517
* @param[in] optionName The name of the option to determine whether its value shall be used
518
* @return Whether the option is set and --defaults-override was set
519
*/
520
bool defaultOptionOverrides(const OptionsCont& oc, const std::string& optionName) const;
521
522
/// @name Depart/arrival-attributes verification
523
/// @{
524
/** @brief Validates a given depart value
525
* @param[in] val The depart value to parse
526
* @param[in] element The name of the type of the parsed element, for building the error message
527
* @param[in] id The id of the parsed element, for building the error message
528
* @param[out] depart The parsed depart time, if given
529
* @param[out] dd The parsed departProcedure definition
530
* @param[out] error Error message, if an error occures
531
* @return Whether the given value is a valid depart definition
532
*/
533
static bool parseDepart(const std::string& val, const std::string& element, const std::string& id,
534
SUMOTime& depart, DepartDefinition& dd, std::string& error, const std::string& attr = "departure");
535
536
/** @brief Validates a given departLane value
537
* @param[in] val The departLane value to parse
538
* @param[in] element The name of the type of the parsed element, for building the error message
539
* @param[in] id The id of the parsed element, for building the error message
540
* @param[out] lane The parsed lane, if given
541
* @param[out] dld The parsed departLane definition
542
* @param[out] error Error message, if an error occures
543
* @return Whether the given value is a valid departLane definition
544
*/
545
static bool parseDepartLane(const std::string& val, const std::string& element, const std::string& id,
546
int& lane, DepartLaneDefinition& dld, std::string& error);
547
548
/** @brief Validates a given departPos value
549
* @param[in] val The departPos value to parse
550
* @param[in] element The name of the type of the parsed element, for building the error message
551
* @param[in] id The id of the parsed element, for building the error message
552
* @param[out] pos The parsed position, if given
553
* @param[out] dpd The parsed departPos definition
554
* @param[out] error Error message, if an error occures
555
* @return Whether the given value is a valid departPos definition
556
*/
557
static bool parseDepartPos(const std::string& val, const std::string& element, const std::string& id,
558
double& pos, DepartPosDefinition& dpd, std::string& error);
559
560
/** @brief Validates a given departPosLat value
561
* @param[in] val The departPosLat value to parse
562
* @param[in] element The name of the type of the parsed element, for building the error message
563
* @param[in] id The id of the parsed element, for building the error message
564
* @param[out] pos The parsed position, if given
565
* @param[out] dpd The parsed departPosLat definition
566
* @param[out] error Error message, if an error occures
567
* @return Whether the given value is a valid departPosLat definition
568
*/
569
static bool parseDepartPosLat(const std::string& val, const std::string& element, const std::string& id,
570
double& pos, DepartPosLatDefinition& dpd, std::string& error);
571
572
/** @brief Validates a given departSpeed value
573
* @param[in] val The departSpeed value to parse
574
* @param[in] element The name of the type of the parsed element, for building the error message
575
* @param[in] id The id of the parsed element, for building the error message
576
* @param[out] speed The parsed speed, if given
577
* @param[out] dsd The parsed departSpeed definition
578
* @param[out] error Error message, if an error occures
579
* @return Whether the given value is a valid departSpeed definition
580
*/
581
static bool parseDepartSpeed(const std::string& val, const std::string& element, const std::string& id,
582
double& speed, DepartSpeedDefinition& dsd, std::string& error);
583
584
/** @brief Validates a given departEdge or arrivalEdge value
585
* @param[in] val The departEdge value to parse
586
* @param[in] element The name of the type of the parsed element, for building the error message
587
* @param[in] id The id of the parsed element, for building the error message
588
* @param[out] edgeIndex The parsed edge index, if given
589
* @param[out] ded The parsed departEdge definition
590
* @param[out] error Error message, if an error occures
591
* @return Whether the given value is a valid departEdge definition
592
*/
593
static bool parseRouteIndex(const std::string& val, const std::string& element, const std::string& id,
594
const SumoXMLAttr attr,
595
int& edgeIndex, RouteIndexDefinition& rid, std::string& error);
596
597
/** @brief Validates a given arrivalLane value
598
* @param[in] val The arrivalLane value to parse
599
* @param[in] element The name of the type of the parsed element, for building the error message
600
* @param[in] id The id of the parsed element, for building the error message
601
* @param[out] lane The parsed lane, if given
602
* @param[out] ald The parsed arrivalLane definition
603
* @param[out] error Error message, if an error occures
604
* @return Whether the given value is a valid arrivalLane definition
605
*/
606
static bool parseArrivalLane(const std::string& val, const std::string& element, const std::string& id,
607
int& lane, ArrivalLaneDefinition& ald, std::string& error);
608
609
/** @brief Validates a given arrivalPos value
610
* @param[in] val The arrivalPos value to parse
611
* @param[in] element The name of the type of the parsed element, for building the error message
612
* @param[in] id The id of the parsed element, for building the error message
613
* @param[out] pos The parsed position, if given
614
* @param[out] apd The parsed arrivalPos definition
615
* @param[out] error Error message, if an error occures
616
* @return Whether the given value is a valid arrivalPos definition
617
*/
618
static bool parseArrivalPos(const std::string& val, const std::string& element, const std::string& id,
619
double& pos, ArrivalPosDefinition& apd, std::string& error);
620
621
/** @brief Validates a given arrivalPosLat value
622
* @param[in] val The arrivalPosLat value to parse
623
* @param[in] element The name of the type of the parsed element, for building the error message
624
* @param[in] id The id of the parsed element, for building the error message
625
* @param[out] pos The parsed position, if given
626
* @param[out] apd The parsed arrivalPosLat definition
627
* @param[out] error Error message, if an error occures
628
* @return Whether the given value is a valid arrivalPosLat definition
629
*/
630
static bool parseArrivalPosLat(const std::string& val, const std::string& element, const std::string& id,
631
double& pos, ArrivalPosLatDefinition& apd, std::string& error);
632
633
634
/** @brief Validates a given arrivalSpeed value
635
* @param[in] val The arrivalSpeed value to parse
636
* @param[in] element The name of the type of the parsed element, for building the error message
637
* @param[in] id The id of the parsed element, for building the error message
638
* @param[out] speed The parsed speed, if given
639
* @param[out] asd The parsed arrivalSpeed definition
640
* @param[out] error Error message, if an error occures
641
* @return Whether the given value is a valid arrivalSpeed definition
642
*/
643
static bool parseArrivalSpeed(const std::string& val, const std::string& element, const std::string& id,
644
double& speed, ArrivalSpeedDefinition& asd, std::string& error);
645
/// @}
646
647
/** @brief Interprets negative edge positions and fits them onto a given edge
648
* @param[in] pos The position to be interpreted
649
* @param[in] maximumValue The maximum allowed value (edge length)
650
* @param[in] attr The attribute from which the value originated
651
* @param[in] id The id of the object to which this attribute belongs
652
* @return Whether the interpreted position
653
*/
654
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string& id, bool silent = false);
655
656
/** @brief Validates a given person modes value
657
* @param[in] modes The modes value to parse
658
* @param[in] element The name of the type of the parsed element, for building the error message
659
* @param[in] id The id of the parsed element, for building the error message
660
* @param[out] modeSet The parsed modes definition
661
* @param[out] error Error message, if an error occures
662
* @return Whether the given value is a valid arrivalSpeed definition
663
*/
664
static bool parsePersonModes(const std::string& modes, const std::string& element, const std::string& id, SVCPermissions& modeSet, std::string& error);
665
666
/// @brief parses stop trigger values
667
static void parseStopTriggers(const std::vector<std::string>& triggers, bool expectTrigger, Stop& stop);
668
669
/// @brief parses parking type value
670
static ParkingType parseParkingType(const std::string& value);
671
672
/// @brief parses insertion checks
673
static int parseInsertionChecks(const std::string& value);
674
675
/// @brief The vehicle tag
676
SumoXMLTag tag;
677
678
/// @brief The vehicle's id
679
std::string id;
680
681
/// @brief The vehicle's route id
682
std::string routeid;
683
684
/// @brief The vehicle's type id
685
std::string vtypeid;
686
687
/// @brief The vehicle's color, TraCI may change this
688
mutable RGBColor color;
689
690
/// @name Departure definition
691
/// @{
692
/// @brief The vehicle's departure time
693
SUMOTime depart;
694
695
/// @brief Information how the vehicle shall choose the depart time
696
DepartDefinition departProcedure;
697
698
/// @brief (optional) The lane the vehicle shall depart from (index in edge)
699
int departLane;
700
701
/// @brief Information how the vehicle shall choose the lane to depart from
702
DepartLaneDefinition departLaneProcedure;
703
704
/// @brief (optional) The position the vehicle shall depart from
705
double departPos;
706
707
/// @brief Information how the vehicle shall choose the departure position
708
DepartPosDefinition departPosProcedure;
709
710
/// @brief (optional) The lateral position the vehicle shall depart from
711
double departPosLat;
712
713
/// @brief Information how the vehicle shall choose the lateral departure position
714
DepartPosLatDefinition departPosLatProcedure;
715
716
/// @brief (optional) The initial speed of the vehicle
717
double departSpeed;
718
719
/// @brief Information how the vehicle's initial speed shall be chosen
720
DepartSpeedDefinition departSpeedProcedure;
721
722
/// @brief (optional) The initial edge within the route of the vehicle
723
int departEdge;
724
725
/// @brief Information how the vehicle's initial edge shall be chosen
726
RouteIndexDefinition departEdgeProcedure;
727
728
/// @}
729
730
/// @name Arrival definition
731
/// @{
732
/// @brief (optional) The lane the vehicle shall arrive on (not used yet)
733
int arrivalLane;
734
735
/// @brief Information how the vehicle shall choose the lane to arrive on
736
ArrivalLaneDefinition arrivalLaneProcedure;
737
738
/// @brief (optional) The position the vehicle shall arrive on
739
double arrivalPos;
740
741
/// @brief Information how the vehicle shall choose the arrival position
742
ArrivalPosDefinition arrivalPosProcedure;
743
744
/// @brief (optional) The lateral position the vehicle shall arrive on
745
double arrivalPosLat;
746
747
/// @brief Information how the vehicle shall choose the lateral arrival position
748
ArrivalPosLatDefinition arrivalPosLatProcedure;
749
750
/// @brief (optional) The final speed of the vehicle (not used yet)
751
double arrivalSpeed;
752
753
/// @brief Information how the vehicle's end speed shall be chosen
754
ArrivalSpeedDefinition arrivalSpeedProcedure;
755
756
/// @brief (optional) The final edge within the route of the vehicle
757
int arrivalEdge;
758
759
/// @brief Information how the vehicle's final edge shall be chosen
760
RouteIndexDefinition arrivalEdgeProcedure;
761
762
/// @}
763
764
/// @name Repetition definition
765
/// @{
766
/// @brief The number of times the vehicle shall be repeatedly inserted
767
int repetitionNumber;
768
769
/// @brief The number of times the vehicle was already inserted
770
int repetitionsDone;
771
772
/// @brief The time offset between vehicle reinsertions
773
SUMOTime repetitionOffset;
774
775
/// @brief The offset between depart and the time for the next vehicle insertions
776
SUMOTime repetitionTotalOffset;
777
778
/// @brief The probability for emitting a vehicle per second
779
double repetitionProbability;
780
781
/// @brief The rate for emitting vehicles with a poisson distribution
782
double poissonRate;
783
784
/// @brief The time at which the flow ends (only needed when using repetitionProbability)
785
SUMOTime repetitionEnd;
786
787
/// @}
788
789
/// @brief The vehicle's line (mainly for public transport)
790
mutable std::string line;
791
792
/// @brief The vehicle's origin zone (district)
793
std::string fromTaz;
794
795
/// @brief The vehicle's destination zone (district)
796
std::string toTaz;
797
798
/// @brief List of the stops the vehicle will make, TraCI may add entries here
799
mutable std::vector<Stop> stops;
800
801
/// @brief List of the via-edges the vehicle must visit
802
mutable std::vector<std::string> via;
803
804
/// @brief The parking access rights
805
std::vector<std::string> parkingBadges;
806
807
/// @brief The modes a person or container can use
808
SVCPermissions modes;
809
810
/// @brief The types of usable (auto-generated) vehicles for a person / container
811
std::string vTypes;
812
813
/// @brief The static number of persons in the vehicle when it departs (not including boarding persons)
814
int personNumber;
815
816
/// @brief The static number of containers in the vehicle when it departs
817
int containerNumber;
818
819
/// @brief individual speedFactor (overriding distribution from vType)
820
double speedFactor;
821
822
/// @brief speed (used by calibrator flows
823
double calibratorSpeed;
824
825
/// @brief bitset of InsertionCheck
826
int insertionChecks;
827
828
/// @brief Information for the router which parameter were set, TraCI may modify this (when changing color)
829
mutable long long int parametersSet;
830
831
public:
832
/// @brief increment flow
833
void incrementFlow(double scale, SumoRNG* rng = nullptr);
834
835
protected:
836
/// @brief obtain depart parameter in string format
837
std::string getDepart() const;
838
839
/// @brief obtain depart lane parameter in string format
840
std::string getDepartLane() const;
841
842
/// @brief obtain depart pos parameter in string format
843
std::string getDepartPos() const;
844
845
/// @brief obtain depart pos lat parameter in string format
846
std::string getDepartPosLat() const;
847
848
/// @brief obtain depart speed parameter in string format
849
std::string getDepartSpeed() const;
850
851
/// @brief obtain depart edge parameter in string format
852
std::string getDepartEdge() const;
853
854
/// @brief obtain arrival lane parameter in string format
855
std::string getArrivalLane() const;
856
857
/// @brief obtain arrival pos parameter in string format
858
std::string getArrivalPos() const;
859
860
/// @brief obtain arrival pos lat parameter in string format
861
std::string getArrivalPosLat() const;
862
863
/// @brief obtain arrival speed parameter in string format
864
std::string getArrivalSpeed() const;
865
866
/// @brief obtain arrival edge parameter in string format
867
std::string getArrivalEdge() const;
868
869
/// @brief get insertion checks in string format
870
std::string getInsertionChecks() const;
871
872
/// @brief check if given insertion checks are valid
873
bool areInsertionChecksValid(const std::string& value) const;
874
875
};
876
877
typedef std::vector<SUMOVehicleParameter::Stop> StopParVector;
878
879