123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- /************************************************************************
- Project: Welling Motor Control Paltform
- Filename: dbc.h
- Partner Filename: dbc.c
- Description: The header file of dbc.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):
- ************************************************************************/
- #include "typedefine.h"
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- *************************************************************************/
- #ifndef DBC_H
- #define DBC_H
- /************************************************************************
- Compiler Directives (N/A)
- *************************************************************************/
- #ifdef _DBC_C_
- #define DBC_EXT
- #else
- #define DBC_EXT extern
- #endif
- /************************************************************************
- Definitions & Macros
- *************************************************************************/
- #define DBC_CALC_COF_DEFAULT \
- { \
- 0, 0, 77 \
- } // Default value of DBC_CALC_COF
- #define DBC_CALC_OUT_DEFAULT \
- { \
- 0, 0 \
- } // Default value of DBC_CALC_OUT
- /************************************************************************
- Typedefs & Structure Defines
- *************************************************************************/
- typedef struct // Input of " dbc_voDBCompCoef "
- {
- UWORD uwPosSwOnTimeNs; // Real Value, unit:ns, IPM switch-on time at positive current
- UWORD uwPosSwOffTimeNs; // Real Value, unit:ns, IPM switch-off time at positive current
- UWORD uwNegSwOnTimeNs; // Real Value, unit:ns, IPM switch-on time at negative current
- UWORD uwNegSwOffTimeNs; // Real Value, unit:ns, IPM switch-off time at negative current
- UWORD uwDeadBandTimeNs; // Real Value, unit:ns, Dead band time
- ULONG ulPWMPerUs; // Real Value, unit:0.1us, PWM period
- UWORD uwKcoefVtPerAp; // Real Value, unit:0.1V/A, Deadband compensation slope coefficient,
- UWORD uwVBaseVt; // Real Value, unit:0.1V, Voltage Base
- UWORD uwIBaseAp; // Real Value, unit:0.01A, Current Base
- } DBC_COF_IN;
- typedef struct // Output of " dbc_voDBCompCoef "
- {
- UWORD uwPosLostVoltDuty; // Q14, Duty ratio of dead-time for positive current
- UWORD uwNegWinVoltDuty; // Q14, Duty ratio of dead-time for for negtive current
- UWORD uwKcoef; // Q12, Deadband compensation slope coefficient
- } DBC_CALC_COF;
- typedef struct // Input of " dbc_voDBComp "
- {
- UWORD uwVdcPu; // Q14, unit:Pu, Busbar voltage
- SWORD swIaPu; // Q14, unit:Pu, Phase A current
- SWORD swIbPu; // Q14, unit:Pu, Phase B current
- SWORD swIcPu; // Q14, unit:Pu, Phase C current
- SWORD swWsPu; // Q15, unit:Pu, speed feedback, electric angle speed rad/s
- } DBC_CALC_IN;
- typedef struct // Output of " dbc_voDBComp "
- {
- SWORD swUalphaCompPu; // Q14, Ualpha compensation
- SWORD swUbetaCompPu; // Q14, Ubeta compensation
- } DBC_CALC_OUT;
- /************************************************************************
- Exported Variables
- *************************************************************************/
- #ifdef _DBC_C_
- DBC_EXT DBC_CALC_COF dbc_stDbCompCoef = DBC_CALC_COF_DEFAULT;
- DBC_EXT DBC_CALC_OUT dbc_stDbCompOut = DBC_CALC_OUT_DEFAULT;
- #else
- DBC_EXT DBC_CALC_COF dbc_stDbCompCoef;
- DBC_EXT DBC_CALC_OUT dbc_stDbCompOut;
- #endif
- /************************************************************************
- RAM ALLOCATION (N/A)
- *************************************************************************/
- //#define dbc_stDbCompCoefIn (*(DBC_COF_IN *)MN_BUFFER)
- DBC_EXT DBC_COF_IN dbc_stDbCompCoefIn;
- #define dbc_stDbCompIn (*(DBC_CALC_IN *)TBC_BUFFER)
- /************************************************************************
- Exported Function Call Prototypes
- *************************************************************************/
- #ifdef _DBC_C_
- DBC_EXT void dbc_voDBComp(DBC_CALC_IN *IN, DBC_CALC_COF *COF, DBC_CALC_OUT *OUT);
- DBC_EXT void dbc_voDBCompCoef(DBC_COF_IN *IN, DBC_CALC_COF *COF);
- DBC_EXT void dbc_voDBCompInit(void);
- #else
- DBC_EXT void dbc_voDBComp(DBC_CALC_IN *IN, DBC_CALC_COF *COF, DBC_CALC_OUT *OUT);
- DBC_EXT void dbc_voDBCompCoef(DBC_COF_IN *IN, DBC_CALC_COF *COF);
- DBC_EXT void dbc_voDBCompInit(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!
- *************************************************************************/
|