Skip to content
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

Merged
merged 10 commits into from Sep 29, 2018

Conversation

andreika-git
Copy link
Collaborator

Please merge #610 first.

@@ -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;
Copy link
Collaborator Author

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);
Copy link
Collaborator Author

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;
Copy link
Collaborator Author

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);
Copy link
Collaborator Author

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);
Copy link
Collaborator Author

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);

Copy link
Collaborator Author

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.

@rusefi rusefi merged commit bd40691 into rusefi:master Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants