#ifndef _PID_AUTOTUNE_H
#define _PID_AUTOTUNE_H


#define TYPE_PID 1
#define TYPE_PI  0


#ifndef TUNE_TURE
#define TUNE_TURE 1
#endif

#ifndef TUNE_FALSE
#define TUNE_FALSE 0
#endif

#define MAX_PEAKS  10
#define MAX_INPUTS 128
#define NOISE_BAND 0.01
#define OSTEP      8
#define LOOK_BACK_TIME 256  //单位为秒 
#define SAMPLE_TIME   4 

typedef struct
{
int    isMax,isMin;
float *input;
unsigned short *output;
float setpoint;
float noiseBand;
int    controlType;
int    running;
unsigned int peak1,peak2,lastTime;
int sampleTime;
int nLookBack;
int peakType;
float lastInputs[MAX_INPUTS];
float peaks[MAX_PEAKS];
int peakCount;
int justchanged;
int justevaled;
float absMax,absMin;
unsigned short oStep;
unsigned short outputStart;
float Ku,Pu;
unsigned int start_time;
}PID_ATune;

#endif



