New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AirFlow-interpolated tCharge Mode #612
Conversation
@@ -686,7 +686,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ | |||
tsOutputChannels->intakeAirTemperature = intake; | |||
tsOutputChannels->throttlePositon = tps; | |||
tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMaf(PASS_ENGINE_PARAMETER_SIGNATURE) : 0; | |||
tsOutputChannels->massAirFlow = hasMafSensor() ? getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE) : 0; | |||
tsOutputChannels->massAirFlow = hasMafSensor() ? getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE) : engine->engineState.airFlow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For air-interpolated tCharge mode, we calculate a decent massAirFlow approximation, so we can show it to users even without MAF sensor!
@@ -914,7 +914,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ | |||
tsOutputChannels->clutchDownState = engine->clutchDownState; | |||
tsOutputChannels->brakePedalState = engine->brakePedalState; | |||
|
|||
tsOutputChannels->tCharge = getTCharge(rpm, tps, coolant, intake PASS_ENGINE_PARAMETER_SUFFIX); | |||
tsOutputChannels->tCharge = ENGINE(engineState.tCharge); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tCharge depends on the previous state now, so we should use the stored value.
@@ -194,7 +199,9 @@ class EngineState { | |||
float baroCorrection; | |||
|
|||
// speed density | |||
float tChargeK; | |||
float tCharge, tChargeK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate-of-change limiter is applied to degrees, so we store both Kelvin and degrees.
float minRpmKcurrentTPS = interpolateMsg("minRpm", tpMin, engineConfiguration->tChargeMinRpmMinTps, tpMax, | ||
engineConfiguration->tChargeMinRpmMaxTps, tps); | ||
float maxRpmKcurrentTPS = interpolateMsg("maxRpm", tpMin, engineConfiguration->tChargeMaxRpmMinTps, tpMax, | ||
engineConfiguration->tChargeMaxRpmMaxTps, tps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved below, it's now one of the possible modes inside if() statement.
if (cisnan(Tcharge_coff)) { | ||
warning(CUSTOM_ERR_T2_CHARGE, "t2-getTCharge NaN"); | ||
return coolantTemp; | ||
} | ||
|
||
float Tcharge = coolantTemp * (1 - Tcharge_coff) + airTemp * Tcharge_coff; | ||
float Tcharge = interpolateClamped(0.0f, coolantTemp, 1.0f, airTemp, Tcharge_coff); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use more robust interp. function for proper tcharge_coff clamping.
@@ -66,6 +66,8 @@ bool isSameF(float v1, float v2); | |||
bool strEqualCaseInsensitive(const char *str1, const char *str2); | |||
bool strEqual(const char *str1, const char *str2); | |||
|
|||
float limitRateOfChange(float newValue, float oldValue, float incrLimitPerSec, float decrLimitPerSec, float secsPassed); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently used by air-interp. tCharge mode.
cb217cb
to
7f2e15b
Compare
6975fa8
to
4a7d601
Compare
Please merge #610 first.