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

35 lines
624 B
C
Raw Normal View History

2015-07-10 06:01:56 -07:00
/**
* @file pid.h
*
* @date Sep 16, 2014
2015-12-31 13:02:30 -08:00
* @author Andrey Belomutskiy, (c) 2012-2016
2015-07-10 06:01:56 -07:00
*/
#ifndef PID_H_
#define PID_H_
2016-01-20 20:03:03 -08:00
#include "engine_configuration_generated_structures.h"
2015-07-10 06:01:56 -07:00
class Pid {
public:
2016-01-20 20:03:03 -08:00
Pid(pid_s *pid, float minResult, float maxResult);
2015-07-10 06:01:56 -07:00
float getValue(float target, float input, float dTime);
void updateFactors(float pFactor, float iFactor, float dFactor);
void reset(void);
float getP(void);
float getI(void);
float getD(void);
2016-01-24 13:01:28 -08:00
float getIntegration(void);
float getPrevError(void);
2015-07-10 06:01:56 -07:00
private:
2016-01-20 20:03:03 -08:00
pid_s *pid;
2015-07-10 06:01:56 -07:00
float minResult;
float maxResult;
float iTerm;
float prevError;
};
#endif /* PID_H_ */