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
25#if EFI_IDLE_CONTROL
26 auto tps = Sensor::get(SensorType::Tps1);
27 // get VE from the separate table for Idle if idling
30 float idleVeLoad = getVeLoadAxis(engineConfiguration->idleVeOverrideMode, load);
31
32 percent_t idleVe = interpolate3d(
34 config->idleVeLoadBins, idleVeLoad,
36 );
37
38 // interpolate between idle table and normal (running) table using TPS threshold
39 // 0 TPS -> idle table
40 // 1/2 threshold -> idle table
41 // idle threshold -> normal table
43 ve = interpolateClamped(idleThreshold / 2, idleVe, idleThreshold, ve, tps.Value);
44 }
45#endif // EFI_IDLE_CONTROL
46
47 // Add any adjustments if configured
48 for (size_t i = 0; i < efi::size(config->veBlends); i++) {
49 auto result = calculateBlend(config->veBlends[i], rpm, load);
50
51 if (postState) {
52 engine->outputChannels.veBlendParameter[i] = result.BlendParameter;
53 engine->outputChannels.veBlendBias[i] = result.Bias;
54 engine->outputChannels.veBlendOutput[i] = result.Value;
55 engine->outputChannels.veBlendYAxis[i] = result.TableYAxis;
56 }
57
58 // Skip extra floating point math if we can...
59 if (result.Value == 0) {
60 continue;
61 }
62
63 // Apply as a multiplier, not as an adder
64 // Value of +5 means add 5%, aka multiply by 1.05
65 ve *= ((100 + result.Value) * 0.01f);
66 }
67
68 if (postState) {
71 }
72
73 return ve * PERCENT_DIV;
74}
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< 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]
scaled_channel< uint16_t, 10, 1 > idleVeTable[IDLE_VE_SIZE][IDLE_VE_SIZE]

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: