rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
table_helper.h File Reference

Detailed Description

Date
Jul 6, 2014
Author
Andrey Belomutskiy, (c) 2012-2020

Definition in file table_helper.h.

Data Structures

class  ValueProvider3D
 
class  Map3D< TColNum, TRowNum, TValue, TXColumn, TRow >
 

Typedefs

typedef Map3D< VE_RPM_COUNT, VE_LOAD_COUNT, uint16_t, uint16_t, uint16_t > ve_Map3D_t
 
typedef Map3D< PEDAL_TO_TPS_RPM_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t, uint8_t > pedal2tps_t
 
typedef Map3D< MAP_EST_RPM_COUNT, MAP_EST_LOAD_COUNT, uint16_t, uint16_t, uint16_t > mapEstimate_Map3D_t
 

Functions

template<typename TValue , int TSize>
void setLinearCurve (TValue(&array)[TSize], float from, float to, float precision=0.01f)
 
template<typename TValue , int TSize>
void setArrayValues (TValue(&array)[TSize], float value)
 
template<typename TElement , typename VElement , size_t N, size_t M>
constexpr void setTable (TElement(&dest)[N][M], const VElement value)
 
template<typename TDest , typename TSource , size_t N, size_t M>
constexpr void copyTable (TDest(&dest)[N][M], const TSource(&source)[N][M], float multiply=1.0f)
 
template<typename TDest , typename TSource , size_t N, size_t M>
constexpr void copyTable (TDest(&dest)[N][M], const std::array< std::array< TSource, M >, N > &source, float multiply=1.0f)
 
template<typename TDest , size_t N, size_t M>
constexpr void copyTable (scaled_channel< TDest, 1, 1 >(&dest)[N][M], const TDest(&source)[N][M])
 
template<typename TDest , size_t N, size_t M>
constexpr void copyTable (TDest(&dest)[N][M], const TDest(&source)[N][M])
 
template<typename kType >
void setRpmBin (kType array[], int size, float idleRpm, float topRpm)
 
template<typename TValue , int TSize>
void setRpmTableBin (TValue(&array)[TSize])
 

Typedef Documentation

◆ mapEstimate_Map3D_t

typedef Map3D<MAP_EST_RPM_COUNT, MAP_EST_LOAD_COUNT, uint16_t, uint16_t, uint16_t> mapEstimate_Map3D_t

Definition at line 141 of file table_helper.h.

◆ pedal2tps_t

typedef Map3D<PEDAL_TO_TPS_RPM_SIZE, PEDAL_TO_TPS_SIZE, uint8_t, uint8_t, uint8_t> pedal2tps_t

Definition at line 140 of file table_helper.h.

◆ ve_Map3D_t

typedef Map3D<VE_RPM_COUNT, VE_LOAD_COUNT, uint16_t, uint16_t, uint16_t> ve_Map3D_t

Definition at line 139 of file table_helper.h.

Function Documentation

◆ copyTable() [1/4]

template<typename TDest , size_t N, size_t M>
constexpr void copyTable ( scaled_channel< TDest, 1, 1 >(&)  dest[N][M],
const TDest(&)  source[N][M] 
)
constexpr

Definition at line 199 of file table_helper.h.

199 {
200 memcpy(dest, source, N * M * sizeof(TDest));
201}

◆ copyTable() [2/4]

template<typename TDest , typename TSource , size_t N, size_t M>
constexpr void copyTable ( TDest(&)  dest[N][M],
const std::array< std::array< TSource, M >, N > &  source,
float  multiply = 1.0f 
)
constexpr

Definition at line 185 of file table_helper.h.

189 {
190 for (size_t n = 0; n < N; n++) {
191 for (size_t m = 0; m < M; m++) {
192 dest[n][m] = source[n][m] * multiply;
193 }
194 }
195}

◆ copyTable() [3/4]

template<typename TDest , size_t N, size_t M>
constexpr void copyTable ( TDest(&)  dest[N][M],
const TDest(&)  source[N][M] 
)
constexpr

Definition at line 204 of file table_helper.h.

204 {
205 memcpy(dest, source, N * M * sizeof(TDest));
206}

◆ copyTable() [4/4]

template<typename TDest , typename TSource , size_t N, size_t M>
constexpr void copyTable ( TDest(&)  dest[N][M],
const TSource(&)  source[N][M],
float  multiply = 1.0f 
)
constexpr

◆ setArrayValues()

template<typename TValue , int TSize>
void setArrayValues ( TValue(&)  array[TSize],
float  value 
)

◆ setLinearCurve()

template<typename TValue , int TSize>
void setLinearCurve ( TValue(&)  array[TSize],
float  from,
float  to,
float  precision = 0.01f 
)
Parameters
precisionfor example '0.1' for one digit fractional part. Default to 0.01, two digits. see also: ensureArrayIsAscending

rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio

Definition at line 148 of file table_helper.h.

148 {
149 for (int i = 0; i < TSize; i++) {
150 float value = interpolateMsg("setLinearCurve", 0, from, TSize - 1, to, i);
151
152 /**
153 * rounded values look nicer, also we want to avoid precision mismatch with Tuner Studio
154 */
155 array[i] = efiRound(value, precision);
156 }
157}
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x)
Linear interpolation by two points.
float efiRound(float value, float precision)
Definition efilib.cpp:34

Referenced by configureRusefiLuaHooks(), proteusLuaDemo(), setBosch02880155868(), setBoschHDEV_5_injectors(), setDefaultBaseEngine(), setDefaultBoostParameters(), setDefaultCltTimingCorrection(), setDefaultCranking(), setDefaultEngineConfiguration(), setDefaultEtbParameters(), setDefaultFuel(), setDefaultIatTimingCorrection(), setDefaultIdleOpenLoopParameters(), setDefaultIgnition(), setDefaultScriptParameters(), setDefaultTrailingSparkTable(), setDefaultVETable(), setDefaultVrThresholds(), setDefaultWallWetting(), setDodgeNeonNGCEngineConfiguration(), setFuelTablesLoadBin(), setGdiDefaults(), setMazdaMiataNbTpsTps(), setScriptCurve1Value(), setScriptCurve2Value(), setTargetRpmCurve(), and setVwAba().

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

◆ setRpmBin()

template<typename kType >
void setRpmBin ( kType  array[],
int  size,
float  idleRpm,
float  topRpm 
)

Definition at line 209 of file table_helper.h.

209 {
210 array[0] = idleRpm - 150;
211 int rpmStep = (int)(efiRound((topRpm - idleRpm) / (size - 2), 50) - 150);
212 for (int i = 1; i < size - 1;i++)
213 array[i] = idleRpm + rpmStep * (i - 1);
214 array[size - 1] = topRpm;
215}
composite packet size

Referenced by setRpmTableBin(), and setTimingRpmBin().

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

◆ setRpmTableBin()

template<typename TValue , int TSize>
void setRpmTableBin ( TValue(&)  array[TSize])

initialize RPM table axis using default RPM range

Definition at line 221 of file table_helper.h.

221 {
222 setRpmBin(array, TSize, 800, DEFAULT_RPM_AXIS_HIGH_VALUE);
223}
void setRpmBin(kType array[], int size, float idleRpm, float topRpm)

Referenced by setBoschHDEV_5_injectors(), setDefaultBaseEngine(), setDefaultBoostParameters(), setDefaultEngineConfiguration(), setDefaultEngineNoiseTable(), setDefaultEtbParameters(), setDefaultFuel(), setDefaultIdleOpenLoopParameters(), setDefaultIgnition(), setDefaultLambdaTable(), setDefaultScriptParameters(), setDefaultTrailingSparkTable(), setDefaultVETable(), setDefaultVrThresholds(), and setGdiDefaults().

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

◆ setTable()

template<typename TElement , typename VElement , size_t N, size_t M>
constexpr void setTable ( TElement(&)  dest[N][M],
const VElement  value 
)
constexpr

Go to the source code of this file.