![]() |
Eclipse SUMO - Simulation of Urban MObility
|
#include <VehicleEngineHandler.h>
Public Member Functions | |
void | endDocument () |
void | endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) |
const EngineParameters & | getEngineParameters () |
void | startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
VehicleEngineHandler (const std::string &toLoad) | |
virtual | ~VehicleEngineHandler () |
Destructor. More... | |
Protected Member Functions | |
int | existsAttribute (std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadBrakesData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadDifferentialData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadDragData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadEngineData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadEngineModelData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadGearData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadMassData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadShiftingData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | loadWheelsData (const XERCES_CPP_NAMESPACE::Attributes &attrs) |
double | parseDoubleAttribute (std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
int | parseIntAttribute (std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
double | parsePolynomialCoefficient (int index, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
std::string | parseStringAttribute (std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs) |
void | raiseMissingAttributeError (std::string tag, std::string attribute) |
void | raiseUnknownTagError (std::string tag) |
Private Member Functions | |
const VehicleEngineHandler & | operator= (const VehicleEngineHandler &s) |
invalidated assignment operator More... | |
VehicleEngineHandler (const VehicleEngineHandler &s) | |
invalidated copy constructor More... | |
Private Attributes | |
int | currentGear |
int | currentTag |
EngineParameters | engineParameters |
std::vector< double > | gearRatios |
bool | skip |
std::string | vehicleToLoad |
SAX handler used to parse engine parameters
Definition at line 82 of file VehicleEngineHandler.h.
VehicleEngineHandler::VehicleEngineHandler | ( | const std::string & | toLoad | ) |
Constructor
[in] | toLoad | id of the vehicle to be loaded |
Definition at line 30 of file VehicleEngineHandler.cpp.
References vehicleToLoad.
|
virtual |
Destructor.
Definition at line 36 of file VehicleEngineHandler.cpp.
|
private |
invalidated copy constructor
void VehicleEngineHandler::endDocument | ( | ) |
Definition at line 210 of file VehicleEngineHandler.cpp.
References EngineParameters::computeCoefficients(), and engineParameters.
void VehicleEngineHandler::endElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname | ||
) |
Definition at line 161 of file VehicleEngineHandler.cpp.
References currentGear, currentTag, ENGINE_TAG_ENGINE, ENGINE_TAG_GEARS, ENGINE_TAG_VEHICLE, engineParameters, EngineParameters::gearRatios, gearRatios, EngineParameters::nGears, skip, TAG_ENGINE, TAG_GEARS, TAG_VEHICLE, TAG_VEHICLES, and transcode().
|
protected |
Checks whether an attribute exists
Definition at line 315 of file VehicleEngineHandler.cpp.
References transcode().
Referenced by loadEngineData(), and parseStringAttribute().
const EngineParameters & VehicleEngineHandler::getEngineParameters | ( | ) |
Definition at line 214 of file VehicleEngineHandler.cpp.
References engineParameters.
Referenced by RealisticEngineModel::loadParameters().
|
protected |
Load data about brakes
Definition at line 311 of file VehicleEngineHandler.cpp.
References EngineParameters::brakesTau_s, ENGINE_TAG_BRAKES, ENGINE_TAG_BRAKES_TAU, engineParameters, and parseDoubleAttribute().
Referenced by startElement().
|
protected |
Load final drive ratio
Definition at line 281 of file VehicleEngineHandler.cpp.
References EngineParameters::differentialRatio, ENGINE_TAG_GEAR_DIFFERENTIAL, ENGINE_TAG_GEAR_RATIO, engineParameters, and parseDoubleAttribute().
Referenced by startElement().
|
protected |
Load air drag related data such as drag coefficient and maximum vehicle section
Definition at line 228 of file VehicleEngineHandler.cpp.
References EngineParameters::a_m2, EngineParameters::cAir, ENGINE_TAG_DRAG, ENGINE_TAG_DRAG_CAIR, ENGINE_TAG_DRAG_SECTION, engineParameters, and parseDoubleAttribute().
Referenced by startElement().
|
protected |
Load data about the engine, such as efficiency factor and cylinders
Definition at line 244 of file VehicleEngineHandler.cpp.
References EngineParameters::cylinders, ENGINE_TAG_ENGINE, ENGINE_TAG_ENGINE_CYLINDERS, ENGINE_TAG_ENGINE_EFFICIENCY, ENGINE_TAG_ENGINE_MAXRPM, ENGINE_TAG_ENGINE_MINRPM, ENGINE_TAG_ENGINE_TAU_BURN, ENGINE_TAG_ENGINE_TAU_EX, ENGINE_TAG_ENGINE_TYPE, EngineParameters::engineEfficiency, engineParameters, existsAttribute(), EngineParameters::fixedTauBurn, EngineParameters::maxRpm, EngineParameters::minRpm, parseDoubleAttribute(), parseIntAttribute(), parseStringAttribute(), EngineParameters::tauBurn_s, and EngineParameters::tauEx_s.
Referenced by startElement().
|
protected |
Load the mapping between engine rpm and output power in terms of linear function, i.e., slope and intercept
Definition at line 287 of file VehicleEngineHandler.cpp.
References EngineParameters::PolynomialEngineModelRpmToHp::degree, EngineParameters::engineMapping, engineParameters, MAX_POLY_DEGREE, parsePolynomialCoefficient(), and EngineParameters::PolynomialEngineModelRpmToHp::x.
Referenced by startElement().
|
protected |
Load gear ratios
Definition at line 265 of file VehicleEngineHandler.cpp.
References currentGear, ENGINE_TAG_GEAR, ENGINE_TAG_GEAR_N, ENGINE_TAG_GEAR_RATIO, gearRatios, parseDoubleAttribute(), and parseIntAttribute().
Referenced by startElement().
|
protected |
Loads mass information, i.e., mass in kg and mass factor which takes into account rotational parts of the engine
Definition at line 221 of file VehicleEngineHandler.cpp.
References ENGINE_TAG_MASS, ENGINE_TAG_MASS_FACTOR, ENGINE_TAG_MASS_MASS, engineParameters, EngineParameters::mass_kg, EngineParameters::massFactor, and parseDoubleAttribute().
Referenced by startElement().
|
protected |
Load the gear shifting rules
Definition at line 304 of file VehicleEngineHandler.cpp.
References EngineParameters::GearShiftingRules::deltaRpm, ENGINE_TAG_SHIFTING, ENGINE_TAG_SHIFTING_DELTARPM, ENGINE_TAG_SHIFTING_RPM, engineParameters, parseDoubleAttribute(), EngineParameters::GearShiftingRules::rpm, and EngineParameters::shiftingRule.
Referenced by startElement().
|
protected |
Load data about vehicle's wheels, such as diameter and friction coefficient
Definition at line 235 of file VehicleEngineHandler.cpp.
References EngineParameters::cr1, EngineParameters::cr2, ENGINE_TAG_WHEELS, ENGINE_TAG_WHEELS_CR1, ENGINE_TAG_WHEELS_CR2, ENGINE_TAG_WHEELS_DIAMETER, ENGINE_TAG_WHEELS_FRICTION, engineParameters, parseDoubleAttribute(), EngineParameters::tiresFrictionCoefficient, and EngineParameters::wheelDiameter_m.
Referenced by startElement().
|
private |
invalidated assignment operator
|
protected |
Search and returns a double attribute if existing. If not, an error is printed to stderr and the simulation is stopped. The simulation is stopped if the double cannot be parsed as well
Definition at line 331 of file VehicleEngineHandler.cpp.
References parseStringAttribute(), and StringUtils::toDouble().
Referenced by loadBrakesData(), loadDifferentialData(), loadDragData(), loadEngineData(), loadGearData(), loadMassData(), loadShiftingData(), loadWheelsData(), and parsePolynomialCoefficient().
|
protected |
Search and returns an integer attribute if existing. If not, an error is printed to stderr and the simulation is stopped. The simulation is stopped if the integer cannot be parsed as well
Definition at line 328 of file VehicleEngineHandler.cpp.
References parseStringAttribute(), and StringUtils::toInt().
Referenced by loadEngineData(), and loadGearData().
|
protected |
Search for the x_i coefficient in the list of attributes. If not found, an error is printed to stderr and the simulation is stopped. The simulation is stopped if the value cannot be parsed as well
Definition at line 334 of file VehicleEngineHandler.cpp.
References ENGINE_TAG_ENGINE_POWER, and parseDoubleAttribute().
Referenced by loadEngineModelData().
|
protected |
Search and returns a string attribute if existing. If not, an error is printed to stderr and the simulation is stopped
Definition at line 318 of file VehicleEngineHandler.cpp.
References existsAttribute(), raiseMissingAttributeError(), and transcode().
Referenced by loadEngineData(), parseDoubleAttribute(), and parseIntAttribute().
|
protected |
Writes a missing attribute error to stderr and terminates the simulation
Definition at line 342 of file VehicleEngineHandler.cpp.
Referenced by parseStringAttribute().
|
protected |
Writes an unknown tag error to stderr and terminates the simulation
Definition at line 350 of file VehicleEngineHandler.cpp.
Referenced by startElement().
void VehicleEngineHandler::startElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname, | ||
const XERCES_CPP_NAMESPACE::Attributes & | attrs | ||
) |
Definition at line 51 of file VehicleEngineHandler.cpp.
References currentTag, ENGINE_TAG_BRAKES, ENGINE_TAG_DRAG, ENGINE_TAG_ENGINE, ENGINE_TAG_ENGINE_POWER, ENGINE_TAG_GEAR, ENGINE_TAG_GEAR_DIFFERENTIAL, ENGINE_TAG_GEARS, ENGINE_TAG_MASS, ENGINE_TAG_SHIFTING, ENGINE_TAG_VEHICLE, ENGINE_TAG_VEHICLE_ID, ENGINE_TAG_VEHICLES, ENGINE_TAG_WHEELS, engineParameters, getAttributeValue(), EngineParameters::id, loadBrakesData(), loadDifferentialData(), loadDragData(), loadEngineData(), loadEngineModelData(), loadGearData(), loadMassData(), loadShiftingData(), loadWheelsData(), raiseUnknownTagError(), skip, TAG_ENGINE, TAG_GEARS, TAG_VEHICLE, TAG_VEHICLES, transcode(), and vehicleToLoad.
|
private |
Definition at line 199 of file VehicleEngineHandler.h.
Referenced by endElement(), and loadGearData().
|
private |
Definition at line 193 of file VehicleEngineHandler.h.
Referenced by endElement(), and startElement().
|
private |
Definition at line 201 of file VehicleEngineHandler.h.
Referenced by endDocument(), endElement(), getEngineParameters(), loadBrakesData(), loadDifferentialData(), loadDragData(), loadEngineData(), loadEngineModelData(), loadMassData(), loadShiftingData(), loadWheelsData(), and startElement().
|
private |
Definition at line 203 of file VehicleEngineHandler.h.
Referenced by endElement(), and loadGearData().
|
private |
Definition at line 197 of file VehicleEngineHandler.h.
Referenced by endElement(), and startElement().
|
private |
Definition at line 195 of file VehicleEngineHandler.h.
Referenced by startElement(), and VehicleEngineHandler().