123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348 |
- /************************************************************************
- Project: Welling Motor Control Paltform
- Filename: CodePara.h
- Partner Filename: CodePara.c
- Description: The header file of CodePara.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):
- Miaozhou create this file;
- ************************************************************************/
- /************************************************************************
- Beginning of File, do not put anything above here except notes
- Compiler Directives:
- *************************************************************************/
- #ifndef CODE_PARA_H
- #define CODE_PARA_H
- #include "typedefine.h"
- #include "board_config.h"
- typedef _Bool BOOL;
- /************************************************************************
- Definitions & Macros
- *************************************************************************/
- #define InitPos 0 // Sample using single resistance
- #define VFContorl 1
- #define IFContorl 2
- #define ClZLOOP 3
- #define CadAssist 4
- #define TorqAssist 5
- #define ANG_OBSERVER 0 // Angle from observer
- #define ANG_RESOLVER 1 // Angle from resolver
- #define ANG_SWITCHHALL 2
- #define SINGLERESISITANCE SINGLE_RESISITANCE // Sample using single resistance
- #define RDSON MOS_RESISITANCE // Sample using Rdson
- #define COMBINATION COMBIN_MOSSING
- #define DOUBLERESISTANCE DOUBLE_RESISITANCE // Sample using double resistance
- #define ForwardRotate 0 // Sample using single resistance
- #define BackwardRotate 1 // Sample using Rdson
- #define CP_FLG_DEFAULT \
- { \
- 0, 0, FALSE, ClZLOOP, ANG_RESOLVER, COMBINATION, ForwardRotate, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE \
- }
- #define CP_MOTOR_PARA_DEFAULT \
- { \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
- } // Default value of ACR_CURPI_COFCP_MOTOR_BIKE_PARA
- #define CP_CONTROL_PARA_DEFAULT \
- { \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0 \
- } // Default value of TCP_CONTROL_PARA
- #define CP_HISTORY_PARA_DEFAULT \
- { \
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \
- } // Default value of TCP_CONTROL_PARA
- /************************************************************************
- TypeDefs & Structure Defines
- *************************************************************************/
- typedef struct
- {
- UWORD ParaFirstSetFlg;
- UWORD SpiOffsetFirstSetFlg;
- UWORD SpiOffsetFirstSetFinishFlg;
- UWORD RunModelSelect;
- UWORD ThetaGetModelSelect;
- UWORD CurrentSampleModelSelect;
- UWORD RotateDirectionSelect;
- UWORD ErrorSaveFlg;
- BOOL ErrorSave2FlashFlg;
-
- BOOL RunPermitFlg;
- BOOL ParaUseEEFlg;
- BOOL ParaUseEEFinishFlg;
- BOOL ParaSaveEEFlg;
- BOOL ParaSaveEEFinishFlg;
- BOOL ParaHistorySaveEEFinishFlg;
- BOOL ParaUpdateFlg;
- BOOL ParaMInfoUpdateFlg;
- BOOL ParaBikeInfoUpdateFlg;
- BOOL ParaMCInfoUpdateFlg;
- BOOL ParaSensorInfoUpdateFlg;
- BOOL ParaAInfoUpdateFlg;
- BOOL TestParaInfoUpdateFlg;
- BOOL ParaRideInfoUpdateFlg;
- BOOL ParaBikeInfo2UpdateFlg;
-
- BOOL ParaMotorDriveUpdateFinishFlg;
- BOOL ParaAssistUpdateFinishFlg;
- } CP_FLG;
- typedef struct
- {
- SWORD swMotrPolePairs;
- SWORD swRsOhm;
- UWORD uwLdmH;
- UWORD uwLqmH;
- SWORD swJD;
- SWORD swFluxWb;
- SWORD swIdMaxA;
- SWORD swIdMinA;
- SWORD swIpeakMaxA;
- SWORD swRSpeedRpm;
- SWORD swRPwrWt;
- SWORD swRIarmsA;
- SWORD swRUdcV;
- SWORD swTorMax;
- } CP_MOTOR_PARA;
- typedef struct
- {
- SWORD swIPMTurnOnNs;
- SWORD swIPMTurnOffNs;
- SWORD swIPMDeadTimeNs;
- SWORD swIPMHvicChrgMs;
- SWORD swAlmOverCurrentVal;
- SWORD swAlmOverCurrentTM;
- SWORD swAlmPhsLossVal;
- SWORD swAlmPhsLossTM;
- SWORD swAlmAdcDetectHighVal;
- SWORD swAlmAdcDetectLowVal;
- SWORD swAlmRotorLockK;
- SWORD swAlmRotorLockTM;
- SWORD swAlmRotorLockCurVal;
- SWORD swAlmRotorLockSpdVal;
- SWORD swAlmOverVolVal1;
- SWORD swAlmOverVolTM1;
- SWORD swAlmUnderVolVal1;
- SWORD swAlmUnderVolTM1;
- SWORD swAlmOverSpdVal;
- SWORD swAlmOverSpdTM;
- SWORD swAlmOverHeatCeVal;
- SWORD swAlmOverHeatTM;
- SWORD swAlmPwrLimitStartTempVal;
- SWORD swAlmMotorOverHeatCeVal;
- SWORD swAlmMotorOverHeatTM;
- SWORD swAlmPwrLimitMotorStartTempVal;
- UWORD uwControlFunEN;
- SWORD swAlmThrPhsShrtFrcTM;
- SWORD swAlmPWMOffTM;
- SWORD swAlmPWMOffShrtsw1TM;
- SWORD swAlmThrPhsShrtNormTM;
- SWORD swAlmShrtPWMOffswTM;
- SWORD swAlmIPMOverCurStopTM;
- SWORD swAlmRecAllTM;
- SWORD swAlmRecOCTM;
- SWORD swAlmRecOVVal;
- SWORD swAlmRecOVTM;
- SWORD swAlmRecUVVal;
- SWORD swAlmRecUVTM;
- SWORD swAlmRecOHeatVal;
- SWORD swAlmRecOHeatTM;
- SWORD swAlmRecOHeatTM1;
- SWORD swAlmMotorRecOHeatVal;
-
- SWORD swStartMode;
- SWORD swInitPosMode;
- SWORD swAlignCurAp;
- SWORD swAlignRampTMms;
- SWORD swAlignHoldTMms;
- SWORD swAlignAngInitDeg;
- SWORD swDragCurAp;
- SWORD swDragVolAp;
- SWORD swDragSpdHz;
- SWORD swDragSpdRampTMms;
- SWORD swOpen2ClzRampTMms;
- SWORD swStopSpdRefRpm;
- SWORD swObsSpdPLLM;
- SWORD swObsSpdPLLBandWidthHz;
- SWORD swObsFluxPIDampratio;
- SWORD swObsFluxPICrossfreHz;
- SWORD swAcrPIBandwidth;
- SWORD swAcrCurFbLpfFre;
- UWORD uwAcrCurOutLim;
- SWORD swAcrRaCoef;
- UWORD uwAcrUdcpOutLim;
- SWORD swAsrPIBandwidth;
- SWORD swAsrPIM;
- SWORD swAsrSpdFbLPFFre;
- SWORD swAsrSpdInerRate;
- SWORD swSpeedAccRate;
- SWORD swSpeedDccRate;
- SWORD swPWMMaxDuty;
- SWORD swPWM7to5Duty;
- SWORD swPWMMinSampleDuty1;
- SWORD swPWMMinSampleDuty2;
- SWORD swPWMMinSampleDuty3;
- SWORD swPWMSampleToSteady;
- SWORD swPWMSampleSigR;
- SWORD swPWM1STSampleCnt;
- SWORD swPWM2NDSampleCnt;
- SWORD swPWMOverMdlMode;
- SWORD swFwVdcMinCalTMms;
- SWORD swFwVdcLPFFre;
- SWORD swFwPWMMaxDuty;
- SWORD swFwIdPIOutMin;
- SWORD swFwIdMinLimRatio;
- SWORD swFwIdKpPu;
- SWORD swFwIdKiPu;
- SWORD swFwCharCurCrossFre;
- SWORD swFwCharCurDampRatio;
- SWORD swCvbConstantVolBrakeV;
- SWORD swCvbConstantSpdLowRpm;
- SWORD swPwrLimitValWt;
- SWORD swPwrLimitValWtCALC;
- SWORD swPwrLimitErrWt;
- SWORD swPwrLimitLPFFre;
- SWORD swPwrLimitKpPu;
- SWORD swPwrLimitKiPu;
- SWORD swDbcK;
- SWORD swUartType;
- } CP_CONTROL_PARA;
- typedef struct
- {
- UWORD uwOpenTimes;
- ULONG ulUsedTime;
- SWORD swNTCTempMaxCe;
- SWORD swNTCTempMinCe;
- UWORD uwAlamHOcurTimes;
- UWORD uwAlamSOcurTimes;
- UWORD uwAlamOHeatTimes;
- UWORD uwAlamRotorLockTimes;
- UWORD uwAlamPhsLossTimes;
- UWORD uwAlamOVolTimes;
- UWORD uwAlamUVolTimes;
- UWORD uwAlamComOTimeTimes;
- UWORD uwG1AvgPwrConsumption;
- UWORD uwG2AvgPwrConsumption;
- UWORD uwG3AvgPwrConsumption;
- UWORD uwG4AvgPwrConsumption;
- UWORD uwG5AvgPwrConsumption;
- ULONG ulODOTrip;
- ULONG ulODOTime;
- ULONG ulTripSum;
- ULONG ulTripSumTime;
- UWORD uwTorSensorAlamTimes;
- UWORD uwCadSensorAlamTimes;
- UWORD uwBikeSpdSensorAlamTimes;
- UWORD uwPosSensorAlamTimes;
- ULONG ulRealODOTrip;
- ULONG ulRealODOTime;
- } CP_HISTORY_PARA;
- typedef struct
- {
- UWORD uwBikeGear;
- UWORD uwBikeGearLast;
- BOOL blGearStUpdate;
- ULONG ulRiTime;
- ULONG ulRiTirpTime;
- ULONG ulRealODOTime;
- UWORD BikeSpeedKmH; //Unit 0.1Km/h
- UWORD BMSRestChargeNow;
- UWORD BMSRestChargeLast;
- UWORD uwCruisDis;
- UWORD uwLightSwitch;
- UWORD uwPowerPerKm;
- UWORD uwAvePowerPerKm;
- UWORD uwPowerPerKmSum;
- UWORD uwPowerPerKmBuf[32];
- UWORD uwAvePowerCNT;
- } CP_BIKERUNINFO_PARA;
- /*************************************************************************/
- /************************************************************************
- Exported Variables:
- *************************************************************************/
- /************************************************************************
- Exported Variables
- *************************************************************************/
- extern CP_MOTOR_PARA cp_stMotorPara;
- extern CP_CONTROL_PARA cp_stControlPara;
- extern CP_HISTORY_PARA cp_stHistoryPara;
- extern CP_BIKERUNINFO_PARA cp_stBikeRunInfoPara;
- extern CP_FLG cp_stFlg;
- extern ULONG cp_ulSystickCnt;
- extern UWORD TimingDelay;
- /************************************************************************
- Exported Function Call Prototypes
- *************************************************************************/
- void CodeParaInit(void);
- void CodeHistoryParaDelete(void);
- void CPHistoryInfoCalTiming(void);
- /************************************************************************
- 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!
- *************************************************************************/
|