Annotations in C++ code to produce formulas in rusEfi console #807
This commit is contained in:
parent
c03fcd672e
commit
37a9e66bc1
|
@ -276,7 +276,7 @@ static void printSensors(Logging *log) {
|
||||||
reportSensorI(log, fileFormat, GAUGE_NAME_DEBUG_I5, "v", tsOutputChannels.debugIntField5);
|
reportSensorI(log, fileFormat, GAUGE_NAME_DEBUG_I5, "v", tsOutputChannels.debugIntField5);
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
|
|
||||||
reportSensorF(log, fileFormat, GAUGE_NAME_TCHARGE, "K", engine->engineState.tChargeK, 2); // log column #8
|
reportSensorF(log, fileFormat, GAUGE_NAME_TCHARGE, "K", engine->engineState.sd.tChargeK, 2); // log column #8
|
||||||
if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
if (hasMapSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
||||||
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_VE, "%", engine->engineState.currentBaroCorrectedVE * PERCENT_MULT, 2);
|
reportSensorF(log, fileFormat, GAUGE_NAME_FUEL_VE, "%", engine->engineState.currentBaroCorrectedVE * PERCENT_MULT, 2);
|
||||||
}
|
}
|
||||||
|
@ -947,12 +947,12 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
|
||||||
tsOutputChannels->acSwitchState = engine->acSwitchState;
|
tsOutputChannels->acSwitchState = engine->acSwitchState;
|
||||||
|
|
||||||
// tCharge depends on the previous state, so we should use the stored value.
|
// tCharge depends on the previous state, so we should use the stored value.
|
||||||
tsOutputChannels->tCharge = ENGINE(engineState.tCharge);
|
tsOutputChannels->tCharge = ENGINE(engineState.sd.tCharge);
|
||||||
float timing = engine->engineState.timingAdvance;
|
float timing = engine->engineState.timingAdvance;
|
||||||
tsOutputChannels->ignitionAdvance = timing > 360 ? timing - 720 : timing;
|
tsOutputChannels->ignitionAdvance = timing > 360 ? timing - 720 : timing;
|
||||||
tsOutputChannels->sparkDwell = ENGINE(engineState.sparkDwell);
|
tsOutputChannels->sparkDwell = ENGINE(engineState.sparkDwell);
|
||||||
tsOutputChannels->crankingFuelMs = engine->isCylinderCleanupMode ? 0 : getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE);
|
tsOutputChannels->crankingFuelMs = engine->isCylinderCleanupMode ? 0 : getCrankingFuel(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
tsOutputChannels->chargeAirMass = engine->engineState.airMass;
|
tsOutputChannels->chargeAirMass = engine->engineState.sd.airMassInOneCylinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern TunerStudioOutputChannels tsOutputChannels;
|
extern TunerStudioOutputChannels tsOutputChannels;
|
||||||
|
|
|
@ -245,8 +245,8 @@ void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUF
|
||||||
float secsPassed = (float)NT2US(curTime - timeSinceLastTChargeK) / 1000000.0f;
|
float secsPassed = (float)NT2US(curTime - timeSinceLastTChargeK) / 1000000.0f;
|
||||||
if (!cisnan(newTCharge)) {
|
if (!cisnan(newTCharge)) {
|
||||||
// control the rate of change or just fill with the initial value
|
// control the rate of change or just fill with the initial value
|
||||||
tCharge = (tChargeK == 0) ? newTCharge : limitRateOfChange(newTCharge, tCharge, CONFIG(tChargeAirIncrLimit), CONFIG(tChargeAirDecrLimit), secsPassed);
|
sd.tCharge = (sd.tChargeK == 0) ? newTCharge : limitRateOfChange(newTCharge, sd.tCharge, CONFIG(tChargeAirIncrLimit), CONFIG(tChargeAirDecrLimit), secsPassed);
|
||||||
tChargeK = convertCelsiusToKelvin(tCharge);
|
sd.tChargeK = convertCelsiusToKelvin(sd.tCharge);
|
||||||
timeSinceLastTChargeK = curTime;
|
timeSinceLastTChargeK = curTime;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -93,15 +93,9 @@ public:
|
||||||
|
|
||||||
float baroCorrection = 0;
|
float baroCorrection = 0;
|
||||||
|
|
||||||
// speed density
|
|
||||||
// Rate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.
|
|
||||||
float tCharge = 0;
|
|
||||||
float tChargeK = 0;
|
|
||||||
efitick_t timeSinceLastTChargeK;
|
efitick_t timeSinceLastTChargeK;
|
||||||
|
|
||||||
float currentRawVE = 0;
|
float currentRawVE = 0;
|
||||||
float currentBaroCorrectedVE = 0;
|
|
||||||
float targetAFR = 0;
|
|
||||||
|
|
||||||
int vssEventCounter = 0;
|
int vssEventCounter = 0;
|
||||||
int totalLoggedBytes = 0;
|
int totalLoggedBytes = 0;
|
||||||
|
|
|
@ -1,51 +1,88 @@
|
||||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Jun 17 20:32:33 EDT 2019
|
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
|
||||||
// begin
|
// begin
|
||||||
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
#ifndef CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
||||||
#define CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
#define CONTROLLERS_GENERATED_ENGINE_STATE_GENERATED_H
|
||||||
#include "rusefi_types.h"
|
#include "rusefi_types.h"
|
||||||
// start of engine_state2_s
|
// start of speed_density_s
|
||||||
struct engine_state2_s {
|
struct speed_density_s {
|
||||||
/**
|
/**
|
||||||
offset 0 bit 0 */
|
offset 0 bit 0 */
|
||||||
bool isTChargeAirModel : 1;
|
bool isTChargeAirModel : 1;
|
||||||
/**
|
/**
|
||||||
* speed-density logic, calculated air mass in grams
|
* Speed-density logic: calculated air mass in one cylinder, in grams
|
||||||
* offset 4
|
* offset 4
|
||||||
*/
|
*/
|
||||||
float airMass = 0;
|
float airMassInOneCylinder = 0;
|
||||||
/**
|
/**
|
||||||
|
* speed density
|
||||||
|
* Rate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.
|
||||||
* offset 8
|
* offset 8
|
||||||
*/
|
*/
|
||||||
float engineCycleDurationMs = 0;
|
float tCharge = 0;
|
||||||
/**
|
/**
|
||||||
* offset 12
|
* offset 12
|
||||||
*/
|
*/
|
||||||
float Tcharge_coff = 0;
|
float tChargeK = 0;
|
||||||
/**
|
/**
|
||||||
* offset 16
|
* offset 16
|
||||||
*/
|
*/
|
||||||
floatms_t airFlow = 0;
|
float Tcharge_coff = 0;
|
||||||
/**
|
/**
|
||||||
* offset 20
|
* offset 20
|
||||||
*/
|
*/
|
||||||
float minRpmKcurrentTPS = 0;
|
floatms_t airFlow = 0;
|
||||||
/**
|
/**
|
||||||
* offset 24
|
* offset 24
|
||||||
*/
|
*/
|
||||||
int currentTpsAdc = 0;
|
float manifoldAirPressureAccelerationAdjustment = 0;
|
||||||
/**
|
/**
|
||||||
* offset 28
|
* offset 28
|
||||||
*/
|
*/
|
||||||
float tpsVoltageMCU = 0;
|
float adjustedManifoldAirPressure = 0;
|
||||||
|
/** total size 32*/
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct speed_density_s speed_density_s;
|
||||||
|
|
||||||
|
// start of engine_state2_s
|
||||||
|
struct engine_state2_s {
|
||||||
|
/**
|
||||||
|
* offset 0
|
||||||
|
*/
|
||||||
|
speed_density_s sd;
|
||||||
/**
|
/**
|
||||||
* offset 32
|
* offset 32
|
||||||
*/
|
*/
|
||||||
|
float targetAFR = 0;
|
||||||
|
/**
|
||||||
|
* offset 36
|
||||||
|
*/
|
||||||
|
float engineCycleDurationMs = 0;
|
||||||
|
/**
|
||||||
|
* offset 40
|
||||||
|
*/
|
||||||
|
float minRpmKcurrentTPS = 0;
|
||||||
|
/**
|
||||||
|
* offset 44
|
||||||
|
*/
|
||||||
|
int currentTpsAdc = 0;
|
||||||
|
/**
|
||||||
|
* offset 48
|
||||||
|
*/
|
||||||
|
float tpsVoltageMCU = 0;
|
||||||
|
/**
|
||||||
|
* offset 52
|
||||||
|
*/
|
||||||
float tpsVoltageBoard = 0;
|
float tpsVoltageBoard = 0;
|
||||||
/** total size 36*/
|
/**
|
||||||
|
* offset 56
|
||||||
|
*/
|
||||||
|
float currentBaroCorrectedVE = 0;
|
||||||
|
/** total size 60*/
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct engine_state2_s engine_state2_s;
|
typedef struct engine_state2_s engine_state2_s;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// end
|
// end
|
||||||
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Jun 17 20:32:33 EDT 2019
|
// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
|
||||||
|
|
|
@ -37,10 +37,10 @@ temperature_t getTCharge(int rpm, float tps, float coolantTemp, float airTemp DE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((engine->engineState.DISPLAY_IF(isTChargeAirModel) = (CONFIG(tChargeMode) == TCHARGE_MODE_AIR_INTERP))) {
|
if ((engine->engineState.sd.DISPLAY_IF(isTChargeAirModel) = (CONFIG(tChargeMode) == TCHARGE_MODE_AIR_INTERP))) {
|
||||||
const floatms_t gramsPerMsToKgPerHour = (3600.0f * 1000.0f) / 1000.0f;
|
const floatms_t gramsPerMsToKgPerHour = (3600.0f * 1000.0f) / 1000.0f;
|
||||||
// We're actually using an 'old' airMass calculated for the previous cycle, but it's ok, we're not having any self-excitaton issues
|
// We're actually using an 'old' airMass calculated for the previous cycle, but it's ok, we're not having any self-excitaton issues
|
||||||
floatms_t airMassForEngine = engine->engineState./***display*/airMass * CONFIG(specs.cylindersCount);
|
floatms_t airMassForEngine = engine->engineState.sd./***display*/airMassInOneCylinder * CONFIG(specs.cylindersCount);
|
||||||
// airMass is in grams per 1 cycle for 1 cyl. Convert it to airFlow in kg/h for the engine.
|
// airMass is in grams per 1 cycle for 1 cyl. Convert it to airFlow in kg/h for the engine.
|
||||||
// And if the engine is stopped (0 rpm), then airFlow is also zero (avoiding NaN division)
|
// And if the engine is stopped (0 rpm), then airFlow is also zero (avoiding NaN division)
|
||||||
floatms_t airFlow = (rpm == 0) ? 0 : airMassForEngine * gramsPerMsToKgPerHour / getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
floatms_t airFlow = (rpm == 0) ? 0 : airMassForEngine * gramsPerMsToKgPerHour / getEngineCycleDuration(rpm PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
@ -48,7 +48,7 @@ temperature_t getTCharge(int rpm, float tps, float coolantTemp, float airTemp DE
|
||||||
DISPLAY_TEXT(interpolate_Air_Flow)
|
DISPLAY_TEXT(interpolate_Air_Flow)
|
||||||
engine->engineState.DISPLAY_FIELD(airFlow) = airFlow;
|
engine->engineState.DISPLAY_FIELD(airFlow) = airFlow;
|
||||||
DISPLAY_TEXT(Between)
|
DISPLAY_TEXT(Between)
|
||||||
engine->engineState.Tcharge_coff = interpolateClamped(0.0,
|
engine->engineState.sd.Tcharge_coff = interpolateClamped(0.0,
|
||||||
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMin)),
|
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMin)),
|
||||||
CONFIG(DISPLAY_CONFIG(tChargeAirFlowMax)),
|
CONFIG(DISPLAY_CONFIG(tChargeAirFlowMax)),
|
||||||
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMax)), airFlow);
|
CONFIG(DISPLAY_CONFIG(tChargeAirCoefMax)), airFlow);
|
||||||
|
@ -69,17 +69,17 @@ temperature_t getTCharge(int rpm, float tps, float coolantTemp, float airTemp DE
|
||||||
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMinTps)), tpMax,
|
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMinTps)), tpMax,
|
||||||
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMaxTps)), tps);
|
CONFIG(DISPLAY_CONFIG(tChargeMaxRpmMaxTps)), tps);
|
||||||
|
|
||||||
engine->engineState.Tcharge_coff = interpolateMsg("Kcurr", rpmMin, minRpmKcurrentTPS, rpmMax, maxRpmKcurrentTPS, rpm);
|
engine->engineState.sd.Tcharge_coff = interpolateMsg("Kcurr", rpmMin, minRpmKcurrentTPS, rpmMax, maxRpmKcurrentTPS, rpm);
|
||||||
/* DISPLAY_ENDIF */
|
/* DISPLAY_ENDIF */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cisnan(engine->engineState.Tcharge_coff)) {
|
if (cisnan(engine->engineState.sd.Tcharge_coff)) {
|
||||||
warning(CUSTOM_ERR_T2_CHARGE, "t2-getTCharge NaN");
|
warning(CUSTOM_ERR_T2_CHARGE, "t2-getTCharge NaN");
|
||||||
return coolantTemp;
|
return coolantTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We use a robust interp. function for proper tcharge_coff clamping.
|
// We use a robust interp. function for proper tcharge_coff clamping.
|
||||||
float Tcharge = interpolateClamped(0.0f, coolantTemp, 1.0f, airTemp, engine->engineState.Tcharge_coff);
|
float Tcharge = interpolateClamped(0.0f, coolantTemp, 1.0f, airTemp, engine->engineState.sd.Tcharge_coff);
|
||||||
|
|
||||||
if (cisnan(Tcharge)) {
|
if (cisnan(Tcharge)) {
|
||||||
// we can probably end up here while resetting engine state - interpolation would fail
|
// we can probably end up here while resetting engine state - interpolation would fail
|
||||||
|
@ -135,14 +135,16 @@ floatms_t getSpeedDensityFuel(float map DECLARE_GLOBAL_SUFFIX) {
|
||||||
/**
|
/**
|
||||||
* most of the values are pre-calculated for performance reasons
|
* most of the values are pre-calculated for performance reasons
|
||||||
*/
|
*/
|
||||||
float tChargeK = ENGINE(engineState.tChargeK);
|
float tChargeK = ENGINE(engineState.sd.tChargeK);
|
||||||
if (cisnan(tChargeK)) {
|
if (cisnan(tChargeK)) {
|
||||||
warning(CUSTOM_ERR_TCHARGE_NOT_READY2, "tChargeK not ready"); // this would happen before we have CLT reading for example
|
warning(CUSTOM_ERR_TCHARGE_NOT_READY2, "tChargeK not ready"); // this would happen before we have CLT reading for example
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(map), "NaN map", 0);
|
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(map), "NaN map", 0);
|
||||||
|
|
||||||
float adjustedMap = map + engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_GLOBAL_SIGNATURE);
|
engine->engineState.sd.manifoldAirPressureAccelerationAdjustment = engine->engineLoadAccelEnrichment.getEngineLoadEnrichment(PASS_GLOBAL_SIGNATURE);
|
||||||
|
|
||||||
|
float adjustedMap = engine->engineState.sd.adjustedManifoldAirPressure = map + engine->engineState.sd.manifoldAirPressureAccelerationAdjustment;
|
||||||
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(adjustedMap), "NaN adjustedMap", 0);
|
efiAssert(CUSTOM_ERR_ASSERT, !cisnan(adjustedMap), "NaN adjustedMap", 0);
|
||||||
|
|
||||||
float airMass = getCylinderAirMass(ENGINE(engineState.currentBaroCorrectedVE), adjustedMap, tChargeK PASS_GLOBAL_SUFFIX);
|
float airMass = getCylinderAirMass(ENGINE(engineState.currentBaroCorrectedVE), adjustedMap, tChargeK PASS_GLOBAL_SUFFIX);
|
||||||
|
@ -155,7 +157,7 @@ floatms_t getSpeedDensityFuel(float map DECLARE_GLOBAL_SUFFIX) {
|
||||||
map, adjustedMap, engine->engineState.airMass);
|
map, adjustedMap, engine->engineState.airMass);
|
||||||
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
#endif /*EFI_PRINTF_FUEL_DETAILS */
|
||||||
|
|
||||||
engine->engineState.airMass = airMass;
|
engine->engineState.sd.airMassInOneCylinder = airMass;
|
||||||
return sdMath(airMass, ENGINE(engineState.targetAFR) PASS_GLOBAL_SUFFIX) * 1000;
|
return sdMath(airMass, ENGINE(engineState.targetAFR) PASS_GLOBAL_SUFFIX) * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,42 @@
|
||||||
|
|
||||||
struct_no_prefix engine_state2_s
|
struct_no_prefix engine_state2_s
|
||||||
|
|
||||||
|
struct_no_prefix speed_density_s
|
||||||
|
|
||||||
bit isTChargeAirModel
|
bit isTChargeAirModel
|
||||||
|
|
||||||
float airMass;speed-density logic, calculated air mass in grams
|
float airMassInOneCylinder;Speed-density logic: calculated air mass in one cylinder, in grams
|
||||||
|
|
||||||
float engineCycleDurationMs;
|
float tCharge;speed density\nRate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.;
|
||||||
|
float tChargeK
|
||||||
|
|
||||||
float Tcharge_coff
|
float Tcharge_coff
|
||||||
|
|
||||||
floatms_t airFlow
|
floatms_t airFlow
|
||||||
|
|
||||||
|
|
||||||
|
float manifoldAirPressureAccelerationAdjustment;
|
||||||
|
float adjustedManifoldAirPressure;
|
||||||
|
|
||||||
|
|
||||||
|
! speed_density_s
|
||||||
|
end_struct
|
||||||
|
|
||||||
|
speed_density_s sd;
|
||||||
|
|
||||||
|
float targetAFR
|
||||||
|
|
||||||
|
|
||||||
|
float engineCycleDurationMs;
|
||||||
|
|
||||||
|
|
||||||
float minRpmKcurrentTPS
|
float minRpmKcurrentTPS
|
||||||
|
|
||||||
int currentTpsAdc
|
int currentTpsAdc
|
||||||
float tpsVoltageMCU
|
float tpsVoltageMCU
|
||||||
float tpsVoltageBoard
|
float tpsVoltageBoard
|
||||||
|
|
||||||
|
float currentBaroCorrectedVE;
|
||||||
|
|
||||||
|
! engine_state2_s
|
||||||
end_struct
|
end_struct
|
||||||
|
|
|
@ -1,28 +1,40 @@
|
||||||
package com.rusefi.config.generated;
|
package com.rusefi.config.generated;
|
||||||
|
|
||||||
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Mon Jun 17 20:32:33 EDT 2019
|
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/engine_state.txt Wed Jun 19 22:24:15 EDT 2019
|
||||||
|
|
||||||
import com.rusefi.config.*;
|
import com.rusefi.config.*;
|
||||||
|
|
||||||
public class EngineState {
|
public class EngineState {
|
||||||
public static final Field ISTCHARGEAIRMODEL = Field.create("ISTCHARGEAIRMODEL", 0, FieldType.BIT, 0);
|
public static final Field ISTCHARGEAIRMODEL = Field.create("ISTCHARGEAIRMODEL", 0, FieldType.BIT, 0);
|
||||||
public static final Field AIRMASS = Field.create("AIRMASS", 4, FieldType.FLOAT);
|
public static final Field AIRMASSINONECYLINDER = Field.create("AIRMASSINONECYLINDER", 4, FieldType.FLOAT);
|
||||||
public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 8, FieldType.FLOAT);
|
public static final Field TCHARGE = Field.create("TCHARGE", 8, FieldType.FLOAT);
|
||||||
public static final Field TCHARGE_COFF = Field.create("TCHARGE_COFF", 12, FieldType.FLOAT);
|
public static final Field TCHARGEK = Field.create("TCHARGEK", 12, FieldType.FLOAT);
|
||||||
public static final Field AIRFLOW = Field.create("AIRFLOW", 16, FieldType.FLOAT);
|
public static final Field TCHARGE_COFF = Field.create("TCHARGE_COFF", 16, FieldType.FLOAT);
|
||||||
public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 20, FieldType.FLOAT);
|
public static final Field AIRFLOW = Field.create("AIRFLOW", 20, FieldType.FLOAT);
|
||||||
public static final Field CURRENTTPSADC = Field.create("CURRENTTPSADC", 24, FieldType.INT);
|
public static final Field MANIFOLDAIRPRESSUREACCELERATIONADJUSTMENT = Field.create("MANIFOLDAIRPRESSUREACCELERATIONADJUSTMENT", 24, FieldType.FLOAT);
|
||||||
public static final Field TPSVOLTAGEMCU = Field.create("TPSVOLTAGEMCU", 28, FieldType.FLOAT);
|
public static final Field ADJUSTEDMANIFOLDAIRPRESSURE = Field.create("ADJUSTEDMANIFOLDAIRPRESSURE", 28, FieldType.FLOAT);
|
||||||
public static final Field TPSVOLTAGEBOARD = Field.create("TPSVOLTAGEBOARD", 32, FieldType.FLOAT);
|
public static final Field TARGETAFR = Field.create("TARGETAFR", 32, FieldType.FLOAT);
|
||||||
|
public static final Field ENGINECYCLEDURATIONMS = Field.create("ENGINECYCLEDURATIONMS", 36, FieldType.FLOAT);
|
||||||
|
public static final Field MINRPMKCURRENTTPS = Field.create("MINRPMKCURRENTTPS", 40, FieldType.FLOAT);
|
||||||
|
public static final Field CURRENTTPSADC = Field.create("CURRENTTPSADC", 44, FieldType.INT);
|
||||||
|
public static final Field TPSVOLTAGEMCU = Field.create("TPSVOLTAGEMCU", 48, FieldType.FLOAT);
|
||||||
|
public static final Field TPSVOLTAGEBOARD = Field.create("TPSVOLTAGEBOARD", 52, FieldType.FLOAT);
|
||||||
|
public static final Field CURRENTBAROCORRECTEDVE = Field.create("CURRENTBAROCORRECTEDVE", 56, FieldType.FLOAT);
|
||||||
public static final Field[] VALUES = {
|
public static final Field[] VALUES = {
|
||||||
ISTCHARGEAIRMODEL,
|
ISTCHARGEAIRMODEL,
|
||||||
AIRMASS,
|
AIRMASSINONECYLINDER,
|
||||||
ENGINECYCLEDURATIONMS,
|
TCHARGE,
|
||||||
|
TCHARGEK,
|
||||||
TCHARGE_COFF,
|
TCHARGE_COFF,
|
||||||
AIRFLOW,
|
AIRFLOW,
|
||||||
|
MANIFOLDAIRPRESSUREACCELERATIONADJUSTMENT,
|
||||||
|
ADJUSTEDMANIFOLDAIRPRESSURE,
|
||||||
|
TARGETAFR,
|
||||||
|
ENGINECYCLEDURATIONMS,
|
||||||
MINRPMKCURRENTTPS,
|
MINRPMKCURRENTTPS,
|
||||||
CURRENTTPSADC,
|
CURRENTTPSADC,
|
||||||
TPSVOLTAGEMCU,
|
TPSVOLTAGEMCU,
|
||||||
TPSVOLTAGEBOARD,
|
TPSVOLTAGEBOARD,
|
||||||
|
CURRENTBAROCORRECTEDVE,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,8 +58,8 @@ TEST(misc, testEngineMath) {
|
||||||
engineConfiguration->tChargeAirCoefMax = 0.902f;
|
engineConfiguration->tChargeAirCoefMax = 0.902f;
|
||||||
engineConfiguration->tChargeAirFlowMax = 153.6f;
|
engineConfiguration->tChargeAirFlowMax = 153.6f;
|
||||||
// calc. some airMass given the engine displacement=1.839 and 4 cylinders (FORD_ESCORT_GT)
|
// calc. some airMass given the engine displacement=1.839 and 4 cylinders (FORD_ESCORT_GT)
|
||||||
engine->engineState.airMass = getCylinderAirMass(/*VE*/1.0f, /*MAP*/100.0f, /*tChargeK*/273.15f + 20.0f PASS_ENGINE_PARAMETER_SUFFIX);
|
engine->engineState.sd.airMassInOneCylinder = getCylinderAirMass(/*VE*/1.0f, /*MAP*/100.0f, /*tChargeK*/273.15f + 20.0f PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
ASSERT_NEAR(0.5464f, engine->engineState.airMass, EPS4D);
|
ASSERT_NEAR(0.5464f, engine->engineState.sd.airMassInOneCylinder, EPS4D);
|
||||||
// calc. airFlow using airMass, and find tCharge
|
// calc. airFlow using airMass, and find tCharge
|
||||||
ASSERT_FLOAT_EQ(59.1175f, getTCharge(/*RPM*/1000, /*TPS*/0, /*CLT*/90.0f, /*IAT*/20.0f PASS_ENGINE_PARAMETER_SUFFIX));
|
ASSERT_FLOAT_EQ(59.1175f, getTCharge(/*RPM*/1000, /*TPS*/0, /*CLT*/90.0f, /*IAT*/20.0f PASS_ENGINE_PARAMETER_SUFFIX));
|
||||||
ASSERT_FLOAT_EQ(65.5625f/*kg/h*/, engine->engineState.airFlow);
|
ASSERT_FLOAT_EQ(65.5625f/*kg/h*/, engine->engineState.airFlow);
|
||||||
|
|
Loading…
Reference in New Issue