rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
AirmassVeModelBase Class Reference

#include <airmass.h>

Inheritance diagram for AirmassVeModelBase:
Inheritance graph
[legend]
Collaboration diagram for AirmassVeModelBase:
Collaboration graph
[legend]

Public Member Functions

 AirmassVeModelBase (const ValueProvider3D &veTable)
 
float getVe (float rpm, percent_t load, bool postState) const
 
- Public Member Functions inherited from AirmassModelBase
virtual AirmassResult getAirmass (float rpm, bool postState)=0
 

Private Attributes

const ValueProvider3D *const m_veTable
 

Detailed Description

Definition at line 15 of file airmass.h.

Constructor & Destructor Documentation

◆ AirmassVeModelBase()

AirmassVeModelBase::AirmassVeModelBase ( const ValueProvider3D veTable)
explicit

Definition at line 6 of file airmass.cpp.

6: m_veTable(&veTable) {}
const ValueProvider3D *const m_veTable
Definition airmass.h:23

Member Function Documentation

◆ getVe()

float AirmassVeModelBase::getVe ( float  rpm,
percent_t  load,
bool  postState 
) const

Definition at line 17 of file airmass.cpp.

17 {
18 efiAssert(ObdCode::OBD_PCM_Processor_Fault, m_veTable != nullptr, "VE table null", 0);
19
20 // Override the load value if necessary
22
23 percent_t ve = m_veTable->getValue(rpm, load);
24 float idleVeLoad = load;
25
26#if EFI_IDLE_CONTROL
27 auto tps = Sensor::get(SensorType::Tps1);
28 // get VE from the separate table for Idle if idling
32
33 percent_t idleVe = interpolate3d(
35 config->idleVeLoadBins, idleVeLoad,
37 );
38
39 // interpolate between idle table and normal (running) table using TPS threshold
40 // 0 TPS -> idle table
41 // 1/2 threshold -> idle table
42 // idle threshold -> normal table
44 ve = interpolateClamped(idleThreshold / 2, idleVe, idleThreshold, ve, tps.Value);
45 }
46#endif // EFI_IDLE_CONTROL
47
48 // Add any adjustments if configured
49 for (size_t i = 0; i < efi::size(config->veBlends); i++) {
50 auto result = calculateBlend(config->veBlends[i], rpm, load);
51
52 if (postState) {
53 engine->outputChannels.veBlendParameter[i] = result.BlendParameter;
54 engine->outputChannels.veBlendBias[i] = result.Bias;
55 engine->outputChannels.veBlendOutput[i] = result.Value;
56 engine->outputChannels.veBlendYAxis[i] = result.TableYAxis;
57 }
58
59 // Skip extra floating point math if we can...
60 if (result.Value == 0) {
61 continue;
62 }
63
64 // Apply as a multiplier, not as an adder
65 // Value of +5 means add 5%, aka multiply by 1.05
66 ve *= ((100 + result.Value) * 0.01f);
67 }
68
69 if (postState) {
73 }
74
75 return ve * PERCENT_DIV;
76}
float getVeLoadAxis(ve_override_e mode, float passedLoad)
Definition airmass.cpp:8
EngineState engineState
Definition engine.h:344
TunerStudioOutputChannels outputChannels
Definition engine.h:109
constexpr auto & module()
Definition engine.h:200
bool isIdlingOrTaper() const override
Definition idle_thread.h:88
virtual SensorResult get() const =0
virtual float getValue(float xColumn, float yRow) const =0
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
static EngineAccessor engine
Definition engine.h:413
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
BlendResult calculateBlend(blend_table_s &cfg, float rpm, float load)
@ OBD_PCM_Processor_Fault
float percent_t
scaled_channel< int16_t, 10, 1 > veTableIdleYAxis
scaled_channel< uint16_t, 100, 1 > veTableYAxis
scaled_channel< int16_t, 10, 1 > veBlendParameter[VE_BLEND_COUNT]
scaled_channel< uint8_t, 2, 1 > veBlendBias[VE_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > veBlendYAxis[VE_BLEND_COUNT]
scaled_channel< int16_t, 100, 1 > veBlendOutput[VE_BLEND_COUNT]
scaled_channel< uint8_t, 1, 10 > idleVeRpmBins[IDLE_VE_SIZE_RPM]
scaled_channel< uint16_t, 10, 1 > idleVeTable[IDLE_VE_SIZE][IDLE_VE_SIZE_RPM]

Referenced by AlphaNAirmass::getAirmass(), SpeedDensityAirmass::getAirmass(), and MafAirmass::getAirmassImpl().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ m_veTable

const ValueProvider3D* const AirmassVeModelBase::m_veTable
private

Definition at line 23 of file airmass.h.

Referenced by getVe().


The documentation for this class was generated from the following files: