Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/** |
2 |
|
|
|
* @file speed_density_base.cpp |
3 |
|
|
|
* |
4 |
|
|
|
* Base for speed density (ie, ideal gas law) math shared by multiple fueling modes. |
5 |
|
|
|
* |
6 |
|
|
|
* @date July 22, 2020 |
7 |
|
|
|
* @author Matthew Kennedy, (C) 2020 |
8 |
|
|
|
*/ |
9 |
|
|
|
|
10 |
|
|
|
#include "pch.h" |
11 |
|
|
|
#include "speed_density_base.h" |
12 |
|
|
|
|
13 |
|
|
|
/** |
14 |
|
|
|
* Derived via: |
15 |
|
|
|
* (8.31 J K mol^-1) <- ideal gas constant R |
16 |
|
|
|
* / |
17 |
|
|
|
* (28.97g mol^-1) <- molar mass of air |
18 |
|
|
|
* = 0.28705 J*K/g |
19 |
|
|
|
*/ |
20 |
|
|
|
#define AIR_R 0.28705f |
21 |
|
|
|
|
22 |
|
|
2221 |
mass_t idealGasLaw(float volume, float pressure, float temperature) { |
23 |
|
|
2221 |
return volume * pressure / (AIR_R * temperature); |
24 |
|
|
|
} |
25 |
|
|
|
|
26 |
|
|
1091 |
/*static*/ mass_t SpeedDensityBase::getAirmassImpl(float ve, float manifoldPressure, float temperature) { |
27 |
|
|
1091 |
mass_t cycleAir = ve * idealGasLaw(engineConfiguration->displacement, manifoldPressure, temperature); |
28 |
|
|
1091 |
return cycleAir / engineConfiguration->cylindersCount; |
29 |
|
|
|
} |
30 |
|
|
|
|