29 CEP::CEP(
bool heavyVehicle,
double vehicleMass,
double vehicleLoading,
double vehicleMassRot,
double crossArea,
double cWValue,
double f0,
double f1,
double f2,
double f3,
double f4,
double axleRatio, std::vector<double>& transmissionGearRatios,
double auxPower,
double ratedPower,
double engineIdlingSpeed,
double engineRatedSpeed,
double effictiveWheelDiameter,
double pNormV0,
double pNormP0,
double pNormV1,
double pNormP1,
const std::string& vehicelFuelType, std::vector<std::vector<double> >& matrixFC, std::vector<std::string>& headerLinePollutants, std::vector<std::vector<double> >& matrixPollutants, std::vector<std::vector<double> >& matrixSpeedRotational, std::vector<std::vector<double> >& normedDragTable,
double idlingFC, std::vector<double>& idlingPollutants) {
30 transmissionGearRatios.size();
56 std::vector<std::string> pollutantIdentifier;
57 std::vector<std::vector<double> > pollutantMeasures;
58 std::vector<std::vector<double> > normalizedPollutantMeasures;
61 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
62 pollutantIdentifier.push_back(headerLinePollutants[i]);
66 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
67 pollutantMeasures.push_back(std::vector<double>());
68 normalizedPollutantMeasures.push_back(std::vector<double>());
75 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
76 if (matrixSpeedRotational[i].size() != 3) {
80 _speedPatternRotational.push_back(matrixSpeedRotational[i][0] / 3.6);
81 _gearTransmissionCurve.push_back(matrixSpeedRotational[i][1]);
88 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
89 if (normedDragTable[i].size() != 2) {
94 _dragNormTable.push_back(normedDragTable[i][1]);
102 for (
int i = 0; i < (int)matrixFC.size(); i++) {
103 if (matrixFC[i].size() != 2) {
107 _powerPatternFC.push_back(matrixFC[i][0] *
_ratedPower);
108 _normalizedPowerPatternFC.push_back(matrixFC[i][0]);
109 _cepCurveFC.push_back(matrixFC[i][1] * _ratedPower);
110 _normedCepCurveFC.push_back(matrixFC[i][1]);
116 double pollutantMultiplyer = 1;
135 int headerCount = (int)headerLinePollutants.size();
136 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
137 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
138 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
147 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
148 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
156 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
158 _cepNormalizedCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], normalizedPollutantMeasures[i]));
159 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
229 std::vector<double> emissionCurve;
230 std::vector<double> powerPattern;
238 if (pollutant ==
"FC") {
243 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
252 if (pollutant ==
"FC") {
258 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
266 if (emissionCurve.empty()) {
267 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
270 if (emissionCurve.size() == 1) {
271 return emissionCurve[0];
275 if (power <= powerPattern.front()) {
276 return emissionCurve[0];
280 if (power >= powerPattern.back()) {
281 return emissionCurve.back();
285 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
293 double fCCO2 = 0.273;
316 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
320 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
345 if (speed >= 10e-2) {
371 if (value <= pattern.front()) {
377 if (value >= pattern.back()) {
378 lowerIndex = (int)pattern.size() - 1;
379 upperIndex = (int)pattern.size() - 1;
384 int middleIndex = ((int)pattern.size() - 1) / 2;
385 upperIndex = (int)pattern.size() - 1;
388 while (upperIndex - lowerIndex > 1) {
389 if (pattern[middleIndex] == value) {
390 lowerIndex = middleIndex;
391 upperIndex = middleIndex;
394 else if (pattern[middleIndex] < value) {
395 lowerIndex = middleIndex;
396 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
399 upperIndex = middleIndex;
400 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
404 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
414 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
std::vector< double > _speedPatternRotational
static const double SPEED_DCEL_MIN
static const std::string strCNG
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
std::vector< double > _normailzedPowerPatternPollutants
std::vector< double > _dragNormTable
std::map< std::string, std::vector< double > > _cepCurvePollutants
void setDrivingPower(const double &value)
double _effectiveWheelDiameter
std::vector< double > _nNormTable
const double & getNormalizingPower() const
void setErrMsg(const std::string &value)
static const std::string strLPG
void setRatedPower(const double &value)
void InitializeInstanceFields()
double GetRotationalCoeffecient(double speed)
const double & getDrivingPower() const
double _engineIdlingSpeed
std::map< std::string, double > _idlingValuesPollutants
std::vector< double > _normedCepCurveFC
static const double NORMALIZING_SPEED
NormalizingType _normalizingType
const double & getRatedPower() const
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
std::vector< double > _normalizedPowerPatternFC
static const double NORMALIZING_ACCELARATION
static const std::string strDiesel
double GetDecelCoast(double speed, double acc, double gradient)
double CalcEngPower(double power)
std::vector< double > _speedCurveRotational
std::vector< double > _gearTransmissionCurve
static const std::string strGasoline
double GetMaxAccel(double speed, double gradient)
CEP(bool heavyVehicle, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cWValue, double f0, double f1, double f2, double f3, double f4, double axleRatio, std::vector< double > &transmissionGearRatios, double auxPower, double ratedPower, double engineIdlingSpeed, double engineRatedSpeed, double effictiveWheelDiameter, double pNormV0, double pNormP0, double pNormV1, double pNormP1, const std::string &vehicelFuelType, std::vector< std::vector< double > > &matrixFC, std::vector< std::string > &headerLinePollutants, std::vector< std::vector< double > > &matrixPollutants, std::vector< std::vector< double > > &matrixSpeedRotational, std::vector< std::vector< double > > &normedDragTable, double idlingFC, std::vector< double > &idlingPollutants)
std::vector< double > _powerPatternFC
std::vector< double > _cepCurveFC
double GetPMaxNorm(double speed)
static const std::string strBEV
const NormalizingType & getNormalizingTypeX() const
double Interpolate(double px, double p1, double p2, double e1, double e2)
static const double GRAVITY_CONST
const bool & getHeavyVehicle() const
double _crossSectionalArea
std::vector< double > _powerPatternPollutants
static double _DRIVE_TRAIN_EFFICIENCY
static const double ZERO_SPEED_ACCURACY
double CalcPower(double speed, double acc, double gradient)
static const double AIR_DENSITY_CONST
const std::string & getFuelType() const
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)