8 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) {
9 transmissionGearRatios.size();
35 std::vector<std::string> pollutantIdentifier;
36 std::vector<std::vector<double> > pollutantMeasures;
37 std::vector<std::vector<double> > normalizedPollutantMeasures;
40 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
41 pollutantIdentifier.push_back(headerLinePollutants[i]);
45 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
46 pollutantMeasures.push_back(std::vector<double>());
47 normalizedPollutantMeasures.push_back(std::vector<double>());
54 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
55 if (matrixSpeedRotational[i].size() != 3) {
59 _speedPatternRotational.push_back(matrixSpeedRotational[i][0] / 3.6);
60 _gearTransmissionCurve.push_back(matrixSpeedRotational[i][1]);
67 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
68 if (normedDragTable[i].size() != 2) {
73 _dragNormTable.push_back(normedDragTable[i][1]);
81 for (
int i = 0; i < (int)matrixFC.size(); i++) {
82 if (matrixFC[i].size() != 2) {
86 _powerPatternFC.push_back(matrixFC[i][0] *
_ratedPower);
87 _normalizedPowerPatternFC.push_back(matrixFC[i][0]);
88 _cepCurveFC.push_back(matrixFC[i][1] * _ratedPower);
89 _normedCepCurveFC.push_back(matrixFC[i][1]);
95 double pollutantMultiplyer = 1;
114 int headerCount = (int)headerLinePollutants.size();
115 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
116 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
117 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
126 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
127 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
135 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
137 _cepNormalizedCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], normalizedPollutantMeasures[i]));
138 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
208 std::vector<double> emissionCurve;
209 std::vector<double> powerPattern;
217 if (pollutant ==
"FC") {
222 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
231 if (pollutant ==
"FC") {
237 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
245 if (emissionCurve.empty()) {
246 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
249 if (emissionCurve.size() == 1) {
250 return emissionCurve[0];
254 if (power <= powerPattern.front()) {
255 return emissionCurve[0];
259 if (power >= powerPattern.back()) {
260 return emissionCurve.back();
264 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
272 double fCCO2 = 0.273;
290 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
294 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
319 if (speed >= 10e-2) {
345 if (value <= pattern.front()) {
351 if (value >= pattern.back()) {
352 lowerIndex = (int)pattern.size() - 1;
353 upperIndex = (int)pattern.size() - 1;
358 int middleIndex = ((int)pattern.size() - 1) / 2;
359 upperIndex = (int)pattern.size() - 1;
362 while (upperIndex - lowerIndex > 1) {
363 if (pattern[middleIndex] == value) {
364 lowerIndex = middleIndex;
365 upperIndex = middleIndex;
368 else if (pattern[middleIndex] < value) {
369 lowerIndex = middleIndex;
370 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
373 upperIndex = middleIndex;
374 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
378 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
388 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
static double _DRIVE_TRAIN_EFFICIENCY
void setErrMsg(const std::string &value)
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
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
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 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)