rusefi-1/firmware/controllers/math/pid_auto_tune.h

58 lines
1.1 KiB
C
Raw Normal View History

2017-09-13 19:08:59 -07:00
/*
* pid_auto_tune.h
*
* http://brettbeauregard.com/blog/2012/01/arduino-pid-autotune-library/
2017-10-09 04:46:50 -07:00
* https://www.ripublication.com/ijeer17/ijeerv9n6_02.pdf
2017-09-13 19:08:59 -07:00
*
*
* Created on: Sep 13, 2017
* @author Andrey Belomutskiy, (c) 2012-2017
*/
#ifndef CONTROLLERS_MATH_PID_AUTO_TUNE_H_
#define CONTROLLERS_MATH_PID_AUTO_TUNE_H_
2017-09-13 19:46:55 -07:00
#include "main.h"
#include "rusefi_types.h"
2017-09-13 19:08:59 -07:00
class PID_AutoTune {
public:
PID_AutoTune();
void reset();
void FinishUp();
2017-09-13 19:46:55 -07:00
int Runtime(Logging *logging);
// bool isMax, isMin;
2017-09-13 19:08:59 -07:00
/**
* sensor position
*/
float input;
/**
* actuator duty cycle
*/
float output;
/**
* trigger line
*/
float setpoint;
float noiseBand;
//int controlType = 1;
bool running;
2017-09-13 19:46:55 -07:00
efitimems_t currentPeakTime, prevPeakTime;
// unsigned int peak1, peak2, lastTime;
2017-09-13 19:08:59 -07:00
//int sampleTime;
int nLookBack;
int peakType; // todo: convert to enum
float lastInputs[101];
float peaks[10];
int peakCount;
2017-09-13 19:46:55 -07:00
int dataPointsCount;
//bool justchanged; //
2017-09-13 19:08:59 -07:00
bool justevaled;
float absMax, absMin;
float oStep;
float outputStart;
float Ku, Pu;
};
#endif /* CONTROLLERS_MATH_PID_AUTO_TUNE_H_ */