docs & refactoring

This commit is contained in:
rusefillc 2021-12-26 12:33:32 -05:00
parent 82ac182ca6
commit 9f8ccececd
8 changed files with 16 additions and 16 deletions

View File

@ -307,7 +307,7 @@ expected<percent_t> EtbController::getSetpointEtb() const {
engineConfiguration->useETBforIdleControl ? m_idlePosition : 0,
100
);
percent_t etbIdleAddition = 0.01f * engineConfiguration->etbIdleThrottleRange * etbIdlePosition;
percent_t etbIdleAddition = PERCENT_DIV * engineConfiguration->etbIdleThrottleRange * etbIdlePosition;
// Interpolate so that the idle adder just "compresses" the throttle's range upward.
// [0, 100] -> [idle, 100]

View File

@ -20,18 +20,18 @@ float AirmassVeModelBase::getVe(int rpm, float load) const {
// Override the load value if necessary
load = getVeLoadAxis(load);
float ve = m_veTable->getValue(rpm, load);
percent_t ve = m_veTable->getValue(rpm, load);
auto tps = Sensor::get(SensorType::Tps1);
// get VE from the separate table for Idle if idling
if (engine->module<IdleController>().unmock().isIdlingOrTaper() &&
tps && engineConfiguration->useSeparateVeForIdle) {
float idleVe = interpolate2d(rpm, config->idleVeBins, config->idleVe);
percent_t idleVe = interpolate2d(rpm, config->idleVeBins, config->idleVe);
// interpolate between idle table and normal (running) table using TPS threshold
ve = interpolateClamped(0.0f, idleVe, engineConfiguration->idlePidDeactivationTpsThreshold, ve, tps.Value);
}
engine->engineState.currentVe = ve;
engine->engineState.currentVeLoad = load;
return ve * 0.01f;
return ve * PERCENT_DIV;
}

View File

@ -24,13 +24,13 @@ AirmassResult MafAirmass::getAirmassImpl(float massAirFlow, int rpm) const {
float revsPerSecond = rpm / 60.0f;
float airPerRevolution = gramPerSecond / revsPerSecond;
// Now we have to divide among cylinders - on a 4 stroke, half of the cylinders happen every rev
// This math is floating point to work properly on engines with odd cyl count
// Now we have to divide among cylinders - on a 4 stroke, half of the cylinders happen every revolution
// This math is floating point to work properly on engines with odd cylinder count
float halfCylCount = engineConfiguration->specs.cylindersCount / 2.0f;
float cylinderAirmass = airPerRevolution / halfCylCount;
//Create % load for fuel table using relative naturally aspiratedcylinder filling
//Create % load for fuel table using relative naturally aspirated cylinder filling
float airChargeLoad = 100 * cylinderAirmass / engine->standardAirCharge;
//Correct air mass by VE table

View File

@ -19,7 +19,7 @@
*/
#define AIR_R 0.28705f
float idealGasLaw(float volume, float pressure, float temperature) {
mass_t idealGasLaw(float volume, float pressure, float temperature) {
return volume * pressure / (AIR_R * temperature);
}

View File

@ -11,7 +11,10 @@
#include "airmass.h"
float idealGasLaw(float volume, float pressure, float temperature);
/**
* @returns mass of air in cylinder
*/
mass_t idealGasLaw(float volume, float pressure, float temperature);
class SpeedDensityBase : public AirmassVeModelBase {
protected:

View File

@ -2,7 +2,7 @@
class ValueProvider3D;
using mass_t = float;
#include "rusefi_types.h"
struct IFuelComputer {
virtual mass_t getCycleFuel(mass_t airmass, int rpm, float load) const = 0;

View File

@ -18,12 +18,6 @@
// https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename
#include <rusefi_hw_enums.h>
// I believe that TunerStudio curve editor has a bug with F32 support
// because of that bug we cannot have '1.05' for 5% extra multiplier
/**
* *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/
*/
#define PERCENT_MULT 100.0f
#define PERCENT_DIV 0.01f

View File

@ -77,6 +77,9 @@ typedef efitime_t efitick_t;
typedef float angle_t;
// mass in grams
typedef float mass_t;
// temperature, in Celsius
typedef float temperature_t;
typedef float floatms_t;