44 #ifdef CHECK_MEMORY_LEAKS
46 #endif // CHECK_MEMORY_LEAKS
65 "' has to be given in the definition of flow '" +
id +
"'.");
70 "' has to be given in the definition of flow '" +
id +
"'.");
75 "' has to be given in the definition of flow '" +
id +
"'.");
84 "' are allowed in flow '" +
id +
"'.");
92 "' is needed in flow '" +
id +
"'.");
107 #ifdef HAVE_SUBSECOND_TIMESTEPS
116 if (ok && vph <= 0) {
118 throw ProcessError(
"Invalid repetition rate in the definition of flow '" +
id +
"'.");
120 if (ok && vph != 0) {
128 throw ProcessError(
"Invalid repetition probability in the definition of flow '" +
id +
"'.");
132 ret->
depart = beginDefault;
136 if (ok && ret->
depart < 0) {
138 throw ProcessError(
"Negative begin time in the definition of flow '" +
id +
"'.");
147 if (ok && end <= ret->depart) {
149 throw ProcessError(
"Flow '" +
id +
"' ends before or at its begin time.");
155 WRITE_WARNING(
"Flow '" +
id +
"' has 0 vehicles; will skip it.");
159 throw ProcessError(
"Negative repetition number in the definition of flow '" +
id +
"'.");
172 throw ProcessError(
"Invalid repetition rate in the definition of flow '" +
id +
"'.");
191 bool optionalID,
bool skipDepart) {
193 std::string id, errorMsg;
402 WRITE_ERROR(
"Unknown lane change model '" + lcmS +
"' when parsing vtype '" + vtype->
id +
"'");
424 CFAttrMap::const_iterator cf_it;
425 for (cf_it = allowedAttrs.begin(); cf_it != allowedAttrs.end(); cf_it++) {
426 if (cf_it->first == element) {
430 if (cf_it == allowedAttrs.end()) {
434 WRITE_ERROR(
"Unknown cfmodel when parsing vtype '" + into.
id +
"'");
443 for (std::set<SumoXMLAttr>::const_iterator it = cf_it->second.begin(); it != cf_it->second.end(); it++) {
448 +
" in car following model '" +
toString(into.
cfModel) +
"' lower than simulation step size may cause collisions");
462 std::set<SumoXMLAttr> krausParams;
471 std::set<SumoXMLAttr> smartSKParams;
483 std::set<SumoXMLAttr> daniel1Params;
495 std::set<SumoXMLAttr> pwagParams;
504 std::set<SumoXMLAttr> idmParams;
512 std::set<SumoXMLAttr> idmmParams;
521 std::set<SumoXMLAttr> bkernerParams;
529 std::set<SumoXMLAttr> wiedemannParams;
542 const std::string&
id) {
552 if (realName != vclassS) {
553 WRITE_WARNING(
"The vehicle class '" + vclassS +
"' for " + attrs.
getObjectType() +
" '" +
id +
"' is deprecated, use '" + realName +
"' instead.");
583 if (realName != vclassS) {
584 WRITE_WARNING(
"The shape '" + vclassS +
"' for " + attrs.
getObjectType() +
" '" +
id +
"' is deprecated, use '" + realName +
"' instead.");
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 VTYPEPARS_MINGAP_SET
SUMOReal repetitionProbability
The probability for emitting a vehicle per second.
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.
static SUMOVehicleParameter * parseVehicleAttributes(const SUMOSAXAttributes &attrs, bool optionalID=false, bool skipDepart=false)
Parses a vehicle's attributes.
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 parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
int repetitionNumber
The number of times the vehicle shall be repeatedly inserted.
std::string vtypeid
The vehicle's type id.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
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)
static void parseVTypeEmbedded(SUMOVTypeParameter &into, int element, const SUMOSAXAttributes &attrs, bool fromVType=false)
Parses an element embedded in vtype definition.
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.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
SUMOReal speedDev
The standard deviation for speed variations.
unsigned int personCapacity
The vehicle's capacity (persons)
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
SUMOReal length
The physical vehicle length.
SUMOReal arrivalPos
(optional) The position the vehicle shall arrive on
const int VEHPARS_ARRIVALLANE_SET
unsigned int personNumber
The number of persons in the vehicle.
SUMOReal width
This class' width.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
const int VTYPEPARS_OSGFILE_SET
SUMOReal repetitionOffset
The time offset between vehicle reinsertions.
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...
#define WRITE_WARNING(msg)
static SUMOVehicleClass parseVehicleClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle class.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
std::string toTaz
The vehicle's destination zone (district)
const int VTYPEPARS_LANE_CHANGE_MODEL_SET
const int VEHPARS_ARRIVALSPEED_SET
static const CFAttrMap & getAllowedCFModelAttrs()
SUMOReal speedFactor
The factor by which the maximum speed may deviate from the allowed max speed on the street...
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
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
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
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
std::string imgFile
Image file for this class.
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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_SPEEDDEVIATION_SET
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
const int VEHPARS_COLOR_SET
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
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
const int VEHPARS_LINE_SET
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
SUMOReal maxSpeed
The vehicle type's maximum speed [m/s].
const int VEHPARS_ARRIVALPOS_SET
int setParameter
Information for the router which parameter were set.
static const RGBColor YELLOW
Structure representing possible vehicle parameter.
SUMOReal impatience
The vehicle's impatience (willingness to obstruct others)
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.
int setParameter
Information for the router which parameter were set.
SUMOReal defaultProbability
The probability when being added to a distribution without an explicit probability.
const int VTYPEPARS_IMGFILE_SET
const int VEHPARS_DEPARTLANE_SET
std::string id
The vehicle type's id.
SUMOReal departPos
(optional) The position the vehicle shall depart from
static CFAttrMap allowedCFModelAttrs
const int VEHPARS_TAZ_SET
T get(const std::string &str) const
const int VEHPARS_VTYPE_SET
const int VTYPEPARS_HEIGHT_SET
static SUMOEmissionClass parseEmissionClass(const SUMOSAXAttributes &attrs, const std::string &id)
Parses the vehicle emission class.
const int VTYPEPARS_WIDTH_SET
static StringBijection< int > Tags
The names of SUMO-XML elements for use in netbuild.
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.
const int VEHPARS_DEPARTPOS_SET
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
const int VEHPARS_PERSON_NUMBER_SET
LaneChangeModel lcModel
The lane-change model to use.
SUMOReal height
This class' height.
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 VTYPEPARS_EMISSIONCLASS_SET
const int VTYPEPARS_COLOR_SET
const int VTYPEPARS_SHAPE_SET
const int VEHPARS_PERSON_CAPACITY_SET
static StringBijection< LaneChangeModel > LaneChangeModels
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
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
std::string id
The vehicle's id.
const int VTYPEPARS_IMPATIENCE_SET
SUMOReal minGap
This class' free space in front of the vehicle itself.
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.