49 repetitionNumber(-1), repetitionsDone(-1), repetitionOffset(-1), repetitionProbability(-1), repetitionEnd(-1),
50 line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0),
63 return oc.
exists(optionName) && oc.
isSet(optionName) && oc.
getBool(
"defaults-override");
91 }
else if (oc.
exists(
"departlane") && oc.
isSet(
"departlane")) {
97 }
else if (oc.
exists(
"departpos") && oc.
isSet(
"departpos")) {
107 }
else if (oc.
exists(
"departspeed") && oc.
isSet(
"departspeed")) {
113 }
else if (oc.
exists(
"departedge") && oc.
isSet(
"departedge")) {
119 }
else if (oc.
exists(
"arrivallane") && oc.
isSet(
"arrivallane")) {
125 }
else if (oc.
exists(
"arrivalpos") && oc.
isSet(
"arrivalpos")) {
135 }
else if (oc.
exists(
"arrivalspeed") && oc.
isSet(
"arrivalspeed")) {
141 }
else if (oc.
exists(
"arrivaledge") && oc.
isSet(
"arrivaledge")) {
181 if (writeTagAndParents) {
275 if (val ==
"triggered") {
277 }
else if (val ==
"containerTriggered") {
279 }
else if (val ==
"split") {
281 }
else if (val ==
"now") {
289 error =
"Negative " + attr +
" time in the definition of " + element +
" '" +
id +
"'.";
294 error =
"Invalid " + attr +
" time for " + element +
". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
296 error =
"Invalid " + attr +
" time for " + element +
" '" +
id +
"';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
311 if (val ==
"random") {
313 }
else if (val ==
"free") {
315 }
else if (val ==
"allowed") {
317 }
else if (val ==
"best") {
319 }
else if (val ==
"first") {
333 error =
"Invalid departLane definition for " + element +
". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
335 error =
"Invalid departLane definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
348 if (val ==
"random") {
350 }
else if (val ==
"random_free") {
352 }
else if (val ==
"free") {
354 }
else if (val ==
"base") {
356 }
else if (val ==
"last") {
358 }
else if (val ==
"stop") {
369 error =
"Invalid departPos definition for " + element +
". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
371 error =
"Invalid departPos definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
384 if (val ==
"random") {
386 }
else if (val ==
"random_free") {
388 }
else if (val ==
"free") {
390 }
else if (val ==
"right") {
392 }
else if (val ==
"center") {
394 }
else if (val ==
"left") {
405 error =
"Invalid departPosLat definition for " + element +
". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
407 error =
"Invalid departPosLat definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
420 if (val ==
"random") {
422 }
else if (val ==
"max") {
424 }
else if (val ==
"desired") {
426 }
else if (val ==
"speedLimit") {
428 }
else if (val ==
"last") {
430 }
else if (val ==
"avg") {
444 error =
"Invalid departSpeed definition for " + element +
". Must be one of (\"random\", \"max\", or a float>=0)";
446 error =
"Invalid departSpeed definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"max\", or a float>=0)";
459 if (val ==
"random") {
473 error =
"Invalid " +
toString(attr) +
" definition for " + element +
". Must be one of (\"random\", \"free\", or an int>=0)";
475 error =
"Invalid " +
toString(attr) +
" definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"free\", or an int>=0)";
488 if (val ==
"current") {
490 }
else if (val ==
"random") {
492 }
else if (val ==
"first") {
506 error =
"Invalid arrivalLane definition for " + element +
". Must be one of (\"current\", or an int>=0)";
508 error =
"Invalid arrivalLane definition for " + element +
" '" +
id +
"';\n must be one of (\"current\", or an int>=0)";
521 if (val ==
"random") {
523 }
else if (val ==
"center") {
525 }
else if (val ==
"max") {
536 error =
"Invalid arrivalPos definition for " + element +
". Must be one of (\"random\", \"max\", or a float)";
538 error =
"Invalid arrivalPos definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"max\", or a float)";
551 if (val ==
"right") {
553 }
else if (val ==
"center") {
555 }
else if (val ==
"left") {
566 error =
"Invalid arrivalPosLat definition for " + element +
". Must be one of (\"right\", \"center\", \"left\", or a float)";
568 error =
"Invalid arrivalPosLat definition for " + element +
" '" +
id +
"';\n must be one of (\"right\", \"center\", \"left\", or a float)";
581 if (val ==
"current") {
595 error =
"Invalid arrivalSpeed definition for " + element +
". Must be one of (\"current\", or a float>=0)";
597 error =
"Invalid arrivalSpeed definition for " + element +
" '" +
id +
"';\n must be one of (\"current\", or a float>=0)";
607 pos = maximumValue + pos;
609 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
623 const std::string mode = st.next();
626 }
else if (mode ==
"taxi") {
628 }
else if (mode ==
"bicycle") {
630 }
else if (mode ==
"public") {
634 error =
"Unknown person mode '" + mode +
"'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
636 error =
"Unknown person mode '" + mode +
"' for " + element +
" '" +
id +
"';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
647 if (triggers.size() == 0 && expectTrigger) {
650 for (std::string val : triggers) {
661 WRITE_ERROR(
"Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean");
671 std::vector<std::string> triggers;
675 if (containerTriggered) {
691 return "containerTriggered";
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
const std::string DEFAULT_VTYPE_ID
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const int VEHPARS_DEPARTEDGE_SET
const int VEHPARS_ARRIVALEDGE_SET
RouteIndexDefinition
Possible ways to choose the departure and arrival edge.
@ RANDOM
The edge is chosen randomly.
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int VEHPARS_COLOR_SET
const int STOP_POSLAT_SET
const int STOP_EXPECTED_SET
DepartLaneDefinition
Possible ways to choose a lane on depart.
@ RANDOM
The lane is chosen randomly.
@ BEST_FREE
The least occupied lane from best lanes.
@ GIVEN
The lane is given.
@ ALLOWED_FREE
The least occupied lane from lanes which allow the continuation.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ FREE
The least occupied lane is used.
const int VEHPARS_TO_TAZ_SET
ArrivalSpeedDefinition
Possible ways to choose the arrival speed.
@ GIVEN
The speed is given.
@ DEFAULT
No information given; use default.
@ CURRENT
The current speed is used.
DepartPosLatDefinition
Possible ways to choose the lateral departure position.
@ RANDOM
The lateral position is chosen randomly.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ FREE
A free lateral position is chosen.
@ CENTER
At the center of the lane.
@ RANDOM_FREE
If a fixed number of random choices fails, a free lateral position is chosen.
DepartPosDefinition
Possible ways to choose the departure position.
@ RANDOM
The position is chosen randomly.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ STOP
depart position is endPos of first stop
@ FREE
A free position is chosen.
@ BASE
Back-at-zero position.
@ LAST
Insert behind the last vehicle as close as possible to still allow the specified departSpeed....
@ RANDOM_FREE
If a fixed number of random choices fails, a free position is chosen.
const int VEHPARS_SPEEDFACTOR_SET
const int STOP_PARKING_SET
const int STOP_TRIP_ID_SET
ArrivalLaneDefinition
Possible ways to choose the arrival lane.
@ RANDOM
The lane is chosen randomly.
@ GIVEN
The arrival lane is given.
@ DEFAULT
No information given; use default.
@ FIRST_ALLOWED
The rightmost lane the vehicle may use.
@ CURRENT
The current lane shall be used.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_SET
const int STOP_PERMITTED_SET
const int VEHPARS_ARRIVALLANE_SET
DepartSpeedDefinition
Possible ways to choose the departure speed.
@ RANDOM
The speed is chosen randomly.
@ MAX
The maximum safe speed is used.
@ GIVEN
The speed is given.
@ LIMIT
The maximum lane speed is used (speedLimit)
@ DEFAULT
No information given; use default.
@ DESIRED
The maximum lane speed is used (speedLimit * speedFactor)
@ LAST
The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
@ AVG
The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
const int VEHPARS_DEPARTLANE_SET
const int VEHPARS_ARRIVALPOSLAT_SET
const int VEHPARS_FROM_TAZ_SET
const int VEHPARS_ARRIVALSPEED_SET
const int VEHPARS_CALIBRATORSPEED_SET
const int STOP_EXTENSION_SET
const int STOP_TRIGGER_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
@ RANDOM
The arrival position is chosen randomly.
@ MAX
The maximum arrival position is used.
@ GIVEN
The arrival position is given.
@ DEFAULT
No information given; use default.
@ CENTER
Half the road length.
const int VEHPARS_LINE_SET
const int STOP_STARTED_SET
const int VEHPARS_PERSON_NUMBER_SET
const int STOP_EXPECTED_CONTAINERS_SET
const int VEHPARS_DEPARTSPEED_SET
ArrivalPosLatDefinition
Possible ways to choose the lateral arrival position.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ CENTER
At the center of the lane.
const int VEHPARS_VTYPE_SET
const int VEHPARS_ARRIVALPOS_SET
DepartDefinition
Possible ways to depart.
@ DEPART_SPLIT
The departure is triggered by a train split.
@ DEPART_GIVEN
The time is given.
@ DEPART_CONTAINER_TRIGGERED
The departure is container triggered.
@ DEPART_TRIGGERED
The departure is person triggered.
@ DEPART_NOW
The vehicle is discarded if emission fails (not fully implemented yet)
const int VEHPARS_DEPARTPOSLAT_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_STOP
stop for vehicles
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_CONTAINER_STOP
@ SUMO_ATTR_DEPARTPOS_LAT
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_CONTAINER_NUMBER
@ SUMO_ATTR_CHARGING_STATION
@ SUMO_ATTR_EXPECTED_CONTAINERS
@ SUMO_ATTR_PERSON_NUMBER
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ARRIVALPOS_LAT
const double INVALID_DOUBLE
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeNonEmptyAttr(const SumoXMLAttr attr, const std::string &val)
writes a string attribute only if it is not the empty string and not the string "default"
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
Definition of vehicle stop (position and duration)
SUMOTime started
the time at which this stop was reached
std::string edge
The edge to stop at (used only in NETEDIT)
std::string lane
The lane to stop at.
SUMOTime extension
The maximum time extension for boarding / loading.
bool friendlyPos
enable or disable friendly position (used by NETEDIT)
double speed
the speed at which this stop counts as reached (waypoint mode)
std::string parkingarea
(Optional) parking area if one is assigned to the stop
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
double startPos
The stopping position start.
std::string line
the new line id of the trip within a cyclical public transport route
double posLat
the lateral offset when stopping
std::string chargingStation
(Optional) charging station if one is assigned to the stop
std::set< std::string > permitted
IDs of persons or containers that may board/load at this stop.
int parametersSet
Information for the output which parameter were set.
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
void writeTriggers(OutputDevice &dev) const
write trigger attribute
SUMOTime until
The time at which the vehicle may continue its journey.
std::string actType
act Type (only used by Persons) (used by NETEDIT)
bool triggered
whether an arriving person lets the vehicle continue
void write(OutputDevice &dev, const bool close=true, const bool writeTagAndParents=true) const
Writes the stop as XML.
SUMOTime ended
the time at which this stop was ended
double endPos
The stopping position end.
bool parking
whether the vehicle is removed from the net while stopping
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool joinTriggered
whether an joined vehicle lets this vehicle continue
std::string tripId
id of the trip within a cyclical public transport route
std::string containerstop
(Optional) container stop if one is assigned to the stop
bool containerTriggered
whether an arriving container lets the vehicle continue
SUMOTime arrival
The (expected) time at which the vehicle reaches the stop.
SUMOTime duration
The stopping duration.
virtual ~SUMOVehicleParameter()
Destructor.
std::string getArrivalSpeed() const
obtain arrival speed parameter in string format
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
std::string vtypeid
The vehicle's type id.
std::string getDepartLane() const
obtain depart lane parameter in string format
double speedFactor
individual speedFactor (overriding distribution from vType)
SUMOVehicleParameter()
Constructor.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
static bool parseArrivalPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosLatDefinition &apd, std::string &error)
Validates a given arrivalPosLat value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
std::string getArrivalLane() const
obtain arrival lane parameter in string format
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
RouteIndexDefinition arrivalEdgeProcedure
Information how the vehicle's final edge shall be chosen.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
std::string getDepartSpeed() const
obtain depart speed parameter in string format
std::string getArrivalPos() const
obtain arrival pos parameter in string format
std::string getDepart() const
obtain depart parameter in string format
double departPos
(optional) The position the vehicle shall depart from
std::string getDepartEdge() const
obtain depart edge parameter in string format
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
RGBColor color
The vehicle's color, TraCI may change this.
double arrivalPos
(optional) The position the vehicle shall arrive on
double calibratorSpeed
speed (used by calibrator flows
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string getArrivalEdge() const
obtain arrival edge parameter in string format
int departEdge
(optional) The initial edge within the route of the vehicle
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
Validates a given depart value.
static bool parsePersonModes(const std::string &modes, const std::string &element, const std::string &id, SVCPermissions &modeSet, std::string &error)
Validates a given person modes value.
bool wasSet(int what) const
Returns whether the given parameter was set.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
static bool parseRouteIndex(const std::string &val, const std::string &element, const std::string &id, const SumoXMLAttr attr, int &edgeIndex, RouteIndexDefinition &rid, std::string &error)
Validates a given departEdge or arrivalEdge value.
static bool parseDepartPosLat(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosLatDefinition &dpd, std::string &error)
Validates a given departPosLat value.
std::string getDepartPosLat() const
obtain depart pos lat parameter in string format
std::string getArrivalPosLat() const
obtain arrival pos lat parameter in string format
std::string getDepartPos() const
obtain depart pos parameter in string format
std::string toTaz
The vehicle's destination zone (district)
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id, bool silent=false)
Interprets negative edge positions and fits them onto a given edge.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
bool defaultOptionOverrides(const OptionsCont &oc, const std::string &optionName) const
Returns whether the defaults shall be used.
int arrivalEdge
(optional) The final edge within the route of the vehicle
std::string fromTaz
The vehicle's origin zone (district)
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::string line
The vehicle's line (mainly for public transport)
int containerNumber
The static number of containers in the vehicle when it departs.
static void parseStopTriggers(const std::vector< std::string > &triggers, bool expectTrigger, Stop &stop)
parses stop trigger values
RouteIndexDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
bool hasNext()
returns the information whether further substrings exist
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter