rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
engine_math.h
Go to the documentation of this file.
1/**
2 * @file engine_math.h
3 *
4 * @date Jul 13, 2013
5 * @author Andrey Belomutskiy, (c) 2012-2020
6 */
7
8#pragma once
9
10#include "rusefi_enums.h"
11
12void setAlgorithm(engine_load_mode_e algo);
13
14void setFlatInjectorLag(float value);
15
16/**
17 * @return time needed to rotate crankshaft by one degree, in milliseconds.
18 * @deprecated use at least Us, maybe even Nt
19 */
20#define getOneDegreeTimeMs(rpm) (1000.0f * 60 / 360 / (rpm))
21
22/**
23 * @return float, time needed to rotate crankshaft by one degree, in microseconds.
24 * See also engine->rpmCalculator.oneDegreeUs
25 */
26#define getOneDegreeTimeUs(rpm) (1000000.0f * 60 / 360 / (rpm))
27
30
31float getFuelingLoad();
32float getIgnitionLoad();
33
35
36void setTimingRpmBin(float from, float to);
37
39
40// we combine trigger-defined triggerShape.tdcPosition with user-defined engineConfiguration->globalTriggerAngleOffset
41// expectation is that for well-known triggers engineConfiguration->globalTriggerAngleOffset would usually be zero
42// while for toothed wheels user would have to provide a value
43// If camSyncOnSecondCrankRevolution is active, 360° are added
44#define tdcPosition() \
45 (getTriggerCentral()->triggerShape.tdcPosition \
46 + ( engineConfiguration->camSyncOnSecondCrankRevolution ? engineConfiguration->globalTriggerAngleOffset + 360 : engineConfiguration->globalTriggerAngleOffset ))
47
48/** Gets phase offset for a particular cylinder's ID and number
49 * For example on 4 cylinder engine with firing order 1-3-4-2, this
50 * returns 0-180-360-540 for index 0-1-2-3
51 * Cylinder number is used for per-cylinder adjustment, if you have
52 * an odd-fire engine (v-twin, V10, some v6, etc)
53 */
54angle_t getPerCylinderFiringOrderOffset(uint8_t cylinderIndex, uint8_t cylinderNumber);
55
56// Table blending helpers
58 // Input blend parameter (lookup to bias table)
60
61 // Bias in percent (0-100%)
62 float Bias;
63
64 // Result value (bias * table value)
65 float Value;
66
67 // Y axis value used for lookup (to show the dot correctly in TunerStudio)
69};
70
71BlendResult calculateBlend(blend_table_s& cfg, float rpm, float load);
angle_t getPerCylinderFiringOrderOffset(uint8_t cylinderIndex, uint8_t cylinderNumber)
void setAlgorithm(engine_load_mode_e algo)
void setFlatInjectorLag(float value)
floatms_t getEngineCycleDuration(float rpm)
void setSingleCoilDwell()
float getFuelingLoad()
void setTimingRpmBin(float from, float to)
floatms_t getCrankshaftRevolutionTimeMs(float rpm)
BlendResult calculateBlend(blend_table_s &cfg, float rpm, float load)
ignition_mode_e getCurrentIgnitionMode()
float getIgnitionLoad()
Fundamental rusEFI enumerable types live here.
ignition_mode_e
float floatms_t
float angle_t
float TableYAxis
Definition engine_math.h:68
float BlendParameter
Definition engine_math.h:59