PI_MACRO宏解析
作者:互联网
typedef struct { _iq Ref; // Input: reference set-point _iq Fbk; // Input: feedback _iq Out; // Output: controller output _iq Kp; // Parameter: proportional loop gain _iq Ki; // Parameter: integral gain _iq Umax; // Parameter: upper saturation limit _iq Umin; // Parameter: lower saturation limit _iq up; // Data: proportional term _iq ui; // Data: integral term _iq v1; // Data: pre-saturated controller output _iq i1; // Data: integrator storage: ui(k-1) _iq w1; // Data: saturation record: [u(k-1) - v(k-1)] } PI_CONTROLLER;
PI_CONTROLLER结构体:
输入变量:Ref(参考输入)
Fbk(反馈输入)
输出变量:Out(控制器输出)
/*----------------------------------------------------------------------------- Default initalisation values for the PI_GRANDO objects -----------------------------------------------------------------------------*/ #define PI_CONTROLLER_DEFAULTS { \ 0, \ 0, \ 0, \ _IQ(1.0), \ _IQ(0.0), \ _IQ(1.0), \ _IQ(-1.0), \ _IQ(0.0), \ _IQ(0.0), \ _IQ(0.0), \ _IQ(0.0), \ _IQ(1.0) \ }
PI_CONTROLLER对象的默认初始化
/*------------------------------------------------------------------------------ PI_GRANDO Macro Definition ------------------------------------------------------------------------------*/ #define PI_MACRO(v) \ \ /* proportional term */ \ v.up = v.Ref - v.Fbk; \ \ /* integral term */ \ v.ui = (v.Out == v.v1)?(_IQmpy(v.Ki, v.up)+ v.i1) : v.i1; \ v.i1 = v.ui; \ \ /* control output */ \ v.v1 = _IQmpy(v.Kp, v.up) + v.ui; \ v.Out= _IQsat(v.v1, v.Umax, v.Umin);
PI_MACRO宏:1.计算参考输入与反馈输入的差值;
2.判断输出的值是否等于预饱和控制器输v1出值,如果输出值Out未饱和,则进行积分调节,否则等于上一次的调节值;
3.i1用于保存上一次的积分项;
4.预饱和控制器输出值v1用于计算PI调节器的输出,之后送入饱和函数;
5.输出值Out为预饱和控制器输出值v1经饱和函数后的值。
标签:解析,v1,iq,MACRO,IQ,ui,PI,Out 来源: https://www.cnblogs.com/xing-2/p/16110673.html