Skip to content

Commit

Permalink
first round of cep refactoring #12 #14285
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Jan 31, 2024
1 parent 051a4b8 commit 67031b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 44 deletions.
40 changes: 3 additions & 37 deletions src/foreign/PHEMlight/V5/cpp/CEP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,8 @@ namespace PHEMlightdllV5 {
}

// looping through matrix and assigning values for pollutants
double pollutantMultiplyer = 1;
setNormalizingPower(CalcPower(Constants::NORMALIZING_SPEED, Constants::NORMALIZING_ACCELARATION, 0, (getCalcType() == "HEV" || getCalcType() == "BEV")));
setDrivingPower(getNormalizingPower());
if (getHeavyVehicle()) {
setNormalizingPower(getRatedPower());
setNormalizingType(eNormalizingType_RatedPower);
pollutantMultiplyer = getRatedPower();
}
else {
setNormalizingPower(getDrivingPower());
setNormalizingType(eNormalizingType_DrivingPower);
}
const double pollutantMultiplyer = getHeavyVehicle() ? getRatedPower() : 1.;
const double normalizingPower = getHeavyVehicle() ? getRatedPower() : CalcPower(Constants::NORMALIZING_SPEED, Constants::NORMALIZING_ACCELARATION, 0, (getCalcType() == "HEV" || getCalcType() == "BEV"));

_powerPatternPollutants = std::vector<double>();
_normailzedPowerPatternPollutants = std::vector<double>();
Expand All @@ -168,7 +158,7 @@ namespace PHEMlightdllV5 {

if (j == 0) {
_normailzedPowerPatternPollutants.push_back(matrixPollutants[i][j]);
_powerPatternPollutants.push_back(matrixPollutants[i][j] * getNormalizingPower());
_powerPatternPollutants.push_back(matrixPollutants[i][j] * normalizingPower);
}
else {
pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
Expand Down Expand Up @@ -213,14 +203,6 @@ namespace PHEMlightdllV5 {
privateCalcType = value;
}

const CEP::eNormalizingType& CEP::getNormalizingType() const {
return privateNormalizingType;
}

void CEP::setNormalizingType(const eNormalizingType& value) {
privateNormalizingType = value;
}

const double& CEP::getRatedPower() const {
return privateRatedPower;
}
Expand All @@ -229,22 +211,6 @@ namespace PHEMlightdllV5 {
privateRatedPower = value;
}

const double& CEP::getNormalizingPower() const {
return privateNormalizingPower;
}

void CEP::setNormalizingPower(const double& value) {
privateNormalizingPower = value;
}

const double& CEP::getDrivingPower() const {
return privateDrivingPower;
}

void CEP::setDrivingPower(const double& value) {
privateDrivingPower = value;
}

double CEP::CalcPower(double speed, double acc, double gradient, bool HBEV) {
//Declaration
double power = 0;
Expand Down
7 changes: 0 additions & 7 deletions src/foreign/PHEMlight/V5/cpp/CEP.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,8 @@ namespace PHEMlightdllV5 {
void setCalcType(const std::string& value);

public:
const eNormalizingType& getNormalizingType() const;
void setNormalizingType(const eNormalizingType& value);

const double& getRatedPower() const;
void setRatedPower(const double& value);
const double& getNormalizingPower() const;
void setNormalizingPower(const double& value);
const double& getDrivingPower() const;
void setDrivingPower(const double& value);
double getAuxPower() const {
return _auxPower * getRatedPower();
}
Expand Down

0 comments on commit 67031b1

Please sign in to comment.