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

95 lines
2.4 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
2017-01-03 03:05:22 -08:00
* @author Andrey Belomutskiy, (c) 2012-2017
2015-07-10 06:01:56 -07:00
*/
#ifndef ACC_ENRICHMENT_H_
#define ACC_ENRICHMENT_H_
2019-01-20 20:44:05 -08:00
#include "global.h"
2015-07-10 06:01:56 -07:00
#include "cyclic_buffer.h"
2016-03-10 21:01:55 -08:00
#include "table_helper.h"
2016-06-29 19:03:26 -07:00
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, 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
*/
2015-07-10 06:01:56 -07:00
class AccelEnrichmemnt {
public:
AccelEnrichmemnt();
2015-08-23 18:03:42 -07:00
/**
2016-01-02 13:01:27 -08:00
* @return Extra engine load value for fuel logic calculation
2015-08-23 18:03:42 -07:00
*/
2017-05-15 20:33:22 -07:00
float getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE);
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);
int getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_SIGNATURE);
float getMaxDelta(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2015-07-10 06:01:56 -07:00
2017-05-15 20:33:22 -07:00
void onEngineCycle(DECLARE_ENGINE_PARAMETER_SIGNATURE);
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_SIGNATURE);
2015-07-10 06:01:56 -07:00
void reset();
void resetFractionValues();
2016-03-09 20:02:39 -08:00
void setLength(int length);
2015-07-10 06:01:56 -07:00
cyclic_buffer<float> cb;
2017-05-15 20:33:22 -07:00
void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_SUFFIX);
2015-07-10 06:01:56 -07:00
private:
2016-01-31 10:03:08 -08:00
float previousValue;
/**
* Used for Fractional TPS enrichment.
*/
floatms_t accumulatedValue;
floatms_t maxExtraPerCycle;
floatms_t maxExtraPerPeriod;
floatms_t maxInjectedPerPeriod;
int cycleCnt;
2015-07-10 06:01:56 -07:00
};
2019-01-04 18:54:57 -08:00
/**
* Wall wetting, also known as fuel film
* See https://github.com/rusefi/rusefi/issues/151 for the theory
*/
2015-08-21 12:01:36 -07:00
class WallFuel {
2015-08-23 18:03:42 -07:00
public:
2015-08-21 12:01:36 -07:00
WallFuel();
2016-01-31 08:01:43 -08:00
/**
* @param target desired squirt duration
* @return total adjusted fuel squirt duration once wall wetting is taken into effect
*/
2017-05-15 20:33:22 -07:00
floatms_t adjust(int injectorIndex, floatms_t target DECLARE_ENGINE_PARAMETER_SUFFIX);
floatms_t getWallFuel(int injectorIndex) const;
2015-09-02 18:03:43 -07:00
void reset();
2015-08-21 12:01:36 -07:00
private:
/**
2016-01-31 10:03:08 -08:00
* Amount of fuel on the wall, in ms of injector open time, for specific injector.
2015-08-21 12:01:36 -07:00
*/
2015-08-23 20:02:37 -07:00
floatms_t wallFuel[INJECTION_PIN_COUNT];
2015-08-21 12:01:36 -07:00
};
2017-05-15 20:33:22 -07:00
void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
2015-12-31 15:02:17 -08:00
void setEngineLoadAccelLen(int len);
void setEngineLoadAccelThr(float value);
void setEngineLoadAccelMult(float value);
2017-01-06 13:03:41 -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);
void setDecelThr(float value);
void setDecelMult(float value);
2017-01-06 07:04:41 -08:00
2016-01-31 12:01:41 -08:00
void updateAccelParameters();
2015-07-10 06:01:56 -07:00
#endif /* ACC_ENRICHMENT_H_ */