dosdt

    1. 不错
    2. PID算法 5/2450 嵌入式系统 2015-08-11
      #include #include /*====================================================================================================     PID Function         The PID (比例、积分、微分) function is used in mainly     control applications. PIDCalc performs one iteration of the PID     algorithm.     While the PID function works, main is just a dummy program showing     a typical usage. =====================================================================================================*/ typedef struct PID {         double  SetPoint;           //  设定目标 Desired Value         double  Proportion;         //  比例常数 Proportional Const         double  Integral;           //  积分常数 Integral Const         double  Derivative;         //  微分常数 Derivative Const         double  LastError;          //  Error[-1]         double  PrevError;          //  Error[-2]         double  SumError;           //  Sums of Errors } PID; /*====================================================================================================    PID计算部分 =====================================================================================================*/ double PIDCalc( PID *pp, double NextPoint ) {     double  dError,             Error;         Error = pp->SetPoint -  NextPoint;          // 偏差         pp->SumError += Error;                      // 积分         dError = pp->LastError - pp->PrevError;     // 当前微分         pp->PrevError = pp->LastError;         pp->LastError = Error;         return (pp->Proportion * Error              // 比例项             +   pp->Integral * pp->SumError         // 积分项             +   pp->Derivative * dError             // 微分项         ); } /*====================================================================================================    Initialize PID Structure =====================================================================================================*/ void PIDInit (PID *pp) {     memset ( pp,0,sizeof(PID)); } /*====================================================================================================     Main Program =====================================================================================================*/ double sensor (void)                    //  Dummy Sensor Function {     return 100.0; } void actuator(double rDelta)            //  Dummy Actuator Function {} void main(void) {     PID         sPID;                   //  PID Control Structure     double      rOut;                   //  PID Response (Output)     double      rIn;                    //  PID Feedback (Input)     PIDInit ( &sPID );                  //  Initialize Structure     sPID.Proportion = 0.5;              //  Set PID Coefficients     sPID.Integral   = 0.5;     sPID.Derivative = 0.0;     sPID.SetPoint   = 100.0;            //  Set PID Setpoint     for (;;) {                          //  Mock Up of PID Processing         rIn = sensor ();                //  Read Input         rOut = PIDCalc ( &sPID,rIn );   //  Perform PID Interation         actuator ( rOut );              //  Effect Needed Changes     } }
    3.     课程目录     课程讨论 我要评论 |  发起讨论 www0123 2015年08月10日 16:50:04 求教程
    4. 电磁控制运动装置的周期怎样控制 5/2776 Microchip MCU 2015-08-10
      就是周期不知道怎样控制,控制幅度来控制周期我试过了不行。
    5. 啊啊
    6. 啊啊
    7. 电磁控制运动装置的周期怎样控制 5/2776 Microchip MCU 2015-08-09
      huo_hu 发表于 2015-8-9 11:33 什么啊!!!
      电磁控制运动装置(J 题) 摆杆的周期能在 0.5s~2s 范围内预置,预置步进值 0.5s,周期绝对误差值≤ 0.1s,响应时间≤10s。 就是周期不知道怎样控制
    8. 2015全国电子设计竞赛内部流出资料 16/6055 电子竞赛 2015-08-05
      不行,唉白下了
    9. 2015电赛专家组命题会议透露的一些消息 1605/94431 电子竞赛 2015-08-04
      电子
    10. 2015电子竞赛最新消息20150701 886/54778 电子竞赛 2015-08-04
      电子
    11. 【电赛】参考案例(7-24更新) 29/9478 微控制器 MCU 2015-08-04
      好东西谢谢楼主分享

最近访客

< 1/1 >

统计信息

已有2人来访过

  • 芯积分:--
  • 好友:--
  • 主题:1
  • 回复:11

留言

你需要登录后才可以留言 登录 | 注册


现在还没有留言