#pragma once
#include <stdint.h>
class PID_DATA{
enum {SCALING_FACTOR = 256};
//! Last process value, used to find derivative of process value.
int16_t lastProcessValue;
//! Summation of errors, used for integrate calculations
int32_t sumError;
//! The Proportional tuning constant, multiplied with SCALING_FACTOR
int16_t P_Factor;
//! The Integral tuning constant, multiplied with SCALING_FACTOR
int16_t I_Factor;
//! The Derivative tuning constant, multiplied with SCALING_FACTOR
int16_t D_Factor;
//! Maximum allowed error, avoid overflow
int16_t maxError;
//! Maximum allowed sumerror, avoid overflow
int32_t maxSumError;
public:
void Init(int16_t p_factor, int16_t i_factor, int16_t d_factor);
int16_t Controller(int16_t setPoint, int16_t processValue);
void Reset_Integrator();
};
Detected encoding: ASCII (7 bit) | 2
|