Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
SUMOVehicleParserHelper Class Reference

Helper methods for parsing vehicle attributes. More...

#include <SUMOVehicleParserHelper.h>

Static Public Member Functions

static SUMOVTypeParameterbeginVTypeParsing (const SUMOSAXAttributes &attrs, const bool hardFail, const std::string &file)
 Starts to parse a vehicle type.
 
static bool isInternalRouteID (const std::string &id)
 Checks whether the route ID uses the syntax of internal routes.
 
static bool parseAngleTimesMap (SUMOVTypeParameter *vtype, const std::string)
 Parse string containing AngleTimes triplets (angle, entry time, exit time)
 
static int parseCarWalkTransfer (const OptionsCont &oc, const bool hasTaxi=false)
 
static bool parseCFMParams (SUMOVTypeParameter *into, const SumoXMLTag element, const SUMOSAXAttributes &attrs, const bool nestedCFM)
 Parses Car Following Mode params.
 
static SUMOVehicleParameterparseFlowAttributes (SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const bool needID, const SUMOTime beginDefault, const SUMOTime endDefault, const bool allowInternalRoutes=false)
 Parses a flow's attributes.
 
static SUMOVehicleShape parseGuiShape (const SUMOSAXAttributes &attrs, const std::string &id)
 Parses the vehicle class.
 
static bool parseJMParams (SUMOVTypeParameter *into, const SUMOSAXAttributes &attrs)
 Parses junction model attributes.
 
static bool parseLCParams (SUMOVTypeParameter *into, LaneChangeModel model, const SUMOSAXAttributes &attrs)
 Parses lane change model attributes.
 
static SUMOVehicleParameterparseVehicleAttributes (int element, const SUMOSAXAttributes &attrs, const bool hardFail, const bool optionalID=false, const bool skipDepart=false, const bool allowInternalRoutes=false)
 Parses a vehicle's attributes.
 
static SUMOVehicleClass parseVehicleClass (const SUMOSAXAttributes &attrs, const std::string &id)
 Parses the vehicle class.
 
static double parseWalkPos (SumoXMLAttr attr, const bool hardFail, const std::string &id, double maxPos, const std::string &val, SumoRNG *rng=0)
 parse departPos or arrivalPos for a walk
 
static SUMOTime processActionStepLength (double given)
 Checks and converts given value for the action step length from seconds to miliseconds assuring it being a positive multiple of the simulation step width.
 

Private Types

typedef std::map< SumoXMLTag, std::set< SumoXMLAttr > > CFAttrMap
 Car-Following attributes map.
 
typedef std::map< LaneChangeModel, std::set< SumoXMLAttr > > LCAttrMap
 Lane-Change-Model attributes map.
 

Static Private Member Functions

static const CFAttrMapgetAllowedCFModelAttrs ()
 returns allowed attrs for each known CF-model (init on first use)
 
static SUMOVehicleParameterhandleVehicleError (const bool hardFail, SUMOVehicleParameter *vehicleParameter, const std::string message="")
 handle error loading SUMOVehicleParameter
 
static SUMOVTypeParameterhandleVehicleTypeError (const bool hardFail, SUMOVTypeParameter *vehicleTypeParameter, const std::string message="")
 handle error loading SUMOVTypeParameter
 
static void parseCommonAttributes (const SUMOSAXAttributes &attrs, SUMOVehicleParameter *ret, SumoXMLTag tag, const bool allowInternalRoutes=false)
 Parses attributes common to vehicles and flows.
 
static std::string parseID (const SUMOSAXAttributes &attrs, const SumoXMLTag element)
 parse ID
 

Static Private Attributes

static CFAttrMap allowedCFModelAttrs
 allowed attrs for each known CF-model
 
static LCAttrMap allowedLCModelAttrs
 allowed attrs for each known LC-model
 

Detailed Description

Helper methods for parsing vehicle attributes.

This class supports helper methods for parsing a vehicle's attributes.

Definition at line 49 of file SUMOVehicleParserHelper.h.

Member Typedef Documentation

◆ CFAttrMap

typedef std::map<SumoXMLTag, std::set<SumoXMLAttr> > SUMOVehicleParserHelper::CFAttrMap
private

Car-Following attributes map.

Definition at line 202 of file SUMOVehicleParserHelper.h.

◆ LCAttrMap

typedef std::map<LaneChangeModel, std::set<SumoXMLAttr> > SUMOVehicleParserHelper::LCAttrMap
private

Lane-Change-Model attributes map.

Definition at line 205 of file SUMOVehicleParserHelper.h.

Member Function Documentation

◆ beginVTypeParsing()

SUMOVTypeParameter * SUMOVehicleParserHelper::beginVTypeParsing ( const SUMOSAXAttributes attrs,
const bool  hardFail,
const std::string &  file 
)
static

Starts to parse a vehicle type.

Parameters
[in]attrThe SAX-attributes to get vehicle parameter from
[in]hardFailenable or disable hard fails if a parameter is invalid
[in]fileThe name of the file being parsed (for resolving paths)
[in]hardFailenable or disable hard fails if a parameter is invalid
Exceptions
ProcessErrorIf an attribute's value is invalid and hardFail is enabled
See also
SUMOVTypeParameter
Note
: the caller is responsible for deleting the returned pointer

Definition at line 756 of file SUMOVehicleParserHelper.cpp.

References SUMOVTypeParameter::actionStepLength, SUMOVTypeParameter::boardingDuration, SUMOVTypeParameter::boardingFactor, SUMOXMLDefinitions::CarFollowModels, SUMOVTypeParameter::cfModel, SUMOVTypeParameter::color, SUMOVTypeParameter::containerCapacity, SUMOVTypeParameter::defaultProbability, SUMOVTypeParameter::desiredMaxSpeed, SUMOVTypeParameter::emissionClass, StringBijection< T >::get(), SUMOSAXAttributes::get(), PollutantsInterface::getClassByName(), FileHelpers::getConfigurationRelative(), SUMOSAXAttributes::getOpt(), OptionsCont::getOptions(), Distribution_Parameterized::getParameter(), SUMOSAXAttributes::getSUMOTimeReporting(), handleVehicleTypeError(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::height, SUMOVTypeParameter::id, SUMOVTypeParameter::imgFile, SUMOVTypeParameter::impatience, FileHelpers::isAbsolute(), Distribution_Parameterized::isValid(), SUMOXMLDefinitions::LaneChangeModels, SUMOVTypeParameter::latAlignmentOffset, SUMOVTypeParameter::latAlignmentProcedure, SUMOVTypeParameter::lcModel, SUMOVTypeParameter::length, SUMOVTypeParameter::loadingDuration, SUMOVTypeParameter::mass, MAX2(), SUMOVTypeParameter::VClassDefaultValues::maxSpeed, SUMOVTypeParameter::maxSpeed, SUMOVTypeParameter::maxSpeedLat, SUMOVTypeParameter::minGap, SUMOVTypeParameter::minGapLat, SUMOVTypeParameter::osgFile, SUMOVTypeParameter::parametersSet, SUMOVTypeParameter::parkingBadges, Distribution_Parameterized::parse(), parseAngleTimesMap(), parseCFMParams(), parseGuiShape(), parseID(), parseJMParams(), SUMOVTypeParameter::parseLatAlignment(), parseLCParams(), parseVehicleClass(), SUMOVTypeParameter::personCapacity, processActionStepLength(), SUMOVTypeParameter::scale, SUMOVTypeParameter::shape, SUMOVTypeParameter::speedFactor, SUMOVTypeParameter::speedFactorPremature, SUMO_ATTR_ACTIONSTEPLENGTH, SUMO_ATTR_BOARDING_DURATION, SUMO_ATTR_BOARDING_FACTOR, SUMO_ATTR_CAR_FOLLOW_MODEL, SUMO_ATTR_COLOR, SUMO_ATTR_CONTAINER_CAPACITY, SUMO_ATTR_DESIRED_MAXSPEED, SUMO_ATTR_EMISSIONCLASS, SUMO_ATTR_GUISHAPE, SUMO_ATTR_HEIGHT, SUMO_ATTR_IMGFILE, SUMO_ATTR_IMPATIENCE, SUMO_ATTR_LANE_CHANGE_MODEL, SUMO_ATTR_LATALIGNMENT, SUMO_ATTR_LENGTH, SUMO_ATTR_LOADING_DURATION, SUMO_ATTR_MANEUVER_ANGLE_TIMES, SUMO_ATTR_MASS, SUMO_ATTR_MAXSPEED, SUMO_ATTR_MAXSPEED_LAT, SUMO_ATTR_MINGAP, SUMO_ATTR_MINGAP_LAT, SUMO_ATTR_OSGFILE, SUMO_ATTR_PARKING_BADGES, SUMO_ATTR_PERSON_CAPACITY, SUMO_ATTR_PROB, SUMO_ATTR_SCALE, SUMO_ATTR_SPEEDDEV, SUMO_ATTR_SPEEDFACTOR, SUMO_ATTR_SPEEDFACTOR_PREMATURE, SUMO_ATTR_TIME_TO_TELEPORT, SUMO_ATTR_TIME_TO_TELEPORT_BIDI, SUMO_ATTR_VCLASS, SUMO_ATTR_WIDTH, SUMO_TAG_VTYPE, SVC_BICYCLE, SVC_PASSENGER, SVC_PEDESTRIAN, SUMOVTypeParameter::timeToTeleport, SUMOVTypeParameter::timeToTeleportBidi, TL, toString(), UNKNOWN, VTYPEPARS_ACTIONSTEPLENGTH_SET, VTYPEPARS_BOARDING_DURATION, VTYPEPARS_BOARDING_FACTOR_SET, VTYPEPARS_CAR_FOLLOW_MODEL, VTYPEPARS_COLOR_SET, VTYPEPARS_CONTAINER_CAPACITY, VTYPEPARS_DESIRED_MAXSPEED_SET, VTYPEPARS_EMISSIONCLASS_SET, VTYPEPARS_HEIGHT_SET, VTYPEPARS_IMGFILE_SET, VTYPEPARS_IMPATIENCE_SET, VTYPEPARS_LANE_CHANGE_MODEL_SET, VTYPEPARS_LATALIGNMENT_SET, VTYPEPARS_LENGTH_SET, VTYPEPARS_LOADING_DURATION, VTYPEPARS_MANEUVER_ANGLE_TIMES_SET, VTYPEPARS_MASS_SET, VTYPEPARS_MAXSPEED_LAT_SET, VTYPEPARS_MAXSPEED_SET, VTYPEPARS_MINGAP_LAT_SET, VTYPEPARS_MINGAP_SET, VTYPEPARS_OSGFILE_SET, VTYPEPARS_PARKING_BADGES_SET, VTYPEPARS_PERSON_CAPACITY, VTYPEPARS_PROBABILITY_SET, VTYPEPARS_SCALE_SET, VTYPEPARS_SHAPE_SET, VTYPEPARS_SPEEDFACTOR_PREMATURE_SET, VTYPEPARS_SPEEDFACTOR_SET, VTYPEPARS_TTT_BIDI_SET, VTYPEPARS_TTT_SET, VTYPEPARS_VEHICLECLASS_SET, VTYPEPARS_WIDTH_SET, SUMOVTypeParameter::width, WRITE_WARNING, WRITE_WARNINGF, and RGBColor::YELLOW.

Referenced by SUMORouteHandler::myStartElement(), and RouteHandler::parseVType().

Here is the caller graph for this function:

◆ getAllowedCFModelAttrs()

const SUMOVehicleParserHelper::CFAttrMap & SUMOVehicleParserHelper::getAllowedCFModelAttrs ( )
staticprivate

returns allowed attrs for each known CF-model (init on first use)

Definition at line 1338 of file SUMOVehicleParserHelper.cpp.

References allowedCFModelAttrs, SUMO_ATTR_ACCEL, SUMO_ATTR_APPARENTDECEL, SUMO_ATTR_APPLYDRIVERSTATE, SUMO_ATTR_CA_GAIN_GAP_CACC, SUMO_ATTR_CA_GAIN_GAP_DOT_CACC, SUMO_ATTR_CA_GAIN_SPACE, SUMO_ATTR_CA_GAIN_SPEED, SUMO_ATTR_CA_OVERRIDE, SUMO_ATTR_CF_CC_C1, SUMO_ATTR_CF_CC_CCACCEL, SUMO_ATTR_CF_CC_CCDECEL, SUMO_ATTR_CF_CC_CONSTSPACING, SUMO_ATTR_CF_CC_FLATBED_D, SUMO_ATTR_CF_CC_FLATBED_H, SUMO_ATTR_CF_CC_FLATBED_KA, SUMO_ATTR_CF_CC_FLATBED_KP, SUMO_ATTR_CF_CC_FLATBED_KV, SUMO_ATTR_CF_CC_KP, SUMO_ATTR_CF_CC_LAMBDA, SUMO_ATTR_CF_CC_LANES_COUNT, SUMO_ATTR_CF_CC_OMEGAN, SUMO_ATTR_CF_CC_PLOEG_H, SUMO_ATTR_CF_CC_PLOEG_KD, SUMO_ATTR_CF_CC_PLOEG_KP, SUMO_ATTR_CF_CC_TAU, SUMO_ATTR_CF_CC_XI, SUMO_ATTR_CF_EIDM_C_COOLNESS, SUMO_ATTR_CF_EIDM_EPSILON_ACC, SUMO_ATTR_CF_EIDM_JERK_MAX, SUMO_ATTR_CF_EIDM_M_BEGIN, SUMO_ATTR_CF_EIDM_M_FLATNESS, SUMO_ATTR_CF_EIDM_MAX_VEH_PREVIEW, SUMO_ATTR_CF_EIDM_SIG_ERROR, SUMO_ATTR_CF_EIDM_SIG_GAP, SUMO_ATTR_CF_EIDM_SIG_LEADER, SUMO_ATTR_CF_EIDM_T_ACC_MAX, SUMO_ATTR_CF_EIDM_T_LOOK_AHEAD, SUMO_ATTR_CF_EIDM_T_PERSISTENCE_DRIVE, SUMO_ATTR_CF_EIDM_T_PERSISTENCE_ESTIMATE, SUMO_ATTR_CF_EIDM_T_REACTION, SUMO_ATTR_CF_EIDM_USEVEHDYNAMICS, SUMO_ATTR_CF_IDM_DELTA, SUMO_ATTR_CF_IDM_STEPPING, SUMO_ATTR_CF_IDMM_ADAPT_FACTOR, SUMO_ATTR_CF_IDMM_ADAPT_TIME, SUMO_ATTR_CF_KERNER_PHI, SUMO_ATTR_CF_PWAGNER2009_APPROB, SUMO_ATTR_CF_PWAGNER2009_TAULAST, SUMO_ATTR_CF_W99_CC1, SUMO_ATTR_CF_W99_CC2, SUMO_ATTR_CF_W99_CC3, SUMO_ATTR_CF_W99_CC4, SUMO_ATTR_CF_W99_CC5, SUMO_ATTR_CF_W99_CC6, SUMO_ATTR_CF_W99_CC7, SUMO_ATTR_CF_W99_CC8, SUMO_ATTR_CF_W99_CC9, SUMO_ATTR_CF_WIEDEMANN_ESTIMATION, SUMO_ATTR_CF_WIEDEMANN_SECURITY, SUMO_ATTR_COLLISION_MINGAP_FACTOR, SUMO_ATTR_DECEL, SUMO_ATTR_EMERGENCYDECEL, SUMO_ATTR_GC_GAIN_GAP_CACC, SUMO_ATTR_GC_GAIN_GAP_DOT_CACC, SUMO_ATTR_GC_GAIN_SPACE, SUMO_ATTR_GC_GAIN_SPEED, SUMO_ATTR_GCC_GAIN_GAP_CACC, SUMO_ATTR_GCC_GAIN_GAP_DOT_CACC, SUMO_ATTR_GCC_GAIN_SPACE, SUMO_ATTR_GCC_GAIN_SPEED, SUMO_ATTR_HEADWAY_TIME_CACC_TO_ACC, SUMO_ATTR_K, SUMO_ATTR_MASSFACTOR, SUMO_ATTR_MAXPOWER, SUMO_ATTR_MAXTRACTION, SUMO_ATTR_RESISTANCE_COEFFICIENT_CONSTANT, SUMO_ATTR_RESISTANCE_COEFFICIENT_LINEAR, SUMO_ATTR_RESISTANCE_COEFFICIENT_QUADRATIC, SUMO_ATTR_RESISTANCE_TABLE, SUMO_ATTR_SC_GAIN, SUMO_ATTR_SC_GAIN_CACC, SUMO_ATTR_SC_MIN_GAP, SUMO_ATTR_SIGMA, SUMO_ATTR_SIGMA_STEP, SUMO_ATTR_SPEED_TABLE, SUMO_ATTR_STARTUP_DELAY, SUMO_ATTR_TAU, SUMO_ATTR_TMP1, SUMO_ATTR_TMP2, SUMO_ATTR_TMP3, SUMO_ATTR_TMP4, SUMO_ATTR_TMP5, SUMO_ATTR_TRACTION_TABLE, SUMO_ATTR_TRAIN_TYPE, SUMO_TAG_CF_ACC, SUMO_TAG_CF_BKERNER, SUMO_TAG_CF_CACC, SUMO_TAG_CF_CC, SUMO_TAG_CF_DANIEL1, SUMO_TAG_CF_EIDM, SUMO_TAG_CF_IDM, SUMO_TAG_CF_IDMM, SUMO_TAG_CF_KRAUSS, SUMO_TAG_CF_KRAUSS_ORIG1, SUMO_TAG_CF_KRAUSS_PLUS_SLOPE, SUMO_TAG_CF_KRAUSSX, SUMO_TAG_CF_PWAGNER2009, SUMO_TAG_CF_RAIL, SUMO_TAG_CF_SMART_SK, SUMO_TAG_CF_W99, SUMO_TAG_CF_WIEDEMANN, and SUMO_TAG_NOTHING.

Referenced by parseCFMParams().

Here is the caller graph for this function:

◆ handleVehicleError()

SUMOVehicleParameter * SUMOVehicleParserHelper::handleVehicleError ( const bool  hardFail,
SUMOVehicleParameter vehicleParameter,
const std::string  message = "" 
)
staticprivate

handle error loading SUMOVehicleParameter

Definition at line 1828 of file SUMOVehicleParserHelper.cpp.

References WRITE_ERROR.

Referenced by parseCommonAttributes(), parseFlowAttributes(), parseVehicleAttributes(), and parseWalkPos().

Here is the caller graph for this function:

◆ handleVehicleTypeError()

SUMOVTypeParameter * SUMOVehicleParserHelper::handleVehicleTypeError ( const bool  hardFail,
SUMOVTypeParameter vehicleTypeParameter,
const std::string  message = "" 
)
staticprivate

handle error loading SUMOVTypeParameter

Definition at line 1842 of file SUMOVehicleParserHelper.cpp.

References WRITE_ERROR.

Referenced by beginVTypeParsing().

Here is the caller graph for this function:

◆ isInternalRouteID()

bool SUMOVehicleParserHelper::isInternalRouteID ( const std::string &  id)
static

Checks whether the route ID uses the syntax of internal routes.

Parameters
[in]idThe route ID to check.
Returns
The given route ID follows the syntax of internal routes.

Definition at line 1772 of file SUMOVehicleParserHelper.cpp.

Referenced by LIBSUMO_NAMESPACE::Vehicle::add(), parseCommonAttributes(), and LIBSUMO_NAMESPACE::Vehicle::setRouteID().

Here is the caller graph for this function:

◆ parseAngleTimesMap()

bool SUMOVehicleParserHelper::parseAngleTimesMap ( SUMOVTypeParameter vtype,
const std::string  atm 
)
static

Parse string containing AngleTimes triplets (angle, entry time, exit time)

Parameters
[in]vtype- the vtype element constructed in the parser
[in]string- containing , separated AngleTimes triplets "angle entry time exit time"
[in]hardFailenable or disable hard fails if a parameter is invalid
Exceptions
ProcessErrorIf an attribute's value is invalid
Note
if the map parameter set is an empty string then the vtype map will not be changed

Definition at line 1203 of file SUMOVehicleParserHelper.cpp.

References StringTokenizer::get(), StringTokenizer::hasNext(), SUMOVTypeParameter::id, SUMOVTypeParameter::myManoeuverAngleTimes, StringTokenizer::next(), StringTokenizer::size(), string2time(), TL, StringUtils::toInt(), and WRITE_ERRORF.

Referenced by beginVTypeParsing().

Here is the caller graph for this function:

◆ parseCarWalkTransfer()

int SUMOVehicleParserHelper::parseCarWalkTransfer ( const OptionsCont oc,
const bool  hasTaxi = false 
)
static

Definition at line 1778 of file SUMOVehicleParserHelper.cpp.

References ALL_JUNCTIONS, OptionsCont::getStringVector(), PARKING_AREAS, PT_STOPS, TAXI_DROPOFF_ANYWHERE, TAXI_DROPOFF_PARKING_AREAS, TAXI_DROPOFF_PT, TAXI_PICKUP_ANYWHERE, TAXI_PICKUP_PARKING_AREAS, TAXI_PICKUP_PT, TL, and WRITE_ERRORF.

Referenced by computeRoutes(), MSNet::getIntermodalRouter(), and MSRoutingEngine::initRouter().

Here is the caller graph for this function:

◆ parseCFMParams()

bool SUMOVehicleParserHelper::parseCFMParams ( SUMOVTypeParameter into,
const SumoXMLTag  element,
const SUMOSAXAttributes attrs,
const bool  nestedCFM 
)
static

Parses Car Following Mode params.

Parameters
[in,filled]into The structure to fill with parsed values
[in]elementThe id of the currently parsed XML-element
[in]attrThe SAX-attributes to get vehicle parameter from
[in]hardFailenable or disable hard fails if a parameter is invalid
[in]nestedCFMWhether the attributes are nested
Exceptions
ProcessErrorIf an attribute's value is invalid
See also
SUMOVTypeParameter

Definition at line 1239 of file SUMOVehicleParserHelper.cpp.

References SUMOVTypeParameter::cfModel, SUMOVTypeParameter::cfParameter, SUMOSAXAttributes::get(), getAllowedCFModelAttrs(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::id, SUMOVTypeParameter::parametersSet, SUMO_ATTR_ACCEL, SUMO_ATTR_APPARENTDECEL, SUMO_ATTR_CF_IDM_STEPPING, SUMO_ATTR_DECEL, SUMO_ATTR_EMERGENCYDECEL, SUMO_ATTR_RESISTANCE_TABLE, SUMO_ATTR_SIGMA, SUMO_ATTR_SPEED_TABLE, SUMO_ATTR_TAU, SUMO_ATTR_TRACTION_TABLE, SUMO_ATTR_TRAIN_TYPE, SUMOXMLDefinitions::Tags, TL, StringUtils::toDouble(), toString(), SUMOXMLDefinitions::TrainTypes, VTYPEPARS_CAR_FOLLOW_MODEL, WRITE_ERROR, and WRITE_ERRORF.

Referenced by beginVTypeParsing(), SUMORouteHandler::myStartElement(), and RouteHandler::parseNestedCFM().

Here is the caller graph for this function:

◆ parseCommonAttributes()

void SUMOVehicleParserHelper::parseCommonAttributes ( const SUMOSAXAttributes attrs,
SUMOVehicleParameter ret,
SumoXMLTag  tag,
const bool  allowInternalRoutes = false 
)
staticprivate

Parses attributes common to vehicles and flows.

Parses all attributes stored in "SUMOVehicleParameter".

See also
SUMOVehicleParameter
Parameters
[in]attrThe SAX-attributes to get vehicle parameter from
[out]retThe parameter to parse into
[in]elementThe name of the element (vehicle or flow)
[in]allowInternalRoutesWhether internal routes are valid in this context
Exceptions
ProcessErrorIf an attribute's value is invalid

Definition at line 416 of file SUMOVehicleParserHelper.cpp.

References SUMOVehicleParameter::arrivalEdge, SUMOVehicleParameter::arrivalEdgeProcedure, SUMOVehicleParameter::arrivalLane, SUMOVehicleParameter::arrivalLaneProcedure, SUMOVehicleParameter::arrivalPos, SUMOVehicleParameter::arrivalPosLat, SUMOVehicleParameter::arrivalPosLatProcedure, SUMOVehicleParameter::arrivalPosProcedure, SUMOVehicleParameter::arrivalSpeed, SUMOVehicleParameter::arrivalSpeedProcedure, SUMOVehicleParameter::calibratorSpeed, SUMOVehicleParameter::color, SUMOVehicleParameter::containerNumber, RGBColor::DEFAULT_COLOR, SUMOVehicleParameter::departEdge, SUMOVehicleParameter::departEdgeProcedure, SUMOVehicleParameter::departLane, SUMOVehicleParameter::departLaneProcedure, SUMOVehicleParameter::departPos, SUMOVehicleParameter::departPosLat, SUMOVehicleParameter::departPosLatProcedure, SUMOVehicleParameter::departPosProcedure, SUMOVehicleParameter::departSpeed, SUMOVehicleParameter::departSpeedProcedure, SUMOVehicleParameter::fromTaz, SUMOSAXAttributes::get(), handleVehicleError(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, SUMOVehicleParameter::insertionChecks, isInternalRouteID(), SUMOVehicleParameter::line, SUMOVehicleParameter::modes, SUMOVehicleParameter::parametersSet, SUMOVehicleParameter::parkingBadges, SUMOVehicleParameter::parseArrivalLane(), SUMOVehicleParameter::parseArrivalPos(), SUMOVehicleParameter::parseArrivalPosLat(), SUMOVehicleParameter::parseArrivalSpeed(), SUMOVehicleParameter::parseDepartLane(), SUMOVehicleParameter::parseDepartPos(), SUMOVehicleParameter::parseDepartPosLat(), SUMOVehicleParameter::parseDepartSpeed(), SUMOVehicleParameter::parseInsertionChecks(), SUMOVehicleParameter::parsePersonModes(), SUMOVehicleParameter::parseRouteIndex(), SUMOVehicleParameter::personNumber, SUMOVehicleParameter::routeid, SUMOVehicleParameter::speedFactor, SUMO_ATTR_ARRIVALEDGE, SUMO_ATTR_ARRIVALLANE, SUMO_ATTR_ARRIVALPOS, SUMO_ATTR_ARRIVALPOS_LAT, SUMO_ATTR_ARRIVALSPEED, SUMO_ATTR_COLOR, SUMO_ATTR_CONTAINER_NUMBER, SUMO_ATTR_DEPARTEDGE, SUMO_ATTR_DEPARTLANE, SUMO_ATTR_DEPARTPOS, SUMO_ATTR_DEPARTPOS_LAT, SUMO_ATTR_DEPARTSPEED, SUMO_ATTR_FROM_TAZ, SUMO_ATTR_INSERTIONCHECKS, SUMO_ATTR_LINE, SUMO_ATTR_MODES, SUMO_ATTR_PARKING_BADGES, SUMO_ATTR_PERSON_NUMBER, SUMO_ATTR_REROUTE, SUMO_ATTR_ROUTE, SUMO_ATTR_SPEED, SUMO_ATTR_SPEEDFACTOR, SUMO_ATTR_TO_TAZ, SUMO_ATTR_TYPE, SUMO_ATTR_VTYPES, SUMO_TAG_FLOW, TL, toString(), SUMOVehicleParameter::toTaz, VEHPARS_ARRIVALEDGE_SET, VEHPARS_ARRIVALLANE_SET, VEHPARS_ARRIVALPOS_SET, VEHPARS_ARRIVALPOSLAT_SET, VEHPARS_ARRIVALSPEED_SET, VEHPARS_CALIBRATORSPEED_SET, VEHPARS_COLOR_SET, VEHPARS_CONTAINER_NUMBER_SET, VEHPARS_DEPARTEDGE_SET, VEHPARS_DEPARTLANE_SET, VEHPARS_DEPARTPOS_SET, VEHPARS_DEPARTPOSLAT_SET, VEHPARS_DEPARTSPEED_SET, VEHPARS_FORCE_REROUTE, VEHPARS_FROM_TAZ_SET, VEHPARS_INSERTION_CHECKS_SET, VEHPARS_LINE_SET, VEHPARS_PARKING_BADGES_SET, VEHPARS_PERSON_NUMBER_SET, VEHPARS_ROUTE_SET, VEHPARS_SPEEDFACTOR_SET, VEHPARS_TO_TAZ_SET, VEHPARS_VTYPE_SET, SUMOVehicleParameter::vtypeid, SUMOVehicleParameter::vTypes, and WRITE_WARNINGF.

Referenced by parseFlowAttributes(), and parseVehicleAttributes().

Here is the caller graph for this function:

◆ parseFlowAttributes()

SUMOVehicleParameter * SUMOVehicleParserHelper::parseFlowAttributes ( SumoXMLTag  tag,
const SUMOSAXAttributes attrs,
const bool  hardFail,
const bool  needID,
const SUMOTime  beginDefault,
const SUMOTime  endDefault,
const bool  allowInternalRoutes = false 
)
static

Parses a flow's attributes.

Parses all attributes stored in "SUMOVehicleParameter".

See also
SUMOVehicleParameter
Parameters
[in]tagSumoXMLTag (used in netedit)
[in]attrThe SAX-attributes to get vehicle parameter from
[in]hardFailenable or disable hard fails if a parameter is invalid
[in]needIDcheck if flow needs an Id (used by Calibrator flows)
[in]allowInternalRouteswhether references to internal routes are allowed in this context
Returns
The parsed attribute structure if no error occurred, 0 otherwise
Exceptions
ProcessErrorIf an attribute's value is invalid
Note
: the caller is responsible for deleting the returned pointer

Definition at line 57 of file SUMOVehicleParserHelper.cpp.

References DEFAULT_CONTAINERTYPE_ID, DEFAULT_PEDTYPE_ID, SUMOVehicleParameter::depart, SUMOVehicleParameter::departProcedure, SUMOSAXAttributes::get(), SUMOSAXAttributes::getName(), SUMOSAXAttributes::getSUMOTimeReporting(), handleVehicleError(), SUMOSAXAttributes::hasAttribute(), SUMOVehicleParameter::id, SUMOXMLDefinitions::isValidVehicleID(), SUMOVehicleParameter::parametersSet, parseCommonAttributes(), SUMOVehicleParameter::parseDepart(), parseID(), SUMOVehicleParameter::poissonRate, SUMOVehicleParameter::repetitionEnd, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionProbability, SUMO_ATTR_BEGIN, SUMO_ATTR_CONTAINERSPERHOUR, SUMO_ATTR_END, SUMO_ATTR_ID, SUMO_ATTR_NUMBER, SUMO_ATTR_PERHOUR, SUMO_ATTR_PERIOD, SUMO_ATTR_PERSONSPERHOUR, SUMO_ATTR_PROB, SUMO_ATTR_VEHSPERHOUR, SUMO_TAG_CONTAINERFLOW, SUMO_TAG_PERSONFLOW, SUMOTime_MAX, SUMOVehicleParameter::tag, TIME2STEPS, TL, StringUtils::toDouble(), toString(), TRIGGERED, VEHPARS_END_SET, VEHPARS_NUMBER_SET, VEHPARS_PERIOD_SET, VEHPARS_PROB_SET, VEHPARS_VPH_SET, SUMOVehicleParameter::vtypeid, WRITE_WARNING, and WRITE_WARNINGF.

Referenced by GNEContainerFrame::buildContainer(), GNEPersonFrame::buildPerson(), GNEVehicleFrame::buildVehicleOverRoute(), GNEVehicleFrame::createPath(), ROJTRTurnDefLoader::myStartElement(), MSStateHandler::myStartElement(), SUMORouteHandler::myStartElement(), RouteHandler::parseContainerFlow(), RouteHandler::parseFlow(), and RouteHandler::parsePersonFlow().

Here is the caller graph for this function:

◆ parseGuiShape()

SUMOVehicleShape SUMOVehicleParserHelper::parseGuiShape ( const SUMOSAXAttributes attrs,
const std::string &  id 
)
static

Parses the vehicle class.

When given, the vehicle class is parsed using getVehicleShapeID. Exceptions occuring within this process are catched and reported.

If no vehicle class is available in the attributes, the default class (SVS_UNKNOWN) is returned.

Parameters
[in]attrsThe attributes to read the class from
[in]idThe id of the parsed element, for error message generation
Returns
The parsed vehicle shape
See also
SUMOVehicleShape
Todo:
Recheck how errors are handled and what happens if they occure

Definition at line 1714 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOpt(), SUMO_ATTR_GUISHAPE, SumoVehicleShapeStrings, TL, UNKNOWN, WRITE_ERRORF, and WRITE_WARNING.

Referenced by beginVTypeParsing().

Here is the caller graph for this function:

◆ parseID()

std::string SUMOVehicleParserHelper::parseID ( const SUMOSAXAttributes attrs,
const SumoXMLTag  element 
)
staticprivate

parse ID

Returns
empty string if ID obtained from attrs isn't valid

Definition at line 393 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::get(), SUMOSAXAttributes::hasAttribute(), SUMOXMLDefinitions::isValidVehicleID(), SUMO_ATTR_ID, TL, toString(), WRITE_ERROR, and WRITE_ERRORF.

Referenced by beginVTypeParsing(), parseFlowAttributes(), and parseVehicleAttributes().

Here is the caller graph for this function:

◆ parseJMParams()

bool SUMOVehicleParserHelper::parseJMParams ( SUMOVTypeParameter into,
const SUMOSAXAttributes attrs 
)
static

Parses junction model attributes.

Definition at line 1647 of file SUMOVehicleParserHelper.cpp.

References SUMOVTypeParameter::AllowedJMAttrs, SUMOSAXAttributes::get(), SUMOSAXAttributes::hasAttribute(), SUMOVTypeParameter::id, SUMOVTypeParameter::jmParameter, SUMO_ATTR_JM_SIGMA_MINOR, TL, StringUtils::toDouble(), toString(), and WRITE_ERRORF.

Referenced by beginVTypeParsing().

Here is the caller graph for this function:

◆ parseLCParams()

bool SUMOVehicleParserHelper::parseLCParams ( SUMOVTypeParameter into,
LaneChangeModel  model,
const SUMOSAXAttributes attrs 
)
static

◆ parseVehicleAttributes()

SUMOVehicleParameter * SUMOVehicleParserHelper::parseVehicleAttributes ( int  element,
const SUMOSAXAttributes attrs,
const bool  hardFail,
const bool  optionalID = false,
const bool  skipDepart = false,
const bool  allowInternalRoutes = false 
)
static

Parses a vehicle's attributes.

Parses all attributes stored in "SUMOVehicleParameter".

See also
SUMOVehicleParameter
Parameters
[in]attrThe SAX-attributes to get vehicle parameter from
[in]hardFailenable or disable hard fails if a parameter is invalid
[in]optionalIDWhether the id shall be skipped (Used only in Calibrator Flows)
[in]skipDepartWhether parsing the departure time shall be skipped
[in]allowInternalRouteswhether references to internal routes are allowed in this context
Returns
The parsed attribute structure if no error occurred, 0 otherwise
Exceptions
ProcessErrorIf an attribute's value is invalid
Note
: the caller is responsible for deleting the returned pointer

Definition at line 334 of file SUMOVehicleParserHelper.cpp.

References DEFAULT_CONTAINERTYPE_ID, DEFAULT_PEDTYPE_ID, SUMOVehicleParameter::depart, SUMOVehicleParameter::departProcedure, SUMOSAXAttributes::get(), SUMOSAXAttributes::getOpt(), handleVehicleError(), SUMOVehicleParameter::id, parseCommonAttributes(), SUMOVehicleParameter::parseDepart(), parseID(), SUMO_ATTR_DEPART, SUMO_ATTR_ID, SUMO_TAG_CONTAINER, SUMO_TAG_PERSON, SUMOVehicleParameter::tag, toString(), and SUMOVehicleParameter::vtypeid.

Referenced by GNEContainerFrame::buildContainer(), GNEPersonFrame::buildPerson(), GNEVehicleFrame::buildVehicleOverRoute(), GNEVehicleFrame::createPath(), ROMARouteHandler::myStartElement(), MSCalibrator::myStartElement(), SUMORouteHandler::myStartElement(), AdditionalHandler::parseCalibratorFlowAttributes(), RouteHandler::parseContainer(), RouteHandler::parsePerson(), RouteHandler::parseTrip(), and RouteHandler::parseVehicle().

Here is the caller graph for this function:

◆ parseVehicleClass()

SUMOVehicleClass SUMOVehicleParserHelper::parseVehicleClass ( const SUMOSAXAttributes attrs,
const std::string &  id 
)
static

Parses the vehicle class.

When given, the vehicle class is parsed using getVehicleClassID. Exceptions occuring within this process are catched and reported.

If no vehicle class is available in the attributes, the default class (SVC_IGNORING) is returned.

Parameters
[in]attrsThe attributes to read the class from
[in]idThe id of the parsed element, for error message generation
Returns
The parsed vehicle class
See also
SUMOVehicleClass
Todo:
Recheck how errors are handled and what happens if they occure

Definition at line 1692 of file SUMOVehicleParserHelper.cpp.

References SUMOSAXAttributes::getObjectType(), SUMOSAXAttributes::getOpt(), getVehicleClassID(), SUMO_ATTR_VCLASS, SumoVehicleClassStrings, SVC_IGNORING, TL, WRITE_ERRORF, and WRITE_WARNING.

Referenced by beginVTypeParsing(), and RouteHandler::parseRoute().

Here is the caller graph for this function:

◆ parseWalkPos()

double SUMOVehicleParserHelper::parseWalkPos ( SumoXMLAttr  attr,
const bool  hardFail,
const std::string &  id,
double  maxPos,
const std::string &  val,
SumoRNG rng = 0 
)
static

parse departPos or arrivalPos for a walk

Definition at line 1732 of file SUMOVehicleParserHelper.cpp.

References CENTER, DEFAULT, handleVehicleError(), SUMOVehicleParameter::interpretEdgePos(), MAX, SUMOVehicleParameter::parseArrivalPos(), RandHelper::rand(), RANDOM, SUMO_TAG_WALK, and toString().

Referenced by RORouteHandler::addWalk(), MSRouteHandler::parseWalkPositions(), and RORouteHandler::parseWalkPositions().

Here is the caller graph for this function:

◆ processActionStepLength()

SUMOTime SUMOVehicleParserHelper::processActionStepLength ( double  given)
static

Checks and converts given value for the action step length from seconds to miliseconds assuring it being a positive multiple of the simulation step width.

Parameters
[in]givenThe value parsed from the configuration (seconds).
Returns
The milisecond value rounded to the next positive multiple of the simulation step length.

Definition at line 1752 of file SUMOVehicleParserHelper.cpp.

References DELTA_T, MAX2(), STEPS2TIME, TIME2STEPS, toString(), and WRITE_WARNING.

Referenced by beginVTypeParsing(), MSVehicle::setActionStepLength(), and MSFrame::setMSGlobals().

Here is the caller graph for this function:

Field Documentation

◆ allowedCFModelAttrs

SUMOVehicleParserHelper::CFAttrMap SUMOVehicleParserHelper::allowedCFModelAttrs
staticprivate

allowed attrs for each known CF-model

Definition at line 211 of file SUMOVehicleParserHelper.h.

Referenced by getAllowedCFModelAttrs().

◆ allowedLCModelAttrs

SUMOVehicleParserHelper::LCAttrMap SUMOVehicleParserHelper::allowedLCModelAttrs
staticprivate

allowed attrs for each known LC-model

Definition at line 214 of file SUMOVehicleParserHelper.h.

Referenced by parseLCParams().


The documentation for this class was generated from the following files: