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 transmissionGearRatios.size();
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) {
83 _speedPatternRotational.push_back(matrixSpeedRotational[i][0] / 3.6);
84 _gearTransmissionCurve.push_back(matrixSpeedRotational[i][1]);
91 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
92 if (normedDragTable[i].size() != 2) {
97 _dragNormTable.push_back(normedDragTable[i][1]);
105 for (
int i = 0; i < (int)matrixFC.size(); i++) {
106 if (matrixFC[i].size() != 2) {
110 _powerPatternFC.push_back(matrixFC[i][0] *
_ratedPower);
111 _normalizedPowerPatternFC.push_back(matrixFC[i][0]);
112 _cepCurveFC.push_back(matrixFC[i][1] * _ratedPower);
113 _normedCepCurveFC.push_back(matrixFC[i][1]);
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++) {
161 _cepNormalizedCurvePollutants.insert(std::make_pair(pollutantIdentifier[i], normalizedPollutantMeasures[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;
314 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
318 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
343 if (speed >= 10e-2) {
369 if (value <= pattern.front()) {
375 if (value >= pattern.back()) {
376 lowerIndex = (int)pattern.size() - 1;
377 upperIndex = (int)pattern.size() - 1;
382 int middleIndex = ((int)pattern.size() - 1) / 2;
383 upperIndex = (int)pattern.size() - 1;
386 while (upperIndex - lowerIndex > 1) {
387 if (pattern[middleIndex] == value) {
388 lowerIndex = middleIndex;
389 upperIndex = middleIndex;
392 else if (pattern[middleIndex] < value) {
393 lowerIndex = middleIndex;
394 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
397 upperIndex = middleIndex;
398 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
402 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
412 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
const NormalizingType & getNormalizingTypeX() const
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)
const bool & getHeavyVehicle() const
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
void setErrMsg(const std::string &value)
void setRatedPower(const double &value)
void InitializeInstanceFields()
double GetRotationalCoeffecient(double speed)
double _engineIdlingSpeed
std::map< std::string, double > _idlingValuesPollutants
std::vector< double > _normedCepCurveFC
static const double NORMALIZING_SPEED
NormalizingType _normalizingType
std::map< std::string, std::vector< double > > _cepNormalizedCurvePollutants
const double & getNormalizingPower() const
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
double Interpolate(double px, double p1, double p2, double e1, double e2)
static const double GRAVITY_CONST
const double & getDrivingPower() const
double _crossSectionalArea
std::vector< double > _powerPatternPollutants
static double _DRIVE_TRAIN_EFFICIENCY
const double & getRatedPower() const
static const double ZERO_SPEED_ACCURACY
double CalcPower(double speed, double acc, double gradient)
const std::string & getFuelType() const
static const double AIR_DENSITY_CONST
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, std::vector< double > &pattern, double value)
double GetCO2Emission(double _FC, double _CO, double _HC, Helpers *VehicleClass)