rusEFI
The most advanced open source ECU
Functions | Variables
engine_math.cpp File Reference

Detailed Description

Date
Jul 13, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file engine_math.cpp.

Functions

floatms_t getEngineCycleDuration (int rpm)
 
floatms_t getCrankshaftRevolutionTimeMs (int rpm)
 
float getFuelingLoad ()
 
float getIgnitionLoad ()
 
void setSingleCoilDwell ()
 
static size_t getFiringOrderLength ()
 
static const uint8_t * getFiringOrderTable ()
 
size_t getFiringOrderCylinderId (size_t index)
 
size_t getNextFiringCylinderId (size_t prevCylinderId)
 
ignition_mode_e getCurrentIgnitionMode ()
 
void prepareOutputSignals ()
 
angle_t getPerCylinderFiringOrderOffset (uint8_t cylinderIndex, uint8_t cylinderNumber)
 
void setTimingRpmBin (float from, float to)
 
void setAlgorithm (engine_load_mode_e algo)
 
void setFlatInjectorLag (float value)
 
BlendResult calculateBlend (blend_table_s &cfg, float rpm, float load)
 

Variables

bool verboseMode
 
static const uint8_t order_1 [] = {1}
 
static const uint8_t order_1_2 [] = {1, 2}
 
static const uint8_t order_1_2_3 [] = {1, 2, 3}
 
static const uint8_t order_1_3_2 [] = {1, 3, 2}
 
static const uint8_t order_1_THEN_3_THEN_4_THEN2 [] = { 1, 3, 4, 2 }
 
static const uint8_t order_1_THEN_2_THEN_4_THEN3 [] = { 1, 2, 4, 3 }
 
static const uint8_t order_1_THEN_3_THEN_2_THEN4 [] = { 1, 3, 2, 4 }
 
static const uint8_t order_1_THEN_4_THEN_3_THEN2 [] = { 1, 4, 3, 2 }
 
static const uint8_t order_1_2_4_5_3 [] = {1, 2, 4, 5, 3}
 
static const uint8_t order_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4 [] = { 1, 5, 3, 6, 2, 4 }
 
static const uint8_t order_1_THEN_4_THEN_2_THEN_5_THEN_3_THEN_6 [] = { 1, 4, 2, 5, 3, 6 }
 
static const uint8_t order_1_THEN_2_THEN_3_THEN_4_THEN_5_THEN_6 [] = { 1, 2, 3, 4, 5, 6 }
 
static const uint8_t order_1_6_3_2_5_4 [] = {1, 6, 3, 2, 5, 4}
 
static const uint8_t order_1_4_3_6_2_5 [] = {1, 4, 3, 6, 2, 5}
 
static const uint8_t order_1_6_2_4_3_5 [] = {1, 6, 2, 4, 3, 5}
 
static const uint8_t order_1_6_5_4_3_2 [] = {1, 6, 5, 4, 3, 2}
 
static const uint8_t order_1_4_5_2_3_6 [] = {1, 4, 5, 2, 3, 6}
 
static const uint8_t order_1_8_4_3_6_5_7_2 [] = { 1, 8, 4, 3, 6, 5, 7, 2 }
 
static const uint8_t order_1_8_7_2_6_5_4_3 [] = { 1, 8, 7, 2, 6, 5, 4, 3 }
 
static const uint8_t order_1_5_4_2_6_3_7_8 [] = { 1, 5, 4, 2, 6, 3, 7, 8 }
 
static const uint8_t order_1_2_7_8_4_5_6_3 [] = { 1, 2, 7, 8, 4, 5, 6, 3 }
 
static const uint8_t order_1_3_7_2_6_5_4_8 [] = { 1, 3, 7, 2, 6, 5, 4, 8 }
 
static const uint8_t order_1_2_3_4_5_6_7_8 [] = { 1, 2, 3, 4, 5, 6, 7, 8 }
 
static const uint8_t order_1_5_4_8_6_3_7_2 [] = { 1, 5, 4, 8, 6, 3, 7, 2 }
 
static const uint8_t order_1_8_7_3_6_5_4_2 [] = { 1, 8, 7, 3, 6, 5, 4, 2 }
 
static const uint8_t order_1_5_4_8_3_7_2_6 [] = { 1, 5, 4, 8, 3, 7, 2, 6 }
 
static const uint8_t order_1_8_6_2_7_3_4_5 [] = { 1, 8, 6, 2, 7, 3, 4, 5 }
 
static const uint8_t order_1_2_3_4_5_6_7_8_9 [] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
 
static const uint8_t order_1_10_9_4_3_6_5_8_7_2 [] = {1, 10, 9, 4, 3, 6, 5, 8, 7, 2}
 
static const uint8_t order_1_6_5_10_2_7_3_8_4_9 [] = {1, 6, 5, 10, 2, 7, 3, 8, 4, 9}
 
static const uint8_t order_1_7_5_11_3_9_6_12_2_8_4_10 [] = {1, 7, 5, 11, 3, 9, 6, 12, 2, 8, 4, 10}
 
static const uint8_t order_1_7_4_10_2_8_6_12_3_9_5_11 [] = {1, 7, 4, 10, 2, 8, 6, 12, 3, 9, 5, 11}
 
static const uint8_t order_1_12_5_8_3_10_6_7_2_11_4_9 [] = {1, 12, 5, 8, 3, 10, 6, 7, 2, 11, 4, 9}
 
static const uint8_t order_1_2_3_4_5_6_7_8_9_10_11_12 [] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
 
static const uint8_t order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10 [] = {1, 14, 9, 4, 7, 12, 15, 6, 13, 8, 3, 16, 11, 2, 5, 10}
 

Function Documentation

◆ calculateBlend()

BlendResult calculateBlend ( blend_table_s cfg,
float  rpm,
float  load 
)

Definition at line 456 of file engine_math.cpp.

456  {
457  // If set to 0, skip the math as its disabled
458  if (cfg.blendParameter == GPPWM_Zero) {
459  return { 0, 0, 0 };
460  }
461 
462  auto value = readGppwmChannel(cfg.blendParameter);
463 
464  if (!value) {
465  return { 0, 0, 0 };
466  }
467 
468  // Override Y axis value (if necessary)
469  if (cfg.yAxisOverride != GPPWM_Zero) {
470  // TODO: is this value_or(0) correct or even reasonable?
471  load = readGppwmChannel(cfg.yAxisOverride).value_or(0);
472  }
473 
474  float tableValue = interpolate3d(
475  cfg.table,
476  cfg.loadBins, load,
477  cfg.rpmBins, rpm
478  );
479 
480  float blendFactor = interpolate2d(value.Value, cfg.blendBins, cfg.blendValues);
481 
482  return { value.Value, blendFactor, 0.01f * blendFactor * tableValue };
483 }
expected< float > readGppwmChannel(gppwm_channel_e channel)
scaled_channel< int16_t, 10, 1 > blendBins[8]
scaled_channel< uint8_t, 2, 1 > blendValues[8]
scaled_channel< int16_t, 10, 1 > table[8][8]

Referenced by BoostController::getOpenLoop(), getRunningAdvance(), BoostController::getSetpoint(), and AirmassVeModelBase::getVe().

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

◆ getCrankshaftRevolutionTimeMs()

floatms_t getCrankshaftRevolutionTimeMs ( int  rpm)
Returns
number of milliseconds in one crank shaft revolution

Definition at line 40 of file engine_math.cpp.

40  {
41  if (rpm == 0) {
42  return NAN;
43  }
44  return 360 * getOneDegreeTimeMs(rpm);
45 }

Referenced by getCoilDutyCycle(), getEngineCycleDuration(), and InjectionEvent::onTriggerTooth().

Here is the caller graph for this function:

◆ getCurrentIgnitionMode()

ignition_mode_e getCurrentIgnitionMode ( )
Returns
IM_WASTED_SPARK if in SPINNING mode and IM_INDIVIDUAL_COILS setting
engineConfiguration->ignitionMode otherwise

Definition at line 387 of file engine_math.cpp.

387  {
389 #if EFI_SHAFT_POSITION_INPUT
390  // In spin-up cranking mode we don't have full phase sync info yet, so wasted spark mode is better
391  // However, only do this on even cylinder count engines: odd cyl count doesn't fire at all
392  if (ignitionMode == IM_INDIVIDUAL_COILS && (engineConfiguration->cylindersCount % 2 == 0)) {
393  bool missingPhaseInfoForSequential =
395 
396  if (!engineConfiguration->oddFireEngine && (engine->rpmCalculator.isSpinningUp() || missingPhaseInfoForSequential)) {
397  ignitionMode = IM_WASTED_SPARK;
398  }
399  }
400 #endif /* EFI_SHAFT_POSITION_INPUT */
401  return ignitionMode;
402 }
TriggerCentral triggerCentral
Definition: engine.h:278
RpmCalculator rpmCalculator
Definition: engine.h:265
bool hasSynchronizedPhase() const
bool isSpinningUp() const
PrimaryTriggerDecoder triggerState
Engine * engine
engine_configuration_s * engineConfiguration
ignition_mode_e
Definition: rusefi_enums.h:305

Referenced by getCoilDutyCycle(), prepareCylinderIgnitionSchedule(), prepareIgnitionSchedule(), and startDwellByTurningSparkPinHigh().

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

◆ getEngineCycleDuration()

floatms_t getEngineCycleDuration ( int  rpm)

Definition at line 33 of file engine_math.cpp.

33  {
35 }
virtual operation_mode_e getOperationMode() const =0
EngineRotationState * getEngineRotationState()
Definition: engine.cpp:572
floatms_t getCrankshaftRevolutionTimeMs(int rpm)
Definition: engine_math.cpp:40
@ TWO_STROKE
Definition: rusefi_enums.h:262

Referenced by getBaseFuelMass(), getInjectorDutyCycle(), getInjectorDutyCycleStage2(), and IFuelComputer::getTChargeCoefficient().

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

◆ getFiringOrderCylinderId()

size_t getFiringOrderCylinderId ( size_t  index)
Parameters
indexfrom zero to cylindersCount - 1
Returns
cylinderId from one to cylindersCount

Definition at line 337 of file engine_math.cpp.

337  {
338  const size_t firingOrderLength = getFiringOrderLength();
339 
340  if (firingOrderLength < 1 || firingOrderLength > MAX_CYLINDER_COUNT) {
341  firmwareError(ObdCode::CUSTOM_FIRING_LENGTH, "fol %d", firingOrderLength);
342  return 1;
343  }
344  if (engineConfiguration->cylindersCount != firingOrderLength) {
345  // May 2020 this somehow still happens with functional tests, maybe race condition?
346  firmwareError(ObdCode::CUSTOM_OBD_WRONG_FIRING_ORDER, "Wrong cyl count for firing order, expected %d cylinders", firingOrderLength);
347  return 1;
348  }
349 
350  if (index >= firingOrderLength) {
351  // May 2020 this somehow still happens with functional tests, maybe race condition?
352  warning(ObdCode::CUSTOM_ERR_6686, "firing order index %d", index);
353  return 1;
354  }
355 
356  if (auto firingOrderTable = getFiringOrderTable()) {
357  return firingOrderTable[index];
358  } else {
359  // error already reported
360  return 1;
361  }
362 }
static const uint8_t * getFiringOrderTable()
static size_t getFiringOrderLength()
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_ERR_6686
@ CUSTOM_FIRING_LENGTH
@ CUSTOM_OBD_WRONG_FIRING_ORDER

Referenced by prepareCylinderIgnitionSchedule(), and InjectionEvent::update().

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

◆ getFiringOrderLength()

static size_t getFiringOrderLength ( )
static

Definition at line 165 of file engine_math.cpp.

165  {
166 
167  switch (engineConfiguration->firingOrder) {
168  case FO_1:
169  return 1;
170 // 2 cylinder
171  case FO_1_2:
172  return 2;
173 // 3 cylinder
174  case FO_1_2_3:
175  case FO_1_3_2:
176  return 3;
177 // 4 cylinder
178  case FO_1_3_4_2:
179  case FO_1_2_4_3:
180  case FO_1_3_2_4:
181  case FO_1_4_3_2:
182  return 4;
183 // 5 cylinder
184  case FO_1_2_4_5_3:
185  return 5;
186 
187 // 6 cylinder
188  case FO_1_5_3_6_2_4:
189  case FO_1_4_2_5_3_6:
190  case FO_1_2_3_4_5_6:
191  case FO_1_6_3_2_5_4:
192  case FO_1_4_3_6_2_5:
193  case FO_1_6_2_4_3_5:
194  case FO_1_6_5_4_3_2:
195  case FO_1_4_5_2_3_6:
196  return 6;
197 
198 // 8 cylinder
199  case FO_1_8_4_3_6_5_7_2:
200  case FO_1_8_7_2_6_5_4_3:
201  case FO_1_5_4_2_6_3_7_8:
202  case FO_1_2_7_8_4_5_6_3:
203  case FO_1_3_7_2_6_5_4_8:
204  case FO_1_2_3_4_5_6_7_8:
205  case FO_1_5_4_8_6_3_7_2:
206  case FO_1_8_7_3_6_5_4_2:
207  case FO_1_5_4_8_3_7_2_6:
208  case FO_1_8_6_2_7_3_4_5:
209  return 8;
210 
211 // 9 cylinder radial
212  case FO_1_2_3_4_5_6_7_8_9:
213  return 9;
214 
215 // 10 cylinder
216  case FO_1_10_9_4_3_6_5_8_7_2:
217  case FO_1_6_5_10_2_7_3_8_4_9:
218  return 10;
219 
220 // 12 cylinder
221  case FO_1_7_5_11_3_9_6_12_2_8_4_10:
222  case FO_1_7_4_10_2_8_6_12_3_9_5_11:
223  case FO_1_12_5_8_3_10_6_7_2_11_4_9:
224  case FO_1_2_3_4_5_6_7_8_9_10_11_12:
225  return 12;
226 
227  case FO_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10:
228  return 16;
229 
230  default:
232  }
233  return 1;
234 }
@ CUSTOM_OBD_UNKNOWN_FIRING_ORDER

Referenced by getFiringOrderCylinderId(), and getNextFiringCylinderId().

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

◆ getFiringOrderTable()

static const uint8_t* getFiringOrderTable ( )
static

Definition at line 236 of file engine_math.cpp.

236  {
237  switch (engineConfiguration->firingOrder) {
238  case FO_1:
239  return order_1;
240 // 2 cylinder
241  case FO_1_2:
242  return order_1_2;
243 // 3 cylinder
244  case FO_1_2_3:
245  return order_1_2_3;
246  case FO_1_3_2:
247  return order_1_3_2;
248 // 4 cylinder
249  case FO_1_3_4_2:
251  case FO_1_2_4_3:
253  case FO_1_3_2_4:
255  case FO_1_4_3_2:
257 // 5 cylinder
258  case FO_1_2_4_5_3:
259  return order_1_2_4_5_3;
260 
261 // 6 cylinder
262  case FO_1_5_3_6_2_4:
264  case FO_1_4_2_5_3_6:
266  case FO_1_2_3_4_5_6:
268  case FO_1_6_3_2_5_4:
269  return order_1_6_3_2_5_4;
270  case FO_1_4_3_6_2_5:
271  return order_1_4_3_6_2_5;
272  case FO_1_6_2_4_3_5:
273  return order_1_6_2_4_3_5;
274  case FO_1_6_5_4_3_2:
275  return order_1_6_5_4_3_2;
276  case FO_1_4_5_2_3_6:
277  return order_1_4_5_2_3_6;
278 
279 // 8 cylinder
280  case FO_1_8_4_3_6_5_7_2:
281  return order_1_8_4_3_6_5_7_2;
282  case FO_1_8_7_2_6_5_4_3:
283  return order_1_8_7_2_6_5_4_3;
284  case FO_1_5_4_2_6_3_7_8:
285  return order_1_5_4_2_6_3_7_8;
286  case FO_1_2_7_8_4_5_6_3:
287  return order_1_2_7_8_4_5_6_3;
288  case FO_1_3_7_2_6_5_4_8:
289  return order_1_3_7_2_6_5_4_8;
290  case FO_1_2_3_4_5_6_7_8:
291  return order_1_2_3_4_5_6_7_8;
292  case FO_1_5_4_8_6_3_7_2:
293  return order_1_5_4_8_6_3_7_2;
294  case FO_1_8_7_3_6_5_4_2:
295  return order_1_8_7_3_6_5_4_2;
296  case FO_1_5_4_8_3_7_2_6:
297  return order_1_5_4_8_3_7_2_6;
298  case FO_1_8_6_2_7_3_4_5:
299  return order_1_5_4_8_3_7_2_6;
300 
301 // 9 cylinder
302  case FO_1_2_3_4_5_6_7_8_9:
304 
305 
306 // 10 cylinder
307  case FO_1_10_9_4_3_6_5_8_7_2:
309  case FO_1_6_5_10_2_7_3_8_4_9:
311 
312 // 12 cylinder
313  case FO_1_7_5_11_3_9_6_12_2_8_4_10:
315  case FO_1_7_4_10_2_8_6_12_3_9_5_11:
317  case FO_1_12_5_8_3_10_6_7_2_11_4_9:
319  case FO_1_2_3_4_5_6_7_8_9_10_11_12:
321 
322 // do not ask
323  case FO_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10:
325 
326  default:
328  }
329 
330  return NULL;
331 }
static const uint8_t order_1_5_4_8_6_3_7_2[]
static const uint8_t order_1_THEN_3_THEN_4_THEN2[]
static const uint8_t order_1_4_5_2_3_6[]
static const uint8_t order_1_6_3_2_5_4[]
static const uint8_t order_1_THEN_4_THEN_2_THEN_5_THEN_3_THEN_6[]
static const uint8_t order_1_8_7_3_6_5_4_2[]
static const uint8_t order_1_THEN_4_THEN_3_THEN2[]
static const uint8_t order_1_THEN_2_THEN_4_THEN3[]
static const uint8_t order_1[]
static const uint8_t order_1_10_9_4_3_6_5_8_7_2[]
static const uint8_t order_1_5_4_8_3_7_2_6[]
static const uint8_t order_1_2_3_4_5_6_7_8_9[]
static const uint8_t order_1_3_7_2_6_5_4_8[]
static const uint8_t order_1_6_2_4_3_5[]
static const uint8_t order_1_3_2[]
static const uint8_t order_1_2_3_4_5_6_7_8[]
static const uint8_t order_1_6_5_10_2_7_3_8_4_9[]
static const uint8_t order_1_5_4_2_6_3_7_8[]
static const uint8_t order_1_2_7_8_4_5_6_3[]
static const uint8_t order_1_4_3_6_2_5[]
static const uint8_t order_1_THEN_3_THEN_2_THEN4[]
static const uint8_t order_1_8_7_2_6_5_4_3[]
static const uint8_t order_1_THEN_2_THEN_3_THEN_4_THEN_5_THEN_6[]
static const uint8_t order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10[]
static const uint8_t order_1_2_3[]
static const uint8_t order_1_2_3_4_5_6_7_8_9_10_11_12[]
static const uint8_t order_1_6_5_4_3_2[]
static const uint8_t order_1_2_4_5_3[]
static const uint8_t order_1_8_4_3_6_5_7_2[]
static const uint8_t order_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4[]
static const uint8_t order_1_12_5_8_3_10_6_7_2_11_4_9[]
static const uint8_t order_1_7_4_10_2_8_6_12_3_9_5_11[]
static const uint8_t order_1_7_5_11_3_9_6_12_2_8_4_10[]
static const uint8_t order_1_2[]

Referenced by getFiringOrderCylinderId(), and getNextFiringCylinderId().

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

◆ getFuelingLoad()

float getFuelingLoad ( )

Definition at line 47 of file engine_math.cpp.

47  {
48  return getEngineState()->fuelingLoad;
49 }
EngineState * getEngineState()
Definition: engine.cpp:576

Referenced by fuelClosedLoopCorrection(), IdleController::getClosedLoop(), VvtController::getSetpoint(), handleGetDataRequest(), EngineState::periodicFastCallback(), and readGppwmChannel().

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

◆ getIgnitionLoad()

float getIgnitionLoad ( )

Definition at line 51 of file engine_math.cpp.

51  {
52  return getEngineState()->ignitionLoad;
53 }

Referenced by KnockController::getMaximumRetard(), EngineState::periodicFastCallback(), and readGppwmChannel().

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

◆ getNextFiringCylinderId()

size_t getNextFiringCylinderId ( size_t  prevCylinderId)
Parameters
prevCylinderIdfrom one to cylindersCount
Returns
cylinderId from one to cylindersCount

Definition at line 368 of file engine_math.cpp.

368  {
369  const size_t firingOrderLength = getFiringOrderLength();
370  auto firingOrderTable = getFiringOrderTable();
371 
372  if (firingOrderTable) {
373  for (size_t i = 0; i < firingOrderLength; i++) {
374  if (firingOrderTable[i] == prevCylinderId) {
375  return firingOrderTable[(i + 1) % firingOrderLength];
376  }
377  }
378  }
379 
380  return 1;
381 }

Referenced by HIP9011::handleChannel(), and HIP9011::readValueAndHandleChannel().

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

◆ getPerCylinderFiringOrderOffset()

angle_t getPerCylinderFiringOrderOffset ( uint8_t  cylinderIndex,
uint8_t  cylinderNumber 
)

Gets phase offset for a particular cylinder's ID and number For example on 4 cylinder engine with firing order 1-3-4-2, this returns 0-180-360-540 for index 0-1-2-3 Cylinder number is used for per-cylinder adjustment, if you have an odd-fire engine (v-twin, V10, some v6, etc)

Definition at line 426 of file engine_math.cpp.

426  {
427  // base = position of this cylinder in the firing order.
428  // We get a cylinder every n-th of an engine cycle where N is the number of cylinders
429  auto firingOrderOffset = engine->engineState.engineCycle * cylinderIndex / engineConfiguration->cylindersCount;
430 
431  // Plus or minus any adjustment if this is an odd-fire engine
432  auto adjustment = engineConfiguration->timing_offset_cylinder[cylinderNumber];
433 
434  auto result = firingOrderOffset + adjustment;
435 
436  assertAngleRange(result, "getCylinderAngle", ObdCode::CUSTOM_ERR_CYL_ANGLE);
437 
438  return result;
439 }
EngineState engineState
Definition: engine.h:307
angle_t engineCycle
Definition: engine_state.h:27
@ CUSTOM_ERR_CYL_ANGLE

Referenced by InjectionEvent::computeInjectionAngle(), and prepareCylinderIgnitionSchedule().

Here is the caller graph for this function:

◆ prepareOutputSignals()

void prepareOutputSignals ( )

This heavy method is only invoked in case of a configuration change or initialization.

Definition at line 409 of file engine_math.cpp.

409  {
411 
412 #if EFI_UNIT_TEST
413  if (verboseMode) {
415  }
416 #endif /* EFI_UNIT_TEST */
417 
418 #if EFI_SHAFT_POSITION_INPUT
420 #endif // EFI_SHAFT_POSITION_INPUT
421 
422  // Fuel schedule may now be completely wrong, force a reset
424 }
const char * getIgnition_mode_e(ignition_mode_e value)
FuelSchedule injectionEvents
Definition: engine.h:250
void prepareTriggerShape()
bool verboseMode
angle_t getEngineCycle(operation_mode_e operationMode)
printf("\n")

Referenced by commonInitEngineController(), setIgnitionMode(), and Engine::updateTriggerWaveform().

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

◆ setAlgorithm()

void setAlgorithm ( engine_load_mode_e  algo)

this method sets algorithm and ignition table scale

Definition at line 448 of file engine_math.cpp.

Referenced by set201xHyundai(), setAlgorithmInt(), setBoardDefaultConfiguration(), setBoardOverrides(), setDodgeNeonNGCEngineConfiguration(), setFordEscortGt(), setFrankensoConfiguration(), setTestVVTEngineConfiguration(), and setVwAba().

Here is the caller graph for this function:

◆ setFlatInjectorLag()

void setFlatInjectorLag ( float  value)

Definition at line 452 of file engine_math.cpp.

452  {
454 }
float battLagCorr[VBAT_INJECTOR_CURVE_SIZE]
void setArrayValues(TValue(&array)[TSize], float value)
Definition: table_helper.h:148

Referenced by fuelBenchMode().

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

◆ setSingleCoilDwell()

void setSingleCoilDwell ( )

see also setConstantDwell

Definition at line 58 of file engine_math.cpp.

58  {
59  for (int i = 0; i < DWELL_CURVE_SIZE; i++) {
60  config->sparkDwellRpmBins[i] = (i + 1) * 50;
61  config->sparkDwellValues[i] = 4;
62  }
63 
64  config->sparkDwellRpmBins[5] = 500;
65  config->sparkDwellValues[5] = 4;
66 
67  config->sparkDwellRpmBins[6] = 4500;
68  config->sparkDwellValues[6] = 4;
69 
70  config->sparkDwellRpmBins[7] = 12500;
71  config->sparkDwellValues[7] = 0;
72 }
persistent_config_s * config
scaled_channel< uint16_t, 100, 1 > sparkDwellValues[DWELL_CURVE_SIZE]

Referenced by setFordAspireEngineConfiguration(), and setFordEscortGt().

Here is the caller graph for this function:

◆ setTimingRpmBin()

void setTimingRpmBin ( float  from,
float  to 
)

Definition at line 441 of file engine_math.cpp.

441  {
442  setRpmBin(config->ignitionRpmBins, IGN_RPM_COUNT, from, to);
443 }
void setRpmBin(kType array[], int size, float idleRpm, float topRpm)
Definition: table_helper.h:184

Referenced by setDefaultIgnition().

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

Variable Documentation

◆ order_1

const uint8_t order_1[] = {1}
static

Definition at line 111 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_10_9_4_3_6_5_8_7_2

const uint8_t order_1_10_9_4_3_6_5_8_7_2[] = {1, 10, 9, 4, 3, 6, 5, 8, 7, 2}
static

Definition at line 153 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_12_5_8_3_10_6_7_2_11_4_9

const uint8_t order_1_12_5_8_3_10_6_7_2_11_4_9[] = {1, 12, 5, 8, 3, 10, 6, 7, 2, 11, 4, 9}
static

Definition at line 159 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10

const uint8_t order_1_14_9_4_7_12_15_6_13_8_3_16_11_2_5_10[] = {1, 14, 9, 4, 7, 12, 15, 6, 13, 8, 3, 16, 11, 2, 5, 10}
static

Definition at line 163 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2

const uint8_t order_1_2[] = {1, 2}
static

Definition at line 113 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_3

const uint8_t order_1_2_3[] = {1, 2, 3}
static

Definition at line 115 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_3_4_5_6_7_8

const uint8_t order_1_2_3_4_5_6_7_8[] = { 1, 2, 3, 4, 5, 6, 7, 8 }
static

Definition at line 143 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_3_4_5_6_7_8_9

const uint8_t order_1_2_3_4_5_6_7_8_9[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
static

Definition at line 150 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_3_4_5_6_7_8_9_10_11_12

const uint8_t order_1_2_3_4_5_6_7_8_9_10_11_12[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
static

Definition at line 160 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_4_5_3

const uint8_t order_1_2_4_5_3[] = {1, 2, 4, 5, 3}
static

Definition at line 125 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_2_7_8_4_5_6_3

const uint8_t order_1_2_7_8_4_5_6_3[] = { 1, 2, 7, 8, 4, 5, 6, 3 }
static

Definition at line 141 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_3_2

const uint8_t order_1_3_2[] = {1, 3, 2}
static

Definition at line 116 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_3_7_2_6_5_4_8

const uint8_t order_1_3_7_2_6_5_4_8[] = { 1, 3, 7, 2, 6, 5, 4, 8 }
static

Definition at line 142 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_4_3_6_2_5

const uint8_t order_1_4_3_6_2_5[] = {1, 4, 3, 6, 2, 5}
static

Definition at line 132 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_4_5_2_3_6

const uint8_t order_1_4_5_2_3_6[] = {1, 4, 5, 2, 3, 6}
static

Definition at line 135 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_5_4_2_6_3_7_8

const uint8_t order_1_5_4_2_6_3_7_8[] = { 1, 5, 4, 2, 6, 3, 7, 8 }
static

Definition at line 140 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_5_4_8_3_7_2_6

const uint8_t order_1_5_4_8_3_7_2_6[] = { 1, 5, 4, 8, 3, 7, 2, 6 }
static

Definition at line 146 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_5_4_8_6_3_7_2

const uint8_t order_1_5_4_8_6_3_7_2[] = { 1, 5, 4, 8, 6, 3, 7, 2 }
static

Definition at line 144 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_6_2_4_3_5

const uint8_t order_1_6_2_4_3_5[] = {1, 6, 2, 4, 3, 5}
static

Definition at line 133 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_6_3_2_5_4

const uint8_t order_1_6_3_2_5_4[] = {1, 6, 3, 2, 5, 4}
static

Definition at line 131 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_6_5_10_2_7_3_8_4_9

const uint8_t order_1_6_5_10_2_7_3_8_4_9[] = {1, 6, 5, 10, 2, 7, 3, 8, 4, 9}
static

Definition at line 154 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_6_5_4_3_2

const uint8_t order_1_6_5_4_3_2[] = {1, 6, 5, 4, 3, 2}
static

Definition at line 134 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_7_4_10_2_8_6_12_3_9_5_11

const uint8_t order_1_7_4_10_2_8_6_12_3_9_5_11[] = {1, 7, 4, 10, 2, 8, 6, 12, 3, 9, 5, 11}
static

Definition at line 158 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_7_5_11_3_9_6_12_2_8_4_10

const uint8_t order_1_7_5_11_3_9_6_12_2_8_4_10[] = {1, 7, 5, 11, 3, 9, 6, 12, 2, 8, 4, 10}
static

Definition at line 157 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_8_4_3_6_5_7_2

const uint8_t order_1_8_4_3_6_5_7_2[] = { 1, 8, 4, 3, 6, 5, 7, 2 }
static

Definition at line 138 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_8_6_2_7_3_4_5

const uint8_t order_1_8_6_2_7_3_4_5[] = { 1, 8, 6, 2, 7, 3, 4, 5 }
static

Definition at line 147 of file engine_math.cpp.

◆ order_1_8_7_2_6_5_4_3

const uint8_t order_1_8_7_2_6_5_4_3[] = { 1, 8, 7, 2, 6, 5, 4, 3 }
static

Definition at line 139 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_8_7_3_6_5_4_2

const uint8_t order_1_8_7_3_6_5_4_2[] = { 1, 8, 7, 3, 6, 5, 4, 2 }
static

Definition at line 145 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_2_THEN_3_THEN_4_THEN_5_THEN_6

const uint8_t order_1_THEN_2_THEN_3_THEN_4_THEN_5_THEN_6[] = { 1, 2, 3, 4, 5, 6 }
static

Definition at line 130 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_2_THEN_4_THEN3

const uint8_t order_1_THEN_2_THEN_4_THEN3[] = { 1, 2, 4, 3 }
static

Definition at line 120 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_3_THEN_2_THEN4

const uint8_t order_1_THEN_3_THEN_2_THEN4[] = { 1, 3, 2, 4 }
static

Definition at line 121 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_3_THEN_4_THEN2

const uint8_t order_1_THEN_3_THEN_4_THEN2[] = { 1, 3, 4, 2 }
static

Definition at line 119 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_4_THEN_2_THEN_5_THEN_3_THEN_6

const uint8_t order_1_THEN_4_THEN_2_THEN_5_THEN_3_THEN_6[] = { 1, 4, 2, 5, 3, 6 }
static

Definition at line 129 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_4_THEN_3_THEN2

const uint8_t order_1_THEN_4_THEN_3_THEN2[] = { 1, 4, 3, 2 }
static

Definition at line 122 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ order_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4

const uint8_t order_1_THEN_5_THEN_3_THEN_6_THEN_2_THEN_4[] = { 1, 5, 3, 6, 2, 4 }
static

Definition at line 128 of file engine_math.cpp.

Referenced by getFiringOrderTable().

◆ verboseMode

bool verboseMode
extern

Referenced by prepareOutputSignals().

Go to the source code of this file.