fome-fw/firmware/controllers/math/throttle_model.h

32 lines
1016 B
C
Raw Normal View History

2023-03-13 13:25:45 -07:00
#pragma once
2023-03-14 20:12:35 -07:00
#include "throttle_model_generated.h"
2023-03-14 20:49:47 -07:00
struct ThrottleModelBase : public throttle_model_s, public EngineModule {
2023-03-13 13:25:45 -07:00
public:
2023-05-11 14:37:48 -07:00
using interface_t = ThrottleModelBase;
2023-03-14 20:49:47 -07:00
void onSlowCallback() override;
2023-03-13 13:25:45 -07:00
float estimateThrottleFlow(float tip, float tps, float map, float iat);
expected<float> estimateThrottleFlow(float map, float tps);
float partThrottleFlow(float tps, float flowCorrection) const;
float partThrottleFlow(float tps, float pressureRatio, float p_up, float iat) const;
2023-03-13 15:43:39 -07:00
float throttlePositionForFlow(float flow, float pressureRatio, float p_up, float iat) const;
2023-03-13 13:25:45 -07:00
protected:
// Given some TPS, what is the normalized choked flow in g/s?
2023-03-13 13:25:45 -07:00
virtual float effectiveArea(float tps) const = 0;
// Given some MAP, what is the most the engine can pull through a wide open throttle, in g/s?
2023-03-13 13:25:45 -07:00
virtual float maxEngineFlow(float map) const = 0;
};
class ThrottleModel : public ThrottleModelBase {
2023-03-13 13:25:45 -07:00
float effectiveArea(float tps) const override;
float maxEngineFlow(float map) const override;
};