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

82 lines
2.1 KiB
C++

/**
* @file accel_enrichment.h
* @brief Acceleration enrichment calculator
*
* @date Apr 21, 2014
* @author Dmitry Sidin
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef ACC_ENRICHMENT_H_
#define ACC_ENRICHMENT_H_
#include "engine_configuration.h"
#include "cyclic_buffer.h"
#include "table_helper.h"
typedef Map3D<TPS_TPS_ACCEL_TABLE, TPS_TPS_ACCEL_TABLE, float> tps_tps_Map3D_t;
/**
* this object is used for MAP rate-of-change and TPS rate-of-change corrections
*/
class AccelEnrichmemnt {
public:
AccelEnrichmemnt();
/**
* @return Extra engine load value for fuel logic calculation
*/
float getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_F);
/**
* @return Extra fuel squirt duration for TPS acceleration
*/
floatms_t getTpsEnrichment(DECLARE_ENGINE_PARAMETER_F);
int getMaxDeltaIndex(DECLARE_ENGINE_PARAMETER_F);
float getMaxDelta(DECLARE_ENGINE_PARAMETER_F);
void onEngineCycle(DECLARE_ENGINE_PARAMETER_F);
void onEngineCycleTps(DECLARE_ENGINE_PARAMETER_F);
void reset();
void setLength(int length);
cyclic_buffer<float> cb;
void onNewValue(float currentValue DECLARE_ENGINE_PARAMETER_S);
private:
float previousValue;
};
class WallFuel {
public:
WallFuel();
/**
* @param target desired squirt duration
* @return total adjusted fuel squirt duration once wall wetting is taken into effect
*/
floatms_t adjust(int injectorIndex, floatms_t target DECLARE_ENGINE_PARAMETER_S);
floatms_t getWallFuel(int injectorIndex);
void reset();
private:
/**
* Amount of fuel on the wall, in ms of injector open time, for specific injector.
*/
floatms_t wallFuel[INJECTION_PIN_COUNT];
};
void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S);
void setEngineLoadAccelLen(int len);
void setEngineLoadAccelThr(float value);
void setEngineLoadAccelMult(float value);
void setTpsAccelThr(float value);
void setTpsDecelThr(float value);
void setTpsDecelMult(float value);
void setTpsAccelLen(int length);
void setDecelThr(float value);
void setDecelMult(float value);
void updateAccelParameters();
#endif /* ACC_ENRICHMENT_H_ */