31 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) {
32 transmissionGearRatios.size();
58 std::vector<std::string> pollutantIdentifier;
59 std::vector<std::vector<double> > pollutantMeasures;
60 std::vector<std::vector<double> > normalizedPollutantMeasures;
63 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
64 pollutantIdentifier.push_back(headerLinePollutants[i]);
68 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
69 pollutantMeasures.push_back(std::vector<double>());
70 normalizedPollutantMeasures.push_back(std::vector<double>());
77 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
78 if (matrixSpeedRotational[i].size() != 3) {
82 _speedPatternRotational.push_back(matrixSpeedRotational[i][0] / 3.6);
83 _gearTransmissionCurve.push_back(matrixSpeedRotational[i][1]);
90 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
91 if (normedDragTable[i].size() != 2) {
96 _dragNormTable.push_back(normedDragTable[i][1]);
104 for (
int i = 0; i < (int)matrixFC.size(); i++) {
105 if (matrixFC[i].size() != 2) {
109 _powerPatternFC.push_back(matrixFC[i][0] *
_ratedPower);
110 _normalizedPowerPatternFC.push_back(matrixFC[i][0]);
111 _cepCurveFC.push_back(matrixFC[i][1] * _ratedPower);
112 _normedCepCurveFC.push_back(matrixFC[i][1]);
118 double pollutantMultiplyer = 1;
137 int headerCount = (int)headerLinePollutants.size();
138 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
139 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
140 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
149 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
150 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
158 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
160 _cepNormalizedCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], normalizedPollutantMeasures[i]));
161 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
231 std::vector<double> emissionCurve;
232 std::vector<double> powerPattern;
240 if (pollutant ==
"FC") {
245 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
254 if (pollutant ==
"FC") {
260 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
268 if (emissionCurve.empty()) {
269 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
272 if (emissionCurve.size() == 1) {
273 return emissionCurve[0];
277 if (power <= powerPattern.front()) {
278 return emissionCurve[0];
282 if (power >= powerPattern.back()) {
283 return emissionCurve.back();
287 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
295 double fCCO2 = 0.273;
318 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
322 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
347 if (speed >= 10e-2) {
373 if (value <= pattern.front()) {
379 if (value >= pattern.back()) {
380 lowerIndex = (int)pattern.size() - 1;
381 upperIndex = (int)pattern.size() - 1;
386 int middleIndex = ((int)pattern.size() - 1) / 2;
387 upperIndex = (int)pattern.size() - 1;
390 while (upperIndex - lowerIndex > 1) {
391 if (pattern[middleIndex] == value) {
392 lowerIndex = middleIndex;
393 upperIndex = middleIndex;
396 else if (pattern[middleIndex] < value) {
397 lowerIndex = middleIndex;
398 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
401 upperIndex = middleIndex;
402 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
406 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
416 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)
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 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)