base class

This commit is contained in:
Matthew Kennedy 2020-07-23 01:12:38 -07:00
parent 50aad7496f
commit 8bc18db80f
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,10 @@
#include "airmass.h"
AirmassModelBase::AirmassModelBase(const ValueProvider3D& veTable) : m_veTable(&veTable) {}
float AirmassModelBase::getVe(int rpm, float load) const {
efiAssert(OBD_PCM_Processor_Fault, m_veTable != nullptr, "VE table null", 0);
// TODO: allow override of the Y axis value based on a config field
return m_veTable->getValue(rpm, load);
}

View File

@ -1,6 +1,22 @@
#pragma once #pragma once
#include "engine.h"
struct AirmassResult { struct AirmassResult {
float CylinderAirmass = 0; float CylinderAirmass = 0;
float EngineLoadPercent = 100; float EngineLoadPercent = 100;
}; };
struct AirmassModelBase {
DECLARE_ENGINE_PTR;
AirmassModelBase(const ValueProvider3D& veTable);
virtual AirmassResult getAirmass(int rpm) = 0;
protected:
// Retrieve the user-calibrated volumetric efficiency from the table
float getVe(int rpm, percent_t load) const;
private:
const ValueProvider3D* const m_veTable;
};