<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Hpid.c ```c #include "Hpid.h" PID_t *mthis ; PID_t* GetPid(PID_t *pid) { mthis = pid ; return mthis; } int HPID_Run(int current) { int ans = 0; mthis->current = current ; mthis->e0 = mthis->e1; mthis->e1 = mthis->e2; mthis->e2 = mthis->target - mthis->current ; ans = mthis -> Kp * (mthis->e2 - mthis->e1) ; //P ans += mthis->Ki * mthis->e2 ; //I ans += mthis->Kd * (mthis->e2 -2*mthis->e1 + mthis->e0) ; //D ans = ans / mthis->A ; return ans ; } void HPID_Reset() { mthis->e2 = 0; mthis->e1 = 0; mthis->e0 = 0; } void HPID_Init(PID_t *pid ){ pid->A = 1; pid->output = 0; pid->current = 0; pid->target = 0; pid->Kp=0; pid->Ki= 0 ; pid->Kd = 0; pid->Run = HPID_Run; pid->Reset = HPID_Reset ; } ``` # Hpid.h ```c #ifndef _SRC_HPID_H_ #define _SRC_HPID_H_ typedef struct _PID_t_{ int A ; //系數,計算值最后縮小的倍數 int output ; //輸出值 int current; //當前值 int target; //設定值 int Kp; //比例系數 int Kd; //積分系數 int Ki; //微分系數 int e0,e1,e2 ; int ( *Run)(int); //進行增量式PID計算 void (*Reset)(); //復位 }PID_t; void HPID_Init(PID_t * pid) ; PID_t* GetPid(PID_t *pid) ; #endif ``` # main.cpp ```cpp #include "iostream" #include "Hpid.h" using namespace std ; int main() { PID_t pid1 ; HPID_Init(&pid1) ; pid1.target = 1; pid1.Ki = 10; cout << GetPid(&pid1)->Run(2); } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看