2015-07-10 06:01:56 -07:00
|
|
|
/**
|
|
|
|
* @file accel_enrichment.cpp
|
|
|
|
* @brief Acceleration enrichment calculator
|
|
|
|
*
|
2015-08-21 12:01:36 -07:00
|
|
|
* In this file we have three strategies for acceleration/deceleration fuel correction
|
|
|
|
*
|
|
|
|
* 1) MAP rate-of-change correction
|
|
|
|
* 2) TPS rate-of-change correction
|
|
|
|
* 3) fuel film/wal wetting correction
|
|
|
|
* AWC Added to Wall Coefficient, %
|
|
|
|
* AWA Added to Wall Amount
|
|
|
|
* SOC Sucked Off wall Coefficient, %
|
|
|
|
* SOA Sucked Off wall amount
|
|
|
|
* WF current on-Wall Fuel amount
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* http://rusefi.com/wiki/index.php?title=Manual:Software:Fuel_Control
|
2015-07-10 06:01:56 -07:00
|
|
|
* @date Apr 21, 2014
|
|
|
|
* @author Dmitry Sidin
|
2018-01-20 17:55:31 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2018
|
2019-01-06 17:45:51 -08:00
|
|
|
* @author Matthew Kennedy
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2018-09-16 19:26:57 -07:00
|
|
|
#include "global.h"
|
2019-01-27 21:44:30 -08:00
|
|
|
#include "engine.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "trigger_central.h"
|
|
|
|
#include "accel_enrichment.h"
|
2019-05-27 15:58:43 -07:00
|
|
|
#include "allsensors.h"
|
2015-07-10 06:01:56 -07:00
|
|
|
#include "engine_math.h"
|
|
|
|
#include "signal_executor.h"
|
2019-04-12 19:07:03 -07:00
|
|
|
#if EFI_TUNER_STUDIO
|
2018-11-16 05:08:20 -08:00
|
|
|
#include "tunerstudio_configuration.h"
|
2016-03-11 08:03:18 -08:00
|
|
|
extern TunerStudioOutputChannels tsOutputChannels;
|
2018-11-16 04:40:06 -08:00
|
|
|
#endif /* EFI_TUNER_STUDIO */
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
EXTERN_ENGINE
|
|
|
|
;
|
|
|
|
|
2016-03-11 08:03:18 -08:00
|
|
|
tps_tps_Map3D_t tpsTpsMap("tpsTps");
|
|
|
|
|
2016-01-31 14:01:29 -08:00
|
|
|
static Logging *logger = NULL;
|
2015-07-10 06:01:56 -07:00
|
|
|
|
2015-08-21 12:01:36 -07:00
|
|
|
WallFuel::WallFuel() {
|
2015-09-03 06:01:31 -07:00
|
|
|
reset();
|
2015-08-21 12:01:36 -07:00
|
|
|
}
|
|
|
|
|
2015-09-02 18:03:43 -07:00
|
|
|
void WallFuel::reset() {
|
2015-09-03 06:01:31 -07:00
|
|
|
memset(wallFuel, 0, sizeof(wallFuel));
|
2015-09-02 18:03:43 -07:00
|
|
|
}
|
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
floatms_t WallFuel::adjust(int injectorIndex, floatms_t M_des DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|
|
|
if (cisnan(M_des)) {
|
|
|
|
return M_des;
|
2015-08-23 22:01:28 -07:00
|
|
|
}
|
2018-01-26 04:14:31 -08:00
|
|
|
// disable this correction for cranking
|
|
|
|
if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) {
|
2019-01-06 17:45:51 -08:00
|
|
|
return M_des;
|
2018-01-26 04:14:31 -08:00
|
|
|
}
|
2015-08-21 12:01:36 -07:00
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
/*
|
|
|
|
this math is based on
|
|
|
|
SAE 810494 by C. F. Aquino
|
|
|
|
SAE 1999-01-0553 by Peter J Maloney
|
2015-08-21 12:01:36 -07:00
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
M_cmd = commanded fuel mass (output of this function)
|
|
|
|
M_des = desired fuel mass (input to this function)
|
|
|
|
M_f = fuel film mass (how much is currently on the wall)
|
2015-08-21 12:01:36 -07:00
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
First we compute how much fuel to command, by accounting for
|
|
|
|
a) how much fuel will evaporate from the walls, entering the air
|
|
|
|
b) how much fuel from the injector will hit the walls, being deposited
|
|
|
|
|
|
|
|
Next, we compute how much fuel will be deposited on the walls. The net
|
|
|
|
effect of these two steps is computed (some leaves walls, some is deposited)
|
|
|
|
and stored back in M_f.
|
|
|
|
|
|
|
|
alpha describes the amount of fuel that REMAINS on the wall per cycle.
|
|
|
|
It is computed as a function of the evaporation time constant (tau) and
|
|
|
|
the time the fuel spent on the wall this cycle, (recriprocal RPM).
|
|
|
|
|
|
|
|
beta describes the amount of fuel that hits the wall.
|
|
|
|
|
|
|
|
TODO: these parameters, tau and beta vary with various engine parameters,
|
|
|
|
most notably manifold pressure (as a proxy for air speed), and coolant
|
|
|
|
temperature (as a proxy for the intake valve and runner temperature).
|
|
|
|
|
|
|
|
TAU: decreases with increasing temperature.
|
|
|
|
decreases with decreasing manifold pressure.
|
|
|
|
|
|
|
|
BETA: decreases with increasing temperature.
|
|
|
|
decreases with decreasing manifold pressure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// if tau is really small, we get div/0.
|
|
|
|
// you probably meant to disable wwae.
|
|
|
|
float tau = CONFIG(wwaeTau);
|
|
|
|
if(tau < 0.01f)
|
|
|
|
{
|
|
|
|
return M_des;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ignore really slow RPM
|
2019-01-21 18:48:58 -08:00
|
|
|
int rpm = GET_RPM();
|
2019-01-06 17:45:51 -08:00
|
|
|
if(rpm < 100)
|
|
|
|
{
|
|
|
|
return M_des;
|
|
|
|
}
|
|
|
|
|
|
|
|
float alpha = expf_taylor(-120 / (rpm * tau));
|
|
|
|
float beta = CONFIG(wwaeBeta);
|
|
|
|
|
|
|
|
// If beta is larger than alpha, the system is underdamped.
|
|
|
|
// For reasonable values {tau, beta}, this should only be possible
|
|
|
|
// at extremely low engine speeds (<300rpm ish)
|
|
|
|
// Clamp beta to less than alpha.
|
|
|
|
if(beta > alpha)
|
|
|
|
{
|
|
|
|
beta = alpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
float M_f = wallFuel[injectorIndex];
|
|
|
|
float M_cmd = (M_des - (1 - alpha) * M_f) / (1 - beta);
|
|
|
|
|
2017-11-25 17:05:40 -08:00
|
|
|
// We can't inject a negative amount of fuel
|
|
|
|
// If this goes below zero we will be over-fueling slightly,
|
|
|
|
// but that's ok.
|
2019-01-06 17:45:51 -08:00
|
|
|
if(M_cmd <= 0)
|
|
|
|
{
|
|
|
|
M_cmd = 0;
|
2017-11-25 17:05:40 -08:00
|
|
|
}
|
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
// remainder on walls from last time + new from this time
|
|
|
|
float M_f_next = alpha * M_f + beta * M_cmd;
|
|
|
|
|
|
|
|
wallFuel[injectorIndex] = M_f_next;
|
|
|
|
engine->wallFuelCorrection = M_cmd - M_des;
|
|
|
|
return M_cmd;
|
2015-08-21 12:01:36 -07:00
|
|
|
}
|
|
|
|
|
2015-08-23 20:02:37 -07:00
|
|
|
floatms_t WallFuel::getWallFuel(int injectorIndex) {
|
|
|
|
return wallFuel[injectorIndex];
|
2015-08-23 18:03:42 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
int AccelEnrichmemnt::getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
2016-03-09 21:04:40 -08:00
|
|
|
|
|
|
|
int len = minI(cb.getSize(), cb.getCount());
|
|
|
|
if (len < 2)
|
|
|
|
return 0;
|
2016-03-10 19:02:54 -08:00
|
|
|
int ci = cb.currentIndex - 1;
|
|
|
|
float maxValue = cb.get(ci) - cb.get(ci - 1);
|
|
|
|
int resultIndex = ci;
|
|
|
|
|
|
|
|
// todo: 'get' method is maybe a bit heavy because of the branching
|
|
|
|
// todo: this could be optimized with some careful magic
|
2016-03-09 21:04:40 -08:00
|
|
|
|
2016-03-10 19:02:54 -08:00
|
|
|
for (int i = 1; i<len - 1;i++) {
|
|
|
|
float v = cb.get(ci - i) - cb.get(ci - i - 1);
|
2016-03-09 21:04:40 -08:00
|
|
|
if (v > maxValue) {
|
|
|
|
maxValue = v;
|
2016-03-10 19:02:54 -08:00
|
|
|
resultIndex = ci - i;
|
2016-03-09 21:04:40 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-10 19:02:54 -08:00
|
|
|
return resultIndex;
|
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
float AccelEnrichmemnt::getMaxDelta(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|
|
|
int index = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2016-03-10 19:02:54 -08:00
|
|
|
|
2019-04-20 14:34:23 -07:00
|
|
|
return (cb.get(index) - (cb.get(index - 1)));
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2016-01-02 13:01:27 -08:00
|
|
|
// todo: eliminate code duplication between these two methods! Some pointer magic would help.
|
2017-05-15 20:28:49 -07:00
|
|
|
floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
2019-03-16 08:14:52 -07:00
|
|
|
int maxDeltaIndex = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2016-03-11 08:03:18 -08:00
|
|
|
|
2019-01-04 21:57:09 -08:00
|
|
|
// FuelSchedule *fs = engineConfiguration->injectionEvents;
|
2019-03-16 08:14:52 -07:00
|
|
|
percent_t tpsTo = cb.get(maxDeltaIndex);
|
|
|
|
percent_t tpsFrom = cb.get(maxDeltaIndex - 1);
|
|
|
|
percent_t deltaTps = tpsTo - tpsFrom;
|
2016-03-11 08:03:18 -08:00
|
|
|
|
2016-09-17 16:02:34 -07:00
|
|
|
float valueFromTable = tpsTpsMap.getValue(tpsFrom, tpsTo);
|
2016-03-11 08:03:18 -08:00
|
|
|
|
2016-03-12 17:03:40 -08:00
|
|
|
floatms_t extraFuel;
|
2019-03-16 08:14:52 -07:00
|
|
|
if (deltaTps > engineConfiguration->tpsAccelEnrichmentThreshold) {
|
2016-09-17 16:02:34 -07:00
|
|
|
extraFuel = valueFromTable;
|
2019-03-16 08:14:52 -07:00
|
|
|
} else if (deltaTps < -engineConfiguration->tpsDecelEnleanmentThreshold) {
|
|
|
|
extraFuel = deltaTps * engineConfiguration->tpsDecelEnleanmentMultiplier;
|
2016-03-11 11:03:23 -08:00
|
|
|
} else {
|
2016-03-12 17:03:40 -08:00
|
|
|
extraFuel = 0;
|
2016-03-11 11:03:23 -08:00
|
|
|
}
|
|
|
|
|
2019-03-28 19:47:20 -07:00
|
|
|
// 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) {
|
|
|
|
// make sure both values are non-zero
|
|
|
|
float periodF = (float)maxI(CONFIG(tpsAccelFractionPeriod), 1);
|
|
|
|
float divisor = maxF(CONFIG(tpsAccelFractionDivisor), 1.0f);
|
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
// update max counters
|
|
|
|
maxExtraPerCycle = maxF(extraFuel, maxExtraPerCycle);
|
|
|
|
maxInjectedPerPeriod = maxF(injFuel, maxInjectedPerPeriod);
|
|
|
|
|
|
|
|
// evenly split it between several engine cycles
|
|
|
|
extraFuel = injFuel / periodF;
|
|
|
|
} else {
|
|
|
|
resetFractionValues();
|
|
|
|
}
|
|
|
|
|
2016-03-11 08:03:18 -08:00
|
|
|
if (engineConfiguration->debugMode == DBG_TPS_ACCEL) {
|
2019-04-12 19:07:03 -07:00
|
|
|
#if EFI_TUNER_STUDIO
|
2016-03-11 08:03:18 -08:00
|
|
|
tsOutputChannels.debugFloatField1 = tpsFrom;
|
|
|
|
tsOutputChannels.debugFloatField2 = tpsTo;
|
2016-09-17 16:02:34 -07:00
|
|
|
tsOutputChannels.debugFloatField3 = valueFromTable;
|
2016-03-12 17:03:40 -08:00
|
|
|
tsOutputChannels.debugFloatField4 = extraFuel;
|
2019-03-28 19:47:20 -07:00
|
|
|
tsOutputChannels.debugFloatField5 = accumulatedValue;
|
|
|
|
tsOutputChannels.debugFloatField6 = maxExtraPerPeriod;
|
|
|
|
tsOutputChannels.debugFloatField7 = maxInjectedPerPeriod;
|
|
|
|
tsOutputChannels.debugIntField1 = cycleCnt;
|
2018-11-16 04:40:06 -08:00
|
|
|
#endif /* EFI_TUNER_STUDIO */
|
2016-03-11 08:03:18 -08:00
|
|
|
}
|
2016-03-11 11:03:23 -08:00
|
|
|
|
2016-03-12 17:03:40 -08:00
|
|
|
return extraFuel;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
float AccelEnrichmemnt::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|
|
|
int index = getMaxDeltaIndex(PASS_ENGINE_PARAMETER_SIGNATURE);
|
2016-03-12 17:03:40 -08:00
|
|
|
|
2016-11-30 18:06:24 -08:00
|
|
|
float d = (cb.get(index) - (cb.get(index - 1))) * CONFIG(specs.cylindersCount);
|
2016-03-12 17:03:40 -08:00
|
|
|
|
|
|
|
float result = 0;
|
|
|
|
int distance = 0;
|
|
|
|
float taper = 0;
|
2015-12-31 10:02:19 -08:00
|
|
|
if (d > engineConfiguration->engineLoadAccelEnrichmentThreshold) {
|
2016-03-12 17:03:40 -08:00
|
|
|
|
|
|
|
int distance = cb.currentIndex - index;
|
|
|
|
if (distance <= 0) // checking if indexes are out of order due to circular buffer nature
|
|
|
|
distance += minI(cb.getCount(), cb.getSize());
|
|
|
|
|
2017-05-29 08:31:07 -07:00
|
|
|
taper = interpolate2d("accel", distance, engineConfiguration->mapAccelTaperBins, engineConfiguration->mapAccelTaperMult, MAP_ACCEL_TAPER);
|
2016-03-12 17:03:40 -08:00
|
|
|
|
|
|
|
result = taper * d * engineConfiguration->engineLoadAccelEnrichmentMultiplier;
|
|
|
|
} else if (d < -engineConfiguration->engineLoadDecelEnleanmentThreshold) {
|
|
|
|
result = d * engineConfiguration->engineLoadAccelEnrichmentMultiplier;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
2016-03-12 17:03:40 -08:00
|
|
|
|
|
|
|
if (engineConfiguration->debugMode == DBG_EL_ACCEL) {
|
2019-04-12 19:07:03 -07:00
|
|
|
#if EFI_TUNER_STUDIO
|
2016-03-12 17:03:40 -08:00
|
|
|
tsOutputChannels.debugIntField1 = distance;
|
|
|
|
tsOutputChannels.debugFloatField1 = result;
|
|
|
|
tsOutputChannels.debugFloatField2 = taper;
|
2018-11-16 04:40:06 -08:00
|
|
|
#endif /* EFI_TUNER_STUDIO */
|
2016-01-02 13:01:27 -08:00
|
|
|
}
|
2016-03-12 17:03:40 -08:00
|
|
|
return result;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void AccelEnrichmemnt::reset() {
|
2016-01-04 21:02:56 -08:00
|
|
|
cb.clear();
|
2016-01-31 10:03:08 -08:00
|
|
|
previousValue = NAN;
|
2019-03-28 19:47:20 -07:00
|
|
|
resetFractionValues();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AccelEnrichmemnt::resetFractionValues() {
|
|
|
|
accumulatedValue = 0;
|
|
|
|
maxExtraPerCycle = 0;
|
|
|
|
maxExtraPerPeriod = 0;
|
|
|
|
maxInjectedPerPeriod = 0;
|
|
|
|
cycleCnt = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2016-03-09 20:02:39 -08:00
|
|
|
void AccelEnrichmemnt::setLength(int length) {
|
|
|
|
cb.setSize(length);
|
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void AccelEnrichmemnt::onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
2016-03-09 21:04:40 -08:00
|
|
|
cb.add(currentValue);
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void AccelEnrichmemnt::onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
2019-03-28 19:47:20 -07:00
|
|
|
// we update values in handleFuel() directly
|
|
|
|
//onNewValue(getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
|
|
|
|
|
|
|
// we used some extra fuel during the current cycle, so we "charge" our "acceleration pump" with it
|
|
|
|
accumulatedValue -= maxExtraPerPeriod;
|
|
|
|
maxExtraPerPeriod = maxF(maxExtraPerCycle, maxExtraPerPeriod);
|
|
|
|
maxExtraPerCycle = 0;
|
|
|
|
accumulatedValue += maxExtraPerPeriod;
|
|
|
|
|
|
|
|
// update the accumulated value every 'Period' engine cycles
|
|
|
|
if (--cycleCnt <= 0) {
|
|
|
|
maxExtraPerPeriod = 0;
|
|
|
|
|
|
|
|
// we've injected this portion during the cycle, so we set what's left for the next cycle
|
|
|
|
accumulatedValue -= maxInjectedPerPeriod;
|
|
|
|
maxInjectedPerPeriod = 0;
|
|
|
|
|
|
|
|
// it's an infinitely convergent series, so we set a limit at some point
|
|
|
|
// (also make sure that accumulatedValue is positive, for safety)
|
|
|
|
static const floatms_t smallEpsilon = 0.001f;
|
|
|
|
if (accumulatedValue < smallEpsilon)
|
|
|
|
accumulatedValue = 0;
|
|
|
|
|
|
|
|
// reset the counter
|
|
|
|
cycleCnt = CONFIG(tpsAccelFractionPeriod);
|
|
|
|
}
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void AccelEnrichmemnt::onEngineCycle(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|
|
|
onNewValue(getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
AccelEnrichmemnt::AccelEnrichmemnt() {
|
|
|
|
reset();
|
|
|
|
cb.setSize(4);
|
|
|
|
}
|
|
|
|
|
2019-04-12 19:07:03 -07:00
|
|
|
#if ! EFI_UNIT_TEST
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
static void accelInfo() {
|
2016-01-31 14:01:29 -08:00
|
|
|
if (logger == NULL)
|
|
|
|
return;
|
2015-12-31 15:02:17 -08:00
|
|
|
// scheduleMsg(logger, "EL accel length=%d", mapInstance.cb.getSize());
|
2018-01-23 09:05:14 -08:00
|
|
|
scheduleMsg(logger, "EL accel th=%.2f/mult=%.2f", engineConfiguration->engineLoadAccelEnrichmentThreshold, engineConfiguration->engineLoadAccelEnrichmentMultiplier);
|
|
|
|
scheduleMsg(logger, "EL decel th=%.2f/mult=%.2f", engineConfiguration->engineLoadDecelEnleanmentThreshold, engineConfiguration->engineLoadDecelEnleanmentMultiplier);
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
// scheduleMsg(logger, "TPS accel length=%d", tpsInstance.cb.getSize());
|
2018-01-23 09:05:14 -08:00
|
|
|
scheduleMsg(logger, "TPS accel th=%.2f/mult=%.2f", engineConfiguration->tpsAccelEnrichmentThreshold, -1);
|
2015-08-23 22:01:28 -07:00
|
|
|
|
2019-01-06 17:45:51 -08:00
|
|
|
scheduleMsg(logger, "beta=%.2f/tau=%.2f", engineConfiguration->wwaeBeta, engineConfiguration->wwaeTau);
|
2015-07-10 06:01:56 -07:00
|
|
|
}
|
|
|
|
|
2015-12-31 15:02:17 -08:00
|
|
|
void setEngineLoadAccelThr(float value) {
|
2015-12-31 10:02:19 -08:00
|
|
|
engineConfiguration->engineLoadAccelEnrichmentThreshold = value;
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2015-12-31 15:02:17 -08:00
|
|
|
void setEngineLoadAccelMult(float value) {
|
2015-12-31 10:02:19 -08:00
|
|
|
engineConfiguration->engineLoadAccelEnrichmentMultiplier = value;
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setTpsAccelThr(float value) {
|
2015-07-10 06:01:56 -07:00
|
|
|
engineConfiguration->tpsAccelEnrichmentThreshold = value;
|
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setTpsDecelThr(float value) {
|
2015-12-31 15:02:17 -08:00
|
|
|
engineConfiguration->tpsDecelEnleanmentThreshold = value;
|
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setTpsDecelMult(float value) {
|
2015-12-31 15:02:17 -08:00
|
|
|
engineConfiguration->tpsDecelEnleanmentMultiplier = value;
|
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setDecelThr(float value) {
|
2015-12-31 15:02:17 -08:00
|
|
|
engineConfiguration->engineLoadDecelEnleanmentThreshold = value;
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setDecelMult(float value) {
|
2015-12-31 15:02:17 -08:00
|
|
|
engineConfiguration->engineLoadDecelEnleanmentMultiplier = value;
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2017-01-06 07:04:41 -08:00
|
|
|
void setTpsAccelLen(int length) {
|
2016-03-09 20:02:39 -08:00
|
|
|
if (length < 1) {
|
2015-09-02 17:01:29 -07:00
|
|
|
scheduleMsg(logger, "Length should be positive");
|
2015-07-10 06:01:56 -07:00
|
|
|
return;
|
|
|
|
}
|
2016-03-09 20:02:39 -08:00
|
|
|
engine->tpsAccelEnrichment.setLength(length);
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2016-03-09 20:02:39 -08:00
|
|
|
void setEngineLoadAccelLen(int length) {
|
|
|
|
if (length < 1) {
|
2015-09-02 17:01:29 -07:00
|
|
|
scheduleMsg(logger, "Length should be positive");
|
2015-07-10 06:01:56 -07:00
|
|
|
return;
|
|
|
|
}
|
2016-03-09 20:02:39 -08:00
|
|
|
engine->engineLoadAccelEnrichment.setLength(length);
|
2015-07-10 06:01:56 -07:00
|
|
|
accelInfo();
|
|
|
|
}
|
|
|
|
|
2016-01-31 12:01:41 -08:00
|
|
|
void updateAccelParameters() {
|
|
|
|
setEngineLoadAccelLen(engineConfiguration->engineLoadAccelLength);
|
|
|
|
setTpsAccelLen(engineConfiguration->tpsAccelLength);
|
|
|
|
}
|
|
|
|
|
2016-03-11 08:03:18 -08:00
|
|
|
#endif /* ! EFI_UNIT_TEST */
|
|
|
|
|
|
|
|
|
2017-05-15 20:28:49 -07:00
|
|
|
void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
2015-07-10 06:01:56 -07:00
|
|
|
logger = sharedLogger;
|
2016-03-11 08:03:18 -08:00
|
|
|
tpsTpsMap.init(config->tpsTpsAccelTable, config->tpsTpsAccelFromRpmBins, config->tpsTpsAccelToRpmBins);
|
|
|
|
|
2019-04-12 19:07:03 -07:00
|
|
|
#if ! EFI_UNIT_TEST
|
2017-01-06 13:03:41 -08:00
|
|
|
|
2015-07-10 06:01:56 -07:00
|
|
|
addConsoleAction("accelinfo", accelInfo);
|
|
|
|
|
2016-01-31 12:01:41 -08:00
|
|
|
updateAccelParameters();
|
2015-07-10 06:01:56 -07:00
|
|
|
#endif /* ! EFI_UNIT_TEST */
|
2016-03-11 08:03:18 -08:00
|
|
|
}
|
|
|
|
|