123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- /************************************************************************
- Project: Welling Motor Control Paltform
- Filename: brake.h
- Partner Filename: brake.c
- Description: The header file of brake.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):
- WLBDM_M4_SR_201809071-new FSM1.1, by mz, create this file;
- ************************************************************************/
- #include "typedefine.h"
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- *************************************************************************/
- #ifndef BRAKE_H
- #define BRAKE_H
- /************************************************************************
- Compiler Directives (N/A)
- *************************************************************************/
- #ifdef _BRAKE_C_
- #define BRAKE_EXT
- #else
- #define BRAKE_EXT extern
- #endif
- /************************************************************************
- Definitions & Macros
- *************************************************************************/
- #define BRAKE_COF_DEFAULT \
- { \
- 20154, 20400, 237, 8704, -320, -4480, 2048, 10, 10, 1365 \
- } // Default value of DBC_CALC_COF (410V,390V,Q14(0.15),Q14(1),Q14(6.8),Q14(0.25),Q14(3.5))
- #define BRAKE_OUT_DEFAULT \
- { \
- 0, 0, 0, 0, FALSE \
- } // Default value of DBC_CALC_OUT (Q14(0),Q14(0),FALSE)
- /************************************************************************
- Typedefs & Structure Defines
- *************************************************************************/
- typedef struct // Input of " cvb_stBrakeCoef "
- {
- UWORD uwVdcCvbVt; // Real Value, unit:0.1V, Voltage to keep for constant voltage braking
- SWORD swIqRefMaxAp; // Real Value, unit:0.01A, Iq limit max value
- SWORD swIdRefMaxAp; // Real Value, unit:0.01A, Id reference max value
- SWORD swIdRefMinAp; // Real Value, unit:0.01A, Id reference min value
- UWORD uwVBaseVt; // Real Value, unit:0.1V, Voltage Base
- UWORD uwIBaseAp; // Real Value, unit:0.01A, Current Base
- UWORD uwFBaseHz; // Real Value, unit:Hz, Frequence Base
- UWORD uwMotorPairs; // Real Value, unit:1, Motor Pairs
- UWORD uwLowSpdRpm; // Real Value, unit:rpm, Low speed without Id
- } BRAKE_COFIN;
- typedef struct // Input of " cvb_stBrakeOut "
- {
- UWORD uwVdcLpfPu; // Q14, unit:Pu, DC bus voltage
- SWORD swSpdPu; // Q15, unit:Pu, Current speed
- UWORD uwSpdLpfAbsPu; // Q15, unit:Pu, Abs of Current speed feedback
- SWORD swIqRefPu; // Q14, unit:Pu, Current Iq Reference
- SWORD swIdRefPu; // Q14, unit:Pu, Current Id Reference
- SWORD uwAngelPu; // Q15, unit:Pu, Obs angle
- UWORD uwSpdState;
- } BRAKE_IN;
- typedef struct // Input of " cvb_stBrakeOut "
- {
- UWORD uwVdcCvbPu; // Q14, unit:Pu, Voltage to keep for constant voltage braking
- UWORD uwVdcLagAngelPu; // Q14, unit:Pu, Voltage to lag angle constant voltage braking
- UWORD uwVdcStartCvbPu; // Q14, unit:Pu, Voltage to start iq limit of constant voltage braking
- UWORD uwKAnglePu; // Q8, unit:Pu, Coefficient of delta Angle
- SWORD swIqLimMaxPu; // Q14, unit:Pu, Iq limit max value
- SWORD swIdRefMaxPu; // Q14, unit:Pu, Id reference max value
- SWORD swIdRefMinPu; // Q14, unit:Pu, Id reference min value
- SWORD swKcvb; // Q14, unit:Pu, Constant voltage braking cofficient
- SWORD swIdDrpPu; // Q14, unit:Pu, delta Id drop
- SWORD swIdRcyPu; // Q14, unit:Pu, delta Id recovery
- UWORD uwLowSpdPu; // Q15, unit:Pu, Low speed without Id
- } BRAKE_COF;
- typedef struct // Output of " cvb_stBrakeOut "
- {
- SWORD swIqRefPu; // Q14, unit:Pu, Q axis current reference
- SWORD swIqLimPu; // Q14, unit:Pu, Q axis current limit
- SWORD swIdRefPu; // Q14, unit:Pu, D axis current reference
- SWORD uwAngelPu; // Q15, unit:Pu, Obs angle after brake lag
- BOOL blCvbFlg; // Bool, constant voltage braking flag
- } BRAKE_OUT;
- /************************************************************************
- Exported Variables
- *************************************************************************/
- #ifdef _BRAKE_C_
- BRAKE_EXT BRAKE_COF cvb_stBrakeCoef = BRAKE_COF_DEFAULT;
- BRAKE_EXT BRAKE_OUT cvb_stBrakeOut = BRAKE_OUT_DEFAULT;
- #else
- BRAKE_EXT BRAKE_COF cvb_stBrakeCoef;
- BRAKE_EXT BRAKE_OUT cvb_stBrakeOut;
- #endif
- /************************************************************************
- RAM ALLOCATION (N/A)
- *************************************************************************/
- #define cvb_stBrakeIn (*(BRAKE_IN *)TBC_BUFFER)
- #define cvb_stBrakeCoefIn (*(BRAKE_COFIN *)MN_BUFFER)
- /************************************************************************
- Exported Function Call Prototypes
- *************************************************************************/
- #ifdef _BRAKE_C_
- BRAKE_EXT void cvb_voBrake(BRAKE_IN *in, BRAKE_COF *coef, BRAKE_OUT *out);
- BRAKE_EXT void cvb_voBrakeCoef(BRAKE_COFIN *in, BRAKE_COF *out);
- BRAKE_EXT void cvb_voBrakeInit();
- #else
- BRAKE_EXT void cvb_voBrake(BRAKE_IN *in, BRAKE_COF *coef, BRAKE_OUT *out);
- BRAKE_EXT void cvb_voBrakeCoef(BRAKE_COFIN *in, BRAKE_COF *out);
- BRAKE_EXT void cvb_voBrakeInit();
- #endif
- /************************************************************************
- Local Function Call Prototypes (N/A)
- *************************************************************************/
- /************************************************************************
- 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!
- *************************************************************************/
|