rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
default_fuel.cpp File Reference

Functions

static void setBosch02880155868 (injector_s &cfg)
 
static void setDefaultWarmupFuelEnrichment ()
 
static void setDefaultVETable ()
 
static void setDefaultFuelCutParameters ()
 
static void setDefaultStftSettings ()
 
static void setDefaultLtftSettings ()
 
static void setMazdaMiataNbTpsTps ()
 
static void setDefaultLambdaTable ()
 
void setGdiWallWetting ()
 
void setDefaultWallWetting ()
 
static void setDefaultWboSettings ()
 
static void setDefaultLambdaProtection ()
 
static void setDefaultPriming ()
 
void setDefaultFuel ()
 

Variables

static const uint8_t tpsTpsTable [TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE]
 

Function Documentation

◆ setBosch02880155868()

static void setBosch02880155868 ( injector_s cfg)
static

Definition at line 8 of file default_fuel.cpp.

8 {
9 // http://www.boschdealer.com/specsheets/0280155868cs.jpg (use web.archive.org)
10#if (VBAT_INJECTOR_CURVE_PRESSURE_SIZE == 2) && (VBAT_INJECTOR_CURVE_SIZE == 8)
11 // see https://github.com/rusefi/rusefi/issues/7521 for adding more values
13#endif
14
15#if (VBAT_INJECTOR_CURVE_SIZE == 8)
16 static const float vBattBins[8] = { 6.0, 8.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0 };
17 copyArray(cfg.battLagCorrBattBins, vBattBins);
18#else
19 setLinearCurve(cfg.battLagCorrBattBins, 6, 15, 0.1);
20#endif
21
22#if (VBAT_INJECTOR_CURVE_PRESSURE_SIZE == 2)
23 static const float pressureBins[2] = { 206.843, 413.685 };
24 copyArray(cfg.battLagCorrPressBins,pressureBins);
25#else
26 setLinearCurve(cfg.battLagCorrPressBins, 300, 400, 1);
27#endif
28
29}
constexpr BattLagCorrTable INJECTOR_BATT_LAG_CURR
scaled_channel< int16_t, 100, 1 > battLagCorrBattBins[VBAT_INJECTOR_CURVE_SIZE]
scaled_channel< uint32_t, 10, 1 > battLagCorrPressBins[VBAT_INJECTOR_CURVE_PRESSURE_SIZE]
scaled_channel< int16_t, 100, 1 > battLagCorrTable[VBAT_INJECTOR_CURVE_PRESSURE_SIZE][VBAT_INJECTOR_CURVE_SIZE]
constexpr void copyTable(TDest(&dest)[N][M], const TSource(&source)[N][M], float multiply=1.0f)
void setLinearCurve(TValue(&array)[TSize], float from, float to, float precision=0.01f)

Referenced by setDefaultFuel().

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

◆ setDefaultFuel()

void setDefaultFuel ( )

By the way http://users.erols.com/srweiss/tableifc.htm has a LOT of data

Definition at line 314 of file default_fuel.cpp.

314 {
315 // Base injection configuration
317 engineConfiguration->injectionMode = IM_SEQUENTIAL;
318
319 /**
320 * By the way http://users.erols.com/srweiss/tableifc.htm has a LOT of data
321 */
325
326 // 9.0 = E100 pure ethanol
328
329 // Injector deadtime
332
333 // Tables
334 setFuelTablesLoadBin(10, 160);
336
339
342
345
348
352
353 setTable(config->injectionPhase, PORT_INJECTION_OFFSET);
354
355 // Charge temperature estimation
360 engineConfiguration->tChargeMode = TCHARGE_MODE_RPM_TPS;
366
367 // CLT correction table
369
370 // IAT correction table
371 // TODO
372
373 // Closed loop fuel correction
376
377 // Decel fuel cut
379
380 engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle
381
383
384 // TPS/TPS AE curve
386
387 // Some reasonable reference pressure that many vehicles use
389
391
392 // Lambda protection defaults
394
396
397 // Cut at 110% instantly
399 // Cut at 96% after 0.5 second
402}
static void setDefaultLtftSettings()
static void setDefaultWarmupFuelEnrichment()
static void setDefaultLambdaProtection()
void setDefaultWallWetting()
static void setBosch02880155868(injector_s &cfg)
static void setDefaultPriming()
static void setDefaultStftSettings()
static void setDefaultVETable()
static void setMazdaMiataNbTpsTps()
static void setDefaultFuelCutParameters()
static void setDefaultLambdaTable()
static void setDefaultWboSettings()
void setFuelTablesLoadBin(float minValue, float maxValue)
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
int16_t injectionPhase[INJ_PHASE_LOAD_COUNT][INJ_PHASE_RPM_COUNT]
scaled_channel< uint8_t, 1, 50 > tpsTspCorrValuesBins[TPS_TPS_ACCEL_CLT_CORR_TABLE]
scaled_channel< uint16_t, 100, 1 > mapEstimateTpsBins[MAP_EST_LOAD_COUNT]
scaled_channel< uint8_t, 50, 1 > predictiveMapBlendDurationValues[TPS_TPS_ACCEL_CLT_CORR_TABLE]
scaled_channel< uint8_t, 50, 1 > tpsTspCorrValues[TPS_TPS_ACCEL_CLT_CORR_TABLE]
scaled_channel< uint16_t, 100, 1 > mapEstimateTable[MAP_EST_LOAD_COUNT][MAP_EST_RPM_COUNT]
scaled_channel< uint8_t, 1, 50 > predictiveMapBlendDurationBins[TPS_TPS_ACCEL_CLT_CORR_TABLE]
constexpr void setTable(TElement(&dest)[N][M], const VElement value)
void setRpmTableBin(TValue(&array)[TSize])

Referenced by setDefaultEngineConfiguration().

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

◆ setDefaultFuelCutParameters()

static void setDefaultFuelCutParameters ( )
static

◆ setDefaultLambdaProtection()

static void setDefaultLambdaProtection ( )
static

Definition at line 292 of file default_fuel.cpp.

292 {
294
299
303}

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setDefaultLambdaTable()

static void setDefaultLambdaTable ( )
static

Definition at line 230 of file default_fuel.cpp.

230 {
232
233#if (FUEL_LOAD_COUNT == 16) && (FUEL_RPM_COUNT == 16)
235
236 // Set each row to the corresponding value from rowValues
237 for (size_t i = 0; i < efi::size(config->lambdaTable); i++) {
238 for (size_t j = 0; j < efi::size(config->lambdaTable[i]); j++) {
240 }
241 }
242#endif
243}
scaled_channel< uint8_t, 147, 1 > lambdaTable[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]

Referenced by setDefaultFuel().

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

◆ setDefaultLtftSettings()

static void setDefaultLtftSettings ( )
static

Definition at line 191 of file default_fuel.cpp.

191 {
192 auto& cfg = engineConfiguration->ltft;
193
194 // Default to allow learning, but do not apply learned corrections
195 cfg.enabled = true;
196 cfg.correctionEnabled = false;
197
198 // Default to slow learning
199 cfg.timeConstant[ftRegionIdle] = 3000;
200 cfg.timeConstant[ftRegionOverrun] = 1500;
201 cfg.timeConstant[ftRegionPower] = 30;
202 cfg.timeConstant[ftRegionCruise] = 300;
203
204 // 0.5% deadband
205 cfg.deadband = 0.5f;
206
207 // Allow +-12.5%
208 cfg.maxAdd = 12.5;
209 cfg.maxRemove = 12.5;
210}

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setDefaultPriming()

static void setDefaultPriming ( )
static

Definition at line 305 of file default_fuel.cpp.

305 {
306 // These defaults are reasonable for ~500cc cylinders
307 static constexpr int8_t primeBins[] = { -40, -20, 0, 20, 40, 60, 80, 100 };
308 static constexpr uint16_t primeValues[] = { 755, 605, 265, 140, 75, 50, 45, 40 };
309
310 copyArray(engineConfiguration->primeBins, primeBins);
311 copyArray(engineConfiguration->primeValues, primeValues);
312}
scaled_channel< int16_t, 1, 1 > primeBins[PRIME_CURVE_COUNT]
scaled_channel< uint8_t, 1, 5 > primeValues[PRIME_CURVE_COUNT]

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setDefaultStftSettings()

static void setDefaultStftSettings ( )
static

Allow +-5%

Definition at line 150 of file default_fuel.cpp.

150 {
151 auto& cfg = engineConfiguration->stft;
152
153 // Default to disabled
155
156 // Default to proportional mode (for wideband sensors)
158
159 // Also used in lambda monitor
161
162 // 60 second startup delay - some O2 sensors are slow to warm up.
163 cfg.startupDelay = 60;
164
165 // Only correct in [12.0, 17.0]
166 cfg.minAfr = 12;
167 cfg.maxAfr = 17;
168
169 // Above 60 deg C
170 cfg.minClt = 60;
171
172 // 0.5% deadband
173 cfg.deadband = 0.5f;
174
175 // Sensible region defaults
176 cfg.maxIdleRegionRpm = 1000;
177 cfg.maxOverrunLoad = 35;
178 cfg.minPowerLoad = 85;
179
180 // Sensible cell defaults
181 for (size_t i = 0; i < efi::size(cfg.cellCfgs); i++) {
182 // 30 second time constant - nice and slow
183 cfg.cellCfgs[i].timeConstant = 30;
184
185 /// Allow +-5%
186 cfg.cellCfgs[i].maxAdd = 5;
187 cfg.cellCfgs[i].maxRemove = 5;
188 }
189}

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setDefaultVETable()

static void setDefaultVETable ( )
static

Definition at line 79 of file default_fuel.cpp.

79 {
81#if (VE_LOAD_COUNT == 16) && (VE_RPM_COUNT == 16)
82 static const float hardCodedveTable[16][16] = {
83{49.300, 49.300, 49.400, 49.600, 50.200, 51.400, 52.600, 53.800, 54.400, 54.600, 54.400, 53.700, 52.800, 51.800, 50.900, 50.000, },
84{49.600, 50.500, 51.500, 54.100, 57.500, 60.700, 62.900, 64.400, 65.000, 65.000, 64.500, 63.500, 62.300, 61.100, 60.000, 58.800, },
85{50.300, 52.400, 54.300, 58.500, 62.700, 66.100, 68.200, 69.700, 70.200, 70.100, 69.500, 68.400, 67.100, 65.800, 64.500, 63.300, },
86{51.400, 55.200, 58.200, 63.500, 68.000, 71.400, 73.500, 74.900, 75.300, 75.200, 74.500, 73.300, 71.800, 70.400, 69.000, 67.700, },
87{54.300, 60.900, 64.900, 70.700, 75.100, 78.300, 80.300, 81.700, 82.100, 81.900, 81.100, 79.700, 78.100, 76.500, 75.000, 73.500, },
88{56.400, 64.400, 68.700, 74.500, 78.700, 81.800, 83.800, 85.100, 85.500, 85.300, 84.400, 83.000, 81.300, 79.600, 78.000, 76.400, },
89{60.700, 70.200, 74.500, 79.900, 83.800, 86.800, 88.900, 90.200, 90.600, 90.300, 89.400, 87.800, 86.000, 84.200, 82.500, 80.800, },
90{65.800, 76.000, 80.000, 85.000, 88.800, 91.800, 93.900, 95.200, 95.600, 95.300, 94.300, 92.600, 90.700, 88.800, 87.000, 85.200, },
91{69.400, 79.100, 82.900, 87.800, 91.700, 94.800, 97.000, 98.300, 98.800, 98.400, 97.400, 95.600, 93.500, 91.500, 89.600, 87.700, },
92{73.000, 82.200, 85.900, 90.700, 94.600, 97.800, 100.000, 101.500, 101.900, 101.600, 100.400, 98.500, 96.400, 94.200, 92.200, 90.200, },
93{76.600, 85.300, 88.800, 93.500, 97.400, 100.700, 103.100, 104.600, 105.100, 104.700, 103.500, 101.500, 99.200, 96.900, 94.800, 92.600, },
94{80.300, 88.500, 91.800, 96.400, 100.300, 103.700, 106.200, 107.800, 108.200, 107.800, 106.500, 104.400, 102.000, 99.700, 97.400, 95.100, },
95{83.900, 91.600, 94.700, 99.200, 103.200, 106.700, 109.200, 110.900, 111.400, 110.900, 109.600, 107.400, 104.800, 102.400, 99.900, 97.600, },
96{87.500, 94.700, 97.600, 102.000, 106.100, 109.700, 112.300, 114.000, 114.500, 114.100, 112.600, 110.300, 107.700, 105.100, 102.500, 100.100, },
97{91.100, 97.800, 100.600, 104.900, 108.900, 112.600, 115.300, 117.200, 117.700, 117.200, 115.700, 113.300, 110.500, 107.800, 105.100, 102.500, },
98{94.700, 100.900, 103.500, 107.700, 111.800, 115.600, 118.400, 120.300, 120.800, 120.300, 118.700, 116.200, 113.300, 110.500, 107.700, 105.000, },
99};
101#else
102 setTable(config->veTable, 80);
103#endif
104
107
108 setLinearCurve(config->tmfRatioBins, 0.5, 1.5, 0.1);
109
110 // Default baro table is all 1.0, we can't recommend a reasonable default here
112
113 // Give default axes for cylinder trim tables
114#if FUEL_TRIM_SIZE == 4
115 copyArray(config->fuelTrimRpmBins, { 1000, 3000, 5000, 7000 });
116 copyArray(config->fuelTrimLoadBins, { 20, 50, 80, 100 });
117#else
120#endif
121
122 // Default axes for VE blends
123 for (size_t i = 0; i < efi::size(config->veBlends); i++) {
124 auto& blend = config->veBlends[i];
125 setLinearCurve(blend.loadBins, 0, 100, 10);
126 setLinearCurve(blend.rpmBins, 0, 7000);
127
128 setLinearCurve(blend.blendBins, 0, 100);
129 setLinearCurve(blend.blendValues, 0, 100);
130 }
131
132 for (size_t i = 0; i < efi::size(config->targetAfrBlends); i++) {
133 auto& blend = config->targetAfrBlends[i];
134 setLinearCurve(blend.rpmBins, 0, 7000);
135
136 setLinearCurve(blend.blendBins, 0, 100);
137 setLinearCurve(blend.blendValues, 0, 100);
138 }
139}
static const uint8_t hardCodedveTable[16][16]
scaled_channel< uint16_t, 10, 1 > veTable[VE_LOAD_COUNT][VE_RPM_COUNT]

Referenced by setDefaultFuel().

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

◆ setDefaultWallWetting()

void setDefaultWallWetting ( )

Definition at line 250 of file default_fuel.cpp.

250 {
251#if !EFI_UNIT_TEST
252 // todo: this is a reasonable default for what kinds of engines exactly?
255#endif // EFI_UNIT_TEST
256
257 // linear reasonable bins
258 setLinearCurve(config->wwCltBins, -40, 100, 1);
259 setLinearCurve(config->wwMapBins, 10, 80, 1);
260
261 // These values are derived from the GM factory tune for a gen3 LS engine
262 // Who knows if they're good for anything else, but at least they look nice?
263 static constexpr float tauClt[] = {
264 1.45, 1.30, 1.17, 1.05, 0.90, 0.82, 0.75, 0.70
265 };
266 copyArray(config->wwTauCltValues, tauClt);
267
268 static constexpr float tauMap[] = {
269 0.38, 0.55, 0.69, 0.86, 0.90, 0.95, 0.97, 1.00
270 };
271 copyArray(config->wwTauMapValues, tauMap);
272
273 static constexpr float betaClt[] = {
274 0.73, 0.66, 0.57, 0.46, 0.38, 0.31, 0.24, 0.19
275 };
276 copyArray(config->wwBetaCltValues, betaClt);
277
278 static constexpr float betaMap[] = {
279 0.21, 0.40, 0.60, 0.79, 0.85, 0.90, 0.95, 1.00
280 };
281 copyArray(config->wwBetaMapValues, betaMap);
282}
scaled_channel< uint8_t, 100, 1 > wwTauMapValues[WWAE_TABLE_SIZE]
scaled_channel< uint8_t, 100, 1 > wwBetaMapValues[WWAE_TABLE_SIZE]
scaled_channel< uint8_t, 100, 1 > wwBetaCltValues[WWAE_TABLE_SIZE]
scaled_channel< uint8_t, 100, 1 > wwTauCltValues[WWAE_TABLE_SIZE]

Referenced by setDefaultFuel().

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

◆ setDefaultWarmupFuelEnrichment()

static void setDefaultWarmupFuelEnrichment ( )
static

Definition at line 31 of file default_fuel.cpp.

31 {
32#if CLT_CURVE_SIZE == 16
33 static const float bins[] =
34 {
35 -40,
36 -30,
37 -20,
38 -10,
39 0,
40 10,
41 20,
42 30,
43 40,
44 50,
45 60,
46 70,
47 80,
48 90,
49 100,
50 110
51 };
52
53 copyArray(config->cltFuelCorrBins, bins);
54
55 static const float values[] =
56 {
57 1.50,
58 1.50,
59 1.42,
60 1.36,
61 1.28,
62 1.19,
63 1.12,
64 1.10,
65 1.06,
66 1.06,
67 1.03,
68 1.01,
69 1,
70 1,
71 1,
72 1
73 };
74
75 copyArray(config->cltFuelCorr, values);
76#endif // CLT_CURVE_SIZE
77}

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setDefaultWboSettings()

static void setDefaultWboSettings ( )
static

Definition at line 284 of file default_fuel.cpp.

284 {
285 for (size_t i = 0; i < CAN_WBO_COUNT; i++) {
286 engineConfiguration->canWbo[i].type = RUSEFI;
287 engineConfiguration->canWbo[i].reId = static_cast<can_wbo_re_id_e>(i);
288 engineConfiguration->canWbo[i].aemId = static_cast<can_wbo_aem_id_e>(i);
289 }
290}
can_wbo_aem_id_e
can_wbo_re_id_e

Referenced by setDefaultFuel().

Here is the caller graph for this function:

◆ setGdiWallWetting()

void setGdiWallWetting ( )

Definition at line 245 of file default_fuel.cpp.

245 {
248}

Referenced by setGDIFueling().

Here is the caller graph for this function:

◆ setMazdaMiataNbTpsTps()

static void setMazdaMiataNbTpsTps ( )
static

Definition at line 224 of file default_fuel.cpp.

224 {
228}
static const uint8_t tpsTpsTable[TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE]
float tpsTpsAccelTable[TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE]

Referenced by setDefaultFuel().

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

Variable Documentation

◆ tpsTpsTable

const uint8_t tpsTpsTable[TPS_TPS_ACCEL_TABLE][TPS_TPS_ACCEL_TABLE]
static
Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, },
{10, 0, 0, 0, 0, 0, 0, 0, },
{17, 10, 0, 0, 0, 0, 0, 0, },
{23, 17, 10, 0, 0, 0, 0, 0, },
{28, 23, 17, 10, 0, 0, 0, 0, },
{32, 28, 23, 17, 10, 0, 0, 0, },
{35, 32, 28, 23, 17, 10, 0, 0, },
{37, 35, 32, 28, 23, 17, 10, 0, },
}

Definition at line 212 of file default_fuel.cpp.

212 {
213/* Generated by TS2C on Tue Apr 18 21:29:16 EDT 2017*/
214{/* 0 0 *//* 0 0.0*/0, /* 1 10.0*/0, /* 2 20.0*/0, /* 3 35.0*/0, /* 4 50.0*/0, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
215{/* 1 10 *//* 0 0.0*/10, /* 1 10.0*/0, /* 2 20.0*/0, /* 3 35.0*/0, /* 4 50.0*/0, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
216{/* 2 20 *//* 0 0.0*/17, /* 1 10.0*/10, /* 2 20.0*/0, /* 3 35.0*/0, /* 4 50.0*/0, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
217{/* 3 35 *//* 0 0.0*/23, /* 1 10.0*/17, /* 2 20.0*/10, /* 3 35.0*/0, /* 4 50.0*/0, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
218{/* 4 50 *//* 0 0.0*/28, /* 1 10.0*/23, /* 2 20.0*/17, /* 3 35.0*/10, /* 4 50.0*/0, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
219{/* 5 65 *//* 0 0.0*/32, /* 1 10.0*/28, /* 2 20.0*/23, /* 3 35.0*/17, /* 4 50.0*/10, /* 5 65.0*/0, /* 6 80.0*/0, /* 7 100.0*/0, },
220{/* 6 80 *//* 0 0.0*/35, /* 1 10.0*/32, /* 2 20.0*/28, /* 3 35.0*/23, /* 4 50.0*/17, /* 5 65.0*/10, /* 6 80.0*/0, /* 7 100.0*/0, },
221{/* 7 100 *//* 0 0.0*/37, /* 1 10.0*/35, /* 2 20.0*/32, /* 3 35.0*/28, /* 4 50.0*/23, /* 5 65.0*/17, /* 6 80.0*/10, /* 7 100.0*/0, },
222};

Referenced by setMazdaMiataNbTpsTps().

Go to the source code of this file.