| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "pch.h" | |||
| 2 | ||||
| 3 | #include "airmass.h" | |||
| 4 | #include "idle_thread.h" | |||
| 5 | ||||
| 6 | 595 | AirmassVeModelBase::AirmassVeModelBase(const ValueProvider3D& veTable) : m_veTable(&veTable) {} | ||
| 7 | ||||
| 8 | 1109 | float getVeLoadAxis(ve_override_e mode, float passedLoad) { | ||
| 9 |
2/4✓ Branch 0 taken 1108 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 time.
✗ Branch 3 not taken.
|
1109 | switch(mode) { | |
| 10 |
1/1✓ Decision 'true' taken 1108 times.
|
1108 | case VE_None: return passedLoad; | |
| 11 | ✗ | case VE_MAP: return Sensor::getOrZero(SensorType::Map); | ||
| 12 |
1/1✓ Decision 'true' taken 1 time.
|
1 | case VE_TPS: return Sensor::getOrZero(SensorType::Tps1); | |
| 13 | ✗ | default: return 0; | ||
| 14 | } | |||
| 15 | } | |||
| 16 | ||||
| 17 | 1102 | float AirmassVeModelBase::getVe(float rpm, float load, bool postState) const { | ||
| 18 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 1102 times.
✗ Branch 3 not taken.
|
1102 | efiAssert(ObdCode::OBD_PCM_Processor_Fault, m_veTable != nullptr, "VE table null", 0); | |
| 19 | ||||
| 20 | // Override the load value if necessary | |||
| 21 |
1/1✓ Branch 1 taken 1102 times.
|
1102 | load = getVeLoadAxis(engineConfiguration->veOverrideMode, load); | |
| 22 | ||||
| 23 |
1/1✓ Branch 1 taken 1102 times.
|
1102 | percent_t ve = m_veTable->getValue(rpm, load); | |
| 24 | 1102 | float idleVeLoad = load; | ||
| 25 | ||||
| 26 | #if EFI_IDLE_CONTROL | |||
| 27 |
1/1✓ Branch 2 taken 1102 times.
|
1102 | auto tps = Sensor::get(SensorType::Tps1); | |
| 28 | // get VE from the separate table for Idle if idling | |||
| 29 |
3/4✓ Branch 1 taken 1102 times.
✓ Branch 5 taken 1102 times.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
|
2/2✓ Decision 'true' taken 7 times.
✓ Decision 'false' taken 1102 times.
|
1109 | if (engine->module<IdleController>()->isIdlingOrTaper() && |
| 30 |
5/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1095 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7 times.
✓ Branch 6 taken 1095 times.
|
1109 | tps && engineConfiguration->useSeparateVeForIdle) { | |
| 31 |
1/1✓ Branch 1 taken 7 times.
|
7 | idleVeLoad = getVeLoadAxis(engineConfiguration->idleVeOverrideMode, load); | |
| 32 | ||||
| 33 | 14 | percent_t idleVe = interpolate3d( | ||
| 34 | 7 | config->idleVeTable, | ||
| 35 | 7 | config->idleVeLoadBins, idleVeLoad, | ||
| 36 |
1/1✓ Branch 1 taken 7 times.
|
7 | config->idleVeRpmBins, rpm | |
| 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 | |||
| 43 | 7 | float idleThreshold = engineConfiguration->idlePidDeactivationTpsThreshold; | ||
| 44 |
1/1✓ Branch 1 taken 7 times.
|
7 | ve = interpolateClamped(idleThreshold / 2, idleVe, idleThreshold, ve, tps.Value); | |
| 45 | } | |||
| 46 | #endif // EFI_IDLE_CONTROL | |||
| 47 | ||||
| 48 | // Add any adjustments if configured | |||
| 49 |
2/2✓ Branch 1 taken 4408 times.
✓ Branch 2 taken 1102 times.
|
2/2✓ Decision 'true' taken 4408 times.
✓ Decision 'false' taken 1102 times.
|
5510 | for (size_t i = 0; i < efi::size(config->veBlends); i++) { |
| 50 |
1/1✓ Branch 2 taken 4408 times.
|
4408 | auto result = calculateBlend(config->veBlends[i], rpm, load); | |
| 51 | ||||
| 52 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4396 times.
|
2/2✓ Decision 'true' taken 12 times.
✓ Decision 'false' taken 4396 times.
|
4408 | if (postState) { |
| 53 | 12 | engine->outputChannels.veBlendParameter[i] = result.BlendParameter; | ||
| 54 | 12 | engine->outputChannels.veBlendBias[i] = result.Bias; | ||
| 55 | 12 | engine->outputChannels.veBlendOutput[i] = result.Value; | ||
| 56 | 12 | engine->outputChannels.veBlendYAxis[i] = result.TableYAxis; | ||
| 57 | } | |||
| 58 | ||||
| 59 | // Skip extra floating point math if we can... | |||
| 60 |
1/2✓ Branch 0 taken 4408 times.
✗ Branch 1 not taken.
|
1/2✓ Decision 'true' taken 4408 times.
✗ Decision 'false' not taken.
|
4408 | if (result.Value == 0) { |
| 61 | 4408 | 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 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1099 times.
|
2/2✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 1099 times.
|
1102 | if (postState) { |
| 70 | 3 | engine->engineState.currentVe = ve; | ||
| 71 | 3 | engine->engineState.veTableYAxis = load; | ||
| 72 | 3 | engine->engineState.veTableIdleYAxis = idleVeLoad; | ||
| 73 | } | |||
| 74 | ||||
| 75 | 1102 | return ve * PERCENT_DIV; | ||
| 76 | } | |||
| 77 |