// Define a struct named DcCtrl
typedef struct
{
        float fPv1PwmDuty; // Duty cycle of PV1
        float fPv2PwmDuty; // Duty cycle of PV2
        float fPv3PwmDuty; // Duty cycle of PV3
        float fPv4PwmDuty; // Duty cycle of PV4
        uint16_t u16Pv1OverCnt; // Over current count of PV1
        uint16_t u16Pv2OverCnt; // Over current count of PV2
        uint16_t u16Pv3OverCnt; // Over current count of PV3
        uint16_t u16Pv4OverCnt; // Over current count of PV4
        uint16_t u16BusFaultCnt; // Bus fault count

}DcCtrl;

// Declare an instance of DcCtrl named DcDc
extern DcCtrl DcDc;

// Define a struct named PiCtrl
typedef struct
{
    float fkp; // Proportional gain
    float fki; // Integral gain

    float fOut; // Controller output
    float fOut1; // Previous controller output

    float fErr; // Error term
    float fErrPre; // Previous error term
    float fMax; // Maximum controller output
    float fMin; // Minimum controller output

}PiCtrl;
C语言结构体定义:DcCtrl 和 PiCtrl

原文地址: https://www.cveoy.top/t/topic/oLT9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录