rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
speed_density_base.cpp
Go to the documentation of this file.
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
22mass_t idealGasLaw(float volume, float pressure, float temperature) {
23 return volume * pressure / (AIR_R * temperature);
24}
25
26/*static*/ mass_t SpeedDensityBase::getAirmassImpl(float ve, float manifoldPressure, float temperature) {
27 mass_t cycleAir = ve * idealGasLaw(engineConfiguration->displacement, manifoldPressure, temperature);
28 return cycleAir / engineConfiguration->cylindersCount;
29}
static mass_t getAirmassImpl(float ve, float manifoldPressure, float temperature)
static constexpr engine_configuration_s * engineConfiguration
float mass_t
mass_t idealGasLaw(float volume, float pressure, float temperature)
mass_t idealGasLaw(float volume, float pressure, float temperature)