SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SUMOVehicleParameter Class Reference

Structure representing possible vehicle parameter. More...

#include <SUMOVehicleParameter.h>

Data Structures

struct  Stop
 Definition of vehicle stop (position and duration) More...

Public Member Functions

bool defaultOptionOverrides (const OptionsCont &oc, const std::string &optionName) const
 Returns whether the defaults shall be used.
 SUMOVehicleParameter ()
 Constructor.
bool wasSet (int what) const
 Returns whether the given parameter was set.
void write (OutputDevice &dev, const OptionsCont &oc) const
 Writes the parameters as a beginning element.
void writeStops (OutputDevice &dev) const
 Writes the enclosed stops.

Static Public Member Functions

static SUMOReal interpretEdgePos (SUMOReal pos, SUMOReal maximumValue, SumoXMLAttr attr, const std::string &id)
 Interprets negative edge positions and fits them onto a given edge.
Depart/arrival-attributes verification
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 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.
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.
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 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 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.

Data Fields

RGBColor color
 The vehicle's color.
std::string fromTaz
 The vehicle's origin zone (district)
std::string id
 The vehicle's id.
std::string line
 The vehicle's line (mainly for public transport)
unsigned int personCapacity
 The vehicle's capacity (persons)
unsigned int personNumber
 The number of persons in the vehicle.
std::string routeid
 The vehicle's route id.
int setParameter
 Information for the router which parameter were set.
std::vector< Stopstops
 List of the stops the vehicle will make.
std::string toTaz
 The vehicle's destination zone (district)
std::string vtypeid
 The vehicle's type id.
Departure definition
SUMOTime depart
 The vehicle's departure time.
DepartDefinition departProcedure
 Information how the vehicle shall choose the depart time.
int departLane
 (optional) The lane the vehicle shall depart from (index in edge)
DepartLaneDefinition departLaneProcedure
 Information how the vehicle shall choose the lane to depart from.
SUMOReal departPos
 (optional) The position the vehicle shall depart from
DepartPosDefinition departPosProcedure
 Information how the vehicle shall choose the departure position.
SUMOReal departSpeed
 (optional) The initial speed of the vehicle
DepartSpeedDefinition departSpeedProcedure
 Information how the vehicle's initial speed shall be chosen.
Arrival definition
int arrivalLane
 (optional) The lane the vehicle shall arrive on (not used yet)
ArrivalLaneDefinition arrivalLaneProcedure
 Information how the vehicle shall choose the lane to arrive on.
SUMOReal arrivalPos
 (optional) The position the vehicle shall arrive on
ArrivalPosDefinition arrivalPosProcedure
 Information how the vehicle shall choose the arrival position.
SUMOReal arrivalSpeed
 (optional) The final speed of the vehicle (not used yet)
ArrivalSpeedDefinition arrivalSpeedProcedure
 Information how the vehicle's end speed shall be chosen.
Repetition definition
int repetitionNumber
 The number of times the vehicle shall be repeatedly inserted.
int repetitionsDone
 The number of times the vehicle was already inserted.
SUMOReal repetitionOffset
 The time offset between vehicle reinsertions.

Detailed Description

Structure representing possible vehicle parameter.

The fields yielding with "Procedure" describe whether the according value shall be used or another procedure is used to choose the value.

See Also
DepartLaneDefinition
DepartPosDefinition
DepartSpeedDefinition

Definition at line 228 of file SUMOVehicleParameter.h.

Constructor & Destructor Documentation

SUMOVehicleParameter::SUMOVehicleParameter ( )

Constructor.

Initialises the structure with default values

Definition at line 48 of file SUMOVehicleParameter.cpp.

References DEFAULT_VTYPE_ID.

Member Function Documentation

bool SUMOVehicleParameter::defaultOptionOverrides ( const OptionsCont oc,
const std::string &  optionName 
) const

Returns whether the defaults shall be used.

Parameters
[in]ocThe options to get the options from
[in]optionNameThe name of the option to determine whether its value shall be used
Returns
Whether the option is set and –defaults-override was set

Definition at line 63 of file SUMOVehicleParameter.cpp.

References OptionsCont::getBool(), and OptionsCont::isSet().

Referenced by write().

SUMOReal SUMOVehicleParameter::interpretEdgePos ( SUMOReal  pos,
SUMOReal  maximumValue,
SumoXMLAttr  attr,
const std::string &  id 
)
static

Interprets negative edge positions and fits them onto a given edge.

Parameters
[in]posThe position to be interpreted
[in]maximumValueThe maximum allowed value (edge length)
[in]attrThe attribute from which the value originated
[in]idThe id of the object to which this attribute belongs
Returns
Whether the interpreted position

Definition at line 432 of file SUMOVehicleParameter.cpp.

References toString(), and WRITE_WARNING.

Referenced by MSPerson::MSPersonStage_Waiting::MSPersonStage_Waiting(), and MSPerson::MSPersonStage_Walking::MSPersonStage_Walking().

bool SUMOVehicleParameter::parseArrivalLane ( const std::string &  val,
const std::string &  element,
const std::string &  id,
int lane,
ArrivalLaneDefinition ald,
std::string &  error 
)
static

Validates a given arrivalLane value.

Parameters
[in]valThe arrivalLane value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]laneThe parsed lane, if given
[out]aldThe parsed arrivalLane definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid arrivalLane definition

Definition at line 364 of file SUMOVehicleParameter.cpp.

References TplConvert::_2int(), ARRIVAL_LANE_CURRENT, and ARRIVAL_LANE_GIVEN.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::parseArrivalPos ( const std::string &  val,
const std::string &  element,
const std::string &  id,
SUMOReal pos,
ArrivalPosDefinition apd,
std::string &  error 
)
static

Validates a given arrivalPos value.

Parameters
[in]valThe arrivalPos value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]posThe parsed position, if given
[out]apdThe parsed arrivalPos definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid arrivalPos definition

Definition at line 388 of file SUMOVehicleParameter.cpp.

References TplConvert::_2SUMOReal(), ARRIVAL_POS_GIVEN, ARRIVAL_POS_MAX, and ARRIVAL_POS_RANDOM.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::parseArrivalSpeed ( const std::string &  val,
const std::string &  element,
const std::string &  id,
SUMOReal speed,
ArrivalSpeedDefinition asd,
std::string &  error 
)
static

Validates a given arrivalSpeed value.

Parameters
[in]valThe arrivalSpeed value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]speedThe parsed speed, if given
[out]asdThe parsed arrivalSpeed definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid arrivalSpeed definition

Definition at line 411 of file SUMOVehicleParameter.cpp.

References TplConvert::_2SUMOReal(), ARRIVAL_SPEED_CURRENT, and ARRIVAL_SPEED_GIVEN.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::parseDepartLane ( const std::string &  val,
const std::string &  element,
const std::string &  id,
int lane,
DepartLaneDefinition dld,
std::string &  error 
)
static

Validates a given departLane value.

Parameters
[in]valThe departLane value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]laneThe parsed lane, if given
[out]dldThe parsed departLane definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid departLane definition

Definition at line 275 of file SUMOVehicleParameter.cpp.

References TplConvert::_2int(), DEPART_LANE_ALLOWED_FREE, DEPART_LANE_BEST_FREE, DEPART_LANE_FREE, DEPART_LANE_GIVEN, and DEPART_LANE_RANDOM.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::parseDepartPos ( const std::string &  val,
const std::string &  element,
const std::string &  id,
SUMOReal pos,
DepartPosDefinition dpd,
std::string &  error 
)
static

Validates a given departPos value.

Parameters
[in]valThe departPos value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]posThe parsed position, if given
[out]dpdThe parsed departPos definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid departPos definition

Definition at line 305 of file SUMOVehicleParameter.cpp.

References TplConvert::_2SUMOReal(), DEPART_POS_BASE, DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_MAX_SPEED_GAP, DEPART_POS_PWAG_GENERIC, DEPART_POS_PWAG_SIMPLE, DEPART_POS_RANDOM, and DEPART_POS_RANDOM_FREE.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::parseDepartSpeed ( const std::string &  val,
const std::string &  element,
const std::string &  id,
SUMOReal speed,
DepartSpeedDefinition dsd,
std::string &  error 
)
static

Validates a given departSpeed value.

Parameters
[in]valThe departSpeed value to parse
[in]elementThe name of the type of the parsed element, for building the error message
[in]idThe id of the parsed element, for building the error message
[out]speedThe parsed speed, if given
[out]dsdThe parsed departSpeed definition
[out]errorError message, if an error occures
Returns
Whether the given value is a valid departSpeed definition

Definition at line 338 of file SUMOVehicleParameter.cpp.

References TplConvert::_2SUMOReal(), DEPART_SPEED_GIVEN, DEPART_SPEED_MAX, and DEPART_SPEED_RANDOM.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), and SUMOVehicleParserHelper::parseCommonAttributes().

bool SUMOVehicleParameter::wasSet ( int  what) const
inline

Returns whether the given parameter was set.

Parameters
[in]whatThe parameter which one asks for
Returns
Whether the given parameter was set

Definition at line 241 of file SUMOVehicleParameter.h.

References setParameter.

Referenced by MSDevice_Routing::buildVehicleDevices(), MSRouteHandler::myStartElement(), RORouteHandler::parseFromTo(), and write().

void SUMOVehicleParameter::write ( OutputDevice dev,
const OptionsCont oc 
) const

Writes the parameters as a beginning element.

Parameters
[in,out]devThe device to write into
[in]ocThe options to get defaults from
Exceptions
IOErrornot yet implemented

Definition at line 69 of file SUMOVehicleParameter.cpp.

References ARRIVAL_LANE_CURRENT, ARRIVAL_LANE_DEFAULT, ARRIVAL_LANE_GIVEN, ARRIVAL_POS_DEFAULT, ARRIVAL_POS_GIVEN, ARRIVAL_POS_MAX, ARRIVAL_POS_RANDOM, ARRIVAL_SPEED_CURRENT, ARRIVAL_SPEED_DEFAULT, ARRIVAL_SPEED_GIVEN, arrivalLane, arrivalLaneProcedure, arrivalPos, arrivalPosProcedure, arrivalSpeed, arrivalSpeedProcedure, color, defaultOptionOverrides(), depart, DEPART_LANE_ALLOWED_FREE, DEPART_LANE_BEST_FREE, DEPART_LANE_DEFAULT, DEPART_LANE_FREE, DEPART_LANE_GIVEN, DEPART_LANE_RANDOM, DEPART_POS_BASE, DEPART_POS_DEFAULT, DEPART_POS_FREE, DEPART_POS_GIVEN, DEPART_POS_MAX_SPEED_GAP, DEPART_POS_PWAG_GENERIC, DEPART_POS_PWAG_SIMPLE, DEPART_POS_RANDOM, DEPART_POS_RANDOM_FREE, DEPART_SPEED_DEFAULT, DEPART_SPEED_GIVEN, DEPART_SPEED_MAX, DEPART_SPEED_RANDOM, DEPART_TRIGGERED, departLane, departLaneProcedure, departPos, departPosProcedure, departProcedure, departSpeed, departSpeedProcedure, fromTaz, OptionsCont::getString(), OptionsCont::isSet(), line, OutputDevice::openTag(), personCapacity, personNumber, SUMO_ATTR_ARRIVALLANE, SUMO_ATTR_ARRIVALPOS, SUMO_ATTR_ARRIVALSPEED, SUMO_ATTR_COLOR, SUMO_ATTR_DEPART, SUMO_ATTR_DEPARTLANE, SUMO_ATTR_DEPARTPOS, SUMO_ATTR_DEPARTSPEED, SUMO_ATTR_FROM_TAZ, SUMO_ATTR_ID, SUMO_ATTR_LINE, SUMO_ATTR_PERSON_CAPACITY, SUMO_ATTR_PERSON_NUMBER, SUMO_ATTR_TO_TAZ, SUMO_ATTR_TYPE, SUMO_TAG_VEHICLE, time2string(), toString(), toTaz, VEHPARS_ARRIVALLANE_SET, VEHPARS_ARRIVALPOS_SET, VEHPARS_ARRIVALSPEED_SET, VEHPARS_COLOR_SET, VEHPARS_DEPARTLANE_SET, VEHPARS_DEPARTPOS_SET, VEHPARS_DEPARTSPEED_SET, VEHPARS_LINE_SET, VEHPARS_PERSON_CAPACITY_SET, VEHPARS_PERSON_NUMBER_SET, VEHPARS_TAZ_SET, VEHPARS_VTYPE_SET, vtypeid, wasSet(), and OutputDevice::writeAttr().

Referenced by ROVehicle::saveAllAsXML().

void SUMOVehicleParameter::writeStops ( OutputDevice dev) const

Field Documentation

int SUMOVehicleParameter::arrivalLane

(optional) The lane the vehicle shall arrive on (not used yet)

Definition at line 400 of file SUMOVehicleParameter.h.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), MSVehicle::getBestLanes(), SUMOVehicleParserHelper::parseCommonAttributes(), and write().

ArrivalLaneDefinition SUMOVehicleParameter::arrivalLaneProcedure

Information how the vehicle shall choose the lane to arrive on.

Definition at line 402 of file SUMOVehicleParameter.h.

Referenced by ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), MSVehicle::getBestLanes(), SUMOVehicleParserHelper::parseCommonAttributes(), and write().

SUMOReal SUMOVehicleParameter::arrivalPos
ArrivalPosDefinition SUMOVehicleParameter::arrivalPosProcedure

Information how the vehicle shall choose the arrival position.

Definition at line 406 of file SUMOVehicleParameter.h.

Referenced by MSBaseVehicle::calculateArrivalPos(), ROJTRFrame::checkOptions(), RODUAFrame::checkOptions(), checkOptions(), SUMOVehicleParserHelper::parseCommonAttributes(), and write().

SUMOReal SUMOVehicleParameter::arrivalSpeed
ArrivalSpeedDefinition SUMOVehicleParameter::arrivalSpeedProcedure
RGBColor SUMOVehicleParameter::color
mutable
int SUMOVehicleParameter::departLane
std::string SUMOVehicleParameter::line

The vehicle's line (mainly for public transport)

Definition at line 431 of file SUMOVehicleParameter.h.

Referenced by MSPersonControl::boardAnyWaiting(), MSVehicleControl::getWaitingVehicle(), SUMOVehicleParserHelper::parseCommonAttributes(), and write().

unsigned int SUMOVehicleParameter::personCapacity

The vehicle's capacity (persons)

Definition at line 469 of file SUMOVehicleParameter.h.

Referenced by SUMOVehicleParserHelper::parseCommonAttributes(), and write().

unsigned int SUMOVehicleParameter::personNumber

The number of persons in the vehicle.

Definition at line 472 of file SUMOVehicleParameter.h.

Referenced by MSVehicle::getPersonNumber(), SUMOVehicleParserHelper::parseCommonAttributes(), and write().

int SUMOVehicleParameter::repetitionsDone

The number of times the vehicle was already inserted.

Definition at line 420 of file SUMOVehicleParameter.h.

Referenced by MSInsertionControl::checkFlows(), RONet::checkFlows(), MSRouteHandler::closeFlow(), and RORouteHandler::closeFlow().

std::vector<Stop> SUMOVehicleParameter::stops

List of the stops the vehicle will make.

Definition at line 466 of file SUMOVehicleParameter.h.

Referenced by MSRouteHandler::addStop(), RORouteHandler::addStop(), MSVehicle::MSVehicle(), and writeStops().


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