我用的是28027F的板子,功率部分是自己做的板子,电压是通过差分检测的,能够测85V的电压,电流检测用的电流传感器,能够检测82.5A的峰值电流,下面的参数配置是否合适,电机的具体参数是,PMSM,额定电压=72V, 额定电流=51A,额定转矩=11.2N,转速=3000,没有经过电机识别,用的是电机已知的参数Rs=0.037欧,L=0.32mH,磁通是0.072Wb,
出现的问题是,1,用Lab4的例程,给Iq一个电流值,电机开始转动,频率在1hz,但是当我继续加电流的时候,电流频率不变,当电流加的太大时,电机就会抖动。
2,当我手动取消Force angle的时候,电机会反转,当继续增加电流时,电机也会出现不转抖动的情况
3,启动的时候,计算的电流偏置到了2.01,这种数据合理吗
//3000*2/60=100Hz
#define USER_IQ_FULL_SCALE_FREQ_Hz (120.0)
//#define USER_IQ_FULL_SCALE_FREQ_Hz (800.0) // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120
#define USER_IQ_FULL_SCALE_FREQ_Hz (120.0)
//#define USER_IQ_FULL_SCALE_FREQ_Hz (800.0) // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120
//! \brief Defines full scale value for the IQ30 variable of Voltage inside the system
//! \brief All voltages are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST meet the following condition: USER_IQ_FULL_SCALE_VOLTAGE_V > 0.5 * USER_MOTOR_MAX_CURRENT * USER_MOTOR_Ls_d * USER_VOLTAGE_FILTER_POLE_rps,//! \brief WARNING: otherwise the value can saturate and roll-over, causing an inaccurate value
//! \brief WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
//! \brief WARNING: if you know the value of your Bemf constant, and you know you are operating at a multiple speed due to field weakening, be sure to set this value higher than the expected Bemf voltage
//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits
//! \brief This value is also used to calculate the minimum flux value: USER_IQ_FULL_SCALE_VOLTAGE_V/USER_EST_FREQ_Hz/0.7
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (24.0) // 24.0 Example for boostxldrv8301_revB typical usage and the Anaheim motor
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (45)
#define USER_IQ_FULL_SCALE_VOLTAGE_V (72)
//! \brief Defines the maximum voltage at the input to the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (26.314) // 26.314 boostxldrv8301_revB voltage scaling
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (58.3)
#define USER_ADC_FULL_SCALE_VOLTAGE_V (85)
//! \brief All voltages are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST meet the following condition: USER_IQ_FULL_SCALE_VOLTAGE_V > 0.5 * USER_MOTOR_MAX_CURRENT * USER_MOTOR_Ls_d * USER_VOLTAGE_FILTER_POLE_rps,//! \brief WARNING: otherwise the value can saturate and roll-over, causing an inaccurate value
//! \brief WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
//! \brief WARNING: if you know the value of your Bemf constant, and you know you are operating at a multiple speed due to field weakening, be sure to set this value higher than the expected Bemf voltage
//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits
//! \brief This value is also used to calculate the minimum flux value: USER_IQ_FULL_SCALE_VOLTAGE_V/USER_EST_FREQ_Hz/0.7
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (24.0) // 24.0 Example for boostxldrv8301_revB typical usage and the Anaheim motor
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (45)
#define USER_IQ_FULL_SCALE_VOLTAGE_V (72)
//! \brief Defines the maximum voltage at the input to the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (26.314) // 26.314 boostxldrv8301_revB voltage scaling
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (58.3)
#define USER_ADC_FULL_SCALE_VOLTAGE_V (85)
//! \brief Defines the voltage scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_VOLTAGE_SF ((float_t)((USER_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_VOLTAGE_SF ((float_t)((USER_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))
//! \brief Defines the full scale current for the IQ variables, A
//! \brief All currents are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum current readings that you are expecting from the motor or the reading will roll over to 0, creating a control issue//#define USER_IQ_FULL_SCALE_CURRENT_A (20.0) // 20.0 Example for boostxldrv8301_revB typical usage
#define USER_IQ_FULL_SCALE_CURRENT_A (51.0)
//! \brief Defines the maximum current at the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_CURRENT_A (33.0) // 33.0 boostxldrv8301_revB current scaling
#define USER_ADC_FULL_SCALE_CURRENT_A (165.0)
//! \brief Defines the current scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_CURRENT_SF ((float_t)((USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A)))
//! \brief All currents are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum current readings that you are expecting from the motor or the reading will roll over to 0, creating a control issue//#define USER_IQ_FULL_SCALE_CURRENT_A (20.0) // 20.0 Example for boostxldrv8301_revB typical usage
#define USER_IQ_FULL_SCALE_CURRENT_A (51.0)
//! \brief Defines the maximum current at the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_CURRENT_A (33.0) // 33.0 boostxldrv8301_revB current scaling
#define USER_ADC_FULL_SCALE_CURRENT_A (165.0)
//! \brief Defines the current scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_CURRENT_SF ((float_t)((USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A)))
//! \brief Defines the number of current sensors used
//! \brief Defined by the hardware capability present
//! \brief May be (2) or (3)
#define USER_NUM_CURRENT_SENSORS (3) // 3 Preferred setting for best performance across full speed range, allows for 100% duty cycle
//! \brief Defined by the hardware capability present
//! \brief May be (2) or (3)
#define USER_NUM_CURRENT_SENSORS (3) // 3 Preferred setting for best performance across full speed range, allows for 100% duty cycle
//! \brief Defines the number of voltage (phase) sensors
//! \brief Must be (3)
#define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required
//! \brief Must be (3)
#define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required
//! \brief ADC current offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define I_A_offset (0.8387260437)
#define I_B_offset (0.8367524147)
#define I_C_offset (0.8327225447)
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define I_A_offset (0.8387260437)
#define I_B_offset (0.8367524147)
#define I_C_offset (0.8327225447)
//! \brief ADC voltage offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define V_A_offset (0.498126924)
#define V_B_offset (0.4988828897)
#define V_C_offset (0.4985800385)
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define V_A_offset (0.498126924)
#define V_B_offset (0.4988828897)
#define V_C_offset (0.4985800385)
//! \brief CLOCKS & TIMERS
// **************************************************************************
//! \brief Defines the system clock frequency, MHz
#define USER_SYSTEM_FREQ_MHz (60.0)
// **************************************************************************
//! \brief Defines the system clock frequency, MHz
#define USER_SYSTEM_FREQ_MHz (60.0)
//! \brief Defines the Pulse Width Modulation (PWM) frequency, kHz
//! \brief PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
//! \brief For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
//! \brief and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
//! \brief Otherwise you risk missing interrupts and disrupting the timing of the control state machine
//#define USER_PWM_FREQ_kHz (45.0) //30.0 Example, 8.0 – 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors
#define USER_PWM_FREQ_kHz (10.0)
//! \brief Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
//! \brief Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
//! \brief The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
//! \brief Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 – Vd^2).
//! \brief Set USER_MAX_VS_MAG = 0.5 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
//! \brief Set USER_MAX_VS_MAG = 1/SQRT(3) = 0.5774 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief Set USER_MAX_VS_MAG = 2/3 = 0.6666 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief For space vector over-modulation, see lab 10 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal.
#define USER_MAX_VS_MAG_PU (0.5) // Set to 0.5 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.
//! \brief PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
//! \brief For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
//! \brief and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
//! \brief Otherwise you risk missing interrupts and disrupting the timing of the control state machine
//#define USER_PWM_FREQ_kHz (45.0) //30.0 Example, 8.0 – 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors
#define USER_PWM_FREQ_kHz (10.0)
//! \brief Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
//! \brief Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
//! \brief The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
//! \brief Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 – Vd^2).
//! \brief Set USER_MAX_VS_MAG = 0.5 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
//! \brief Set USER_MAX_VS_MAG = 1/SQRT(3) = 0.5774 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief Set USER_MAX_VS_MAG = 2/3 = 0.6666 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief For space vector over-modulation, see lab 10 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal.
#define USER_MAX_VS_MAG_PU (0.5) // Set to 0.5 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.
//! \brief Defines the address of estimator handle
//!
#define USER_EST_HANDLE_ADDRESS (0x600)
//!
#define USER_EST_HANDLE_ADDRESS (0x600)
//! \brief Defines the direct voltage (Vd) scale factor
//!
#define USER_VD_SF (0.95)
//!
#define USER_VD_SF (0.95)
//! \brief Defines the Pulse Width Modulation (PWM) period, usec
//! \brief Compile time calculation
#define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)
//! \brief Compile time calculation
#define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)
//! \brief Defines the Interrupt Service Routine (ISR) frequency, Hz
//!
#define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//!
#define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//! \brief Defines the Interrupt Service Routine (ISR) period, usec
//!
#define USER_ISR_PERIOD_usec (USER_PWM_PERIOD_usec * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//!
#define USER_ISR_PERIOD_usec (USER_PWM_PERIOD_usec * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//! \brief DECIMATION
// **************************************************************************
//! \brief Defines the number of pwm clock ticks per isr clock tick
//! Note: Valid values are 1, 2 or 3 only
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (3)
// **************************************************************************
//! \brief Defines the number of pwm clock ticks per isr clock tick
//! Note: Valid values are 1, 2 or 3 only
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (3)
//! \brief Defines the number of isr ticks (hardware) per controller clock tick (software)
//! \brief Controller clock tick (CTRL) is the main clock used for all timing in the software
//! \brief Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
//! \brief ADC SOC triggers an ADC Conversion Done
//! \brief ADC Conversion Done triggers ISR
//! \brief This relates the hardware ISR rate to the software controller rate
//! \brief Typcially want to consider some form of decimation (ePWM hardware, CURRENT or EST) over 16KHz ISR to insure interrupt completes and leaves time for background tasks
#define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1) // 2 Example, controller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control
//! \brief Controller clock tick (CTRL) is the main clock used for all timing in the software
//! \brief Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
//! \brief ADC SOC triggers an ADC Conversion Done
//! \brief ADC Conversion Done triggers ISR
//! \brief This relates the hardware ISR rate to the software controller rate
//! \brief Typcially want to consider some form of decimation (ePWM hardware, CURRENT or EST) over 16KHz ISR to insure interrupt completes and leaves time for background tasks
#define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1) // 2 Example, controller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control
//! \brief Defines the number of controller clock ticks per current controller clock tick
//! \brief Relationship of controller clock rate to current controller (FOC) rate
#define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1) // 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.
//! \brief Relationship of controller clock rate to current controller (FOC) rate
#define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1) // 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.
//! \brief Defines the number of controller clock ticks per estimator clock tick
//! \brief Relationship of controller clock rate to estimator (FAST) rate
//! \brief Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applications may require up to 15 KHz
#define USER_NUM_CTRL_TICKS_PER_EST_TICK (1) // 1 Typical, FAST estimator runs at same rate as CTRL;
//! \brief Relationship of controller clock rate to estimator (FAST) rate
//! \brief Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applications may require up to 15 KHz
#define USER_NUM_CTRL_TICKS_PER_EST_TICK (1) // 1 Typical, FAST estimator runs at same rate as CTRL;
//! \brief Defines the number of controller clock ticks per speed controller clock tick
//! \brief Relationship of controller clock rate to speed loop rate
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15) // 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop
//! \brief Relationship of controller clock rate to speed loop rate
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15) // 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop
//! \brief Defines the number of controller clock ticks per trajectory clock tick
//! \brief Relationship of controller clock rate to trajectory loop rate
//! \brief Typically the same as the speed rate
#define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15) // 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory
//! \brief Relationship of controller clock rate to trajectory loop rate
//! \brief Typically the same as the speed rate
#define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15) // 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory
//! \brief Defines the controller frequency, Hz
//! \brief Compile time calculation
#define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Compile time calculation
#define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Defines the estimator frequency, Hz
//! \brief Compile time calculation
#define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)
//! \brief Compile time calculation
#define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)
//! \brief Defines the trajectory frequency, Hz
//! \brief Compile time calculation
#define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)
//! \brief Compile time calculation
#define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)
//! \brief Defines the controller execution period, usec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Defines the controller execution period, sec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)
//! \brief LIMITS
// **************************************************************************
//! \brief Defines the maximum negative current to be applied in Id reference
//! \brief Used in field weakening only, this is a safety setting (e.g. to protect against demagnetization)
//! \brief User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-0.5 * USER_MOTOR_MAX_CURRENT) // -0.5 * USER_MOTOR_MAX_CURRENT Example, adjust to meet safety needs of your motor
// **************************************************************************
//! \brief Defines the maximum negative current to be applied in Id reference
//! \brief Used in field weakening only, this is a safety setting (e.g. to protect against demagnetization)
//! \brief User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-0.5 * USER_MOTOR_MAX_CURRENT) // -0.5 * USER_MOTOR_MAX_CURRENT Example, adjust to meet safety needs of your motor
//! \brief Defines the low speed limit for the flux integrator, pu//! \brief This is the speed range (CW/CCW) at which the ForceAngle object is active, but only if Enabled
//! \brief Outside of this speed – or if Disabled – the ForcAngle will NEVER be active and the angle is provided by FAST only
#define USER_ZEROSPEEDLIMIT (0.5 / USER_IQ_FULL_SCALE_FREQ_Hz) // 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz
//#define USER_ZEROSPEEDLIMIT (0.2 / USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Outside of this speed – or if Disabled – the ForcAngle will NEVER be active and the angle is provided by FAST only
#define USER_ZEROSPEEDLIMIT (0.5 / USER_IQ_FULL_SCALE_FREQ_Hz) // 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz
//#define USER_ZEROSPEEDLIMIT (0.2 / USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Defines the force angle frequency, Hz
//! \brief Frequency of stator vector rotation used by the ForceAngle object
//! \brief Can be positive or negative
#define USER_FORCE_ANGLE_FREQ_Hz (2.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz) // 1.0 Typical force angle start-up speed
//#define USER_FORCE_ANGLE_FREQ_Hz (5.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Frequency of stator vector rotation used by the ForceAngle object
//! \brief Can be positive or negative
#define USER_FORCE_ANGLE_FREQ_Hz (2.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz) // 1.0 Typical force angle start-up speed
//#define USER_FORCE_ANGLE_FREQ_Hz (5.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Defines the maximum current slope for Id trajectory during PowerWarp
//! \brief For Induction motors only, controls how fast Id input can change under PowerWarp control
#define USER_MAX_CURRENT_SLOPE_POWERWARP (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down
//! \brief For Induction motors only, controls how fast Id input can change under PowerWarp control
#define USER_MAX_CURRENT_SLOPE_POWERWARP (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down
//! \brief Defines the starting maximum acceleration AND deceleration for the speed profiles, Hz/s
//! \brief Updated in run-time through user functions
//! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
#define USER_MAX_ACCEL_Hzps (20.0) // 20.0 Default
//! \brief Updated in run-time through user functions
//! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
#define USER_MAX_ACCEL_Hzps (20.0) // 20.0 Default
//! \brief Defines maximum acceleration for the estimation speed profiles, Hz/s
//! \brief Only used during Motor ID (commission)
#define USER_MAX_ACCEL_EST_Hzps (5.0) // 5.0 Default, don't change
//! \brief Only used during Motor ID (commission)
#define USER_MAX_ACCEL_EST_Hzps (5.0) // 5.0 Default, don't change
//! \brief Defines the maximum current slope for Id trajectory during estimation
#define USER_MAX_CURRENT_SLOPE (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change
#define USER_MAX_CURRENT_SLOPE (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change
//! \brief Defines the fraction of IdRated to use during rated flux estimation
//!
#define USER_IDRATED_FRACTION_FOR_RATED_FLUX (1.0) // 1.0 Default, don't change
//!
#define USER_IDRATED_FRACTION_FOR_RATED_FLUX (1.0) // 1.0 Default, don't change
//! \brief Defines the fraction of IdRated to use during inductance estimation
//!
#define USER_IDRATED_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//!
#define USER_IDRATED_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//! \brief Defines the IdRated delta to use during estimation
//!
#define USER_IDRATED_DELTA (0.00002)
//!
#define USER_IDRATED_DELTA (0.00002)
//! \brief Defines the fraction of SpeedMax to use during inductance estimation
//!
#define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//!
#define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//! \brief Defines flux fraction to use during inductance identification
//!
#define USER_FLUX_FRACTION (1.0) // 1.0 Default, don't change
//!
#define USER_FLUX_FRACTION (1.0) // 1.0 Default, don't change
//! \brief Defines the PowerWarp gain for computing Id reference
//! \brief Induction motors only
#define USER_POWERWARP_GAIN (1.0) // 1.0 Default, don't change
//! \brief Induction motors only
#define USER_POWERWARP_GAIN (1.0) // 1.0 Default, don't change
//! \brief Defines the R/L estimation frequency, Hz
//! \brief User higher values for low inductance motors and lower values for higher inductance
//! \brief motors. The values can range from 100 to 300 Hz.
//#define USER_R_OVER_L_EST_FREQ_Hz (300) // 300 Default
#define USER_R_OVER_L_EST_FREQ_Hz (100)
//! \brief User higher values for low inductance motors and lower values for higher inductance
//! \brief motors. The values can range from 100 to 300 Hz.
//#define USER_R_OVER_L_EST_FREQ_Hz (300) // 300 Default
#define USER_R_OVER_L_EST_FREQ_Hz (100)
//! \brief POLES
// **************************************************************************
//! \brief Defines the analog voltage filter pole location, Hz
//! \brief Must match the hardware filter for Vph
#define USER_VOLTAGE_FILTER_POLE_Hz (300.682) // 364.682, value for boostxldrv8301_revB hardware
// **************************************************************************
//! \brief Defines the analog voltage filter pole location, Hz
//! \brief Must match the hardware filter for Vph
#define USER_VOLTAGE_FILTER_POLE_Hz (300.682) // 364.682, value for boostxldrv8301_revB hardware
//! \brief Defines the analog voltage filter pole location, rad/s
//! \brief Compile time calculation from Hz to rad/s
#define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)
//! \brief Compile time calculation from Hz to rad/s
#define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)
//! \brief Defines the software pole location for the voltage and current offset estimation, rad/s
//! \brief Should not be changed from default of (20.0)
#define USER_OFFSET_POLE_rps (20.0) // 20.0 Default, do not change
//! \brief Should not be changed from default of (20.0)
#define USER_OFFSET_POLE_rps (20.0) // 20.0 Default, do not change
//! \brief Defines the software pole location for the flux estimation, rad/s
//! \brief Should not be changed from default of (100.0)
#define USER_FLUX_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Should not be changed from default of (100.0)
#define USER_FLUX_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the software pole location for the direction filter, rad/s
#define USER_DIRECTION_POLE_rps (6.0) // 6.0 Default, do not change
#define USER_DIRECTION_POLE_rps (6.0) // 6.0 Default, do not change
//! \brief Defines the software pole location for the speed control filter, rad/s
#define USER_SPEED_POLE_rps (100.0) // 100.0 Default, do not change
#define USER_SPEED_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the software pole location for the DC bus filter, rad/s
#define USER_DCBUS_POLE_rps (100.0) // 100.0 Default, do not change
#define USER_DCBUS_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the convergence factor for the estimator
//! \brief Do not change from default for FAST
#define USER_EST_KAPPAQ (1.5) // 1.5 Default, do not change
//! \brief Do not change from default for FAST
#define USER_EST_KAPPAQ (1.5) // 1.5 Default, do not change
// **************************************************************************
// end the defines
// end the defines
//! \brief USER MOTOR & ID SETTINGS
// **************************************************************************
// **************************************************************************
//! \brief Define each motor with a unique name and ID number
// BLDC & SMPM motors
#define Estun_EMJ_04APB22 101
#define Anaheim_BLY172S 102
#define My_Motor 104
#define hobby_3p5T 105
#define hobby_4p5T 106
#define small_hobby 107
#define teknic_2310P 108
#define hobbywing_ezrun_8p5T 109
#define eflite_helicopter_420 110
#define Bodine_34B3FEBL 114
#define Pittman_elcom_5233B599 115
#define medical_instrument 117
// BLDC & SMPM motors
#define Estun_EMJ_04APB22 101
#define Anaheim_BLY172S 102
#define My_Motor 104
#define hobby_3p5T 105
#define hobby_4p5T 106
#define small_hobby 107
#define teknic_2310P 108
#define hobbywing_ezrun_8p5T 109
#define eflite_helicopter_420 110
#define Bodine_34B3FEBL 114
#define Pittman_elcom_5233B599 115
#define medical_instrument 117
// IPM motors
// If user provides separate Ls-d, Ls-q
// else treat as SPM with user or identified average Ls
#define Belt_Drive_Washer_IPM 201
// If user provides separate Ls-d, Ls-q
// else treat as SPM with user or identified average Ls
#define Belt_Drive_Washer_IPM 201
// ACIM motors
#define Marathon_5K33GN2A 301
#define Kinetek_YDQ1p3_4 302
#define LPKF_CAD_CAM 303
#define Marathon_5K33GN2A 301
#define Kinetek_YDQ1p3_4 302
#define LPKF_CAD_CAM 303
//! \brief Uncomment the motor which should be included at compile
//! \brief These motor ID settings and motor parameters are then available to be used by the control system
//! \brief Once your ideal settings and parameters are identified update the motor section here so it is available in the binary code
//#define USER_MOTOR Estun_EMJ_04APB22
#define USER_MOTOR Anaheim_BLY172S
//#define USER_MOTOR hobby_3p5T
//#define USER_MOTOR hobby_4p5T
//#define USER_MOTOR My_Motor
//#define USER_MOTOR small_hobby
//#define USER_MOTOR Belt_Drive_Washer_IPM
//#define USER_MOTOR Marathon_5K33GN2A
//#define USER_MOTOR teknic_2310P
//#define USER_MOTOR hobbywing_ezrun_8p5T
//#define USER_MOTOR eflite_helicopter_420
//#define USER_MOTOR Bodine_34B3FEBL
//#define USER_MOTOR Pittman_elcom_5233B599
//#define USER_MOTOR medical_instrument
//#define USER_MOTOR Kinetek_YDQ1p3_4
//#define USER_MOTOR LPKF_CAD_CAM
//! \brief These motor ID settings and motor parameters are then available to be used by the control system
//! \brief Once your ideal settings and parameters are identified update the motor section here so it is available in the binary code
//#define USER_MOTOR Estun_EMJ_04APB22
#define USER_MOTOR Anaheim_BLY172S
//#define USER_MOTOR hobby_3p5T
//#define USER_MOTOR hobby_4p5T
//#define USER_MOTOR My_Motor
//#define USER_MOTOR small_hobby
//#define USER_MOTOR Belt_Drive_Washer_IPM
//#define USER_MOTOR Marathon_5K33GN2A
//#define USER_MOTOR teknic_2310P
//#define USER_MOTOR hobbywing_ezrun_8p5T
//#define USER_MOTOR eflite_helicopter_420
//#define USER_MOTOR Bodine_34B3FEBL
//#define USER_MOTOR Pittman_elcom_5233B599
//#define USER_MOTOR medical_instrument
//#define USER_MOTOR Kinetek_YDQ1p3_4
//#define USER_MOTOR LPKF_CAD_CAM
#elif (USER_MOTOR == Anaheim_BLY172S)
#define USER_MOTOR_TYPE MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS (2)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.037)
#define USER_MOTOR_Ls_d (0.00032)
#define USER_MOTOR_Ls_q (0.00032)
#define USER_MOTOR_RATED_FLUX (0.072)
#define USER_MOTOR_TYPE MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS (2)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.037)
#define USER_MOTOR_Ls_d (0.00032)
#define USER_MOTOR_Ls_q (0.00032)
#define USER_MOTOR_RATED_FLUX (0.072)
#define USER_MOTOR_MAGNETIZING_CURRENT (NULL)
#define USER_MOTOR_RES_EST_CURRENT (4.0)
#define USER_MOTOR_IND_EST_CURRENT (-4.0)
#define USER_MOTOR_MAX_CURRENT (30.0)
#define USER_MOTOR_FLUX_EST_FREQ_Hz (10.0)
#define USER_MOTOR_RES_EST_CURRENT (4.0)
#define USER_MOTOR_IND_EST_CURRENT (-4.0)
#define USER_MOTOR_MAX_CURRENT (30.0)
#define USER_MOTOR_FLUX_EST_FREQ_Hz (10.0)
#define USER_MOTOR_FREQ_LOW (10.0) // Hz – suggested to set to 10% of rated motor frequency
#define USER_MOTOR_FREQ_HIGH (100.0) // Hz – suggested to set to 100% of rated motor frequency
#define USER_MOTOR_FREQ_MAX (120.0) // Hz – suggested to set to 120% of rated motor frequency
//#define USER_MOTOR_VOLT_MIN (3.0) // Volt – suggested to set to 15% of rated motor voltage
//#define USER_MOTOR_VOLT_MAX (18.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_FREQ_HIGH (100.0) // Hz – suggested to set to 100% of rated motor frequency
#define USER_MOTOR_FREQ_MAX (120.0) // Hz – suggested to set to 120% of rated motor frequency
//#define USER_MOTOR_VOLT_MIN (3.0) // Volt – suggested to set to 15% of rated motor voltage
//#define USER_MOTOR_VOLT_MAX (18.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_VOLT_MIN (10.8) // Volt – suggested to set to 15% of rated motor voltage
#define USER_MOTOR_VOLT_MAX (72.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_VOLT_MAX (72.0) // Volt – suggested to set to 100% of rated motor voltage
bob iuuiy:
这个问题困扰了我很久了,有没有大神帮忙看一下,万分感谢
我用的是28027F的板子,功率部分是自己做的板子,电压是通过差分检测的,能够测85V的电压,电流检测用的电流传感器,能够检测82.5A的峰值电流,下面的参数配置是否合适,电机的具体参数是,PMSM,额定电压=72V, 额定电流=51A,额定转矩=11.2N,转速=3000,没有经过电机识别,用的是电机已知的参数Rs=0.037欧,L=0.32mH,磁通是0.072Wb,
出现的问题是,1,用Lab4的例程,给Iq一个电流值,电机开始转动,频率在1hz,但是当我继续加电流的时候,电流频率不变,当电流加的太大时,电机就会抖动。
2,当我手动取消Force angle的时候,电机会反转,当继续增加电流时,电机也会出现不转抖动的情况
3,启动的时候,计算的电流偏置到了2.01,这种数据合理吗
//3000*2/60=100Hz
#define USER_IQ_FULL_SCALE_FREQ_Hz (120.0)
//#define USER_IQ_FULL_SCALE_FREQ_Hz (800.0) // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120
#define USER_IQ_FULL_SCALE_FREQ_Hz (120.0)
//#define USER_IQ_FULL_SCALE_FREQ_Hz (800.0) // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120
//! \brief Defines full scale value for the IQ30 variable of Voltage inside the system
//! \brief All voltages are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST meet the following condition: USER_IQ_FULL_SCALE_VOLTAGE_V > 0.5 * USER_MOTOR_MAX_CURRENT * USER_MOTOR_Ls_d * USER_VOLTAGE_FILTER_POLE_rps,//! \brief WARNING: otherwise the value can saturate and roll-over, causing an inaccurate value
//! \brief WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
//! \brief WARNING: if you know the value of your Bemf constant, and you know you are operating at a multiple speed due to field weakening, be sure to set this value higher than the expected Bemf voltage
//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits
//! \brief This value is also used to calculate the minimum flux value: USER_IQ_FULL_SCALE_VOLTAGE_V/USER_EST_FREQ_Hz/0.7
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (24.0) // 24.0 Example for boostxldrv8301_revB typical usage and the Anaheim motor
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (45)
#define USER_IQ_FULL_SCALE_VOLTAGE_V (72)
//! \brief Defines the maximum voltage at the input to the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (26.314) // 26.314 boostxldrv8301_revB voltage scaling
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (58.3)
#define USER_ADC_FULL_SCALE_VOLTAGE_V (85)
//! \brief All voltages are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST meet the following condition: USER_IQ_FULL_SCALE_VOLTAGE_V > 0.5 * USER_MOTOR_MAX_CURRENT * USER_MOTOR_Ls_d * USER_VOLTAGE_FILTER_POLE_rps,//! \brief WARNING: otherwise the value can saturate and roll-over, causing an inaccurate value
//! \brief WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
//! \brief WARNING: if you know the value of your Bemf constant, and you know you are operating at a multiple speed due to field weakening, be sure to set this value higher than the expected Bemf voltage
//! \brief It is recommended to start with a value ~3x greater than the USER_ADC_FULL_SCALE_VOLTAGE_V and increase to 4-5x if scenarios where a Bemf calculation may exceed these limits
//! \brief This value is also used to calculate the minimum flux value: USER_IQ_FULL_SCALE_VOLTAGE_V/USER_EST_FREQ_Hz/0.7
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (24.0) // 24.0 Example for boostxldrv8301_revB typical usage and the Anaheim motor
//#define USER_IQ_FULL_SCALE_VOLTAGE_V (45)
#define USER_IQ_FULL_SCALE_VOLTAGE_V (72)
//! \brief Defines the maximum voltage at the input to the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (26.314) // 26.314 boostxldrv8301_revB voltage scaling
//#define USER_ADC_FULL_SCALE_VOLTAGE_V (58.3)
#define USER_ADC_FULL_SCALE_VOLTAGE_V (85)
//! \brief Defines the voltage scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_VOLTAGE_SF ((float_t)((USER_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_VOLTAGE_SF ((float_t)((USER_ADC_FULL_SCALE_VOLTAGE_V)/(USER_IQ_FULL_SCALE_VOLTAGE_V)))
//! \brief Defines the full scale current for the IQ variables, A
//! \brief All currents are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum current readings that you are expecting from the motor or the reading will roll over to 0, creating a control issue//#define USER_IQ_FULL_SCALE_CURRENT_A (20.0) // 20.0 Example for boostxldrv8301_revB typical usage
#define USER_IQ_FULL_SCALE_CURRENT_A (51.0)
//! \brief Defines the maximum current at the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_CURRENT_A (33.0) // 33.0 boostxldrv8301_revB current scaling
#define USER_ADC_FULL_SCALE_CURRENT_A (165.0)
//! \brief Defines the current scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_CURRENT_SF ((float_t)((USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A)))
//! \brief All currents are converted into (pu) based on the ratio to this value
//! \brief WARNING: this value MUST be larger than the maximum current readings that you are expecting from the motor or the reading will roll over to 0, creating a control issue//#define USER_IQ_FULL_SCALE_CURRENT_A (20.0) // 20.0 Example for boostxldrv8301_revB typical usage
#define USER_IQ_FULL_SCALE_CURRENT_A (51.0)
//! \brief Defines the maximum current at the AD converter
//! \brief The value that will be represented by the maximum ADC input (3.3V) and conversion (0FFFh)
//! \brief Hardware dependent, this should be based on the current sensing and scaling to the ADC input
//#define USER_ADC_FULL_SCALE_CURRENT_A (33.0) // 33.0 boostxldrv8301_revB current scaling
#define USER_ADC_FULL_SCALE_CURRENT_A (165.0)
//! \brief Defines the current scale factor for the system
//! \brief Compile time calculation for scale factor (ratio) used throughout the system
#define USER_CURRENT_SF ((float_t)((USER_ADC_FULL_SCALE_CURRENT_A)/(USER_IQ_FULL_SCALE_CURRENT_A)))
//! \brief Defines the number of current sensors used
//! \brief Defined by the hardware capability present
//! \brief May be (2) or (3)
#define USER_NUM_CURRENT_SENSORS (3) // 3 Preferred setting for best performance across full speed range, allows for 100% duty cycle
//! \brief Defined by the hardware capability present
//! \brief May be (2) or (3)
#define USER_NUM_CURRENT_SENSORS (3) // 3 Preferred setting for best performance across full speed range, allows for 100% duty cycle
//! \brief Defines the number of voltage (phase) sensors
//! \brief Must be (3)
#define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required
//! \brief Must be (3)
#define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required
//! \brief ADC current offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define I_A_offset (0.8387260437)
#define I_B_offset (0.8367524147)
#define I_C_offset (0.8327225447)
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define I_A_offset (0.8387260437)
#define I_B_offset (0.8367524147)
#define I_C_offset (0.8327225447)
//! \brief ADC voltage offsets for A, B, and C phases
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define V_A_offset (0.498126924)
#define V_B_offset (0.4988828897)
#define V_C_offset (0.4985800385)
//! \brief One-time hardware dependent, though the calibration can be done at run-time as well
//! \brief After initial board calibration these values should be updated for your specific hardware so they are available after compile in the binary to be loaded to the controller
#define V_A_offset (0.498126924)
#define V_B_offset (0.4988828897)
#define V_C_offset (0.4985800385)
//! \brief CLOCKS & TIMERS
// **************************************************************************
//! \brief Defines the system clock frequency, MHz
#define USER_SYSTEM_FREQ_MHz (60.0)
// **************************************************************************
//! \brief Defines the system clock frequency, MHz
#define USER_SYSTEM_FREQ_MHz (60.0)
//! \brief Defines the Pulse Width Modulation (PWM) frequency, kHz
//! \brief PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
//! \brief For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
//! \brief and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
//! \brief Otherwise you risk missing interrupts and disrupting the timing of the control state machine
//#define USER_PWM_FREQ_kHz (45.0) //30.0 Example, 8.0 – 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors
#define USER_PWM_FREQ_kHz (10.0)
//! \brief Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
//! \brief Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
//! \brief The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
//! \brief Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 – Vd^2).
//! \brief Set USER_MAX_VS_MAG = 0.5 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
//! \brief Set USER_MAX_VS_MAG = 1/SQRT(3) = 0.5774 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief Set USER_MAX_VS_MAG = 2/3 = 0.6666 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief For space vector over-modulation, see lab 10 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal.
#define USER_MAX_VS_MAG_PU (0.5) // Set to 0.5 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.
//! \brief PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
//! \brief For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
//! \brief and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
//! \brief Otherwise you risk missing interrupts and disrupting the timing of the control state machine
//#define USER_PWM_FREQ_kHz (45.0) //30.0 Example, 8.0 – 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors
#define USER_PWM_FREQ_kHz (10.0)
//! \brief Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
//! \brief Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
//! \brief The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
//! \brief Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 – Vd^2).
//! \brief Set USER_MAX_VS_MAG = 0.5 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
//! \brief Set USER_MAX_VS_MAG = 1/SQRT(3) = 0.5774 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief Set USER_MAX_VS_MAG = 2/3 = 0.6666 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
//! \brief For space vector over-modulation, see lab 10 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal.
#define USER_MAX_VS_MAG_PU (0.5) // Set to 0.5 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.
//! \brief Defines the address of estimator handle
//!
#define USER_EST_HANDLE_ADDRESS (0x600)
//!
#define USER_EST_HANDLE_ADDRESS (0x600)
//! \brief Defines the direct voltage (Vd) scale factor
//!
#define USER_VD_SF (0.95)
//!
#define USER_VD_SF (0.95)
//! \brief Defines the Pulse Width Modulation (PWM) period, usec
//! \brief Compile time calculation
#define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)
//! \brief Compile time calculation
#define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)
//! \brief Defines the Interrupt Service Routine (ISR) frequency, Hz
//!
#define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//!
#define USER_ISR_FREQ_Hz ((float_t)USER_PWM_FREQ_kHz * 1000.0 / (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//! \brief Defines the Interrupt Service Routine (ISR) period, usec
//!
#define USER_ISR_PERIOD_usec (USER_PWM_PERIOD_usec * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//!
#define USER_ISR_PERIOD_usec (USER_PWM_PERIOD_usec * (float_t)USER_NUM_PWM_TICKS_PER_ISR_TICK)
//! \brief DECIMATION
// **************************************************************************
//! \brief Defines the number of pwm clock ticks per isr clock tick
//! Note: Valid values are 1, 2 or 3 only
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (3)
// **************************************************************************
//! \brief Defines the number of pwm clock ticks per isr clock tick
//! Note: Valid values are 1, 2 or 3 only
#define USER_NUM_PWM_TICKS_PER_ISR_TICK (3)
//! \brief Defines the number of isr ticks (hardware) per controller clock tick (software)
//! \brief Controller clock tick (CTRL) is the main clock used for all timing in the software
//! \brief Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
//! \brief ADC SOC triggers an ADC Conversion Done
//! \brief ADC Conversion Done triggers ISR
//! \brief This relates the hardware ISR rate to the software controller rate
//! \brief Typcially want to consider some form of decimation (ePWM hardware, CURRENT or EST) over 16KHz ISR to insure interrupt completes and leaves time for background tasks
#define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1) // 2 Example, controller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control
//! \brief Controller clock tick (CTRL) is the main clock used for all timing in the software
//! \brief Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
//! \brief ADC SOC triggers an ADC Conversion Done
//! \brief ADC Conversion Done triggers ISR
//! \brief This relates the hardware ISR rate to the software controller rate
//! \brief Typcially want to consider some form of decimation (ePWM hardware, CURRENT or EST) over 16KHz ISR to insure interrupt completes and leaves time for background tasks
#define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1) // 2 Example, controller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control
//! \brief Defines the number of controller clock ticks per current controller clock tick
//! \brief Relationship of controller clock rate to current controller (FOC) rate
#define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1) // 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.
//! \brief Relationship of controller clock rate to current controller (FOC) rate
#define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1) // 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.
//! \brief Defines the number of controller clock ticks per estimator clock tick
//! \brief Relationship of controller clock rate to estimator (FAST) rate
//! \brief Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applications may require up to 15 KHz
#define USER_NUM_CTRL_TICKS_PER_EST_TICK (1) // 1 Typical, FAST estimator runs at same rate as CTRL;
//! \brief Relationship of controller clock rate to estimator (FAST) rate
//! \brief Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applications may require up to 15 KHz
#define USER_NUM_CTRL_TICKS_PER_EST_TICK (1) // 1 Typical, FAST estimator runs at same rate as CTRL;
//! \brief Defines the number of controller clock ticks per speed controller clock tick
//! \brief Relationship of controller clock rate to speed loop rate
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15) // 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop
//! \brief Relationship of controller clock rate to speed loop rate
#define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15) // 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop
//! \brief Defines the number of controller clock ticks per trajectory clock tick
//! \brief Relationship of controller clock rate to trajectory loop rate
//! \brief Typically the same as the speed rate
#define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15) // 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory
//! \brief Relationship of controller clock rate to trajectory loop rate
//! \brief Typically the same as the speed rate
#define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15) // 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory
//! \brief Defines the controller frequency, Hz
//! \brief Compile time calculation
#define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Compile time calculation
#define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Defines the estimator frequency, Hz
//! \brief Compile time calculation
#define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)
//! \brief Compile time calculation
#define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)
//! \brief Defines the trajectory frequency, Hz
//! \brief Compile time calculation
#define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)
//! \brief Compile time calculation
#define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)
//! \brief Defines the controller execution period, usec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)
//! \brief Defines the controller execution period, sec
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)
//! \brief Compile time calculation
#define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)
//! \brief LIMITS
// **************************************************************************
//! \brief Defines the maximum negative current to be applied in Id reference
//! \brief Used in field weakening only, this is a safety setting (e.g. to protect against demagnetization)
//! \brief User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-0.5 * USER_MOTOR_MAX_CURRENT) // -0.5 * USER_MOTOR_MAX_CURRENT Example, adjust to meet safety needs of your motor
// **************************************************************************
//! \brief Defines the maximum negative current to be applied in Id reference
//! \brief Used in field weakening only, this is a safety setting (e.g. to protect against demagnetization)
//! \brief User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
#define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-0.5 * USER_MOTOR_MAX_CURRENT) // -0.5 * USER_MOTOR_MAX_CURRENT Example, adjust to meet safety needs of your motor
//! \brief Defines the low speed limit for the flux integrator, pu//! \brief This is the speed range (CW/CCW) at which the ForceAngle object is active, but only if Enabled
//! \brief Outside of this speed – or if Disabled – the ForcAngle will NEVER be active and the angle is provided by FAST only
#define USER_ZEROSPEEDLIMIT (0.5 / USER_IQ_FULL_SCALE_FREQ_Hz) // 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz
//#define USER_ZEROSPEEDLIMIT (0.2 / USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Outside of this speed – or if Disabled – the ForcAngle will NEVER be active and the angle is provided by FAST only
#define USER_ZEROSPEEDLIMIT (0.5 / USER_IQ_FULL_SCALE_FREQ_Hz) // 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz
//#define USER_ZEROSPEEDLIMIT (0.2 / USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Defines the force angle frequency, Hz
//! \brief Frequency of stator vector rotation used by the ForceAngle object
//! \brief Can be positive or negative
#define USER_FORCE_ANGLE_FREQ_Hz (2.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz) // 1.0 Typical force angle start-up speed
//#define USER_FORCE_ANGLE_FREQ_Hz (5.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Frequency of stator vector rotation used by the ForceAngle object
//! \brief Can be positive or negative
#define USER_FORCE_ANGLE_FREQ_Hz (2.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz) // 1.0 Typical force angle start-up speed
//#define USER_FORCE_ANGLE_FREQ_Hz (5.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz)
//! \brief Defines the maximum current slope for Id trajectory during PowerWarp
//! \brief For Induction motors only, controls how fast Id input can change under PowerWarp control
#define USER_MAX_CURRENT_SLOPE_POWERWARP (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down
//! \brief For Induction motors only, controls how fast Id input can change under PowerWarp control
#define USER_MAX_CURRENT_SLOPE_POWERWARP (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down
//! \brief Defines the starting maximum acceleration AND deceleration for the speed profiles, Hz/s
//! \brief Updated in run-time through user functions
//! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
#define USER_MAX_ACCEL_Hzps (20.0) // 20.0 Default
//! \brief Updated in run-time through user functions
//! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
#define USER_MAX_ACCEL_Hzps (20.0) // 20.0 Default
//! \brief Defines maximum acceleration for the estimation speed profiles, Hz/s
//! \brief Only used during Motor ID (commission)
#define USER_MAX_ACCEL_EST_Hzps (5.0) // 5.0 Default, don't change
//! \brief Only used during Motor ID (commission)
#define USER_MAX_ACCEL_EST_Hzps (5.0) // 5.0 Default, don't change
//! \brief Defines the maximum current slope for Id trajectory during estimation
#define USER_MAX_CURRENT_SLOPE (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change
#define USER_MAX_CURRENT_SLOPE (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz) // USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change
//! \brief Defines the fraction of IdRated to use during rated flux estimation
//!
#define USER_IDRATED_FRACTION_FOR_RATED_FLUX (1.0) // 1.0 Default, don't change
//!
#define USER_IDRATED_FRACTION_FOR_RATED_FLUX (1.0) // 1.0 Default, don't change
//! \brief Defines the fraction of IdRated to use during inductance estimation
//!
#define USER_IDRATED_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//!
#define USER_IDRATED_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//! \brief Defines the IdRated delta to use during estimation
//!
#define USER_IDRATED_DELTA (0.00002)
//!
#define USER_IDRATED_DELTA (0.00002)
//! \brief Defines the fraction of SpeedMax to use during inductance estimation
//!
#define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//!
#define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0) // 1.0 Default, don't change
//! \brief Defines flux fraction to use during inductance identification
//!
#define USER_FLUX_FRACTION (1.0) // 1.0 Default, don't change
//!
#define USER_FLUX_FRACTION (1.0) // 1.0 Default, don't change
//! \brief Defines the PowerWarp gain for computing Id reference
//! \brief Induction motors only
#define USER_POWERWARP_GAIN (1.0) // 1.0 Default, don't change
//! \brief Induction motors only
#define USER_POWERWARP_GAIN (1.0) // 1.0 Default, don't change
//! \brief Defines the R/L estimation frequency, Hz
//! \brief User higher values for low inductance motors and lower values for higher inductance
//! \brief motors. The values can range from 100 to 300 Hz.
//#define USER_R_OVER_L_EST_FREQ_Hz (300) // 300 Default
#define USER_R_OVER_L_EST_FREQ_Hz (100)
//! \brief User higher values for low inductance motors and lower values for higher inductance
//! \brief motors. The values can range from 100 to 300 Hz.
//#define USER_R_OVER_L_EST_FREQ_Hz (300) // 300 Default
#define USER_R_OVER_L_EST_FREQ_Hz (100)
//! \brief POLES
// **************************************************************************
//! \brief Defines the analog voltage filter pole location, Hz
//! \brief Must match the hardware filter for Vph
#define USER_VOLTAGE_FILTER_POLE_Hz (300.682) // 364.682, value for boostxldrv8301_revB hardware
// **************************************************************************
//! \brief Defines the analog voltage filter pole location, Hz
//! \brief Must match the hardware filter for Vph
#define USER_VOLTAGE_FILTER_POLE_Hz (300.682) // 364.682, value for boostxldrv8301_revB hardware
//! \brief Defines the analog voltage filter pole location, rad/s
//! \brief Compile time calculation from Hz to rad/s
#define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)
//! \brief Compile time calculation from Hz to rad/s
#define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)
//! \brief Defines the software pole location for the voltage and current offset estimation, rad/s
//! \brief Should not be changed from default of (20.0)
#define USER_OFFSET_POLE_rps (20.0) // 20.0 Default, do not change
//! \brief Should not be changed from default of (20.0)
#define USER_OFFSET_POLE_rps (20.0) // 20.0 Default, do not change
//! \brief Defines the software pole location for the flux estimation, rad/s
//! \brief Should not be changed from default of (100.0)
#define USER_FLUX_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Should not be changed from default of (100.0)
#define USER_FLUX_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the software pole location for the direction filter, rad/s
#define USER_DIRECTION_POLE_rps (6.0) // 6.0 Default, do not change
#define USER_DIRECTION_POLE_rps (6.0) // 6.0 Default, do not change
//! \brief Defines the software pole location for the speed control filter, rad/s
#define USER_SPEED_POLE_rps (100.0) // 100.0 Default, do not change
#define USER_SPEED_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the software pole location for the DC bus filter, rad/s
#define USER_DCBUS_POLE_rps (100.0) // 100.0 Default, do not change
#define USER_DCBUS_POLE_rps (100.0) // 100.0 Default, do not change
//! \brief Defines the convergence factor for the estimator
//! \brief Do not change from default for FAST
#define USER_EST_KAPPAQ (1.5) // 1.5 Default, do not change
//! \brief Do not change from default for FAST
#define USER_EST_KAPPAQ (1.5) // 1.5 Default, do not change
// **************************************************************************
// end the defines
// end the defines
//! \brief USER MOTOR & ID SETTINGS
// **************************************************************************
// **************************************************************************
//! \brief Define each motor with a unique name and ID number
// BLDC & SMPM motors
#define Estun_EMJ_04APB22 101
#define Anaheim_BLY172S 102
#define My_Motor 104
#define hobby_3p5T 105
#define hobby_4p5T 106
#define small_hobby 107
#define teknic_2310P 108
#define hobbywing_ezrun_8p5T 109
#define eflite_helicopter_420 110
#define Bodine_34B3FEBL 114
#define Pittman_elcom_5233B599 115
#define medical_instrument 117
// BLDC & SMPM motors
#define Estun_EMJ_04APB22 101
#define Anaheim_BLY172S 102
#define My_Motor 104
#define hobby_3p5T 105
#define hobby_4p5T 106
#define small_hobby 107
#define teknic_2310P 108
#define hobbywing_ezrun_8p5T 109
#define eflite_helicopter_420 110
#define Bodine_34B3FEBL 114
#define Pittman_elcom_5233B599 115
#define medical_instrument 117
// IPM motors
// If user provides separate Ls-d, Ls-q
// else treat as SPM with user or identified average Ls
#define Belt_Drive_Washer_IPM 201
// If user provides separate Ls-d, Ls-q
// else treat as SPM with user or identified average Ls
#define Belt_Drive_Washer_IPM 201
// ACIM motors
#define Marathon_5K33GN2A 301
#define Kinetek_YDQ1p3_4 302
#define LPKF_CAD_CAM 303
#define Marathon_5K33GN2A 301
#define Kinetek_YDQ1p3_4 302
#define LPKF_CAD_CAM 303
//! \brief Uncomment the motor which should be included at compile
//! \brief These motor ID settings and motor parameters are then available to be used by the control system
//! \brief Once your ideal settings and parameters are identified update the motor section here so it is available in the binary code
//#define USER_MOTOR Estun_EMJ_04APB22
#define USER_MOTOR Anaheim_BLY172S
//#define USER_MOTOR hobby_3p5T
//#define USER_MOTOR hobby_4p5T
//#define USER_MOTOR My_Motor
//#define USER_MOTOR small_hobby
//#define USER_MOTOR Belt_Drive_Washer_IPM
//#define USER_MOTOR Marathon_5K33GN2A
//#define USER_MOTOR teknic_2310P
//#define USER_MOTOR hobbywing_ezrun_8p5T
//#define USER_MOTOR eflite_helicopter_420
//#define USER_MOTOR Bodine_34B3FEBL
//#define USER_MOTOR Pittman_elcom_5233B599
//#define USER_MOTOR medical_instrument
//#define USER_MOTOR Kinetek_YDQ1p3_4
//#define USER_MOTOR LPKF_CAD_CAM
//! \brief These motor ID settings and motor parameters are then available to be used by the control system
//! \brief Once your ideal settings and parameters are identified update the motor section here so it is available in the binary code
//#define USER_MOTOR Estun_EMJ_04APB22
#define USER_MOTOR Anaheim_BLY172S
//#define USER_MOTOR hobby_3p5T
//#define USER_MOTOR hobby_4p5T
//#define USER_MOTOR My_Motor
//#define USER_MOTOR small_hobby
//#define USER_MOTOR Belt_Drive_Washer_IPM
//#define USER_MOTOR Marathon_5K33GN2A
//#define USER_MOTOR teknic_2310P
//#define USER_MOTOR hobbywing_ezrun_8p5T
//#define USER_MOTOR eflite_helicopter_420
//#define USER_MOTOR Bodine_34B3FEBL
//#define USER_MOTOR Pittman_elcom_5233B599
//#define USER_MOTOR medical_instrument
//#define USER_MOTOR Kinetek_YDQ1p3_4
//#define USER_MOTOR LPKF_CAD_CAM
#elif (USER_MOTOR == Anaheim_BLY172S)
#define USER_MOTOR_TYPE MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS (2)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.037)
#define USER_MOTOR_Ls_d (0.00032)
#define USER_MOTOR_Ls_q (0.00032)
#define USER_MOTOR_RATED_FLUX (0.072)
#define USER_MOTOR_TYPE MOTOR_Type_Pm
#define USER_MOTOR_NUM_POLE_PAIRS (2)
#define USER_MOTOR_Rr (NULL)
#define USER_MOTOR_Rs (0.037)
#define USER_MOTOR_Ls_d (0.00032)
#define USER_MOTOR_Ls_q (0.00032)
#define USER_MOTOR_RATED_FLUX (0.072)
#define USER_MOTOR_MAGNETIZING_CURRENT (NULL)
#define USER_MOTOR_RES_EST_CURRENT (4.0)
#define USER_MOTOR_IND_EST_CURRENT (-4.0)
#define USER_MOTOR_MAX_CURRENT (30.0)
#define USER_MOTOR_FLUX_EST_FREQ_Hz (10.0)
#define USER_MOTOR_RES_EST_CURRENT (4.0)
#define USER_MOTOR_IND_EST_CURRENT (-4.0)
#define USER_MOTOR_MAX_CURRENT (30.0)
#define USER_MOTOR_FLUX_EST_FREQ_Hz (10.0)
#define USER_MOTOR_FREQ_LOW (10.0) // Hz – suggested to set to 10% of rated motor frequency
#define USER_MOTOR_FREQ_HIGH (100.0) // Hz – suggested to set to 100% of rated motor frequency
#define USER_MOTOR_FREQ_MAX (120.0) // Hz – suggested to set to 120% of rated motor frequency
//#define USER_MOTOR_VOLT_MIN (3.0) // Volt – suggested to set to 15% of rated motor voltage
//#define USER_MOTOR_VOLT_MAX (18.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_FREQ_HIGH (100.0) // Hz – suggested to set to 100% of rated motor frequency
#define USER_MOTOR_FREQ_MAX (120.0) // Hz – suggested to set to 120% of rated motor frequency
//#define USER_MOTOR_VOLT_MIN (3.0) // Volt – suggested to set to 15% of rated motor voltage
//#define USER_MOTOR_VOLT_MAX (18.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_VOLT_MIN (10.8) // Volt – suggested to set to 15% of rated motor voltage
#define USER_MOTOR_VOLT_MAX (72.0) // Volt – suggested to set to 100% of rated motor voltage
#define USER_MOTOR_VOLT_MAX (72.0) // Volt – suggested to set to 100% of rated motor voltage
bob iuuiy:
顶一下,求解惑