This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28069M: User motor parameters in motor identification

Part Number: TMS320F28069M


Tool/software: Code Composer Studio

Hi,

I am working on a custom PMSM motor, with limited manufacture specifications, and is expected to run at around 6000 rpm. I am currently trying to tune the instaspin identification process which has brought up a compilation of issues that I wish to clarify.

1. How important is the identification process with regard to smooth motor performance post identification? In its present state, the stator and rotor synchronise at around 1250 rpm and runs smoothly with little rattle or vibration. It then begins to rattle and vibrate at higher speeds. Could this be caused from incorrect motor identification, or would it more likely be the controller gains?

2. The user guide gives some information on how to calculate the ADC voltage and current bias, however I am unable to understand what they are used for. Would I be able to get clarification?

3. Why do incorrect values of USER_MOTOR_RES_EST_CURRENT and USER_MOTOR_IND_EST_CURRENT cause the motor to malfunction? I was encountering a problem in the induction estimation phase during motor identification where the motor would start to rattle as soon as the IND current was injected. Trial and error revealed that lower values reduced this behaviour. Why would this occur?

4. The parameter USER_MOTOR_FLUX_EST_FREQ_Hz to my understanding sets the maximum speed at which the motor runs during identification. However, during the ramp up phase the motor only reaches half of this value and remains at this value until identification has finished. For example I have set the parameter at 40 Hz which corresponds to 2400 rpm in a 2 pole pair motor. The motor only reaches 1200 rpm during identification. The variable itself (gMotorVars.Speed_krpm), does in fact reach 2400 rpm before dropping back down to 1200 rpm after the Ramp_State has finished. Any ideas on this behaviour?

5. When changing USER_MOTOR_FLUX_EST_FREQ_Hz, the final estimated inductance also changes based on the speed it is running at during the induction estimation phase. I plotted the behaviour below, it flattens out after around 66 Hz because the motor did not spin faster than 2000 rpm despite increasing the EST_FREQ. In addition for inductance values over 0.0015, the motor would make a high pitched buzz sound when running the motor post identification. Would there be a way to justify this behaviour, the figure seems to suggest that inductance changes with respect to motor speed?

I am trying to relate the user parameters to motor performance as to be able to tune them better. Any ideas will be much appreciated!

Here is the relevant part of my user.h

#ifdef __cplusplus
extern "C" {
#endif

// **************************************************************************
// the defines

//! \brief CURRENTS AND VOLTAGES
// **************************************************************************
//! \brief Defines the full scale frequency for IQ variable, Hz
//! \brief All frequencies are converted into (pu) based on the ratio to this value
//! \brief this value MUST be larger than the maximum speed that you are expecting from the motor
#define USER_IQ_FULL_SCALE_FREQ_Hz        (300.0)   // 800 Example with buffer for 8-pole 6 KRPM motor to be run to 10 KRPM with field weakening; Hz =(RPM * Poles) / 120 CHANGED

//! \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      (15.5)   // 24.0 Example for boostxldrv8301_revB typical usage and the Anaheim motor

//! \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 CHANGED

//! \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         (1.0) // 20.0 Example for boostxldrv8301_revB typical usage CHANGED

//! \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        (1.65)  // 33.0 boostxldrv8301_revB current scaling CHANGED

//! \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 Defines the number of voltage (phase) sensors
//! \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.8332871199)//(0.6493877172)//(0.8331743479) CHANGED
#define   I_B_offset    (0.8345739841)//(0.6464807391)//(0.8355930448) CHANGED
#define   I_C_offset    (0.815166533)//(0.6342716813)//(0.8392037153) CHANGED

//! \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.4948008657)//(0.3080589771)//(0.5271264911) CHANGED
#define   V_B_offset    (0.4973449111)//(0.3073014617)//(0.5257175565) CHANGED
#define   V_C_offset    (0.4958329797)//(0.3086396456)//(0.5249399543) CHANGED


//! \brief CLOCKS & TIMERS
// **************************************************************************
//! \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                (60.0) // CHANGED 30.0 Example, 8.0 - 30.0 KHz typical; 45-80 KHz may be required for very low inductance, high speed motors

//! \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 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        (2) //CHANGED

//! \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 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 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 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 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 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 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 CHANGED

//! \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

//! \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


//! \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   /*(364.682)*/ (385.38)   // 364.682, value for boostxldrv8301_revB hardware CHANGED


//! \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 Tamagawa_A0100              103
#define Teknic_M2310PLN04K          104
#define Drone_A2212_1000KV          105
#define Drone_A2313_960KV           106
#define Custom_Motor                107

// 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
#define Anaheim_Salient             202

// ACIM motors
#define Marathon_5K33GN2A           301

//! \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 Tamagawa_A0100
//#define USER_MOTOR Drone_A2313_960KV
//#define USER_MOTOR Teknic_M2310PLN04K
//#define USER_MOTOR Belt_Drive_Washer_IPM
//#define USER_MOTOR Marathon_5K33GN2A
//#define USER_MOTOR Anaheim_Salient
#define USER_MOTOR Custom_Motor

#if (USER_MOTOR == Custom_Motor)                  // Name must match the motor #define
#define USER_MOTOR_TYPE                 MOTOR_Type_Pm  // Motor_Type_Pm (All Synchronous: BLDC, PMSM, SMPM, IPM) or Motor_Type_Induction (Asynchronous ACI)
#define USER_MOTOR_NUM_POLE_PAIRS       (2)            // PAIRS, not total poles. Used to calculate user RPM from rotor Hz only
#define USER_MOTOR_Rr                   (NULL)         // Induction motors only, else NULL
#define USER_MOTOR_Rs                   (2.9126) /*(5.662)*/     // Identified phase to neutral resistance in a Y equivalent circuit (Ohms, float)
#define USER_MOTOR_Ls_d                 (0.00016951155)//(0.000768524536)//(0.00129)  // For PM, Identified average stator inductance  (Henry, float)
#define USER_MOTOR_Ls_q                 (0.00016951155)//(0.000768524536)//(0.00129)  // For PM, Identified average stator inductance  (Henry, float)
#define USER_MOTOR_RATED_FLUX           (0.0131929209)//(0.0127)         // Identified TOTAL flux linkage between the rotor and the stator (V/Hz)
#define USER_MOTOR_MAGNETIZING_CURRENT  (NULL)         // Induction motors only, else NULL
#define USER_MOTOR_RES_EST_CURRENT      (0.1)          // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
#define USER_MOTOR_IND_EST_CURRENT      (-0.05)         // During Motor ID, maximum current (negative Amperes, float) used for Ls estimation, use just enough to enable rotation
#define USER_MOTOR_MAX_CURRENT          (1.0)         // CRITICAL: Used during ID and run-time, sets a limit on the maximum current command output of the provided Speed PI Controller to the Iq controller
#define USER_MOTOR_FLUX_EST_FREQ_Hz     (40)         // During Motor ID, maximum commanded speed (Hz, float), ~10% rated

 

Thank you

David

  • 1. Yes, that's very important to keep the motor running smoothly during the identification process. If not, the Ls and Flux can't be identified correctly.

    2. It's to calibrate the offset of the ADC sampling circuit, that will be done automatically by default.

    3. As a reply to question 1, Since the motor is running without a rotor angle during the identification process, so you need to set the right values to run the motor according to its specification as mentioned in InstaSPIN user's guide.

    4. 5. As replied above, these three parameters must be set to right values based on the motor specification, if not, you can't achieve the precise motor parameter by the identification running.

  • Hi Yanming

    1. Okay so a decent amount of time should be spent to get the identification process right?

    2. Why does the ADC need these offsets? It mentions something about setting the zeros and scaling, does it change the ADC voltage range or something similar?

    3. I see, is there a point in identification process where the rotor angle estimate in introduced? The motor seems to pass a threshold of 1200 rpm and "clicks into place", could this be where it is introduced? Also is it possible to understand why the lower values produced less error?

    4.5. Why does the system estimate different values of inductance when the parameter changes?

    Thank you for your help so far!

    David

  • For Q1~Q3, you may have a look at the InstaSPIN-FOC and InstaSPIN-MOTION User's Guide that has a very detailed description of your questions. Please let me know if you still have any questions.

    For Q4~Q5, as replied to you above, the identified parameters should be very similar if you set right identification parameters in user.h to spin the motor smoothly.