32 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) {
33 (void)transmissionGearRatios;
59 std::vector<std::string> pollutantIdentifier;
60 std::vector<std::vector<double> > pollutantMeasures;
61 std::vector<std::vector<double> > normalizedPollutantMeasures;
64 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
65 pollutantIdentifier.push_back(headerLinePollutants[i]);
69 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
70 pollutantMeasures.push_back(std::vector<double>());
71 normalizedPollutantMeasures.push_back(std::vector<double>());
78 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
79 if (matrixSpeedRotational[i].size() != 3) {
91 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
92 if (normedDragTable[i].size() != 2) {
105 for (
int i = 0; i < (int)matrixFC.size(); i++) {
106 if (matrixFC[i].size() != 2) {
119 double pollutantMultiplyer = 1;
138 int headerCount = (int)headerLinePollutants.size();
139 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
140 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
141 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
150 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
151 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
159 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
162 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
232 std::vector<double> emissionCurve;
233 std::vector<double> powerPattern;
241 if (pollutant ==
"FC") {
246 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
255 if (pollutant ==
"FC") {
261 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
269 if (emissionCurve.empty()) {
270 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
273 if (emissionCurve.size() == 1) {
274 return emissionCurve[0];
278 if (power <= powerPattern.front()) {
279 return emissionCurve[0];
283 if (power >= powerPattern.back()) {
284 return emissionCurve.back();
288 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
296 double fCCO2 = 0.273;
319 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
323 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
348 if (speed >= 10e-2) {
374 if (value <= pattern.front()) {
380 if (value >= pattern.back()) {
381 lowerIndex = (int)pattern.size() - 1;
382 upperIndex = (int)pattern.size() - 1;
387 int middleIndex = ((int)pattern.size() - 1) / 2;
388 upperIndex = (int)pattern.size() - 1;
391 while (upperIndex - lowerIndex > 1) {
392 if (pattern[middleIndex] == value) {
393 lowerIndex = middleIndex;
394 upperIndex = middleIndex;
397 else if (pattern[middleIndex] < value) {
398 lowerIndex = middleIndex;
399 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
402 upperIndex = middleIndex;
403 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
407 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
417 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
std::vector< double > _powerPatternPollutants
std::vector< double > _dragNormTable
const double & getDrivingPower() const
std::vector< double > _powerPatternFC
double GetPMaxNorm(double speed)
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 > _nNormTable
const NormalizingType & getNormalizingTypeX() const
double _effectiveWheelDiameter
void setDrivingPower(const double &value)
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
std::map< std::string, double > _idlingValuesPollutants
double GetMaxAccel(double speed, double gradient)
const double & getNormalizingPower() const
std::vector< double > _speedPatternRotational
std::vector< double > _normalizedPowerPatternFC
NormalizingType _normalizingType
std::vector< double > _cepCurveFC
std::vector< double > _normedCepCurveFC
std::vector< double > _normailzedPowerPatternPollutants
double _crossSectionalArea
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
std::vector< double > _gearTransmissionCurve
void setRatedPower(const double &value)
double GetRotationalCoeffecient(double speed)
double CalcEngPower(double power)
double GetEmission(const std::string &pollutant, double power, double speed, Helpers *VehicleClass)
std::vector< double > _speedCurveRotational
double CalcPower(double speed, double acc, double gradient)
void InitializeInstanceFields()
const std::string & getFuelType() const
const bool & getHeavyVehicle() const
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)
double Interpolate(double px, double p1, double p2, double e1, double e2)
double _engineIdlingSpeed
@ NormalizingType_RatedPower
@ NormalizingType_DrivingPower
std::map< std::string, std::vector< double > > _cepCurvePollutants
const double & getRatedPower() const
double GetDecelCoast(double speed, double acc, double gradient)
static const std::string strBEV
static const double AIR_DENSITY_CONST
static const double SPEED_DCEL_MIN
static const std::string strLPG
static const double & getDRIVE_TRAIN_EFFICIENCY()
get drive train efficiency
static const double ZERO_SPEED_ACCURACY
static const double GRAVITY_CONST
static const std::string strDiesel
static const double NORMALIZING_ACCELARATION
static const std::string strGasoline
static const std::string strCNG
static const double NORMALIZING_SPEED
void setErrMsg(const std::string &value)