You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
740 B
57 lines
740 B
#ifndef _PID_H
|
|
#define _PID_H
|
|
|
|
#include "SysTick.h"
|
|
|
|
void PID_Init(void);
|
|
void PID_Calc(void);
|
|
|
|
typedef struct Pid
|
|
{
|
|
float set_tem;// User settings
|
|
float now_tem;// current temperature
|
|
|
|
float hp;
|
|
float hi;
|
|
float hd;
|
|
int h_percent;
|
|
float cp;
|
|
float ci;
|
|
float cd;
|
|
int c_speed;
|
|
|
|
float Kp; // 110
|
|
float Ki; // 0.001
|
|
float Kd; // 340
|
|
int t; // PID calculation cycle - sampling cycle
|
|
float Ti;
|
|
float Td;
|
|
|
|
float Ek; // This deviation
|
|
float Ek_1;// Last deviation
|
|
float SEk; // The sum of historical deviations
|
|
|
|
float Iout;
|
|
float Pout;
|
|
float Dout;
|
|
|
|
float OUT0;
|
|
|
|
float OUT;
|
|
|
|
int C1ms;
|
|
|
|
int pwmcycle;// PWM cycle
|
|
|
|
int times;
|
|
|
|
float tem_offset;
|
|
|
|
float tem_threshold;
|
|
}PID;
|
|
|
|
extern PID pid;
|
|
#endif
|
|
|
|
|