cranking fuel live data fix #911
This commit is contained in:
parent
c630feb23c
commit
b090be14b0
|
@ -48,20 +48,29 @@ DISPLAY(DISPLAY_IF(isCranking)) floatms_t getCrankingFuel3(float coolantTemperat
|
|||
/**
|
||||
* Cranking fuel changes over time
|
||||
*/
|
||||
DISPLAY_TEXT(Duration_coef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(durationCoefficient) = interpolate2d("crank", revolutionCounterSinceStart, config->crankingCycleBins,
|
||||
config->crankingCycleCoef);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
/**
|
||||
* Cranking fuel is different depending on engine coolant temperature
|
||||
*/
|
||||
DISPLAY_TEXT(Coolant_coef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(coolantTemperatureCoefficient) = cisnan(coolantTemperature) ? 1 : interpolate2d("crank", coolantTemperature, config->crankingFuelBins,
|
||||
config->crankingFuelCoef);
|
||||
DISPLAY_SENSOR(CLT);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
percent_t tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
DISPLAY_TEXT(TPS_coef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(tpsCoefficient) = cisnan(tps) ? 1 : interpolate2d("crankTps", tps, engineConfiguration->crankingTpsBins,
|
||||
engineConfiguration->crankingTpsCoef);
|
||||
DISPLAY_SENSOR(TPS);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Cranking_fuel);
|
||||
floatms_t crankingFuel = engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(fuel) = baseCrankingFuel
|
||||
* engine->engineState.cranking.durationCoefficient
|
||||
* engine->engineState.cranking.coolantTemperatureCoefficient
|
||||
|
@ -76,17 +85,40 @@ DISPLAY(DISPLAY_IF(isCranking)) floatms_t getCrankingFuel3(float coolantTemperat
|
|||
/* DISPLAY_ELSE */
|
||||
|
||||
floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
float iatCorrection = ENGINE(engineState.running.intakeTemperatureCoefficient);
|
||||
float cltCorrection = ENGINE(engineState.running.coolantTemperatureCoefficient);
|
||||
float postCrankingFuelCorrection = ENGINE(engineState.running.postCrankingFuelCorrection);
|
||||
DISPLAY_TEXT(Base_fuel);
|
||||
ENGINE(engineState.DISPLAY_PREFIX(running).DISPLAY_FIELD(baseFuel)) = baseFuel;
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
|
||||
DISPLAY_TEXT(Intake_coef);
|
||||
float iatCorrection = ENGINE(engineState.DISPLAY_PREFIX(running).DISPLAY_FIELD(intakeTemperatureCoefficient));
|
||||
DISPLAY_SENSOR(IAT);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Coolant_coef);
|
||||
float cltCorrection = ENGINE(engineState.DISPLAY_PREFIX(running).DISPLAY_FIELD(coolantTemperatureCoefficient));
|
||||
DISPLAY_SENSOR(CLT);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Post_cranking_coef);
|
||||
float postCrankingFuelCorrection = ENGINE(engineState.DISPLAY_PREFIX(running).DISPLAY_FIELD(postCrankingFuelCorrection));
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(iatCorrection), "NaN iatCorrection", 0);
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(cltCorrection), "NaN cltCorrection", 0);
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(postCrankingFuelCorrection), "NaN postCrankingFuelCorrection", 0);
|
||||
|
||||
floatms_t runningFuel = baseFuel * iatCorrection * cltCorrection * postCrankingFuelCorrection + ENGINE(engineState.running.pidCorrection);
|
||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(runningFuel), "NaN runningFuel", 0);
|
||||
ENGINE(engineState.running.fuel) = runningFuel;
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Running_fuel);
|
||||
ENGINE(engineState.DISPLAY_PREFIX(running).DISPLAY_FIELD(fuel)) = runningFuel;
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
DISPLAY_TEXT(Injector_lag);
|
||||
DISPLAY(DISPLAY_PREFIX(running).DISPLAY_FIELD(injectorLag));
|
||||
DISPLAY_SENSOR(VBATT);
|
||||
return runningFuel;
|
||||
}
|
||||
|
||||
|
|
|
@ -812,6 +812,6 @@ int getRusEfiVersion(void) {
|
|||
if (initBootloader() != 0)
|
||||
return 123;
|
||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||
return 20190826;
|
||||
return 20190827;
|
||||
}
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Aug 26 23:28:23 EDT 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Aug 28 00:23:00 EDT 2019
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
||||
|
@ -162,15 +162,19 @@ struct running_fuel_s {
|
|||
* offset 20
|
||||
*/
|
||||
floatms_t pidCorrection = (floatms_t)0;
|
||||
/**
|
||||
* offset 24
|
||||
*/
|
||||
floatms_t baseFuel = (floatms_t)0;
|
||||
/**
|
||||
* Actual injection duration with CLT, IAT and TPS acceleration corrections per cycle, as squirt duration.
|
||||
* Without injector lag.
|
||||
* @see baseFuel
|
||||
* @see actualLastInjection
|
||||
* offset 24
|
||||
* offset 28
|
||||
*/
|
||||
floatms_t fuel = (floatms_t)0;
|
||||
/** total size 28*/
|
||||
/** total size 32*/
|
||||
};
|
||||
|
||||
typedef struct running_fuel_s running_fuel_s;
|
||||
|
@ -228,11 +232,11 @@ struct engine_state2_s {
|
|||
* offset 104
|
||||
*/
|
||||
running_fuel_s running;
|
||||
/** total size 132*/
|
||||
/** total size 136*/
|
||||
};
|
||||
|
||||
typedef struct engine_state2_s engine_state2_s;
|
||||
|
||||
#endif
|
||||
// end
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Aug 26 23:28:23 EDT 2019
|
||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Aug 28 00:23:00 EDT 2019
|
||||
|
|
|
@ -92,6 +92,7 @@ float postCrankingFuelCorrection
|
|||
floatms_t pidCorrection;closed-loop fuel correction
|
||||
|
||||
|
||||
floatms_t baseFuel;
|
||||
floatms_t fuel;Actual injection duration with CLT, IAT and TPS acceleration corrections per cycle, as squirt duration.\nWithout injector lag.\n@see baseFuel\n@see actualLastInjection
|
||||
|
||||
|
||||
|
|
|
@ -77,13 +77,13 @@ public class Field {
|
|||
// not enum field
|
||||
Number number = value;
|
||||
if (number instanceof Float)
|
||||
return niceToString(number.floatValue());
|
||||
return niceToString(number.floatValue(), 3);
|
||||
return number.toString();
|
||||
}
|
||||
|
||||
public static String niceToString(double value) {
|
||||
public static String niceToString(double value, int i) {
|
||||
int scale = (int) Math.log10(value);
|
||||
int places = 1 + Math.max(0, 4 - scale);
|
||||
int places = 1 + Math.max(0, i - scale);
|
||||
double toScale = Math.pow(10, places);
|
||||
return Double.toString(Math.round(value * toScale) / toScale);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Aug 26 23:28:23 EDT 2019
|
||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Aug 28 00:23:00 EDT 2019
|
||||
|
||||
// by class com.rusefi.output.JavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
@ -43,7 +43,8 @@ public class EngineState {
|
|||
public static final Field RUNNING_TIMESINCECRANKINGINSECS = Field.create("RUNNING_TIMESINCECRANKINGINSECS", 116, FieldType.FLOAT);
|
||||
public static final Field RUNNING_INJECTORLAG = Field.create("RUNNING_INJECTORLAG", 120, FieldType.FLOAT);
|
||||
public static final Field RUNNING_PIDCORRECTION = Field.create("RUNNING_PIDCORRECTION", 124, FieldType.FLOAT);
|
||||
public static final Field RUNNING_FUEL = Field.create("RUNNING_FUEL", 128, FieldType.FLOAT);
|
||||
public static final Field RUNNING_BASEFUEL = Field.create("RUNNING_BASEFUEL", 128, FieldType.FLOAT);
|
||||
public static final Field RUNNING_FUEL = Field.create("RUNNING_FUEL", 132, FieldType.FLOAT);
|
||||
public static final Field[] VALUES = {
|
||||
ITERM,
|
||||
DTERM,
|
||||
|
@ -82,6 +83,7 @@ public class EngineState {
|
|||
RUNNING_TIMESINCECRANKINGINSECS,
|
||||
RUNNING_INJECTORLAG,
|
||||
RUNNING_PIDCORRECTION,
|
||||
RUNNING_BASEFUEL,
|
||||
RUNNING_FUEL,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -30,12 +30,14 @@ public class FieldTest {
|
|||
|
||||
@Test
|
||||
public void testPrecisionDependingOnScale() {
|
||||
assertEquals("1234567.1", Field.niceToString(1234567.123));
|
||||
assertEquals("10000.0", Field.niceToString(10000.00002));
|
||||
assertEquals("0.12302", Field.niceToString(0.12302));
|
||||
assertEquals("0.002", Field.niceToString(0.002));
|
||||
assertEquals("12.302", Field.niceToString(12.302));
|
||||
assertEquals("123.02", Field.niceToString(123.02));
|
||||
assertEquals("0.12302", Field.niceToString(0.12302, 4));
|
||||
assertEquals("0.1232", Field.niceToString(0.12317, 3));
|
||||
|
||||
assertEquals("1234567.1", Field.niceToString(1234567.123, 4));
|
||||
assertEquals("10000.0", Field.niceToString(10000.00002, 4));
|
||||
assertEquals("0.002", Field.niceToString(0.002, 4));
|
||||
assertEquals("12.302", Field.niceToString(12.302, 4));
|
||||
assertEquals("123.02", Field.niceToString(123.02, 4));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190825;
|
||||
public static final int CONSOLE_VERSION = 20190827;
|
||||
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
||||
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
|
|
|
@ -6,12 +6,42 @@ public class FuelMathMeta {
|
|||
public static final Request[] CONTENT = new Request[]{
|
||||
new IfRequest("isCranking",
|
||||
new Request[]{
|
||||
new TextRequest("Duration_coef"),
|
||||
new FieldRequest("cranking_durationCoefficient"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Coolant_coef"),
|
||||
new FieldRequest("cranking_coolantTemperatureCoefficient"),
|
||||
new SensorRequest("CLT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("TPS_coef"),
|
||||
new FieldRequest("cranking_tpsCoefficient"),
|
||||
new SensorRequest("TPS"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Cranking_fuel"),
|
||||
new FieldRequest("cranking_fuel"),
|
||||
},
|
||||
new Request[]{
|
||||
new TextRequest("Base_fuel"),
|
||||
new FieldRequest("running_baseFuel"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Intake_coef"),
|
||||
new FieldRequest("running_intakeTemperatureCoefficient"),
|
||||
new SensorRequest("IAT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Coolant_coef"),
|
||||
new FieldRequest("running_coolantTemperatureCoefficient"),
|
||||
new SensorRequest("CLT"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Post_cranking_coef"),
|
||||
new FieldRequest("running_postCrankingFuelCorrection"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Running_fuel"),
|
||||
new FieldRequest("running_fuel"),
|
||||
new TextRequest("eol"),
|
||||
new TextRequest("Injector_lag"),
|
||||
new FieldRequest("running_injectorLag"),
|
||||
new SensorRequest("VBATT"),
|
||||
}),
|
||||
};
|
||||
}
|
|
@ -120,7 +120,7 @@ public class LiveDocPanel {
|
|||
@Override
|
||||
public void refresh(BinaryProtocol bp, byte[] response) {
|
||||
double value = SensorCentral.getInstance().getValue(sensor);
|
||||
label.setText(niceToString(value));
|
||||
label.setText(niceToString(value, 4));
|
||||
}
|
||||
});
|
||||
} else if (r instanceof IfRequest) {
|
||||
|
@ -192,6 +192,10 @@ public class LiveDocPanel {
|
|||
@NotNull
|
||||
public static JPanel createLiveDocumentationPanel() {
|
||||
JPanel liveDocs = new JPanel(new MigLayout(LAYOUT));
|
||||
|
||||
liveDocs.add(createPanel("Fuel", "", Fields.LDS_ENGINE_STATE_INDEX,
|
||||
EngineState.VALUES, FuelMathMeta.CONTENT), CONSTRAINTS);
|
||||
|
||||
liveDocs.add(createPanel("tCharge", "", Fields.LDS_ENGINE_STATE_INDEX,
|
||||
EngineState.VALUES, SpeedDensityMeta.CONTENT), CONSTRAINTS);
|
||||
|
||||
|
|
Loading…
Reference in New Issue