mirror of https://github.com/rusefi/rusefi-1.git
docs & refactoring
This commit is contained in:
parent
82ac182ca6
commit
9f8ccececd
|
@ -307,7 +307,7 @@ expected<percent_t> EtbController::getSetpointEtb() const {
|
||||||
engineConfiguration->useETBforIdleControl ? m_idlePosition : 0,
|
engineConfiguration->useETBforIdleControl ? m_idlePosition : 0,
|
||||||
100
|
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.
|
// Interpolate so that the idle adder just "compresses" the throttle's range upward.
|
||||||
// [0, 100] -> [idle, 100]
|
// [0, 100] -> [idle, 100]
|
||||||
|
|
|
@ -20,18 +20,18 @@ float AirmassVeModelBase::getVe(int rpm, float load) const {
|
||||||
// Override the load value if necessary
|
// Override the load value if necessary
|
||||||
load = getVeLoadAxis(load);
|
load = getVeLoadAxis(load);
|
||||||
|
|
||||||
float ve = m_veTable->getValue(rpm, load);
|
percent_t ve = m_veTable->getValue(rpm, load);
|
||||||
|
|
||||||
auto tps = Sensor::get(SensorType::Tps1);
|
auto tps = Sensor::get(SensorType::Tps1);
|
||||||
// get VE from the separate table for Idle if idling
|
// get VE from the separate table for Idle if idling
|
||||||
if (engine->module<IdleController>().unmock().isIdlingOrTaper() &&
|
if (engine->module<IdleController>().unmock().isIdlingOrTaper() &&
|
||||||
tps && engineConfiguration->useSeparateVeForIdle) {
|
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
|
// interpolate between idle table and normal (running) table using TPS threshold
|
||||||
ve = interpolateClamped(0.0f, idleVe, engineConfiguration->idlePidDeactivationTpsThreshold, ve, tps.Value);
|
ve = interpolateClamped(0.0f, idleVe, engineConfiguration->idlePidDeactivationTpsThreshold, ve, tps.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->engineState.currentVe = ve;
|
engine->engineState.currentVe = ve;
|
||||||
engine->engineState.currentVeLoad = load;
|
engine->engineState.currentVeLoad = load;
|
||||||
return ve * 0.01f;
|
return ve * PERCENT_DIV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,13 +24,13 @@ AirmassResult MafAirmass::getAirmassImpl(float massAirFlow, int rpm) const {
|
||||||
float revsPerSecond = rpm / 60.0f;
|
float revsPerSecond = rpm / 60.0f;
|
||||||
float airPerRevolution = gramPerSecond / revsPerSecond;
|
float airPerRevolution = gramPerSecond / revsPerSecond;
|
||||||
|
|
||||||
// Now we have to divide among cylinders - on a 4 stroke, half of the cylinders happen every rev
|
// 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 cyl count
|
// This math is floating point to work properly on engines with odd cylinder count
|
||||||
float halfCylCount = engineConfiguration->specs.cylindersCount / 2.0f;
|
float halfCylCount = engineConfiguration->specs.cylindersCount / 2.0f;
|
||||||
|
|
||||||
float cylinderAirmass = airPerRevolution / halfCylCount;
|
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;
|
float airChargeLoad = 100 * cylinderAirmass / engine->standardAirCharge;
|
||||||
|
|
||||||
//Correct air mass by VE table
|
//Correct air mass by VE table
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
#define AIR_R 0.28705f
|
#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);
|
return volume * pressure / (AIR_R * temperature);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
|
|
||||||
#include "airmass.h"
|
#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 {
|
class SpeedDensityBase : public AirmassVeModelBase {
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class ValueProvider3D;
|
class ValueProvider3D;
|
||||||
|
|
||||||
using mass_t = float;
|
#include "rusefi_types.h"
|
||||||
|
|
||||||
struct IFuelComputer {
|
struct IFuelComputer {
|
||||||
virtual mass_t getCycleFuel(mass_t airmass, int rpm, float load) const = 0;
|
virtual mass_t getCycleFuel(mass_t airmass, int rpm, float load) const = 0;
|
||||||
|
|
|
@ -18,12 +18,6 @@
|
||||||
// https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename
|
// https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename
|
||||||
#include <rusefi_hw_enums.h>
|
#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_MULT 100.0f
|
||||||
#define PERCENT_DIV 0.01f
|
#define PERCENT_DIV 0.01f
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,9 @@ typedef efitime_t efitick_t;
|
||||||
|
|
||||||
typedef float angle_t;
|
typedef float angle_t;
|
||||||
|
|
||||||
|
// mass in grams
|
||||||
|
typedef float mass_t;
|
||||||
|
|
||||||
// temperature, in Celsius
|
// temperature, in Celsius
|
||||||
typedef float temperature_t;
|
typedef float temperature_t;
|
||||||
typedef float floatms_t;
|
typedef float floatms_t;
|
||||||
|
|
Loading…
Reference in New Issue