29 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) {
30 transmissionGearRatios.size();
56 std::vector<std::string> pollutantIdentifier;
57 std::vector<std::vector<double> > pollutantMeasures;
58 std::vector<std::vector<double> > normalizedPollutantMeasures;
61 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
62 pollutantIdentifier.push_back(headerLinePollutants[i]);
66 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
67 pollutantMeasures.push_back(std::vector<double>());
68 normalizedPollutantMeasures.push_back(std::vector<double>());
75 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
76 if (matrixSpeedRotational[i].size() != 3) {
88 for (
int i = 0; i < (int)normedDragTable.size(); i++) {
89 if (normedDragTable[i].size() != 2) {
102 for (
int i = 0; i < (int)matrixFC.size(); i++) {
103 if (matrixFC[i].size() != 2) {
116 double pollutantMultiplyer = 1;
135 int headerCount = (int)headerLinePollutants.size();
136 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
137 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
138 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
147 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
148 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
156 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
159 _idlingValuesPollutants.insert(std::make_pair(pollutantIdentifier[i], idlingPollutants[i] * pollutantMultiplyer));
229 std::vector<double> emissionCurve;
230 std::vector<double> powerPattern;
238 if (pollutant ==
"FC") {
243 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
252 if (pollutant ==
"FC") {
258 VehicleClass->
setErrMsg(std::string(
"Emission pollutant ") + pollutant + std::string(
" not found!"));
266 if (emissionCurve.empty()) {
267 VehicleClass->
setErrMsg(std::string(
"Empty emission curve for ") + pollutant + std::string(
" found!"));
270 if (emissionCurve.size() == 1) {
271 return emissionCurve[0];
275 if (power <= powerPattern.front()) {
276 return emissionCurve[0];
280 if (power >= powerPattern.back()) {
281 return emissionCurve.back();
285 return Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
293 double fCCO2 = 0.273;
316 VehicleClass->
setErrMsg(std::string(
"The propolsion type is not known! (") +
_fuelType + std::string(
")"));
320 return (_FC * fCBr - _CO * fCCO - _HC * fCHC) / fCCO2;
345 if (speed >= 10e-2) {
371 if (value <= pattern.front()) {
377 if (value >= pattern.back()) {
378 lowerIndex = (int)pattern.size() - 1;
379 upperIndex = (int)pattern.size() - 1;
384 int middleIndex = ((int)pattern.size() - 1) / 2;
385 upperIndex = (int)pattern.size() - 1;
388 while (upperIndex - lowerIndex > 1) {
389 if (pattern[middleIndex] == value) {
390 lowerIndex = middleIndex;
391 upperIndex = middleIndex;
394 else if (pattern[middleIndex] < value) {
395 lowerIndex = middleIndex;
396 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
399 upperIndex = middleIndex;
400 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
404 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
414 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);