模糊-PID控制技术运用到程控电压源的设计中,从而使得电压源的输出电压值达到预定的要求,提高输出电压的精度和反应速度。
采用51单片机,利用adc0832和DAC0832,通过220V市电通过整流得到 12V再由12V转5V。LM358搭配DAC0832电路实现电压的输出。通过ADC采集。
最终得到电压。
1:电压的整定时间小于0.5S
2:电压的精确度再0.02以内
3:论文中涉及到第二种硬件设计方案,使用更高精度的采集。
typedef struct{
float Kp;
float Ki;
float Kd;
}PID;
PID fuzzy(int e,int ec)
{
int etemp,ectemp;
int eLefttemp,ecLefttemp;
int eRighttemp ,ecRighttemp;
int eLeftIndex,ecLeftIndex;
int eRightIndex,ecRightIndex;
PID fuzzy_PID;
etemp = e > 3.0 ? 0.0 : (e < - 3.0 ? 0.0 : (e >= 0.0 ? (e >= 2.0 ? 2.5: (e >= 1.0 ? 1.5 : 0.5)) : (e >= -1.0 ? -0.5 : (e >= -2.0 ? -1.5 : (e >= -3.0 ? -2.5 : 0.0) ))));