rusefi-1/firmware/controllers/algo/accel_enrichment.h

62 lines
1.5 KiB
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file accel_enrichment.h
* @brief Acceleration enrichment calculator
*
* @date Apr 21, 2014
* @author Dmitry Sidin
2020-01-13 18:57:43 -08:00
* @author Andrey Belomutskiy, (c) 2012-2020
2015-07-10 06:01:56 -07:00
*/
2019-11-14 21:00:13 -08:00
#pragma once
2015-07-10 06:01:56 -07:00
#include "cyclic_buffer.h"
2016-03-10 21:01:55 -08:00
#include "table_helper.h"
#include "wall_fuel_state_generated.h"
2016-03-10 21:01:55 -08:00
2019-06-10 09:38:32 -07:00
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, float, float> tps_tps_Map3D_t;
2015-07-10 06:01:56 -07:00
2015-08-21 12:01:36 -07:00
/**
* this object is used for MAP rate-of-change and TPS rate-of-change corrections
*/
class AccelEnrichment {
public:
AccelEnrichment();
int getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getMaxDelta(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void resetAE();
void setLength(int length);
cyclic_buffer<float> cb;
void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_SUFFIX);
2019-10-16 19:10:38 -07:00
int onUpdateInvocationCounter = 0;
};
class TpsAccelEnrichment : public AccelEnrichment {
public:
2015-08-23 18:03:42 -07:00
/**
* @return Extra fuel squirt duration for TPS acceleration
*/
2017-05-15 20:33:22 -07:00
floatms_t getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void resetFractionValues();
void resetAE();
2015-07-10 06:01:56 -07:00
private:
/**
* Used for Fractional TPS enrichment.
*/
2020-07-29 02:22:54 -07:00
floatms_t accumulatedValue = 0;
floatms_t maxExtraPerCycle = 0;
floatms_t maxExtraPerPeriod = 0;
floatms_t maxInjectedPerPeriod = 0;
int cycleCnt = 0;
2015-07-10 06:01:56 -07:00
};
void initAccelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2015-12-31 15:02:17 -08:00
2017-01-06 07:04:41 -08:00
void setTpsAccelThr(float value);
void setTpsDecelThr(float value);
void setTpsDecelMult(float value);
2017-01-06 13:03:41 -08:00
void setTpsAccelLen(int length);
2016-01-31 12:01:41 -08:00
void updateAccelParameters();