Skip to content

Commit

Permalink
optional after start fuel mutliplier table
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 15, 2024
1 parent d8632f7 commit 6a202f4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
1 change: 1 addition & 0 deletions firmware/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ or
- Add two more aux linear sensors #476
- Support wasted spark on odd cylinder count and odd-fire engines. Improves startup and allows running without a cam sensor!
- Add an option for the DFCO MAP threshold to use a table dependent upon RPM #485 (thank you @alrijleh!)
- Ability to use an 8x8 table for after-start fuel multiplier that depends on CLT and engine run time

### Fixed
- Improve performance with Lua CAN reception of a high volume of frames
Expand Down
3 changes: 3 additions & 0 deletions firmware/controllers/algo/defaults/default_cranking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ void setDefaultCranking() {

engineConfiguration->postCrankingDurationSec = 10;

copyArray(config->postCrankingEnrichTempBins, { -20, 0, 20, 40, 60, 80, 100, 120 });
copyArray(config->postCrankingEnrichRuntimeBins, { 0, 10, 20, 40, 60, 90, 120, 180 });

setLinearCurve(config->crankingTpsCoef, /*from*/1, /*to*/1, 1);
setLinearCurve(config->crankingTpsBins, 0, 100, 1);

Expand Down
22 changes: 16 additions & 6 deletions firmware/controllers/algo/engine2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,23 @@ void EngineState::periodicFastCallback() {
engine->module<DfcoController>()->update();

// post-cranking fuel enrichment.
// for compatibility reasons, apply only if the factor is greater than unity (only allow adding fuel)
if (engineConfiguration->postCrankingFactor > 1.0f) {
// use interpolation for correction taper
engine->fuelComputer.running.postCrankingFuelCorrection = interpolateClamped(0.0f, engineConfiguration->postCrankingFactor,
engineConfiguration->postCrankingDurationSec, 1.0f, engine->fuelComputer.running.timeSinceCrankingInSecs);
if (engineConfiguration->postCrankingFuelUseTable) {
float postCrankingCorr = interpolate3d(
config->postCrankingEnrichTable,
config->postCrankingEnrichTempBins, Sensor::getOrZero(SensorType::Clt),
config->postCrankingEnrichRuntimeBins, engine->fuelComputer.running.timeSinceCrankingInSecs
);

engine->fuelComputer.running.postCrankingFuelCorrection = clampF(1, postCrankingCorr, 5);
} else {
engine->fuelComputer.running.postCrankingFuelCorrection = 1.0f;
// for compatibility reasons, apply only if the factor is greater than unity (only allow adding fuel)
if (engineConfiguration->postCrankingFactor > 1.0f) {
// use interpolation for correction taper
engine->fuelComputer.running.postCrankingFuelCorrection = interpolateClamped(0.0f, engineConfiguration->postCrankingFactor,
engineConfiguration->postCrankingDurationSec, 1.0f, engine->fuelComputer.running.timeSinceCrankingInSecs);
} else {
engine->fuelComputer.running.postCrankingFuelCorrection = 1.0f;
}
}

engine->ignitionState.cltTimingCorrection = getCltTimingCorrection();
Expand Down
6 changes: 5 additions & 1 deletion firmware/integration/rusefi_config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ bit is_enabled_spi_2
bit alignEngineSnifferAtTDC
bit enableAemXSeries;AEM X-Series or rusEFI Wideband
bit useTableForDfcoMap,"Table","Fixed";Fixed: MAP threshold cut fuel when conditions are met\nTable: Use a curve to vary the MAP threshold based on engine RPM

bit postCrankingFuelUseTable,"Table","Basic"

brain_input_pin_e[LOGIC_ANALYZER_CHANNEL_COUNT iterate] logicAnalyzerPins;

Expand Down Expand Up @@ -1732,6 +1732,10 @@ uint8_t[8] autoscale minimumOilPressureValues;;"kPa", 10, 0, 0, 1000, 0
uint8_t[DFCO_RPM_MAP_TABLE] autoscale dfcoMapRpmValuesBins;;"RPM", 100, 0, 0, 17500, 0
uint8_t[DFCO_RPM_MAP_TABLE] autoscale dfcoMapRpmValues;DFCO will activate when operating below this curve. Used to allow a higher threshold at low RPM where less vaccuum is generated;"MAP", 1, 0, 0, 50, 0

uint8_t[8 x 8] autoscale postCrankingEnrichTable;;"ratio", 0.02, 0, 1, 5, 2
int8_t[8] autoscale postCrankingEnrichTempBins;;"deg C", 1, 0, -40, 120, 0
uint8_t[8] postCrankingEnrichRuntimeBins;;"sec", 1, 0, 0, 180, 0

end_struct

! Pedal Position Sensor
Expand Down
12 changes: 10 additions & 2 deletions firmware/tunerstudio/tunerstudio.template.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,12 @@ curve = 32Curve, "3-2 Shift Solenoid Percent by Speed"
yBins = hpfpCompensationLoadBins, running_fuel
zBins = hpfpCompensation

table = postCrankingEnrichmentTable, postCrankingEnrichmentTableId, "", 1
xBins = postCrankingEnrichRuntimeBins, running_timeSinceCrankingInSecs
yBins = postCrankingEnrichTempBins, coolant
zBins = postCrankingEnrichTable
xyLabels = "Run time", "CLT"


[GaugeConfigurations]
gaugeCategory = "Fuel: math"
Expand Down Expand Up @@ -1813,6 +1819,7 @@ menuDialog = main
menu = "&Cranking"
subMenu = crankingDialog, "Cranking settings"
subMenu = postCrankingEnrichment, "After-start enrichment"
subMenu = postCrankingEnrichmentTable, "After-start enrichment table", 0, {postCrankingFuelUseTable}
subMenu = primingFuelPulsePanel, "Priming pulse"
subMenu = std_separator

Expand Down Expand Up @@ -3903,8 +3910,9 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
field = "Fixed Cranking Dwell", ignitionDwellForCrankingMs

dialog = postCrankingEnrichment, "After start enrichment"
field = "Post-Cranking factor", postCrankingFactor
field = "Duration", postCrankingDurationSec
field = "After start enrichment mode", postCrankingFuelUseTable
field = "Post-Cranking factor", postCrankingFactor, {postCrankingFuelUseTable == 0}
field = "Duration", postCrankingDurationSec, {postCrankingFuelUseTable == 0}

dialog = primingFuelPulsePanel, "Priming fuel pulse"
field = "Priming delay", primingDelay
Expand Down

0 comments on commit 6a202f4

Please sign in to comment.