61 "' has to be given in the definition of flow '" +
id +
"'.");
66 "' has to be given in the definition of flow '" +
id +
"'.");
71 "' has to be given in the definition of flow '" +
id +
"'.");
80 "' are allowed in flow '" +
id +
"'.");
88 "' is needed in flow '" +
id +
"'.");
108 if (ok && vph <= 0) {
110 throw ProcessError(
"Invalid repetition rate in the definition of flow '" +
id +
"'.");
112 if (ok && vph != 0) {
113 ret->repetitionOffset =
TIME2STEPS(3600. / vph);
118 if (ok && (ret->repetitionProbability <= 0 || ret->repetitionProbability > 1)) {
120 throw ProcessError(
"Invalid repetition probability in the definition of flow '" +
id +
"'.");
124 ret->depart = beginDefault;
128 if (ok && ret->depart < 0) {
130 throw ProcessError(
"Negative begin time in the definition of flow '" +
id +
"'.");
132 ret->repetitionEnd = endDefault;
133 if (ret->repetitionEnd < 0) {
140 (endDefault >=
TIME2STEPS(9223372036854773) || endDefault < 0)) {
141 WRITE_WARNING(
"Undefined end for flow '" +
id +
"', defaulting to 24hour duration.");
142 ret->repetitionEnd = ret->depart +
TIME2STEPS(24 * 3600);
144 if (ok && ret->repetitionEnd < ret->depart) {
146 throw ProcessError(
"Flow '" +
id +
"' ends before its begin time.");
151 if (ret->repetitionNumber == 0) {
152 WRITE_WARNING(
"Flow '" +
id +
"' has 0 vehicles; will skip it.");
154 if (ok && ret->repetitionNumber < 0) {
156 throw ProcessError(
"Negative repetition number in the definition of flow '" +
id +
"'.");
158 if (ok && ret->repetitionOffset < 0) {
159 ret->repetitionOffset = (ret->repetitionEnd - ret->depart) / ret->repetitionNumber;
162 ret->repetitionEnd = ret->depart + ret->repetitionNumber * ret->repetitionOffset;
165 if (ok && ret->repetitionProbability > 0) {
166 ret->repetitionNumber = std::numeric_limits<int>::max();
168 if (ok && ret->repetitionOffset <= 0) {
170 throw ProcessError(
"Invalid repetition rate in the definition of flow '" +
id +
"'.");
173 ret->repetitionNumber = std::numeric_limits<int>::max();
175 const double repLength = (double)(ret->repetitionEnd - ret->depart);
176 ret->repetitionNumber = (int)ceil(repLength / ret->repetitionOffset);
190 const bool optionalID,
const bool skipDepart,
const bool isPerson) {
192 std::string id, errorMsg;
387 WRITE_ERROR(
"Invalid speed distribution when parsing vType '" + vtype->
id +
"' (" + error +
")");
407 vtype->
impatience = -std::numeric_limits<double>::max();
449 if (lcmS ==
"JE2013") {
450 WRITE_WARNING(
"Lane change model 'JE2013' is deprecated. Using default model instead.");
456 WRITE_ERROR(
"Unknown lane change model '" + lcmS +
"' when parsing vType '" + vtype->
id +
"'");
466 WRITE_ERROR(
"Unknown car following model '" + cfmS +
"' when parsing vType '" + vtype->
id +
"'");
500 WRITE_ERROR(
"Unknown lateral alignment '" + alignS +
"' when parsing vType '" + vtype->
id +
"'");
518 const bool fromVType) {
520 CFAttrMap::const_iterator cf_it = allowedAttrs.find(element);
521 if (cf_it == allowedAttrs.end()) {
523 WRITE_ERROR(
"Unknown car following model " +
toString(element) +
" when parsing vType '" + into.
id +
"'");
525 WRITE_ERROR(
"Unknown car following model when parsing vType '" + into.
id +
"'");
535 for (std::set<SumoXMLAttr>::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); ++it) {
540 +
" in car following model '" +
toString(into.
cfModel) +
"' lower than simulation step size may cause collisions");
554 std::set<SumoXMLAttr> kraussParams;
565 std::set<SumoXMLAttr> allParams(kraussParams);
567 std::set<SumoXMLAttr> kraussXParams(kraussParams);
574 allParams.insert(kraussXParams.begin(), kraussXParams.end());
576 std::set<SumoXMLAttr> smartSKParams;
589 allParams.insert(smartSKParams.begin(), smartSKParams.end());
591 std::set<SumoXMLAttr> daniel1Params;
604 allParams.insert(daniel1Params.begin(), daniel1Params.end());
606 std::set<SumoXMLAttr> pwagParams;
616 allParams.insert(pwagParams.begin(), pwagParams.end());
618 std::set<SumoXMLAttr> idmParams;
627 allParams.insert(idmParams.begin(), idmParams.end());
629 std::set<SumoXMLAttr> idmmParams;
639 allParams.insert(idmmParams.begin(), idmmParams.end());
641 std::set<SumoXMLAttr> bkernerParams;
650 allParams.insert(bkernerParams.begin(), bkernerParams.end());
652 std::set<SumoXMLAttr> wiedemannParams;
660 allParams.insert(wiedemannParams.begin(), wiedemannParams.end());
662 std::set<SumoXMLAttr> railParams;
665 allParams.insert(railParams.begin(), railParams.end());
667 std::set<SumoXMLAttr> ACCParams;
681 allParams.insert(ACCParams.begin(), ACCParams.end());
683 std::set<SumoXMLAttr> CACCParams;
703 allParams.insert(CACCParams.begin(), CACCParams.end());
715 std::set<SumoXMLAttr> lc2013Params;
729 std::set<SumoXMLAttr> sl2015Params = lc2013Params;
739 std::set<SumoXMLAttr> noParams;
748 for (std::set<SumoXMLAttr>::const_iterator it = allowed.begin(); it != allowed.end(); it++) {
786 const std::string&
id) {
796 if (realName != vclassS) {
797 WRITE_WARNING(
"The vehicle class '" + vclassS +
"' for " + attrs.
getObjectType() +
" '" +
id +
"' is deprecated, use '" + realName +
"' instead.");
814 if (realName != vclassS) {
815 WRITE_WARNING(
"The shape '" + vclassS +
"' for " + attrs.
getObjectType() +
" '" +
id +
"' is deprecated, use '" + realName +
"' instead.");
837 result = maxPos / 2.;
850 std::stringstream ss;
851 ss <<
"The parameter action-step-length must be a non-negative multiple of the simulation step-length. Ignoring given value (=" 856 }
else if (result %
DELTA_T != 0) {
857 std::stringstream ss;
861 ss <<
"The parameter action-step-length must be a non-negative multiple of the simulation step-length. Parsing given value (" 862 << given <<
" s.) to the adjusted value "
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
const int VTYPEPARS_MAXSPEED_SET
const int VEHPARS_TO_TAZ_SET
const int VTYPEPARS_MINGAP_SET
static StringBijection< SumoXMLTag > CarFollowModels
car following models
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLTag cfModel
The enum-representation of the car-following model to use.
RGBColor color
The vehicle's color, TraCI may change this.
const int VTYPEPARS_LATALIGNMENT_SET
const int VEHPARS_FORCE_REROUTE
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
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.
double impatience
The vehicle's impatience (willingness to obstruct others)
const int VTYPEPARS_HASDRIVERSTATE_SET
std::string vtypeid
The vehicle's type id.
static std::set< SumoXMLAttr > allowedJMAttrs
static SUMOVehicleShape parseGuiShape(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
StringBijection< SUMOVehicleShape > SumoVehicleShapeStrings(sumoVehicleShapeStringInitializer, SVS_UNKNOWN, false)
virtual std::string getName(int attr) const =0
Converts the given attribute id into a man readable string.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOVehicleShape shape
This class' shape.
Structure representing possible vehicle parameter.
const int VTYPEPARS_MINGAP_LAT_SET
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
double defaultProbability
The probability when being added to a distribution without an explicit probability.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, const bool optionalID=false, const bool skipDepart=false, const bool isPerson=false)
Parses a vehicle's attributes.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
static void parseVTypeEmbedded(SUMOVTypeParameter &into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool fromVType=false)
Parses an element embedded in vtype definition.
int containerCapacity
The container capacity of the vehicle.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
const int VTYPEPARS_BOARDING_DURATION
ArrivalPosLatDefinition arrivalPosLatProcedure
Information how the vehicle shall choose the lateral arrival position.
weights: time range begin
double arrivalPosLat
(optional) The lateral position the vehicle shall arrive on
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
static LCAttrMap allowedLCModelAttrs
const int VEHPARS_ARRIVALLANE_SET
const std::string & getObjectType() const
return the objecttype to which these attributes belong
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
const int VTYPEPARS_CAR_FOLLOW_MODEL
const int VTYPEPARS_OSGFILE_SET
const int VTYPEPARS_MAXSPEED_LAT_SET
const int VTYPEPARS_PROBABILITY_SET
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
static double parseWalkPos(SumoXMLAttr attr, const std::string &id, double maxPos, const std::string &val, std::mt19937 *rng=0)
parse departPos or arrivalPos for a walk
#define WRITE_WARNING(msg)
void parse(const std::string &description)
Overwrite by parsable distribution description.
static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
static void parseLCParams(SUMOVTypeParameter &into, LaneChangeModel model, const SUMOSAXAttributes &attrs)
Parses lane change model attributes.
double height
This class' height.
std::string toTaz
The vehicle's destination zone (district)
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
const int VEHPARS_ARRIVALSPEED_SET
static double interpretEdgePos(double pos, double maximumValue, SumoXMLAttr attr, const std::string &id)
Interprets negative edge positions and fits them onto a given edge.
double departSpeed
(optional) The initial speed of the vehicle
static const CFAttrMap & getAllowedCFModelAttrs()
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
double maxSpeed
The vehicle type's maximum speed [m/s].
double width
This class' width.
SUMOTime boardingDuration
The time a person needs to board the vehicle.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const int VTYPEPARS_ACTIONSTEPLENGTH_SET
std::string routeid
The vehicle's route id.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
static SUMOVehicleParameter * parseFlowAttributes(const SUMOSAXAttributes &attrs, const SUMOTime beginDefault, const SUMOTime endDefault)
Parses a flow's attributes.
const int VEHPARS_DEPARTSPEED_SET
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
std::string osgFile
3D model file for this class
static void parseCommonAttributes(const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, std::string element)
Parses attributes common to vehicles and flows.
static const RGBColor DEFAULT_COLOR
The default color (for vehicle types and vehicles)
std::map< SumoXMLTag, std::set< SumoXMLAttr > > CFAttrMap
T get(const std::string &str) const
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
std::string imgFile
Image file for this class.
const int VEHPARS_DEPARTPOSLAT_SET
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
SUMOTime string2time(const std::string &r)
const int VEHPARS_ROUTE_SET
std::string fromTaz
The vehicle's origin zone (district)
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.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const int VTYPEPARS_LOADING_DURATION
const int VTYPEPARS_CONTAINER_CAPACITY
const int VEHPARS_COLOR_SET
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
vehicle is a passenger car (a "normal" car)
const int VEHPARS_FROM_TAZ_SET
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
std::string line
The vehicle's line (mainly for public transport)
const int VTYPEPARS_SPEEDFACTOR_SET
double arrivalPos
(optional) The position the vehicle shall arrive on
double maxSpeedLat
The vehicle type's maximum lateral speed [m/s].
int parametersSet
Information for the router which parameter were set.
const int VEHPARS_ARRIVALPOSLAT_SET
double departPosLat
(optional) The lateral position the vehicle shall depart from
const int VEHPARS_LINE_SET
const int VEHPARS_ARRIVALPOS_SET
int personCapacity
The person capacity of the vehicle.
bool hasDriverState
Whether vehicles of this type are equipped with a driver (i.e. MSDriverState))
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
double departPos
(optional) The position the vehicle shall depart from
double minGapLat
The vehicle type's minimum lateral gap [m].
static const RGBColor YELLOW
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
const int VEHPARS_PERIODFREQ_SET
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
const std::string DEFAULT_PEDTYPE_ID
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.
static void parseJMParams(SUMOVTypeParameter &into, const SUMOSAXAttributes &attrs)
Parses junction model attributes.
SubParams jmParameter
Junction-model parameter.
const int VTYPEPARS_IMGFILE_SET
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.
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.
SubParams cfParameter
Car-following parameter.
SUMOTime loadingDuration
The time a container needs to get loaded on the vehicle.
const int VEHPARS_DEPARTLANE_SET
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 containerNumber
The static number of containers in the vehicle when it departs.
std::string id
The vehicle type's id.
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.
const int VTYPEPARS_PERSON_CAPACITY
static CFAttrMap allowedCFModelAttrs
LateralAlignment latAlignment
The vehicles desired lateral alignment.
SUMOTime actionStepLength
The vehicle type's default actionStepLength [ms], i.e. the interval between two control actions...
const int VEHPARS_VTYPE_SET
double minGap
This class' free space in front of the vehicle itself.
const int VTYPEPARS_HEIGHT_SET
ArrivalPosDefinition
Possible ways to choose the arrival position.
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
const int VTYPEPARS_WIDTH_SET
static StringBijection< int > Tags
The names of SUMO-XML elements for use in netbuild.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_PERSON_NUMBER_SET
LaneChangeModel lcModel
The lane-change model to use.
const int VTYPEPARS_LENGTH_SET
const int VTYPEPARS_VEHICLECLASS_SET
static SUMOVTypeParameter * beginVTypeParsing(const SUMOSAXAttributes &attrs, const std::string &file)
Starts to parse a vehicle type.
const int VEHPARS_CONTAINER_NUMBER_SET
const int VTYPEPARS_EMISSIONCLASS_SET
The maximum arrival position is used.
const int VTYPEPARS_COLOR_SET
Distribution_Parameterized speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
const int VTYPEPARS_SHAPE_SET
double length
The physical vehicle length.
SubParams lcParameter
Lane-changing parameter.
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
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.
SUMOEmissionClass emissionClass
The emission class of this vehicle.
vehicles ignoring classes
std::map< LaneChangeModel, std::set< SumoXMLAttr > > LCAttrMap
bool isValid(std::string &error)
check whether the distribution is valid
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
const int VTYPEPARS_IMPATIENCE_SET
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.
The arrival position is chosen randomly.
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.