c语言实现pid算法

c语言实现pid算法

ID:18911723

大小:53.50 KB

页数:10页

时间:2018-09-21

c语言实现pid算法_第1页
c语言实现pid算法_第2页
c语言实现pid算法_第3页
c语言实现pid算法_第4页
c语言实现pid算法_第5页
资源描述:

《c语言实现pid算法》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、C语言实现PID算法#includeC语言实现PID算法#includeC语言实现PID算法#includeC语言实现PID算法#include  struct _pid {   int pv; /*integer that contains the process value*/   int sp; /*integer that contains the set point*/   float integral;   float pgain;   float igain;   fl

2、oat dgain;   int deadband;   int last_error;  };    struct _pid warm,*pid;  int process_point, set_point,dead_band;   float p_gain, i_gain, d_gain, integral_val,new_integ;;         /*------------------------------------------------------------------------   pid_init     DESCRIPTI

3、ON This function initializes the pointers in the _pid structure   to the process variable and the setpoint. *pv and *sp are   integer pointers.   ------------------------------------------------------------------------*/   void pid_init(struct _pid *warm, int process_point, int s

4、et_point)  {    struct _pid *pid;       pid = warm;    pid->pv = process_point;    pid->sp = set_point;   }       /*------------------------------------------------------------------------   pid_tune     DESCRIPTION Sets the proportional gain (p_gain), integral gain (i_gain),   d

5、erivitive gain (d_gain), and the dead band (dead_band) of   a pid control structure _pid.   ------------------------------------------------------------------------*/     void pid_tune(struct _pid *pid, float p_gain, float i_gain, float d_gain, int dead_band)   {    pid->pgain = 

6、p_gain;    pid->igain = i_gain;    pid->dgain = d_gain;    pid->deadband = dead_band;    pid->integral= integral_val;    pid->last_error=0;   }     /*------------------------------------------------------------------------   pid_setinteg     DESCRIPTION Set a new value for the in

7、tegral term of the pid equation.   This is useful for setting the initial output of the   pid controller at start up.   ------------------------------------------------------------------------*/   void pid_setinteg(struct _pid *pid,float new_integ)  {    pid->integral = new_integ

8、;    pid->last_error = 0;   }     /*----

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。