29 : currentTag(
TAG_VEHICLES), skip(false), currentGear(1) {
44 std::string
getAttributeValue(
const char* attributeName,
const XERCES_CPP_NAMESPACE::Attributes& attrs) {
51 const XMLCh*
const qname,
52 const XERCES_CPP_NAMESPACE::Attributes& attrs) {
161 const XMLCh*
const qname) {
183 for (
int i = 0; i < (int)
gearRatios.size(); i++) {
256 if (mapType !=
"poly") {
257 throw ProcessError(
"Invalid engine map type. Only \"poly\" is supported for now");
268 std::stringstream ss;
269 ss <<
"Invalid gear number " << number <<
". Please check that gears are inserted in order";
288 std::stringstream ss;
289 ss <<
"Maximum degree for the engine polynomial is " <<
MAX_POLY_DEGREE <<
". Please check your model's data";
293 for (
int i = 0; i < (int)attrs.getLength(); i++) {
314 return attrs.getIndex(
transcode(attribute));
318 std::string strValue;
320 if (attributeIndex == -1) {
324 return transcode(attrs.getValue(attributeIndex));
333 std::stringstream ss;
341 std::stringstream ss;
342 ss <<
"Missing attribute \"" << attribute <<
"\" for tag " << tag;
349 std::stringstream ss;
350 ss <<
"I don't know what to do with this tag: " << tag;
std::string getAttributeValue(const char *attributeName, const XERCES_CPP_NAMESPACE::Attributes &attrs)
std::string transcode(const XMLCh *const qname)
#define ENGINE_TAG_ENGINE_TAU_EX
#define ENGINE_TAG_BRAKES_TAU
#define ENGINE_TAG_ENGINE_MINRPM
#define ENGINE_TAG_ENGINE
#define ENGINE_TAG_ENGINE_MAXRPM
#define ENGINE_TAG_WHEELS_DIAMETER
#define ENGINE_TAG_DRAG_SECTION
#define ENGINE_TAG_ENGINE_CYLINDERS
#define ENGINE_TAG_WHEELS
#define ENGINE_TAG_GEAR_N
#define ENGINE_TAG_MASS_MASS
#define ENGINE_TAG_ENGINE_POWER
#define ENGINE_TAG_GEAR_DIFFERENTIAL
#define ENGINE_TAG_WHEELS_FRICTION
#define ENGINE_TAG_GEAR_RATIO
#define ENGINE_TAG_DRAG_CAIR
#define ENGINE_TAG_VEHICLE
#define ENGINE_TAG_MASS_FACTOR
#define ENGINE_TAG_ENGINE_TAU_BURN
#define ENGINE_TAG_SHIFTING
#define ENGINE_TAG_SHIFTING_DELTARPM
#define ENGINE_TAG_BRAKES
#define ENGINE_TAG_ENGINE_EFFICIENCY
#define ENGINE_TAG_SHIFTING_RPM
#define ENGINE_TAG_VEHICLE_ID
#define ENGINE_TAG_VEHICLES
#define ENGINE_TAG_ENGINE_TYPE
#define ENGINE_TAG_WHEELS_CR2
#define ENGINE_TAG_WHEELS_CR1
void computeCoefficients()
struct PolynomialEngineModelRpmToHp engineMapping
double tiresFrictionCoefficient
struct GearShiftingRules shiftingRule
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
const EngineParameters & getEngineParameters()
std::string parseStringAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
virtual ~VehicleEngineHandler()
Destructor.
std::vector< double > gearRatios
void loadEngineModelData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
EngineParameters engineParameters
void loadDifferentialData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadGearData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
VehicleEngineHandler(const std::string &toLoad)
double parsePolynomialCoefficient(int index, const XERCES_CPP_NAMESPACE::Attributes &attrs)
int parseIntAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadShiftingData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadWheelsData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadMassData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
int existsAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
void loadEngineData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void loadBrakesData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
void raiseUnknownTagError(std::string tag)
double parseDoubleAttribute(std::string tag, const char *attribute, const XERCES_CPP_NAMESPACE::Attributes &attrs)
void raiseMissingAttributeError(std::string tag, std::string attribute)
std::string vehicleToLoad
void loadDragData(const XERCES_CPP_NAMESPACE::Attributes &attrs)
double x[MAX_POLY_DEGREE]