Whatever we call it, no matter how we do it - we need live data / remote view into rusEFI actual state #3353
This commit is contained in:
parent
d4ba9b78d2
commit
97e34ad0d1
|
@ -66,12 +66,12 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATUR
|
|||
percent_t tpsFrom = cb.get(maxDeltaIndex - 1);
|
||||
percent_t deltaTps = tpsTo - tpsFrom;
|
||||
|
||||
float valueFromTable = tpsTpsMap.getValue(tpsFrom, tpsTo);
|
||||
|
||||
floatms_t extraFuel;
|
||||
if (deltaTps > engineConfiguration->tpsAccelEnrichmentThreshold) {
|
||||
isAboveAccelThreshold = deltaTps > engineConfiguration->tpsAccelEnrichmentThreshold;
|
||||
isBelowDecelThreshold = deltaTps < -engineConfiguration->tpsDecelEnleanmentThreshold;
|
||||
if (isAboveAccelThreshold) {
|
||||
valueFromTable = tpsTpsMap.getValue(tpsFrom, tpsTo);
|
||||
extraFuel = valueFromTable;
|
||||
} else if (deltaTps < -engineConfiguration->tpsDecelEnleanmentThreshold) {
|
||||
} else if (isBelowDecelThreshold) {
|
||||
extraFuel = deltaTps * engineConfiguration->tpsDecelEnleanmentMultiplier;
|
||||
} else {
|
||||
extraFuel = 0;
|
||||
|
@ -79,7 +79,8 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATUR
|
|||
|
||||
// Fractional enrichment (fuel portions are accumulated and split between several engine cycles.
|
||||
// This is a crude imitation of carburetor's acceleration pump.
|
||||
if (CONFIG(tpsAccelFractionPeriod) > 1 || CONFIG(tpsAccelFractionDivisor) > 1.0f) {
|
||||
isFractionalEnrichment = CONFIG(tpsAccelFractionPeriod) > 1 || CONFIG(tpsAccelFractionDivisor) > 1.0f;
|
||||
if (isFractionalEnrichment) {
|
||||
// make sure both values are non-zero
|
||||
float periodF = (float)maxI(CONFIG(tpsAccelFractionPeriod), 1);
|
||||
float divisor = maxF(CONFIG(tpsAccelFractionDivisor), 1.0f);
|
||||
|
@ -87,20 +88,20 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATUR
|
|||
// if current extra fuel portion is not "strong" enough, then we keep up the "pump pressure" with the accumulated portion
|
||||
floatms_t maxExtraFuel = maxF(extraFuel, accumulatedValue);
|
||||
// use only a fixed fraction of the accumulated portion
|
||||
floatms_t injFuel = maxExtraFuel / divisor;
|
||||
fractionalInjFuel = maxExtraFuel / divisor;
|
||||
|
||||
// update max counters
|
||||
maxExtraPerCycle = maxF(extraFuel, maxExtraPerCycle);
|
||||
maxInjectedPerPeriod = maxF(injFuel, maxInjectedPerPeriod);
|
||||
maxInjectedPerPeriod = maxF(fractionalInjFuel, maxInjectedPerPeriod);
|
||||
|
||||
// evenly split it between several engine cycles
|
||||
extraFuel = injFuel / periodF;
|
||||
extraFuel = fractionalInjFuel / periodF;
|
||||
} else {
|
||||
resetFractionValues();
|
||||
}
|
||||
|
||||
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
|
||||
#if EFI_TUNER_STUDIO
|
||||
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
|
||||
tsOutputChannels.debugFloatField1 = tpsFrom;
|
||||
tsOutputChannels.debugFloatField2 = tpsTo;
|
||||
tsOutputChannels.debugFloatField3 = valueFromTable;
|
||||
|
@ -109,8 +110,8 @@ floatms_t TpsAccelEnrichment::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATUR
|
|||
tsOutputChannels.debugFloatField6 = maxExtraPerPeriod;
|
||||
tsOutputChannels.debugFloatField7 = maxInjectedPerPeriod;
|
||||
tsOutputChannels.debugIntField1 = cycleCnt;
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
}
|
||||
#endif /* EFI_TUNER_STUDIO */
|
||||
|
||||
return extraFuel;
|
||||
}
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
#include "cyclic_buffer.h"
|
||||
#include "table_helper.h"
|
||||
#include "wall_fuel_state_generated.h"
|
||||
#include "tps_accel_state_generated.h"
|
||||
|
||||
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, float, float> tps_tps_Map3D_t;
|
||||
|
||||
/**
|
||||
* this object is used for MAP rate-of-change and TPS rate-of-change corrections
|
||||
*/
|
||||
class AccelEnrichment {
|
||||
class AccelEnrichment : public tps_accel_state_s {
|
||||
public:
|
||||
AccelEnrichment();
|
||||
int getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -40,15 +41,6 @@ public:
|
|||
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
void resetFractionValues();
|
||||
void resetAE();
|
||||
private:
|
||||
/**
|
||||
* Used for Fractional TPS enrichment.
|
||||
*/
|
||||
floatms_t accumulatedValue = 0;
|
||||
floatms_t maxExtraPerCycle = 0;
|
||||
floatms_t maxExtraPerPeriod = 0;
|
||||
floatms_t maxInjectedPerPeriod = 0;
|
||||
int cycleCnt = 0;
|
||||
};
|
||||
|
||||
void initAccelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -1,23 +1,29 @@
|
|||
struct_no_prefix tps_accel_state_s
|
||||
|
||||
custom percent_t 4 bits, F32, @OFFSET@, [0:2], "not important"
|
||||
|
||||
percent_t tpsFrom;
|
||||
percent_t tpsTo;
|
||||
percent_t deltaTps;
|
||||
|
||||
floatms_t extraFuel;
|
||||
float valueFromTable = 0;
|
||||
float valueFromTable;
|
||||
|
||||
bit isAboveAccelThreshold;
|
||||
bit isBelowDecelThreshold;
|
||||
bit isTimeToResetAccumulator
|
||||
bit isFractionalEnrichment
|
||||
|
||||
float fractionalInjFuel
|
||||
|
||||
! /**
|
||||
! * Used for Fractional TPS enrichment.
|
||||
! */
|
||||
floatms_t accumulatedValue;
|
||||
floatms_t maxExtraPerCycle;
|
||||
floatms_t maxExtraPerPeriod;
|
||||
floatms_t maxInjectedPerPeriod;
|
||||
cycleCnt = 0;
|
||||
floatms_t accumulatedValue
|
||||
floatms_t maxExtraPerCycle
|
||||
floatms_t maxExtraPerPeriod
|
||||
floatms_t maxInjectedPerPeriod
|
||||
int cycleCnt
|
||||
|
||||
|
||||
end_struct
|
||||
|
|
|
@ -1,12 +1,152 @@
|
|||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sat Oct 30 21:35:17 EDT 2021
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sat Oct 30 21:58:43 EDT 2021
|
||||
// by class com.rusefi.output.CHeaderConsumer
|
||||
// begin
|
||||
#pragma once
|
||||
#include "rusefi_types.h"
|
||||
// start of tps_accel_state_s
|
||||
struct tps_accel_state_s {
|
||||
/** total size 0*/
|
||||
/**
|
||||
* offset 0
|
||||
*/
|
||||
percent_t tpsFrom = (percent_t)0;
|
||||
/**
|
||||
* offset 4
|
||||
*/
|
||||
percent_t tpsTo = (percent_t)0;
|
||||
/**
|
||||
* offset 8
|
||||
*/
|
||||
percent_t deltaTps = (percent_t)0;
|
||||
/**
|
||||
* offset 12
|
||||
*/
|
||||
floatms_t extraFuel = (floatms_t)0;
|
||||
/**
|
||||
* offset 16
|
||||
*/
|
||||
float valueFromTable = (float)0;
|
||||
/**
|
||||
offset 20 bit 0 */
|
||||
bool isAboveAccelThreshold : 1;
|
||||
/**
|
||||
offset 20 bit 1 */
|
||||
bool isBelowDecelThreshold : 1;
|
||||
/**
|
||||
offset 20 bit 2 */
|
||||
bool isTimeToResetAccumulator : 1;
|
||||
/**
|
||||
offset 20 bit 3 */
|
||||
bool isFractionalEnrichment : 1;
|
||||
/**
|
||||
offset 20 bit 4 */
|
||||
bool unusedBit_9_4 : 1;
|
||||
/**
|
||||
offset 20 bit 5 */
|
||||
bool unusedBit_9_5 : 1;
|
||||
/**
|
||||
offset 20 bit 6 */
|
||||
bool unusedBit_9_6 : 1;
|
||||
/**
|
||||
offset 20 bit 7 */
|
||||
bool unusedBit_9_7 : 1;
|
||||
/**
|
||||
offset 20 bit 8 */
|
||||
bool unusedBit_9_8 : 1;
|
||||
/**
|
||||
offset 20 bit 9 */
|
||||
bool unusedBit_9_9 : 1;
|
||||
/**
|
||||
offset 20 bit 10 */
|
||||
bool unusedBit_9_10 : 1;
|
||||
/**
|
||||
offset 20 bit 11 */
|
||||
bool unusedBit_9_11 : 1;
|
||||
/**
|
||||
offset 20 bit 12 */
|
||||
bool unusedBit_9_12 : 1;
|
||||
/**
|
||||
offset 20 bit 13 */
|
||||
bool unusedBit_9_13 : 1;
|
||||
/**
|
||||
offset 20 bit 14 */
|
||||
bool unusedBit_9_14 : 1;
|
||||
/**
|
||||
offset 20 bit 15 */
|
||||
bool unusedBit_9_15 : 1;
|
||||
/**
|
||||
offset 20 bit 16 */
|
||||
bool unusedBit_9_16 : 1;
|
||||
/**
|
||||
offset 20 bit 17 */
|
||||
bool unusedBit_9_17 : 1;
|
||||
/**
|
||||
offset 20 bit 18 */
|
||||
bool unusedBit_9_18 : 1;
|
||||
/**
|
||||
offset 20 bit 19 */
|
||||
bool unusedBit_9_19 : 1;
|
||||
/**
|
||||
offset 20 bit 20 */
|
||||
bool unusedBit_9_20 : 1;
|
||||
/**
|
||||
offset 20 bit 21 */
|
||||
bool unusedBit_9_21 : 1;
|
||||
/**
|
||||
offset 20 bit 22 */
|
||||
bool unusedBit_9_22 : 1;
|
||||
/**
|
||||
offset 20 bit 23 */
|
||||
bool unusedBit_9_23 : 1;
|
||||
/**
|
||||
offset 20 bit 24 */
|
||||
bool unusedBit_9_24 : 1;
|
||||
/**
|
||||
offset 20 bit 25 */
|
||||
bool unusedBit_9_25 : 1;
|
||||
/**
|
||||
offset 20 bit 26 */
|
||||
bool unusedBit_9_26 : 1;
|
||||
/**
|
||||
offset 20 bit 27 */
|
||||
bool unusedBit_9_27 : 1;
|
||||
/**
|
||||
offset 20 bit 28 */
|
||||
bool unusedBit_9_28 : 1;
|
||||
/**
|
||||
offset 20 bit 29 */
|
||||
bool unusedBit_9_29 : 1;
|
||||
/**
|
||||
offset 20 bit 30 */
|
||||
bool unusedBit_9_30 : 1;
|
||||
/**
|
||||
offset 20 bit 31 */
|
||||
bool unusedBit_9_31 : 1;
|
||||
/**
|
||||
* offset 24
|
||||
*/
|
||||
float fractionalInjFuel = (float)0;
|
||||
/**
|
||||
* offset 28
|
||||
*/
|
||||
floatms_t accumulatedValue = (floatms_t)0;
|
||||
/**
|
||||
* offset 32
|
||||
*/
|
||||
floatms_t maxExtraPerCycle = (floatms_t)0;
|
||||
/**
|
||||
* offset 36
|
||||
*/
|
||||
floatms_t maxExtraPerPeriod = (floatms_t)0;
|
||||
/**
|
||||
* offset 40
|
||||
*/
|
||||
floatms_t maxInjectedPerPeriod = (floatms_t)0;
|
||||
/**
|
||||
* offset 44
|
||||
*/
|
||||
int cycleCnt = (int)0;
|
||||
/** total size 48*/
|
||||
};
|
||||
|
||||
// end
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sat Oct 30 21:35:17 EDT 2021
|
||||
// this section was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sat Oct 30 21:58:43 EDT 2021
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package com.rusefi.config.generated;
|
||||
|
||||
// this file was generated automatically by rusEFI tool ConfigDefinition.jar based on (unknown script) controllers/algo/tps_accel_state.txt Sat Oct 30 21:58:43 EDT 2021
|
||||
|
||||
// by class com.rusefi.output.FileJavaFieldsConsumer
|
||||
import com.rusefi.config.*;
|
||||
|
||||
public class TpsAccelState {
|
||||
public static final Field TPSFROM = Field.create("TPSFROM", 0, FieldType.FLOAT);
|
||||
public static final Field TPSTO = Field.create("TPSTO", 4, FieldType.FLOAT);
|
||||
public static final Field DELTATPS = Field.create("DELTATPS", 8, FieldType.FLOAT);
|
||||
public static final Field EXTRAFUEL = Field.create("EXTRAFUEL", 12, FieldType.FLOAT);
|
||||
public static final Field VALUEFROMTABLE = Field.create("VALUEFROMTABLE", 16, FieldType.FLOAT);
|
||||
public static final Field ISABOVEACCELTHRESHOLD = Field.create("ISABOVEACCELTHRESHOLD", 20, FieldType.BIT, 0);
|
||||
public static final Field ISBELOWDECELTHRESHOLD = Field.create("ISBELOWDECELTHRESHOLD", 20, FieldType.BIT, 1);
|
||||
public static final Field ISTIMETORESETACCUMULATOR = Field.create("ISTIMETORESETACCUMULATOR", 20, FieldType.BIT, 2);
|
||||
public static final Field ISFRACTIONALENRICHMENT = Field.create("ISFRACTIONALENRICHMENT", 20, FieldType.BIT, 3);
|
||||
public static final Field UNUSEDBIT_9_4 = Field.create("UNUSEDBIT_9_4", 20, FieldType.BIT, 4);
|
||||
public static final Field UNUSEDBIT_9_5 = Field.create("UNUSEDBIT_9_5", 20, FieldType.BIT, 5);
|
||||
public static final Field UNUSEDBIT_9_6 = Field.create("UNUSEDBIT_9_6", 20, FieldType.BIT, 6);
|
||||
public static final Field UNUSEDBIT_9_7 = Field.create("UNUSEDBIT_9_7", 20, FieldType.BIT, 7);
|
||||
public static final Field UNUSEDBIT_9_8 = Field.create("UNUSEDBIT_9_8", 20, FieldType.BIT, 8);
|
||||
public static final Field UNUSEDBIT_9_9 = Field.create("UNUSEDBIT_9_9", 20, FieldType.BIT, 9);
|
||||
public static final Field UNUSEDBIT_9_10 = Field.create("UNUSEDBIT_9_10", 20, FieldType.BIT, 10);
|
||||
public static final Field UNUSEDBIT_9_11 = Field.create("UNUSEDBIT_9_11", 20, FieldType.BIT, 11);
|
||||
public static final Field UNUSEDBIT_9_12 = Field.create("UNUSEDBIT_9_12", 20, FieldType.BIT, 12);
|
||||
public static final Field UNUSEDBIT_9_13 = Field.create("UNUSEDBIT_9_13", 20, FieldType.BIT, 13);
|
||||
public static final Field UNUSEDBIT_9_14 = Field.create("UNUSEDBIT_9_14", 20, FieldType.BIT, 14);
|
||||
public static final Field UNUSEDBIT_9_15 = Field.create("UNUSEDBIT_9_15", 20, FieldType.BIT, 15);
|
||||
public static final Field UNUSEDBIT_9_16 = Field.create("UNUSEDBIT_9_16", 20, FieldType.BIT, 16);
|
||||
public static final Field UNUSEDBIT_9_17 = Field.create("UNUSEDBIT_9_17", 20, FieldType.BIT, 17);
|
||||
public static final Field UNUSEDBIT_9_18 = Field.create("UNUSEDBIT_9_18", 20, FieldType.BIT, 18);
|
||||
public static final Field UNUSEDBIT_9_19 = Field.create("UNUSEDBIT_9_19", 20, FieldType.BIT, 19);
|
||||
public static final Field UNUSEDBIT_9_20 = Field.create("UNUSEDBIT_9_20", 20, FieldType.BIT, 20);
|
||||
public static final Field UNUSEDBIT_9_21 = Field.create("UNUSEDBIT_9_21", 20, FieldType.BIT, 21);
|
||||
public static final Field UNUSEDBIT_9_22 = Field.create("UNUSEDBIT_9_22", 20, FieldType.BIT, 22);
|
||||
public static final Field UNUSEDBIT_9_23 = Field.create("UNUSEDBIT_9_23", 20, FieldType.BIT, 23);
|
||||
public static final Field UNUSEDBIT_9_24 = Field.create("UNUSEDBIT_9_24", 20, FieldType.BIT, 24);
|
||||
public static final Field UNUSEDBIT_9_25 = Field.create("UNUSEDBIT_9_25", 20, FieldType.BIT, 25);
|
||||
public static final Field UNUSEDBIT_9_26 = Field.create("UNUSEDBIT_9_26", 20, FieldType.BIT, 26);
|
||||
public static final Field UNUSEDBIT_9_27 = Field.create("UNUSEDBIT_9_27", 20, FieldType.BIT, 27);
|
||||
public static final Field UNUSEDBIT_9_28 = Field.create("UNUSEDBIT_9_28", 20, FieldType.BIT, 28);
|
||||
public static final Field UNUSEDBIT_9_29 = Field.create("UNUSEDBIT_9_29", 20, FieldType.BIT, 29);
|
||||
public static final Field UNUSEDBIT_9_30 = Field.create("UNUSEDBIT_9_30", 20, FieldType.BIT, 30);
|
||||
public static final Field UNUSEDBIT_9_31 = Field.create("UNUSEDBIT_9_31", 20, FieldType.BIT, 31);
|
||||
public static final Field FRACTIONALINJFUEL = Field.create("FRACTIONALINJFUEL", 24, FieldType.FLOAT);
|
||||
public static final Field ACCUMULATEDVALUE = Field.create("ACCUMULATEDVALUE", 28, FieldType.FLOAT);
|
||||
public static final Field MAXEXTRAPERCYCLE = Field.create("MAXEXTRAPERCYCLE", 32, FieldType.FLOAT);
|
||||
public static final Field MAXEXTRAPERPERIOD = Field.create("MAXEXTRAPERPERIOD", 36, FieldType.FLOAT);
|
||||
public static final Field MAXINJECTEDPERPERIOD = Field.create("MAXINJECTEDPERPERIOD", 40, FieldType.FLOAT);
|
||||
public static final Field CYCLECNT = Field.create("CYCLECNT", 44, FieldType.INT);
|
||||
public static final Field[] VALUES = {
|
||||
TPSFROM,
|
||||
TPSTO,
|
||||
DELTATPS,
|
||||
EXTRAFUEL,
|
||||
VALUEFROMTABLE,
|
||||
ISABOVEACCELTHRESHOLD,
|
||||
ISBELOWDECELTHRESHOLD,
|
||||
ISTIMETORESETACCUMULATOR,
|
||||
ISFRACTIONALENRICHMENT,
|
||||
UNUSEDBIT_9_4,
|
||||
UNUSEDBIT_9_5,
|
||||
UNUSEDBIT_9_6,
|
||||
UNUSEDBIT_9_7,
|
||||
UNUSEDBIT_9_8,
|
||||
UNUSEDBIT_9_9,
|
||||
UNUSEDBIT_9_10,
|
||||
UNUSEDBIT_9_11,
|
||||
UNUSEDBIT_9_12,
|
||||
UNUSEDBIT_9_13,
|
||||
UNUSEDBIT_9_14,
|
||||
UNUSEDBIT_9_15,
|
||||
UNUSEDBIT_9_16,
|
||||
UNUSEDBIT_9_17,
|
||||
UNUSEDBIT_9_18,
|
||||
UNUSEDBIT_9_19,
|
||||
UNUSEDBIT_9_20,
|
||||
UNUSEDBIT_9_21,
|
||||
UNUSEDBIT_9_22,
|
||||
UNUSEDBIT_9_23,
|
||||
UNUSEDBIT_9_24,
|
||||
UNUSEDBIT_9_25,
|
||||
UNUSEDBIT_9_26,
|
||||
UNUSEDBIT_9_27,
|
||||
UNUSEDBIT_9_28,
|
||||
UNUSEDBIT_9_29,
|
||||
UNUSEDBIT_9_30,
|
||||
UNUSEDBIT_9_31,
|
||||
FRACTIONALINJFUEL,
|
||||
ACCUMULATEDVALUE,
|
||||
MAXEXTRAPERCYCLE,
|
||||
MAXEXTRAPERPERIOD,
|
||||
MAXINJECTEDPERPERIOD,
|
||||
CYCLECNT,
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue