2021-10-16 17:16:40 -07:00
|
|
|
/*
|
|
|
|
* @file wall_fuel.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-09-05 00:38:44 -07:00
|
|
|
#include "wall_fuel_state_generated.h"
|
2022-09-05 00:18:32 -07:00
|
|
|
#include "engine_module.h"
|
|
|
|
|
2021-10-16 17:16:40 -07:00
|
|
|
/**
|
|
|
|
* Wall wetting, also known as fuel film
|
|
|
|
* See https://github.com/rusefi/rusefi/issues/151 for the theory
|
|
|
|
*/
|
2022-04-13 17:45:52 -07:00
|
|
|
class WallFuel : public wall_fuel_state_s {
|
2021-10-16 17:16:40 -07:00
|
|
|
public:
|
|
|
|
/**
|
2021-11-25 15:45:44 -08:00
|
|
|
* @param desiredMassGrams desired fuel quantity, in grams
|
|
|
|
* @return total adjusted fuel squirt mass in grams once wall wetting is taken into effect
|
2021-10-16 17:16:40 -07:00
|
|
|
*/
|
2021-11-25 15:45:44 -08:00
|
|
|
float adjust(float desiredMassGrams);
|
|
|
|
float getWallFuel() const;
|
2021-10-16 17:16:40 -07:00
|
|
|
void resetWF();
|
|
|
|
int invocationCounter = 0;
|
|
|
|
};
|
2022-01-27 04:45:50 -08:00
|
|
|
|
|
|
|
struct IWallFuelController {
|
|
|
|
virtual bool getEnable() const = 0;
|
|
|
|
virtual float getAlpha() const = 0;
|
|
|
|
virtual float getBeta() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
class WallFuelController : public IWallFuelController, public EngineModule {
|
|
|
|
public:
|
|
|
|
using interface_t = IWallFuelController;
|
|
|
|
|
|
|
|
void onFastCallback() override;
|
|
|
|
|
|
|
|
bool getEnable() const override {
|
|
|
|
return m_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
float getAlpha() const override {
|
|
|
|
return m_alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
float getBeta() const override {
|
|
|
|
return m_beta;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
float computeTau() const;
|
|
|
|
float computeBeta() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_enable = false;
|
|
|
|
float m_alpha = 0;
|
|
|
|
float m_beta = 0;
|
|
|
|
};
|