//-------------------------------------------------------// // Project Code : CodeLibrary // File Name : PiCtrl.h // Created on : 2019. 06. 07. // Description : PI 제어기 // Author : KimJeongWoo // Last modified Date : //-------------------------------------------------------// #ifndef DIGITALCTRL_PICTRL_H_ #define DIGITALCTRL_PICTRL_H_ #ifdef __cplusplus extern "C" { #endif #define PI_MODE 0 #define IP_MODE 1 struct sPiCtrl { float Kp; // 비례 게인 float Ki; // 적분 게인 float Ka; // 안티-와인드업 게인 float Wc; // 제어기 대역폭 float ff; // 피드포워드 항 float PiMax; // 제어기 리미트 최대치 float PiMin; // 제어기 리미트 최소치 float Err; // 에러값 float Integ; // 적분항 float fb; // 피드백항 float out; // 제어 출력값 float Tprd; // 제어 주기 float ref; // 지령치 float Val; // 현재값 void Reset(void); // 제어기 리셋 void Init(float mKp, float mKi, float mKa, float mWc, float mTprd, float mPI_Max, float mPI_Min); // 제어기 초기화 float Run(); }; //초기화 및 게인 업데이트는 각 상황마다 상이하므로 별도로 입력해 줄 것 #ifdef __cplusplus } #endif /* extern "C" */ #endif /* _PI_CTRL_H_ */