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);