rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
controllers
math
torque_estimator.cpp
Go to the documentation of this file.
1
#include "
pch.h
"
2
3
void
estimateTorqueTable
() {
4
for
(
int
rpmIndex = 0;rpmIndex<TORQUE_CURVE_RPM_SIZE;rpmIndex++) {
5
for
(
int
loadIndex = 0;loadIndex<TORQUE_CURVE_SIZE;loadIndex++) {
6
float
rpmValue =
config
->
torqueRpmBins
[rpmIndex];
7
8
// let's assume speed density for now
9
// here we assume load is MAP while older parts of codebase have TPS, maybe for no good reason
10
// TODO: clean this up, see 'torqueLoadBins' usages
11
float
mapValue =
config
->
torqueLoadBins
[loadIndex];
12
13
percent_t
veValue
= interpolate3d(
14
config
->
veTable
,
15
config
->
veLoadBins
, mapValue,
16
config
->
veRpmBins
, rpmValue
17
);
18
float
estimated =
engineConfiguration
->
referenceTorqueForGenerator
19
*
veValue
/
engineConfiguration
->
referenceVeForGenerator
20
* mapValue /
engineConfiguration
->
referenceMapForGenerator
;
21
22
config
->
torqueTable
[loadIndex][rpmIndex] = estimated;
23
if
(loadIndex == 0 && rpmIndex == 0) {
24
efiPrintf(
"estimateTorqueTable [%f] %f"
,
veValue
, estimated);
25
}
26
27
}
28
}
29
30
}
config
static constexpr persistent_config_s * config
Definition
engine_configuration.h:82
engineConfiguration
static constexpr engine_configuration_s * engineConfiguration
Definition
engine_configuration.h:81
pch.h
percent_t
float percent_t
Definition
rusefi_types.h:70
veValue
veValue("Fuel: VE", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 86, 0.1, 0.0, 0.0, "ratio")
engine_configuration_s::referenceVeForGenerator
float referenceVeForGenerator
Definition
engine_configuration_generated_structures_alphax-2chan.h:3628
engine_configuration_s::referenceMapForGenerator
float referenceMapForGenerator
Definition
engine_configuration_generated_structures_alphax-2chan.h:3624
engine_configuration_s::referenceTorqueForGenerator
float referenceTorqueForGenerator
Definition
engine_configuration_generated_structures_alphax-2chan.h:3620
persistent_config_s::veLoadBins
uint16_t veLoadBins[VE_LOAD_COUNT]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6586
persistent_config_s::torqueLoadBins
uint16_t torqueLoadBins[TORQUE_CURVE_SIZE]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6087
persistent_config_s::veTable
scaled_channel< uint16_t, 10, 1 > veTable[VE_LOAD_COUNT][VE_RPM_COUNT]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6581
persistent_config_s::torqueRpmBins
uint16_t torqueRpmBins[TORQUE_CURVE_RPM_SIZE]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6082
persistent_config_s::torqueTable
scaled_channel< uint8_t, 1, 10 > torqueTable[TORQUE_CURVE_SIZE][TORQUE_CURVE_RPM_SIZE]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6077
persistent_config_s::veRpmBins
uint16_t veRpmBins[VE_RPM_COUNT]
Definition
engine_configuration_generated_structures_alphax-2chan.h:6591
estimateTorqueTable
void estimateTorqueTable()
Definition
torque_estimator.cpp:3
Generated on Sat Feb 7 2026 00:13:09 for rusEFI by
1.9.8