28 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) {
29 transmissionGearRatios.size();
55 std::vector<std::string> pollutantIdentifier;
56 std::vector<std::vector<double> > pollutantMeasures;
57 std::vector<std::vector<double> > normalizedPollutantMeasures;
60 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
61 pollutantIdentifier.push_back(headerLinePollutants[i]);
65 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
66 pollutantMeasures.push_back(std::vector<double>());
67 normalizedPollutantMeasures.push_back(std::vector<double>());
74 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
75 if (matrixSpeedRotational[i].size() != 3) {
87 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
88 if (normedDragTable[i].size() != 2) {
101 for (
int i = 0; i < (int)matrixFC.size(); i++) {
102 if (matrixFC[i].size() != 2) {
115 double pollutantMultiplyer = 1;
134 int headerCount = (int)headerLinePollutants.size();
135 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
136 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
137 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
146 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
147 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
155 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
158 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
228 std::vector<double> emissionCurve;
229 std::vector<double> powerPattern;
237 if (pollutant ==
"FC") {
242 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
251 if (pollutant ==
"FC") {
257 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
265 if (emissionCurve.empty()) {
266 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
269 if (emissionCurve.size() == 1) {
270 return emissionCurve[0];
274 if (power <= powerPattern.front()) {
275 return emissionCurve[0];
279 if (power >= powerPattern.back()) {
280 return emissionCurve.back();
284 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
292 double fCCO2 = 0.273;
315 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
319 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
344 if (speed >= 10e-2) {
370 if (value <= pattern.front()) {
376 if (value >= pattern.back()) {
377 lowerIndex = (int)pattern.size() - 1;
378 upperIndex = (int)pattern.size() - 1;
383 int middleIndex = ((int)pattern.size() - 1) / 2;
384 upperIndex = (int)pattern.size() - 1;
387 while (upperIndex - lowerIndex > 1) {
388 if (pattern[middleIndex] == value) {
389 lowerIndex = middleIndex;
390 upperIndex = middleIndex;
393 else if (pattern[middleIndex] < value) {
394 lowerIndex = middleIndex;
395 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
398 upperIndex = middleIndex;
399 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
403 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
413 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);