/************************************************************************ Project: Welling Motor Control Paltform Filename: asr.h Partner Filename: asr.c Description: The header file of asr.c Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems. CPU TYPE : GD32F3x0 ************************************************************************* Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd. All rights reserved. ************************************************************************* ************************************************************************* Revising History (ECL of this file): ************************************************************************/ /************************************************************************ Beginning of File, do not put anything above here except notes Compiler Directives: *************************************************************************/ #ifndef ASR_NEW_H #define ASR_NEW_H /************************************************************************ Compiler Directives (N/A) *************************************************************************/ #ifdef _ASR_NEW_C_ #define _ASR_NEW_EXT #else #define _ASR_NEW_EXT extern #endif /************************************************************************ Definitions & Macros (#define ...) *************************************************************************/ #define ASRNEW_SPDPI_COF_DEFAULT \ { \ 0, 0, 0 \ } // Default value of ASR_SPDPI_COF #define ASRNEW_SPDPI_OUT_DEFAULT \ { \ 0, 0, 0, 0 \ } // Default value of ASR_SPDPI_OUT /************************************************************************ global varibles Macros (#define ...) *************************************************************************/ /************************************************************************ TypeDefs & Structure defines *************************************************************************/ typedef struct // Input of "asr_voSpdPI" { SWORD swSpdRefPu; // Q15, Speed reference SWORD swSpdFdbPu; // Q15, Speed feedback SWORD swIqMaxPu; // Q14, Iq output maximum limit SWORD swIqMinPu; // Q14, Iq output minimum limit } ASRNEW_SPDPI_IN; typedef struct // Output of "asr_voSpdPI" { SLONG slIqiPu; // Q30, Integration of previous step SLONG slIqSumPu; // Q21, PI output before limitation SLONG slIqRefPu; // Q21, PI output after limitation SWORD swIqRefPu; // Q14, PI output after limitation SWORD swErrZ1Pu; // Q15, Error recorder } ASRNEW_SPDPI_OUT; typedef struct // Input of "asr_voSpdPI" { UWORD uwKpPu; // Q4, Kp UWORD uwKitPu; // Q15, Kit UWORD uwKbPu; // Q8, Kb UWORD uwKsPu; } ASRNEW_SPDPI_COF; /************************************************************************ TypeDefs & Structure defines *************************************************************************/ typedef struct { UWORD uwRatioJm; // Q0, Ratio of load inertia and motor inertia UWORD uwMcoef; // Q0, Damping factor UWORD uwMtJm; // Motor rotational inertia UWORD uwMtFlxWb; // unit: 0.01mWb, Flux linkage UWORD uwUbVt; // unit: 0.1V, Voltage base UWORD uwIbAp; // unit: 0.01A, Current base UWORD uwFbHz; // unit: Hz, Frequency base UWORD uwFTbsHz; // TBS frequency UWORD uwPairs; // Pole pairs base UWORD uwWvcHz; // unit: Hz, Speed loop bandwidth } ASRNEW_SPDPI_COFIN; /************************************************************************ TypeDefs & Structure defines *************************************************************************/ /************************************************************************ Constant Table *************************************************************************/ /************************************************************************ Exported Variables: *************************************************************************/ #ifdef _ASR_NEW_C_ _ASR_NEW_EXT ASRNEW_SPDPI_OUT asrnew_stSpdPIOut = ASRNEW_SPDPI_OUT_DEFAULT; _ASR_NEW_EXT ASRNEW_SPDPI_COF asrnew_stSpdPICoef = ASRNEW_SPDPI_COF_DEFAULT; #else _ASR_NEW_EXT ASRNEW_SPDPI_OUT asrnew_stSpdPIOut; _ASR_NEW_EXT ASRNEW_SPDPI_COF asrnew_stSpdPICoef; #endif /************************************************************************ RAM ALLOCATION: *************************************************************************/ #define asrnew_stSpdPICoefIn (*(ASRNEW_SPDPI_COFIN *)MN_BUFFER) #define asrnew_stSpdPIIn (*(ASRNEW_SPDPI_IN *)TBS_BUFFER) /************************************************************************ Exported Function Call Prototypes (N/A) *************************************************************************/ #ifdef _ASR_NEW_C_ _ASR_NEW_EXT void asrnew_voSpdPI(ASRNEW_SPDPI_IN *in, ASRNEW_SPDPI_COF *coef, ASRNEW_SPDPI_OUT *out); _ASR_NEW_EXT void asrnew_voSpdPICoef(ASRNEW_SPDPI_COFIN *in, ASRNEW_SPDPI_COF *out); _ASR_NEW_EXT void asrnew_voSpdPIInit(void); #else _ASR_NEW_EXT void asrnew_voSpdPI(ASRNEW_SPDPI_IN *in, ASRNEW_SPDPI_COF *coef, ASRNEW_SPDPI_OUT *out); _ASR_NEW_EXT void asrnew_voSpdPICoef(ASRNEW_SPDPI_COFIN *in, ASRNEW_SPDPI_COF *out); _ASR_NEW_EXT void asrnew_voSpdPIInit(void); #endif /************************************************************************ Flag Define (N/A) *************************************************************************/ #endif /************************************************************************ Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd. All rights reserved. ************************************************************************* End of this File (EOF)! Do not put anything after this part! *************************************************************************/