📄 bldcadczcdefines.h
字号:
#define MOTORB_CURRLIMIT_PI_PROPORTIONAL_GAIN 16384 /* Current Limitation PI Controller Parameters */
#define MOTORB_CURRLIMIT_PI_PROPORTIONAL_GAIN_SCALE 4
#define MOTORB_CURRLIMIT_PI_INTEGRAL_GAIN 16384
#define MOTORB_CURRLIMIT_PI_INTEGRAL_GAIN_SCALE 4
/* Speed PI regulator constants */
#define MOTORB_SPEED_PI_PROPORTIONAL_GAIN 30500 /* Speed PI Controller Parameters */
#define MOTORB_SPEED_PI_PROPORTIONAL_GAIN_SCALE 5
#define MOTORB_SPEED_PI_INTEGRAL_GAIN 19500
#define MOTORB_SPEED_PI_INTEGRAL_GAIN_SCALE 9
/* Speed constants */
#define MOTORB_SPEED_ROTOR_MAX_RPM 5000 /* Maximal rotor speed [rpm] */
#define MOTORB_MOTOR_COMMUTATION_PREV 24 /* Motor Commutations Per mechanical Revolution */
#define MOTORB_OMEGA_MIN_SYSU 3267 /* Angular frequency minimal [system unit] */ //3270
#define MOTORB_MAX_ZCROSERR 10 /* Maximal Zero Crossing Errors to stop commutations */
#define MOTORB_MIN_ZCROSOK_START 5 /* Minimal Zero Crossing OK to stop starting */
#define MOTORB_ALIGNMENT_STEP_CMT_ACB 4 /* Alignment commutation step index for direction acb */
#define MOTORB_ALIGNMENT_STEP_CMT_ABC 5 /* Alignment commutation step index for direction abc */
/* Current limit settings */
#define MOTORB_CURR_LIMIT_DESIRED_A 6.0 /* Limitation Current Desired [A] */
/* Bldc Commutation constants */
#define MOTORB_PER_START_PROCCMT_US 250.0 /* Minimum Toff duration during Start Phase [uS] */
#define MOTORB_PER_CMTSTART_US 3600 /* Start Commutation Period [uS] */
#define MOTORB_PER_TOFFSTART_US 7200.0 /* Start Toff Period [uS] */
#define MOTORB_COEF_START_CMT_PRECOMP_FRAC FRAC16(0.5)
#define MOTORB_COEF_START_CMT_PRECOMP_LSHFT 2
#define MOTORB_COEF_START_HLFCMT FRAC16(0.125)
#define MOTORB_COEF_START_TOFF FRAC16(0.150)
#define MOTORB_PER_RUN_PROCCMT_US 75.0 /* Mimimum Toff duration during Run Phase [uS] */
#define MOTORB_COEF_RUN_CMT_PRECOMP_FRAC FRAC16(0.5)
#define MOTORB_COEF_RUN_CMT_PRECOMP_LSHFT 2
#define MOTORB_COEF_RUN_HLFCMT FRAC16(0.200)
#define MOTORB_COEF_RUN_TOFF FRAC16(0.250)
#define MOTORB_PWM_to_ADC_COEF FRAC16(0.3)
/* Values in system units, derived from user definitions */
/* Alignment duration [system units] */
#define MOTORB_PER_ALIGNMENT_SYS ( MOTORB_PER_ALIGNMENT_S / CONTROL_SCAN_PERIOD )
#define MOTORB_CURR_ALIGN_DESIRED_sub CURR_DC_BUS_UP_LIMIT_SYS * MOTORB_CURR_ALIGN_DESIRED_A
#define MOTORB_CURR_LIMIT_DESIRED_sub CURR_DC_BUS_UP_LIMIT_SYS * MOTORB_CURR_LIMIT_DESIRED_A
/* Minimal commutation period in internal scale */
#define MOTORB_PER_CMT_MIN (((( IPBUS_CLOCK_FREQ / MOTORB_SPEED_ROTOR_MAX_RPM )/ \
CMT_QT_PRESCALER ) * 60 ) / MOTORB_MOTOR_COMMUTATION_PREV )
/* CmtProc duration during Start Phase [system unit] */
#define MOTORB_PER_START_PROCCMT ((UWord16) ( MOTORB_PER_START_PROCCMT_US * \
( IPBUS_CLOCK_FREQ/CMT_QT_PRESCALER / 1000000.0)))
/* CmtProc duration during Start Phase [system unit] */
#define MOTORB_PER_RUN_PROCCMT ((UWord16) ( MOTORB_PER_RUN_PROCCMT_US * \
( IPBUS_CLOCK_FREQ/CMT_QT_PRESCALER / 1000000.0)))
/* Start Commutation Period [system unit] */
#define MOTORB_PER_CMTSTART ((UWord16) ( MOTORB_PER_CMTSTART_US * \
( IPBUS_CLOCK_FREQ/CMT_QT_PRESCALER / 1000000.0)))
/* Start Zero Crossing Toff Period [system unit] */
#define MOTORB_PER_TOFFSTART ((UWord16) ( MOTORB_PER_TOFFSTART_US * \
( IPBUS_CLOCK_FREQ/CMT_QT_PRESCALER / 1000000.0)))
/************************************************************************/
/** GLOBAL TYPES **/
/************************************************************************/
typedef enum
{
STOP,
RUN,
FAULT
} eRunStop;
typedef enum
{
ALIGNMENT,
STARTING,
RUNNING,
STOPPED
} eBldcStatusCommutation;
typedef struct
{
unsigned int uintStartAlignmentCmtCmdFlag; /* Commutation - Started Alignment Command flag */
unsigned int uintEndAlignmentRqFlag; /* End of Alignment Request flag */
unsigned int uintAlignmentTimedFlag; /* Alignment timed flag */
unsigned int uintBldcRunRqFlag; /* Bldc motor run request flag */
unsigned int uintDirACBCmtRqFlag; /* Commutation Direction ACB Request flag */
unsigned int uintDirACBCmtActualFlag; /* Commutation Direction ACB Actual flag */
unsigned int uintStartRunningCmtCmdFlag; /* Running commut. mode Started Command flag */
unsigned int uintSpeedCtrlEnblFlag; /* SpeedControl Enable flag */
unsigned int uintEndRunningCmtCmdFlag; /* Commutation - End Running Command flag */
unsigned int uintZeroCrosEnblFlag; /* Zero Crossing Enable flag */
unsigned int uintCurrentLimitingActiveFlag; /* Current limiting activation information flag */
unsigned int uintCalibrationDoneFlag; /* Calibration done information flag */
} BldcfCmdApplication; /* Application command/request structure */
/************************************************************************/
/** FUNCTIONS DECLARATIONS **/
/************************************************************************/
static void CheckRunStopSwitch ( void );
static void ApplicationStateMachine ( void );
static void Initialize ( void );
static void InitializeSetup ( void );
static void CommutationControlInit ( void );
static void CommutationControl ( void );
static void CommutationSetAlignment ( UWord16 uwwAlignStepCmt,
UWord16 uwwPerAlignment,
UWord16 *pExtendOCCmt2Val,
BldcfCmdApplication *pCmdApplication );
static void CommutationSetStarting ( bldczc_sStates *pStates, bldczc_sTimes *pTimes,
UWord16 uwwStartStepCmt,
Word16 wwMinZCrosOKStart,
Word16 wwMaxZCrosErr,
BldcfCmdApplication *pCmdApplication );
static void CommutationSetRunning ( bldczc_sStates *pStates, bldczc_sTimes *pTimes );
static void CommutationSetStop ( bldczc_sStates *pStates, BldcfCmdApplication *pCmdApplication );
static void BldcCmtPWM ( UWord16 uwwStepCmt );
void EVM33395BoardSettings ( void );
void MPBoardSettings ( void );
void MotorASettings ( void );
void MotorBSettings ( void );
void CheckUpDownSwitches ( void );
Frac16 RampGetValue ( Frac16 incrementUp, Frac16 incrementDown, \
const Frac16 *pActualValue, const Frac16 *pRequestedValue );
void StopApplication ( void );
/************************************************************************/
/** MotorA parameters constants, structures **/
/** Low Voltage Motor MCG IB23810 **/
/************************************************************************/
/* commutation algorithms initialization structures */
static const bldczc_sComputInit mudtMOTORA_START_COMPUT_INIT =
{
/* Const_PerProcCmt = */ MOTORA_PER_START_PROCCMT,
/* Max_PerCmt */ 0x8000,
/* Mode_CoefInit = */ BLDCZC_SET_DEFAULT,
/* Coef_CmtPrecompLShft = */ MOTORA_COEF_START_CMT_PRECOMP_LSHFT,
/* Coef_CmtPrecompFrac = */ MOTORA_COEF_START_CMT_PRECOMP_FRAC,
/* Coef_HlfCmt = */ MOTORA_COEF_START_HLFCMT,
/* Coef_Toff = */ MOTORA_COEF_START_TOFF,
/* Mode_State_ComputInit = */ BLDCZC_SET_DEFAULT,
/* Mode_TimesInit = */ BLDCZC_SET_DEFAULT,
/* Per_CmtStart = */ MOTORA_PER_CMTSTART,
/* Per_ToffStart = */ MOTORA_PER_TOFFSTART
};
static const bldczc_sComputInit mudtMOTORA_RUN_COMPUT_INIT =
{
/* Const_PerProcCmt = */ MOTORA_PER_RUN_PROCCMT,
/* Max_PerCmt */ 0x8000,
/* Mode_CoefInit = */ BLDCZC_SET_DEFAULT,
/* Coef_CmtPrecompLShft = */ MOTORA_COEF_RUN_CMT_PRECOMP_LSHFT,
/* Coef_CmtPrecompFrac = */ MOTORA_COEF_RUN_CMT_PRECOMP_FRAC,
/* Coef_HlfCmt = */ MOTORA_COEF_RUN_HLFCMT,
/* Coef_Toff = */ MOTORA_COEF_RUN_TOFF,
/* Mode_State_ComputInit = */ BLDCZC_DO_NOT_EFFECT,
/* Mode_TimesInit = */ BLDCZC_DO_NOT_EFFECT,
/* Per_CmtStart = */ 0,
/* Per_ToffStart = */ 0
};
/************************************************************************/
/** MotorB parameters constants, structures **/
/** Low Voltage Motor Pitmann 2311 **/
/************************************************************************/
/* commutation algorithms initialization structures */
static const bldczc_sComputInit mudtMOTORB_START_COMPUT_INIT =
{
/* Const_PerProcCmt = */ MOTORB_PER_START_PROCCMT,
/* Max_PerCmt */ 0x8000,
/* Mode_CoefInit = */ BLDCZC_SET_DEFAULT,
/* Coef_CmtPrecompLShft = */ MOTORB_COEF_START_CMT_PRECOMP_LSHFT,
/* Coef_CmtPrecompFrac = */ MOTORB_COEF_START_CMT_PRECOMP_FRAC,
/* Coef_HlfCmt = */ MOTORB_COEF_START_HLFCMT,
/* Coef_Toff = */ MOTORB_COEF_START_TOFF,
/* Mode_State_ComputInit = */ BLDCZC_SET_DEFAULT,
/* Mode_TimesInit = */ BLDCZC_SET_DEFAULT,
/* Per_CmtStart = */ MOTORB_PER_CMTSTART,
/* Per_ToffStart = */ MOTORB_PER_TOFFSTART
};
static const bldczc_sComputInit mudtMOTORB_RUN_COMPUT_INIT =
{
/* Const_PerProcCmt = */ MOTORB_PER_RUN_PROCCMT,
/* Max_PerCmt */ 0x8000,
/* Mode_CoefInit = */ BLDCZC_SET_DEFAULT,
/* Coef_CmtPrecompLShft = */ MOTORB_COEF_RUN_CMT_PRECOMP_LSHFT,
/* Coef_CmtPrecompFrac = */ MOTORB_COEF_RUN_CMT_PRECOMP_FRAC,
/* Coef_HlfCmt = */ MOTORB_COEF_RUN_HLFCMT,
/* Coef_Toff = */ MOTORB_COEF_RUN_TOFF,
/* Mode_State_ComputInit = */ BLDCZC_DO_NOT_EFFECT,
/* Mode_TimesInit = */ BLDCZC_DO_NOT_EFFECT,
/* Per_CmtStart = */ 0,
/* Per_ToffStart = */ 0
};
/* DEFINITION END */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -