DSP28335 2812 pid 电机控制DSP28335 2812 pid 电机控制
/*=====================================================================================
File name: PID_REG3.C (IQ version)
Originator: Digital Control Systems Group
Texas Instruments
Description: The PID controller with anti-windup
=====...
DSP28335 2812 pid 电机控制
/*=====================================================================================
File name: PID_REG3.C (IQ version)
Originator: Digital Control Systems Group
Texas Instruments
Description: The PID controller with anti-windup
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20
-------------------------------------------------------------------------------------*/
#include "IQmathLib.h" // Include header for IQmath library
// Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file
#include "dmctype.h"
#include "pid_reg3.h"
void pid_reg3_calc(PIDREG3 *v)
{
// Compute the error
v->Err = v->Ref - v->Fdb;
// Compute the proportional output
v->Up = _IQmpy(v->Kp,v->Err);
// Compute the integral output
v->Ui = v->Ui + _IQmpy(v->Ki,v->Up) + _IQmpy(v->Kc,v->SatErr);
// Compute the derivative output
v->Ud = _IQmpy(v->Kd,(v->Up - v->Up1));
// Compute the pre-saturated output
v->OutPreSat = v->Up + v->Ui + v->Ud;
// Saturate the output
if (v->OutPreSat > v->OutMax)
v->Out = v->OutMax;
else if (v->OutPreSat < v->OutMin)
v->Out = v->OutMin;
else
v->Out = v->OutPreSat;
// Compute the saturate difference
v->SatErr = v->Out - v->OutPreSat;
// Update the previous proportional output
v->Up1 = v->Up;
}
本文档为【DSP28335 2812 pid 电机控制】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。