48 repetitionNumber(-1), repetitionsDone(-1), repetitionOffset(-1), repetitionProbability(-1), repetitionEnd(-1),
49 line(), fromTaz(), toTaz(), personNumber(0), containerNumber(0),
61 return oc.
exists(optionName) && oc.
isSet(optionName) && oc.
getBool(
"defaults-override");
86 }
else if (oc.
exists(
"departlane") && oc.
isSet(
"departlane")) {
92 }
else if (oc.
exists(
"departpos") && oc.
isSet(
"departpos")) {
102 }
else if (oc.
exists(
"departspeed") && oc.
isSet(
"departspeed")) {
108 }
else if (oc.
exists(
"departedge") && oc.
isSet(
"departedge")) {
114 }
else if (oc.
exists(
"arrivallane") && oc.
isSet(
"arrivallane")) {
120 }
else if (oc.
exists(
"arrivalpos") && oc.
isSet(
"arrivalpos")) {
130 }
else if (oc.
exists(
"arrivalspeed") && oc.
isSet(
"arrivalspeed")) {
246 if (val ==
"triggered") {
248 }
else if (val ==
"containerTriggered") {
250 }
else if (val ==
"split") {
252 }
else if (val ==
"now") {
260 error =
"Negative departure time in the definition of '" +
id +
"'.";
265 error =
"Invalid departure time for " + element +
". Must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
267 error =
"Invalid departure time for " + element +
" '" +
id +
"';\n must be one of (\"triggered\", \"containerTriggered\", \"now\", or a float >= 0)";
282 if (val ==
"random") {
284 }
else if (val ==
"free") {
286 }
else if (val ==
"allowed") {
288 }
else if (val ==
"best") {
290 }
else if (val ==
"first") {
304 error =
"Invalid departLane definition for " + element +
". Must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
306 error =
"Invalid departLane definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"free\", \"allowed\", \"best\", \"first\", or an int>=0)";
319 if (val ==
"random") {
321 }
else if (val ==
"random_free") {
323 }
else if (val ==
"free") {
325 }
else if (val ==
"base") {
327 }
else if (val ==
"last") {
329 }
else if (val ==
"stop") {
340 error =
"Invalid departPos definition for " + element +
". Must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
342 error =
"Invalid departPos definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"random_free\", \"free\", \"base\", \"last\" or a float)";
355 if (val ==
"random") {
357 }
else if (val ==
"random_free") {
359 }
else if (val ==
"free") {
361 }
else if (val ==
"right") {
363 }
else if (val ==
"center") {
365 }
else if (val ==
"left") {
376 error =
"Invalid departPosLat definition for " + element +
". Must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
378 error =
"Invalid departPosLat definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"random_free\", \"free\", \"right\", \"center\", \"left\", or a float)";
391 if (val ==
"random") {
393 }
else if (val ==
"max") {
395 }
else if (val ==
"desired") {
397 }
else if (val ==
"speedLimit") {
411 error =
"Invalid departSpeed definition for " + element +
". Must be one of (\"random\", \"max\", or a float>=0)";
413 error =
"Invalid departSpeed definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"max\", or a float>=0)";
426 if (val ==
"random") {
440 error =
"Invalid departEdge definition for " + element +
". Must be one of (\"random\", \"free\", or an int>=0)";
442 error =
"Invalid departEdge definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"free\", or an int>=0)";
455 if (val ==
"current") {
469 error =
"Invalid arrivalLane definition for " + element +
". Must be one of (\"current\", or an int>=0)";
471 error =
"Invalid arrivalLane definition for " + element +
" '" +
id +
"';\n must be one of (\"current\", or an int>=0)";
484 if (val ==
"random") {
486 }
else if (val ==
"center") {
488 }
else if (val ==
"max") {
499 error =
"Invalid arrivalPos definition for " + element +
". Must be one of (\"random\", \"max\", or a float)";
501 error =
"Invalid arrivalPos definition for " + element +
" '" +
id +
"';\n must be one of (\"random\", \"max\", or a float)";
514 if (val ==
"right") {
516 }
else if (val ==
"center") {
518 }
else if (val ==
"left") {
529 error =
"Invalid arrivalPosLat definition for " + element +
". Must be one of (\"right\", \"center\", \"left\", or a float)";
531 error =
"Invalid arrivalPosLat definition for " + element +
" '" +
id +
"';\n must be one of (\"right\", \"center\", \"left\", or a float)";
544 if (val ==
"current") {
558 error =
"Invalid arrivalSpeed definition for " + element +
". Must be one of (\"current\", or a float>=0)";
560 error =
"Invalid arrivalSpeed definition for " + element +
" '" +
id +
"';\n must be one of (\"current\", or a float>=0)";
570 pos = maximumValue + pos;
572 if (pos > maximumValue && pos != std::numeric_limits<double>::infinity()) {
586 const std::string mode = st.next();
589 }
else if (mode ==
"taxi") {
591 }
else if (mode ==
"bicycle") {
593 }
else if (mode ==
"public") {
597 error =
"Unknown person mode '" + mode +
"'. Must be a combination of (\"car\", \"bicycle\" or \"public\")";
599 error =
"Unknown person mode '" + mode +
"' for " + element +
" '" +
id +
"';\n must be a combination of (\"car\", \"bicycle\" or \"public\")";
610 if (triggers.size() == 0 && expectTrigger) {
613 for (std::string val : triggers) {
624 WRITE_ERROR(
"Value of stop attribute 'trigger' must be 'person', 'container', 'join' or a boolean");
634 std::vector<std::string> triggers;
638 if (containerTriggered) {
654 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 STOP_ARRIVAL_SET
const int STOP_DURATION_SET
const int VEHPARS_COLOR_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.
@ 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.
@ GIVEN
The arrival lane is given.
@ DEFAULT
No information given; use default.
@ CURRENT
The current lane shall be used.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_CONTAINER_NUMBER_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)
const int VEHPARS_DEPARTLANE_SET
const int VEHPARS_ARRIVALPOSLAT_SET
DepartEdgeDefinition
Possible ways to choose the departure edge.
@ RANDOM
The edge is chosen randomly.
@ GIVEN
The edge index is given.
@ DEFAULT
No information given; use default.
const int VEHPARS_FROM_TAZ_SET
const int VEHPARS_ARRIVALSPEED_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 VEHPARS_PERSON_NUMBER_SET
const int STOP_EXPECTED_CONTAINERS_SET
const int VEHPARS_DEPARTSPEED_SET
ArrivalPosLatDefinition
Possible ways to choose the departure 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
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)
std::string edge
The edge to stop at (used only in NETEDIT)
std::string lane
The lane to stop at.
void write(OutputDevice &dev, bool close=true) const
Writes the stop as XML.
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
std::string chargingStation
(Optional) charging station if one is assigned to the 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
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
SumoXMLTag tag
The vehicle tag.
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.
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.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
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.
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
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.
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
int departEdge
(optional) The initial edge within the route of the vehicle
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 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.
DepartEdgeDefinition departEdgeProcedure
Information how the vehicle's initial edge shall be chosen.
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.
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)
static bool parseDepartEdge(const std::string &val, const std::string &element, const std::string &id, int &edgeIndex, DepartEdgeDefinition &ded, std::string &error)
Validates a given departEdge value.
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
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