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.

No current during auto ID for RoverL and Rs identification

Other Parts Discussed in Thread: MOTORWARE, DRV8301, CONTROLSUITE

I have a custom designed inverter that is driving a 10kW, 12 pole PM motor. I'm having troubles with getting InstaSPIN Lab 2a to identify my motor - specifically, I do not see any current during RoverL and Rs identification.

The inverter has 3 motor phase sensors, 3 hall effect current sensors (ACS756) and a DC bus voltage sense:

My user.h is included here: 2746.user.h

My DC bus is at 90V, and I have a bi-direction current sensor that hits saturation at around +/-50A.

I have confirmed that my voltage and currents are connected correctly at the hardware level - I am able to inject test currents and voltages into my sensors and read PU values that I'd expect during debug in gAdcData. 

I have a scope on two of the phase currents, and I expect to see a 100Hz, 5A signal during RoverL identification,  and a DC, 10A signal during Rs identification, but all I see is a flat line. I am using MotorWare _11, but I have both _11 and _09 installed.

I know the inverter's switching section works correctly, because I have previous non InstaSPIN hardware that can turn a motor.

The identified parameters (such as Rs_ohm) vary greatly. I've been able to get the motor to spin at times, just due to what I think is a random convergence of noise (very small V/I that just happened to land in a "reasonable" ratio). I can confirm that the InstaSPIN F2806 is properly toggling the gate drives for it's PWMs, and I know that the voltage and current sensors work, so I suspect it's something in the software.

I feel like I'm missing something very obvious!

  • Here's my User.H again:

    ============================

    #ifndef _USER_H_
    #define _USER_H_

    //Includes
    #include "sw/modules/types/src/types.h"
    #include "sw/modules/motor/src/motor.h"
    #include "sw/modules/est/src/32b/est.h"
    #include "sw/modules/est/src/est_states.h"
    #include "sw/modules/est/src/est_Flux_states.h"
    #include "sw/modules/est/src/est_Ls_states.h"
    #include "sw/modules/est/src/est_Rs_states.h"
    #include "sw/modules/ctrl/src/32b/ctrl_obj.h"


    //Platforms
    #include "sw/modules/fast/src/32b/userParams.h"

    #ifdef __cplusplus
    extern "C" {
    #endif

    // **************************************************************************
    // Definitions
    // **************************************************************************


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

    //Defines full scale value for the IQ30 variable of Voltage inside the system
    //All voltages are converted into (pu) based on the ratio to this value
    //WARNING: this value MUST be larger than the maximum value of any voltage calculated inside the control system otherwise the value can saturate and roll-over, causing an inaccurate value
    //WARNING: this value is OFTEN greater than the maximum measured ADC value, especially with high Bemf motors operating at higher than rated speeds
    //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
    //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
    //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 (107.68)

    //Defines the maximum voltage at the input to the AD converter
    //The value that will be represtented by the maximum ADC input (3.3V) and conversion (0FFFh)
    //Hardware dependent, this should be based on the voltage sensing and scaling to the ADC input
    #define USER_ADC_FULL_SCALE_VOLTAGE_V (98.02)


    //Defines the current scale factor for the system
    //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)))

    //Defines the full scale current for the IQ variables, A
    //All currents are converted into (pu) based on the ratio to this value
    //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 (62) //TriZilla at 350

    //! \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 (124) //TriZilla at 760

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

    //Defines the number of current sensors used
    //Defined by the hardware capability present
    //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

    //Defines the number of voltage (phase) sensors
    //Must be (3)
    #define USER_NUM_VOLTAGE_SENSORS (3) // 3 Required

    //ADC current offsets for A, B, and C phases
    //One-time hardware dependent, though the calibration can be done at run-time as well
    //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.4966198802) //(0.9769329429)
    #define I_B_offset (0.4983224869) //(0.9756236076)
    #define I_C_offset (0.4983224869) //(0.9838535786)


    //ADC voltage offsets for A, B, and C phases
    //One-time hardware dependent, though the calibration can be done at run-time as well
    //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.4391527772) //(0.1179168224)
    #define V_B_offset (0.4720226526) //(0.1170922518)
    #define V_C_offset (0.4754385352) //(0.1298020482)

    // **************************************************************************
    //CLOCKS & TIMERS
    // **************************************************************************

    //Defines the system clock frequency, MHz
    #define USER_SYSTEM_FREQ_MHz (90.0)

    //Defines the Pulse Width Modulation (PWM) frequency, kHz
    //PWM frequency can be set directly here up to 30 KHz safely (60 KHz MAX in some cases)
    //For higher PWM frequencies (60 KHz+ typical for low inductance, high current ripple motors) it is recommended to use the ePWM hardware
    //and adjustable ADC SOC to decimate the ADC conversion done interrupt to the control system, or to use the software Que example.
    //Otherwise you risk missing interrupts and disrupting the timing of the control state machine
    //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 (15)

    //Defines the maximum Voltage vector (Vs) magnitude allowed. This value sets the maximum magnitude for the output of the
    //Id and Iq PI current controllers. The Id and Iq current controller outputs are Vd and Vq.
    //The relationship between Vs, Vd, and Vq is: Vs = sqrt(Vd^2 + Vq^2). In this FOC controller, the
    //Vd value is set equal to USER_MAX_VS_MAG*USER_VD_MAG_FACTOR. Vq = sqrt(USER_MAX_VS_MAG^2 - Vd^2).
    //Set USER_MAX_VS_MAG = 1.0 for a pure sinewave with a peak at SQRT(3)/2 = 86.6% duty cycle. No current reconstruction is needed for this scenario.
    //Set USER_MAX_VS_MAG = 2/SQRT(3) = 1.1547 for a pure sinewave with a peak at 100% duty cycle. Current reconstruction will be needed for this scenario (Lab10a-x).
    //Set USER_MAX_VS_MAG = 4/3 = 1.3333 to create a trapezoidal voltage waveform. Current reconstruction will be needed for this scenario (Lab10a-x).
    //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 (1.0) // Set to 1.0 if a current reconstruction technique is not used. Look at the module svgen_current in lab10a-x for more info.


    //Defines the Pulse Width Modulation (PWM) period, usec
    //Compile time calculation
    #define USER_PWM_PERIOD_usec (1000.0/USER_PWM_FREQ_kHz)

    //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)

    //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)


    // **************************************************************************
    //DECIMATION
    // **************************************************************************

    //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 (1)

    //Defines the number of isr ticks (hardware) per controller clock tick (software)
    //Controller clock tick (CTRL) is the main clock used for all timing in the software
    //Typically the PWM Frequency triggers (can be decimated by the ePWM hardware for less overhead) an ADC SOC
    //ADC SOC triggers an ADC Conversion Done
    //ADC Conversion Done triggers ISR
    //This relates the hardware ISR rate to the software controller rate
    //Typically 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
    //Example, controller clock rate (CTRL) runs at PWM / 2; ex 30 KHz PWM, 15 KHz control
    #define USER_NUM_ISR_TICKS_PER_CTRL_TICK (1)

    //Defines the number of controller clock ticks per current controller clock tick
    //Relationship of controller clock rate to current controller (FOC) rate
    //Note: 1 Typical, Forward FOC current controller (Iq/Id/IPARK/SVPWM) runs at same rate as CTRL.
    #define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK (1)

    //Defines the number of controller clock ticks per estimator clock tick
    //Relationship of controller clock rate to estimator (FAST) rate
    //Depends on needed dynamic performance, FAST provides very good results as low as 1 KHz while more dynamic or high speed applicatons may require up to 15 KHz
    //Note: 1 Typical, FAST estimator runs at same rate as CTRL;
    #define USER_NUM_CTRL_TICKS_PER_EST_TICK (1)

    //Defines the number of controller clock ticks per speed controller clock tick
    //Relationship of controller clock rate to speed loop rate
    //Note: 15 Typical to match PWM, ex: 15KHz PWM, controller, and current loop, 1KHz speed loop
    #define USER_NUM_CTRL_TICKS_PER_SPEED_TICK (15)

    //Defines the number of controller clock ticks per trajectory clock tick
    //Relationship of controller clock rate to trajectory loop rate
    //Typically the same as the speed rate
    //Note: 15 Typical to match PWM, ex: 10KHz controller & current loop, 1KHz speed loop, 1 KHz Trajectory
    #define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK (15)

    //Defines the controller frequency, Hz
    //Compile time calculation
    #define USER_CTRL_FREQ_Hz (uint_least32_t)(USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)

    //Defines the estimator frequency, Hz
    //Compile time calculation
    #define USER_EST_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)

    //Defines the trajectory frequency, Hz
    //Compile time calculation
    #define USER_TRAJ_FREQ_Hz (uint_least32_t)(USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)

    //Defines the controller execution period, usec
    //Compile time calculation
    #define USER_CTRL_PERIOD_usec (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)

    //Defines the controller execution period, sec
    //Compile time calculation
    #define USER_CTRL_PERIOD_sec ((float_t)USER_CTRL_PERIOD_usec/(float_t)1000000.0)


    // **************************************************************************
    //LIMITS
    // **************************************************************************

    //Defines the maximum negative current to be applied in Id reference
    //Used in field weakening only, this is a safety setting (e.g. to protect against demagnetization)
    //User must also be aware that overall current magnitude [sqrt(Id^2 + Iq^2)] should be kept below any machine design specifications
    //Note: -2.0 Example, adjust to meet safety needs of your motor
    #define USER_MAX_NEGATIVE_ID_REF_CURRENT_A (-2.0)

    //Defines the low speed limit for the flux integrator, pu
    //This is the speed range (CW/CCW) at which the ForceAngle object is active, but only if Enabled
    //Outside of this speed - or if Disabled - the ForcAngle will NEVER be active and the angle is provided by FAST only
    //Note: 0.002 pu, 1-5 Hz typical; Hz = USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz
    #define USER_ZEROSPEEDLIMIT (0.002)

    //Defines the force angle frequency, Hz
    //Frequency of stator vector rotation used by the ForceAngle object
    //Can be positive or negative
    //Note: 1.0 Typical force angle start-up speed
    #define USER_FORCE_ANGLE_FREQ_Hz (1.0)

    //Defines the maximum current slope for Id trajectory during EPL mode
    //For Induction motors only, controls how fast Id input can change under EPL control
    //Note: 0.3*RES_EST_CURRENT / IQ_FULL_SCALE_CURRENT / TRAJ_FREQ Typical to produce 1-sec rampup/down
    #define USER_MAX_CURRENT_SLOPE_EPL (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz)

    //Defines the starting maximum acceleration AND deceleration for the speed profiles, Hz/s
    //Updated in run-time through user functions
    //Inverter, motor, inertia, and load will limit actual acceleration capability
    //Note: 20.0 Default
    #define USER_MAX_ACCEL_Hzps (20)

    //Defines maximum acceleration for the estimation speed profiles, rad/sec^2
    //Only used during Motor ID (commission)
    //Note: 2.0 Default, don't change
    #define USER_MAX_ACCEL_EST_Hzps (2.0)

    //Defines the maximum current slope for Id trajectory during estimation
    //Note: USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz Default, don't change
    //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)

    //Defines the fraction of IdRated to use during rated flux estimation
    //Note: 0.5 Default, don't change
    #define USER_IDRATED_FRACTION_FOR_RATED_FLUX (0.5)

    //Defines the fraction of IdRated to use during inductance estimation
    //Note: 0.5 Default, don't change
    #define USER_IDRATED_FRACTION_FOR_L_IDENT (0.5) // 0.5 Default, don't change

    //Defines the IdRated delta to use during estimation
    //Note: 0.0001 Default, don't change
    #define USER_IDRATED_DELTA (0.0001)

    //Defines the fraction of SpeedMax to use during inductance estimation
    //Note: 1.0 Default, don't change
    #define USER_SPEEDMAX_FRACTION_FOR_L_IDENT (1.0)

    //Defines flux fraction to use during inductance identification
    //Note: 1.0 Default, don't change
    #define USER_FLUX_FRACTION (1.0)

    //Defines the EPL (Efficient Partial Load) gain for computing Id reference
    //Induction motors only
    //Note: 1.0 Default, don't change
    #define USER_EPL_GAIN (1.0)

    //Defines the R/L estimation frequency, Hz
    #define USER_R_OVER_L_EST_FREQ_Hz (100)

    // **************************************************************************
    //POLES
    // **************************************************************************

    //Defines the analog voltage filter pole location, Hz
    //Must match the hardware filter for Vph
    #define USER_VOLTAGE_FILTER_POLE_Hz (202)

    //Defines the analog voltage filter pole location, rad/s
    //Compile time calculation from Hz to rad/s
    #define USER_VOLTAGE_FILTER_POLE_rps (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)

    //Defines the software pole location for the voltage and current offset estimation, rad/s
    //Should not be changed from default of (20.0)
    #define USER_OFFSET_POLE_rps (20.0)

    //Defines the software pole location for the flux estimation, rad/s
    //Should not be changed from default of (100.0)
    #define USER_FLUX_POLE_rps (100.0)

    //Defines the software pole location for the direction filter, rad/s
    //Note: 6.0 Default, do not change
    #define USER_DIRECTION_POLE_rps (6.0)

    //Defines the software pole location for the speed control filter, rad/s
    //Note: 100.0 Default, do not change
    #define USER_SPEED_POLE_rps (100.0)

    //Defines the software pole location for the DC bus filter, rad/s
    //Note: 100.0 Default, do not change
    #define USER_DCBUS_POLE_rps (100.0)

    //Defines the convergence factor for the estimator
    //Do not change from default for FAST
    //Note: 1.5 Default, do not change
    #define USER_EST_KAPPAQ (1.5)

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

    // **************************************************************************
    //USER MOTOR & ID SETTINGS
    // **************************************************************************

    //Defines the default bandwidth for SpinTAC Control
    //This value should be determined by putting SpinTAC Control through a tuning process
    #define USER_SYSTEM_BANDWIDTH_SCALE (1.0)

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

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

    // ACIM motors
    #define Marathon_5K33GN2A 301
    #define EV1 302

    //Uncomment the motor which should be included at compile
    //These motor ID settings and motor parameters are then available to be used by the control system
    //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 My_Motor
    //#define USER_MOTOR Belt_Drive_Washer_IPM
    //#define USER_MOTOR Marathon_5K33GN2A
    //#define USER_MOTOR Experimental
    //#define USER_MOTOR EV1


    #if (USER_MOTOR == Estun_EMJ_04APB22) // 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 (4) // 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.303403) // Identified phase to neutral resistance in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d (0.008464367) // For PM, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_Ls_q (0.008464367) // For PM, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_RATED_FLUX (0.38) // 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 (1.0) // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT (-1.0) // During Motor ID, maximum current (negative Amperes, float) used for Ls estimation, use just enough to enable rotation
    #define USER_MOTOR_MAX_CURRENT (3.82) // 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 (20.0) // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
    //#define USER_MOTOR_ENCODER_LINES (2500.0) // Number of lines on the motor's quadrature encoder
    ////#define USER_MOTOR_MAX_SPEED_KRPM (3.0) // Maximum speed that the motor
    //#define USER_SYSTEM_INERTIA (0.01469898224)// Inertia of the motor & system, should be estimated by SpinTAC Velocity Identify
    //#define USER_SYSTEM_FRICTION (0.07802134752)// Friction of the motor & system, should be estimated by SpinTAC Velocity Identify

    #elif (USER_MOTOR == Anaheim_BLY172S)
    #define USER_MOTOR_TYPE MOTOR_Type_Pm
    #define USER_MOTOR_NUM_POLE_PAIRS (4)
    #define USER_MOTOR_Rr (NULL)
    #define USER_MOTOR_Rs (0.4110007)
    #define USER_MOTOR_Ls_d (0.0007092811)
    #define USER_MOTOR_Ls_q (0.0007092811)
    #define USER_MOTOR_RATED_FLUX (0.03279636)
    #define USER_MOTOR_MAGNETIZING_CURRENT (NULL)
    #define USER_MOTOR_RES_EST_CURRENT (1.0)
    #define USER_MOTOR_IND_EST_CURRENT (-1.0)
    #define USER_MOTOR_MAX_CURRENT (5.0)
    #define USER_MOTOR_FLUX_EST_FREQ_Hz (20.0)
    #define USER_MOTOR_ENCODER_LINES (2000.0)
    #define USER_MOTOR_MAX_SPEED_KRPM (4.0)
    #define USER_SYSTEM_INERTIA (0.02)
    #define USER_SYSTEM_FRICTION (0.01)

    #elif (USER_MOTOR == Belt_Drive_Washer_IPM)
    #define USER_MOTOR_TYPE MOTOR_Type_Pm
    #define USER_MOTOR_NUM_POLE_PAIRS (4)
    #define USER_MOTOR_Rr (NULL)
    #define USER_MOTOR_Rs (2.832002)
    #define USER_MOTOR_Ls_d (0.0115)
    #define USER_MOTOR_Ls_q (0.0135)
    #define USER_MOTOR_RATED_FLUX (0.5022156)
    #define USER_MOTOR_MAGNETIZING_CURRENT (NULL)
    #define USER_MOTOR_RES_EST_CURRENT (1.0)
    #define USER_MOTOR_IND_EST_CURRENT (-1.0)
    #define USER_MOTOR_MAX_CURRENT (4.0)
    #define USER_MOTOR_FLUX_EST_FREQ_Hz (20.0)

    #elif (USER_MOTOR == Marathon_5K33GN2A)
    #define USER_MOTOR_TYPE MOTOR_Type_Induction // 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 (5.508003) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Rs (10.71121) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d (0.05296588) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_Ls_q (0.05296588) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_RATED_FLUX (0.8165*240.0/245) // sqrt(2/3)* Rated V (line-line) / Rated Freq (Hz)
    #define USER_MOTOR_MAGNETIZING_CURRENT (1.378) // Identified magnetizing current for induction motors, else NULL
    #define USER_MOTOR_RES_EST_CURRENT (0.5) // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT (NULL) // not used for induction
    #define USER_MOTOR_MAX_CURRENT (2.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 (5.0) // During Motor ID, maximum commanded speed (Hz, float). Should always use 5 Hz for Induction.

    #elif (USER_MOTOR == My_Motor)
    #define USER_MOTOR_TYPE MOTOR_Type_Pm
    #define USER_MOTOR_NUM_POLE_PAIRS (6)
    #define USER_MOTOR_Rr (NULL)//(3.173709)
    #define USER_MOTOR_Rs (NULL)//(2.341695)
    #define USER_MOTOR_Ls_d (NULL)
    #define USER_MOTOR_Ls_q (NULL)
    #define USER_MOTOR_RATED_FLUX (NULL)//(0.817) ///GUESS
    #define USER_MOTOR_MAGNETIZING_CURRENT (NULL)
    #define USER_MOTOR_RES_EST_CURRENT (10)
    #define USER_MOTOR_IND_EST_CURRENT (-10)
    #define USER_MOTOR_MAX_CURRENT (50)
    #define USER_MOTOR_FLUX_EST_FREQ_Hz (20)

    #elif (USER_MOTOR == Experimental)
    #define USER_MOTOR_TYPE MOTOR_Type_Induction // 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 (5.508003) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Rs (10.71121) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d (0.05296588) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_Ls_q (0.05296588) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_RATED_FLUX (0.8165*220.0/60.0) // sqrt(2/3)* Rated V (line-line) / Rated Freq (Hz)
    #define USER_MOTOR_MAGNETIZING_CURRENT (1.378) // Identified magnetizing current for induction motors, else NULL
    #define USER_MOTOR_RES_EST_CURRENT (0.5) // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT (NULL) // not used for induction
    #define USER_MOTOR_MAX_CURRENT (10) // 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 (5.0) // During Motor ID, maximum commanded speed (Hz, float). Should always use 5 Hz for Induction.

    #elif (USER_MOTOR == EV1) // Name must match the motor #define
    #define USER_MOTOR_TYPE MOTOR_Type_Induction // 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 (4 pole ACIM has 2 pole pairs)
    #define USER_MOTOR_Rr (NULL) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Rs (NULL) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d (NULL) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_Ls_q (NULL) // For Induction, Identified average stator inductance (Henry, float)
    #define USER_MOTOR_RATED_FLUX (0.8165*240.0/245) // sqrt(2/3)* Rated V (line-line) / Rated Freq (Hz) - found 0.8V per Hz on Internet
    #define USER_MOTOR_MAGNETIZING_CURRENT (NULL) // Identified magnetizing current for induction motors, else NULL
    #define USER_MOTOR_RES_EST_CURRENT (0.5) // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT (NULL) // not used for induction
    #define USER_MOTOR_MAX_CURRENT (50) // 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 (5.0) // During Motor ID, maximum commanded speed (Hz, float). Should always use 5 Hz for Induction.

    #else
    #error No motor type specified
    #endif

    #ifndef USER_MOTOR
    #error Motor is not defined in user.h
    #endif

    #ifndef USER_MOTOR_TYPE
    #error The motor type is not defined in user.h
    #endif

    #ifndef USER_MOTOR_NUM_POLE_PAIRS
    #error Number of motor pole pairs is not defined in user.h
    #endif

    #ifndef USER_MOTOR_Rr
    #error The rotor resistance is not defined in user.h
    #endif

    #ifndef USER_MOTOR_Rs
    #error The stator resistance is not defined in user.h
    #endif

    #ifndef USER_MOTOR_Ls_d
    #error The direct stator inductance is not defined in user.h
    #endif

    #ifndef USER_MOTOR_Ls_q
    #error The quadrature stator inductance is not defined in user.h
    #endif

    #ifndef USER_MOTOR_RATED_FLUX
    #error The rated flux of motor is not defined in user.h
    #endif

    #ifndef USER_MOTOR_MAGNETIZING_CURRENT
    #error The magnetizing current is not defined in user.h
    #endif

    #ifndef USER_MOTOR_RES_EST_CURRENT
    #error The resistance estimation current is not defined in user.h
    #endif

    #ifndef USER_MOTOR_IND_EST_CURRENT
    #error The inductance estimation current is not defined in user.h
    #endif

    #ifndef USER_MOTOR_MAX_CURRENT
    #error The maximum current is not defined in user.h
    #endif

    #ifndef USER_MOTOR_FLUX_EST_FREQ_Hz
    #error The flux estimation frequency is not defined in user.h
    #endif


    // **************************************************************************
    // Functions
    // **************************************************************************

    // Sets the user parameter values
    //! \param[in] pUserParams The pointer to the user param structure
    extern void USER_setParams(USER_Params *pUserParams);


    #ifdef __cplusplus
    }
    #endif // extern "C"

    //@} // ingroup
    #endif // end of _USER_H_ definition

  • this is a tough one. Not seeing current injected during RoverL is a big red flag.  There must be something wrong with the mapping of PWM signals in software to your inverter.

    I made some changes and added some comments to your user.h

    Fundamentally nothing wrong....especially that would cause this issue.

     

    Again, I would go back and look at the mapping of your PWM modules / pins to your inverter gate drive.

     

    2746.user.h
  • Thanks for the tips, Chris! It's good to know where to look - I'll check out the PWM assignments, and do a fresh install of all the software. I had a pretty cluttered install of MotorWare (with _9 and _11 installed) and CCS (had version 4 and 5 installed at one point). 

    Where should I look to check for pin assignments? 

    Thanks again for the prompt response! :)

  • Hai,

    To understand pin assignments:

    1. look at the drv.c fle first

    ex: C:\ti\motorware\motorware_1_01_00_11\sw\drivers\drv\boards\drv8301kit_revD\f28x\f2806x\src\drv.c

    DRV_setupGpios(DRV_Handle handle)

    this is where pins are selected as GP input, output, or other function. You have to map these to your inverter.

    As an example look at the DRV8301 EVM schmatic

    C:\ti\controlSUITE\development_kits\DRV830x-HC-C2-KIT_v104\~DRV830x-HC-EVM-HWdevPkg\DRV830x_RevD_HWDevPKG\Schematic

    and you can see that your PWMs map to GPIO-00 through -05

    and in drv.c you will see

      // PWM1
      GPIO_setMode(obj->gpioHandle,GPIO_Number_0,GPIO_0_Mode_EPWM1A);

      // PWM2
      GPIO_setMode(obj->gpioHandle,GPIO_Number_1,GPIO_1_Mode_EPWM1B);

      // PWM3
      GPIO_setMode(obj->gpioHandle,GPIO_Number_2,GPIO_2_Mode_EPWM2A);

      // PWM4
      GPIO_setMode(obj->gpioHandle,GPIO_Number_3,GPIO_3_Mode_EPWM2B);

      // PWM5
      GPIO_setMode(obj->gpioHandle,GPIO_Number_4,GPIO_4_Mode_EPWM3A);

      // PWM6
      GPIO_setMode(obj->gpioHandle,GPIO_Number_5,GPIO_5_Mode_EPWM3B);

    2. Then you can look at the

    DRV_setupPwms()

    to see how the PWMs are configured.

    3. You also need to look through all of the drv.c file to understand the Clock set-up, PLL, and PIE features.

     

  • Hello Chris!

    I've made some progress my invert: I realized that I forgot to put a low pass filter on the OCP and TZ-1 pins and what was happening was as soon as the PWMs turned on (even in the idle state) the noise would intermittently trip OCP/TZ-1.  I didn't realize that InstaSPIN had latched a fault - the motor ID states in Lab2A kept going through RoverL, Rs, etc. even  though OCP has been tripped. Is there a way I can fix this issue such that if OCP trips while going through Motor ID, the controller state enters the "error" state?

    Now that I've got the PWMs working consistently at 90V DC bus, I'm still having issues with RoverL. When I go through Lab2A now, here's what happens:

    1.) Offsets gets calibrates (successful)

    2.) RoverL - no signature 100Hz current; still a flat line. I've checked and re-checked my PWM mapping (parsed though all over drv.c) and it looks correct. I based my design on the HVMTR kit, so I shouldn't even have to re-map if my schematics are correct. 

    The motor voltages look like this during RoverL:


    I would expect some sort of "shifted" PWM motor voltages, but the motor voltage (relative to DC supply ground) I see during RoverL is the same as step 1, when the system was going through offset calibration. 

    3.) Rs identification: motor experiences a large torque pulsation and then trips my hardware 50A overcurrent protection circuit. I don't put too much stock into this because if RoverL is not working right, I don't expect Rs identification to work correctly.

    Do you have any ideas as to why InstaSPIN would command essentially a "zero" motor voltage? Is there a way I can look at the code that determines PWM values for RoverL or is that proprietary? 

    Also, I have 3 Allegro current sensors - do I have to use 2 for USER_NUM_CURRENT_SENSORS or can I use 3?

    Thanks for your great feedback, Chris!

  • "Is there a way I can fix this issue such that if OCP trips while going through Motor ID, the controller state enters the "error" state?

    This should have been something we had in the controller IMO.  I think the easiest way would be to create a function to read the trip zone register to see if it's faulted. Most of the drivers (DRV83xx, Powerex IPM) also have a fault signal(s) that you can read (and will need to reset).  We created a CheckForFaults() and ResetFaults() for the GUI project.  Once we had the the CheckForFaults we added them througout the code as appropriate.

    While you don't have access to change the Motor ID code, you can poll the state and do a CheckForFaults() in each state change.  For an example look at proj_lab2c starting at line 223 to see how we poll the state change and take some action. You could add CheckForFaults similarly.

     

    "1.) Offsets gets calibrates (successful)"

    How do you know it was successfult?  What are the values returned?

    "Do you have any ideas as to why InstaSPIN would command essentially a "zero" motor voltage?"

    Zero voltage vector is applied during the Offset Calibration.

    The User Guide is very clear about exactly what is occuring during Motor ID process, and you can follow through the ctrl.h / ctrl.c code.

    "Also, I have 3 Allegro current sensors - do I have to use 2 for USER_NUM_CURRENT_SENSORS or can I use 3?"

    If you have 3 you can use 3.

     

    Did you make any other changes or are you using a fresh install of MW _11?  Either a pin mapping or some gross timing issue has been introduced.

     

  • and also look in proj_lab2c at

    CTRL_recalcKpKi()

    where we poll the EST_state, which is more appropriate for what you want to do.

     

  • Thank you for the very quick reply, Chris!

    I'll be sure to check out Lab 2c - I haven't played with Lab 2c very much yet because it wasn't part of the HV kit labs. I'll go through the user guide and follow through in ctrl.h/ctrl.c later today and see if I find any insights.

    ==========================

    To answer your questions about the offset calibration - I copied code from Lab 3a to Lab 2a such that I get the bias for voltage and currents. 

    My DC bus voltage was set at 90V, and I played around in my user.h such that these are my voltage and current scales:

    #define USER_IQ_FULL_SCALE_VOLTAGE_V (120) 

    #define USER_ADC_FULL_SCALE_VOLTAGE_V (98.02) 

    #define USER_IQ_FULL_SCALE_CURRENT_A (62) 

    #define USER_ADC_FULL_SCALE_CURRENT_A (124)

    I also copied the bias calculated in Lab 2a to my user.h, and they are:

    #define I_A_offset (0.9977442622)
    #define I_B_offset (0.9945485592)
    #define I_C_offset (0.991394043)

    #define V_A_offset (0.3725035191)
    #define V_B_offset (0.409307301)
    #define V_C_offset (0.3864483237)

    These values are near my ideals: current offset ideal is 1.033 and voltage offset ideal is 0.375. I see 50% duty cycle for motor voltage during offset calibration. The results for offset calibration look correct, right?

    =================

    2.) RoverL calculation:

    Sorry for not making this clear, but this is the motor voltage I see during RoverL identification with a DC bus of 90V:

    As you can see, motor voltages are near zero for all 3 phases during RoverL identification - this is I believe a symptom of the root cause of my problems. 

    Do you know what could cause the Motor ID algorithm to output 50% duty cycle for the entirety of the RoverL identification?

    ===================

    I did do a fresh uninstall of all TI products on my computer and then I installed:

    CCS 5.5.00077

    ControlSuite

    InstaSPIN/Motorware version 11

    ===================

    Thanks for your help again, Chris!

  • On your USER_ values please put a .0 trailing all integer values. This will force the pre-compile #defines to use float math for the scale factor calculation. We did see an issue where because both the ADC and IQ values were integers the scale factor was truncated to an integer as well.   I don't think this is your issue, but FYI.  In _12 we are forcing these to use float in the scale factor division.

     

    I'm stumped on what's happening during RoverL.  Let me see if anyone else on the team has any ideas.

     

  • Thanks Chris! I'll try that later today and let you know how it goes! 

  • Hello Chris!

    I tried your suggestion of putting a ".0" behind most of the values in user.h, and it worked!!!!

    Here's a capture of the RoverL current waveform for phase A:

    Attached here is my user.h: 0804.user.h

    Now I can go on and troubleshoot other things!! Thanks again!!! :)