38 double vehicleMass,
double vehicleLoading,
double vehicleMassRot,
39 double crossArea,
double cdValue,
40 double f0,
double f1,
double f2,
double f3,
double f4,
41 double ratedPower,
double pNormV0,
double pNormP0,
double pNormV1,
double pNormP1,
42 double axleRatio,
double engineIdlingSpeed,
double engineRatedSpeed,
double effectiveWheelDiameter,
44 const std::string& vehicleFuelType,
45 const std::vector< std::vector<double> >& matrixFC,
46 const std::vector<std::string>& headerLinePollutants,
47 const std::vector< std::vector<double> >& matrixPollutants,
48 const std::vector< std::vector<double> >& matrixSpeedRotational,
49 const std::vector< std::vector<double> >& normedDragTable,
50 const std::vector<double>& idlingValuesPollutants) {
78 std::vector<std::string> pollutantIdentifier;
79 std::vector< std::vector<double> > pollutantMeasures;
80 std::vector<std::vector<double> > normalizedPollutantMeasures;
83 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
84 pollutantIdentifier.push_back(headerLinePollutants[i]);
92 for (
int i = 0; i < (int)headerLinePollutants.size(); i++) {
93 pollutantMeasures.push_back(std::vector<double>());
94 normalizedPollutantMeasures.push_back(std::vector<double>());
101 for (
int i = 0; i < (int)matrixSpeedRotational.size(); i++) {
102 if (matrixSpeedRotational[i].size() != 3) {
103 throw InvalidArgument(
"Error loading vehicle file for: " + emissionClassIdentifier);
114 for (
int i = 0; i < (int) normedDragTable.size(); i++) {
115 if (normedDragTable[i].size() != 2) {
129 for (
int i = 0; i < (int)matrixFC.size(); i++) {
130 if (matrixFC[i].size() != 2) {
131 throw InvalidArgument(
"Error loading vehicle file for: " + emissionClassIdentifier);
142 double pollutantMultiplyer = 1;
157 const int headerCount = (int)headerLinePollutants.size();
158 for (
int i = 0; i < (int)matrixPollutants.size(); i++) {
159 for (
int j = 0; j < (int)matrixPollutants[i].size(); j++) {
160 if ((
int)matrixPollutants[i].size() != headerCount + 1) {
168 pollutantMeasures[j - 1].push_back(matrixPollutants[i][j] * pollutantMultiplyer);
169 normalizedPollutantMeasures[j - 1].push_back(matrixPollutants[i][j]);
174 for (
int i = 0; i < (int) headerLinePollutants.size(); i++) {
197 std::vector<double> emissionCurve;
198 std::vector<double> powerPattern;
201 if (pollutant ==
"FC") {
208 if (pollutant ==
"FC") {
218 throw InvalidArgument(
"Emission pollutant " + pollutant +
" not found!");
233 if (emissionCurve.size() == 0) {
234 throw InvalidArgument(
"Empty emission curve for " + pollutant +
" found!");
237 if (emissionCurve.size() == 1) {
238 return emissionCurve[0];
242 if (power <= powerPattern.front()) {
243 double calcEmission =
PHEMCEP::Interpolate(power, powerPattern[0], powerPattern[1], emissionCurve[0], emissionCurve[1]);
245 if (calcEmission < 0) {
254 if (power >= powerPattern.back()) {
255 return PHEMCEP::Interpolate(power, powerPattern[powerPattern.size() - 2], powerPattern.back(), emissionCurve[emissionCurve.size() - 2], emissionCurve.back());
264 return PHEMCEP::Interpolate(power, powerPattern[lowerIndex], powerPattern[upperIndex], emissionCurve[lowerIndex], emissionCurve[upperIndex]);
274 return e1 + (px - p1) / (p2 - p1) * (e2 - e1);
299 if (speed >= 10e-2) {
358 if (value <= pattern.front()) {
365 if (value >= pattern.back()) {
366 lowerIndex = (int)pattern.size() - 1;
367 upperIndex = (int)pattern.size() - 1;
372 int middleIndex = ((int)pattern.size() - 1) / 2;
373 upperIndex = (int)pattern.size() - 1;
376 while (upperIndex - lowerIndex > 1) {
377 if (pattern[middleIndex] == value) {
378 lowerIndex = middleIndex;
379 upperIndex = middleIndex;
381 }
else if (pattern[middleIndex] < value) {
382 lowerIndex = middleIndex;
383 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
385 upperIndex = middleIndex;
386 middleIndex = (upperIndex - lowerIndex) / 2 + lowerIndex;
390 if (pattern[lowerIndex] <= value && value < pattern[upperIndex]) {
393 throw ProcessError(
"Error during calculation of position in pattern!");
const double AIR_DENSITY_CONST
const double ZERO_SPEED_ACCURACY
const double SPEED_DCEL_MIN
const double GRAVITY_CONST
const double NORMALIZING_ACCELARATION
const double NORMALIZING_SPEED
#define UNUSED_PARAMETER(x)
double _resistanceF3
Rolling resistance f3.
double _pNormV0
Step functions parameter for maximum rated power.
void FindLowerUpperInPattern(int &lowerIndex, int &upperIndex, const std::vector< double > &pattern, double value) const
Finds bounding upper and lower index in pattern for value.
double _effictiveWheelDiameter
std::vector< double > _speedCurveRotational
StringBijection< std::vector< double > > _cepCurvePollutants
double _vehicleLoading
vehicle loading
std::string _vehicleFuelType
double CalcPower(double v, double a, double slope, double vehicleLoading=0) const
Returns the power of used for a vehicle at state v,a, slope and loading.
double GetDragCoeffecient(double nNorm) const
double _pNormV1
Step functions parameter for maximum rated power.
double _pNormP1
Step functions parameter for maximum rated power.
double _resistanceF2
Rolling resistance f2.
std::vector< double > _nNormTable
double _engineIdlingSpeed
double _resistanceF4
Rolling resistance f4.
double _resistanceF1
Rolling resistance f1.
double GetEmission(const std::string &pollutantIdentifier, double power, double speed, bool normalized=false) const
Returns a emission measure for power[kW] level.
double _resistanceF0
Rolling resistance f0.
std::vector< double > _normedCepCurveFC
std::vector< double > _cepCurveFC
double GetDecelCoast(double speed, double acc, double gradient, double vehicleLoading) const
std::vector< double > _powerPatternPollutants
std::vector< double > _normailzedPowerPatternPollutants
double _massVehicle
vehicle mass
double _pNormP0
Step functions parameter for maximum rated power.
SUMOEmissionClass _emissionClass
PHEM emission class of vehicle.
double GetMaxAccel(double v, double a, double gradient, double vehicleLoading=0) const
Returns the maximum accelaration for a vehicle at state v,a, slope and loading.
std::vector< double > _dragNormTable
NormalizingType _normalizingType
std::vector< double > _speedPatternRotational
double Interpolate(double px, double p1, double p2, double e1, double e2) const
Interpolates emission linearly between two known power-emission pairs.
std::vector< double > _powerPatternFC
StringBijection< double > _idlingValuesPollutants
double GetRotationalCoeffecient(double speed) const
Calculates rotational index for speed.
int _sizeOfPatternPollutants
double GetGearCoeffecient(double speed) const
double _ratedPower
rated power of vehicle
double _massRot
rotational mass of vehicle
std::vector< double > _gearTransmissionCurve
StringBijection< std::vector< double > > _normalizedCepCurvePollutants
double GetPMaxNorm(double speed) const
Calculates maximum available rated power for speed.
std::vector< double > _normalizedPowerPatternFC
PHEMCEP(bool heavyVehicel, SUMOEmissionClass emissionClass, const std::string &emissionClassIdentifier, double vehicleMass, double vehicleLoading, double vehicleMassRot, double crossArea, double cdValue, double f0, double f1, double f2, double f3, double f4, double ratedPower, double pNormV0, double pNormP0, double pNormV1, double pNormP1, double axleRatio, double engineIdlingSpeed, double engineRatedSpeed, double effectiveWheelDiameter, double idlingFC, const std::string &vehicleFuelType, const std::vector< std::vector< double > > &matrixFC, const std::vector< std::string > &headerLinePollutants, const std::vector< std::vector< double > > &matrixPollutants, const std::vector< std::vector< double > > &matrixSpeedRotational, const std::vector< std::vector< double > > &normedDragTable, const std::vector< double > &idlingValuesPollutants)
double _crossSectionalArea
crosssectional area of vehicle
bool hasString(const std::string &str) const
T get(const std::string &str) const
void insert(const std::string str, const T key, bool checkDuplicates=true)