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.

drv8301 InstaSPIN-FOC development, motor ID, controller tuning, full load testing

Other Parts Discussed in Thread: DRV8301, MOTORWARE

Hello,

I really need help , i am still a learner and this is the task given.

I am working with Instaspin FOC drv8301 kit

my motor which has rated voltage 18V .

when working with automatic ID I change the identification parameters accordingly , my motor spins and gets identified. Some times it stops at EST_STATE_Ramp down 

Is the identified parameters correct ?

If so ,now my next step is that i should update this in user.h and compile

I am unable to do that.

Can anyone help how to do this or suggest any references ?

If anyone helps me out i will be really glad and grateful

Thankyou in advance

Archana Lokesh

  • Archana,

    I have moved your thread to the InstaSPIN forum. They will better be able to assist you.

  • Archana,

    Are you using the GUI to do Motor ID, or doing Motor ID through a CCS project?

    Post your identified parameters and everything you know about the motor please.

    I will say that if you have an 18V motor you may need to (and certainly will want to eventually) change the voltage scaling hardware. It is scaled to 66V and you really only need <30 for your motor.  You will get better performance (especially low speed) if you change this scaling.  Similar for current, do you need the +/-40A of the DRV8301 kit?

    The only other real change you might need to make is the PWM frequency.  Once you get into the <100 uH range and high short circuit current you will want to PWM at a faster rate (30-60 typical) vs. the 20 KHz defautl of the GUI.  You'll notice in the CCS MotorWare projects that the default PWM frequency for the DRV83x kits is now 45 KHz for this very reason, we see many people using very low inductance motors.

    Yes, once you have your parameters you will update them in the user.h for the MotorWare project, which for your DRV8301 board will be at:

    C:\ti\motorware\motorware_1_01_00_08\sw\solutions\instaspin_foc\boards\drv8301kit_revD\f28x\f2806xF\src\user.h

    You are specifically updating the USER_MOTOR section, but you may also make changes to the clocking and current/voltage scaling.

    You need to follow the Labs, which are currently at the back of the User's Guide SPRUHJ1 (we will be moving into their own document for the next MotorWare update in August).  These labs will show how incrementally how to use the features of InstaSPIN-FOC.

     

     

  • Hello CHris , 

    Motor which I am using is a high speed motor with a speed of 15000 rpm with 4 poles. 

    I am using GUI 

    Identification Settings:

    Res Est Current : 1.1

    Ind Est Current: -1.1

    Estimation Motor frequency: 360

    Motor pole pairs: 4

    Motor Max current: 20

    Motor Max Frequency: 800

    and the resulting parameters are :

    Rs: 0.0486301

    Ls_d: 0.0000678006

    Ls_q: 0.0000678006

    Flux: 0.022512

    Thank you 

    Sincerely,

    Archana

     

  • Hi Chris,

    Now i am using CCS5.3 to spin my BLDC motor

    I am following the labs that are given in the spurhj1a 

    project 2 I can succesfully get the values of Rs, L 

    when i compare its same as GUI

    now if do project 3 , updating the values of resistance and inductance for calibrating the offset current and voltage values 

    I get the values at the Ref speed of 200 RPM

    but as mentioned there if I can  change the values of Speed_Ref , i just give 2k , my motor firstly doesnt reach the 2k and it tries but it stops or its starts rotating in the reverse direction 

    and I update these values in user.h for project 3b and add drv 

    Debug

     in my watch window I dont find offset values 

    My motor rated speed is 17kRPM

    i am worrying that whether the calibrated values are correct or no ?

    because it stops at 2kRPM only 

    when i do it with the GUI i can achieve that speed instantaneously .

    Please help me 

    Thanks you in advance 

    Archana 

  • My instinct is that the Offset Calibration is not being done/saved when using the CCS projects.  Make sure gMotorVars.Flag_enableOffsetcalc = 1 before you set gMotorVars.Flag_Run_Identify = 1

    If the Rs/Ls/Flux values are similar then this seems most likely.

    They only other differences between the GUI and CCS project is the default PWM and controller frequencies as well as the fact that the CCS projects default the max duty cycle to 1.0 while the GUI goes ahead and sets 2.0 (~16% higher RPM)

    The GUI is set to run at 20 KHz PWM and 10 KHz current/FAST. The default CCS proejcts for the DRV83x hardware are set to run at 45 KHz PWM and 15 KHz current/FAST.  This will change the PI controller calculations (due to scaling) but will still be tuned to your motor (current controller) and max current setting (speed controller).

    if you post your user.h I'll take a look.

  • Hi Chris ,

    This is my user.h .

    #ifndef _USER_H_
    #define _USER_H_
    /* --COPYRIGHT--,BSD
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    //! \file   solutions/instaspin_foc/boards/drv8301kit_revD/f28x/f2806xF/src/user.h
    //! \brief Contains the public interface for user initialization data for the CTRL, DRV, and EST modules 
    //!
    //! (C) Copyright 2012, Texas Instruments, Inc.
    // **************************************************************************
    // the includes
    // modules
    #include "sw/modules/types/src/32b/types.h"
    #include "sw/modules/motor/src/32b/motor.h"
    #include "sw/modules/est/src/32b/est.h"
    #include "sw/modules/est/src/32b/est_Flux.h"
    #include "sw/modules/est/src/32b/est_Ls.h"
    #include "sw/modules/est/src/32b/est_Rs.h"
    // platforms
    #include "sw/solutions/instaspin_foc/src/ctrlStates.h"
    #include "sw/modules/fast/src/32b/userParams.h"
    //!
    //!
    //! \defgroup USER USER
    //!
    //@{
    #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        (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 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
    //! \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
    #define USER_IQ_FULL_SCALE_VOLTAGE_V      (48.0) // 48.0 Example for drv8301 typical usage
    //! \brief Defines the maximum voltage at the input to the AD converter
    //! \brief The value that will be represtented 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       (66.32) // 66.32 drv8301_revd voltage scaling
    //! \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               ((float32_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          (41.25) // 41.25 Example for drv8301_revd typical usage
    //! \brief Defines the maximum current at the AD converter
    //! \brief The value that will be represtented 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        (82.5)     // 82.5 drv8301_revd current scaling
    //! \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               ((float32_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 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.9975856543)
    #define   I_B_offset    (1.00966841)
    #define   I_C_offset    (1.004334629)
    //! \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.207689607)
    #define   V_B_offset    (0.2080324292)
    #define   V_C_offset    (0.2081195712)
    //! \brief CLOCKS & TIMERS
    // **************************************************************************
    //! \brief Defines the system clock frequency, MHz
    #define USER_SYSTEM_FREQ_MHz             (90.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
    //! \brief Defines the maximum duty cycle
    //! \brief 1.0 or 100% is the maximum duty cycle.
    //! \brief For space vector over-modulation, see lab 6 for details on system requirements that will allow the SVM generator to go all the way to trapezoidal
    //! \brief modulation.
    #define USER_MAX_DUTY_CYCLE          (1.0) // 1.0 default for 100% modulation (always stay below or equal to 1.0)
    //! \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 Defines the Interrupt Service Routine (ISR) frequency, Hz
    //!
    #define USER_ISR_FREQ_Hz           ((float32_t)USER_PWM_FREQ_kHz * 1000.0 / (float32_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 * (float32_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 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, oontroller 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 applicatons 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 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 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 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 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 Defines the controller execution period, sec
    //! \brief Compile time calculation
    #define USER_CTRL_PERIOD_sec       ((float32_t)USER_CTRL_PERIOD_usec/(float32_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 demagnetizaton)
    //! \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     (-2.0) // -2.0 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.002)  // 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            (1.0) // 1.0 Typical force angle start-up speed
    //! \brief Defines the maximum current slope for Id trajectory during EPL mode
    //! \brief For Induction motors only, controls how fast Id input can change under EPL control
    #define USER_MAX_CURRENT_SLOPE_EPL (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, rad/sec^2
    //! \brief Updated in run-time through user functions
    //! \brief Inverter, motor, inertia, and load will limit actual acceleration capability
    #define USER_MAX_ACCEL_rps2                 (20.0) // 20.0 Default
    //! \brief Defines maximum acceleration for the estimation speed profiles, rad/sec^2
    //! \brief Only used during Motor ID (commission)
    #define USER_MAX_ACCEL_EST_rps2           (2.0) // 2.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
    //! \brief Defines the fraction of IdRated to use during rated flux estimation
    //!
    #define USER_IDRATED_FRACTION_FOR_RATED_FLUX (0.5) // 0.5 Default, don't change
    //! \brief Defines the fraction of IdRated to use during inductance estimation
    //!
    #define USER_IDRATED_FRACTION_FOR_L_IDENT    (0.5) // 0.5 Default, don't change
    //! \brief Defines the IdRated delta to use during estimation
    //!
    #define USER_IDRATED_DELTA                  (0.0001) // 0.0001 Default, don't change
    //! \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
    //! \brief Defines flux fraction to use during inductance identification
    //!
    #define USER_FLUX_FRACTION        (1.0) // 1.0 Default, don't change
    //! \brief Defines the EPL (Efficient Partial Load) gain for computing Id reference
    //! \brief Induction motors only
    #define USER_EPL_GAIN                   (1.0) // 1.0 Default, don't change
    //! \brief Defines the R/L estimation frequency, Hz
    #define USER_R_OVER_L_EST_FREQ_Hz       (100) // 100 Default, don't change
    //! \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  (335.648) // 335.648, value for drv8301_revd hardware
    //! \brief Defines the analog voltage filter pole location, rad/s
    //! \brief Compile time calcuation 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 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 Defines the software pole location for the direction filter, rad/s
    #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
    //! \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
    //! \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
    // **************************************************************************
    // 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 Feo_Motor_1
    // 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
    //! \brief Uncomment the motor which shold 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 My_Motor
    //#define USER_MOTOR Belt_Drive_Washer_IPM
    //#define USER_MOTOR Marathon_5K33GN2A
    #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 (Webers = Volts* Seconds)
    #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
    #elif (USER_MOTOR == Anaheim_BLY172S) // 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                   (0.4110007) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d                 (0.0007092811) // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_Ls_q                 (0.0007092811) // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_RATED_FLUX           (0.03279636) // Identified TOTAL flux linkage between the rotor and the stator (Webers = Volts* Seconds)
    #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          (5.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     (20.0) // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
    #elif (USER_MOTOR == My_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                   (0.05187642)         // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d                 (5.81165e-05)      // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_Ls_q                 (5.81165e-05)      // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_RATED_FLUX           (0.02101798)        // Identified TOTAL flux linkage between the rotor and the stator (Webers = Volts* Seconds)
    #define USER_MOTOR_MAGNETIZING_CURRENT  (NULL)              // Induction motors only, else NULL
    #define USER_MOTOR_RES_EST_CURRENT      (3.0)               // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT      (-0.5)              // During Motor ID, maximum current (negative Amperes, float) used for Ls estimation, use just enough to enable rotation
    #define USER_MOTOR_MAX_CURRENT          (20.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     (20.0)              // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
    #elif (USER_MOTOR == Feo_Motor_1)                       // 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                   (0.04898188)         // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d                 (8.717959e-05)      // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_Ls_q                 (8.717959e-05)      // For PM, Identified average stator inductance  (Henry, float)
    #define USER_MOTOR_RATED_FLUX           (0.02123285)        // Identified TOTAL flux linkage between the rotor and the stator (Webers = Volts* Seconds)
    #define USER_MOTOR_MAGNETIZING_CURRENT  (NULL)              // Induction motors only, else NULL
    #define USER_MOTOR_RES_EST_CURRENT      (1.1)               // During Motor ID, maximum current (Amperes, float) used for Rs estimation, 10-20% rated current
    #define USER_MOTOR_IND_EST_CURRENT      (-1.1)              // During Motor ID, maximum current (negative Amperes, float) used for Ls estimation, use just enough to enable rotation
    #define USER_MOTOR_MAX_CURRENT          (20.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     (360.0)              // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
    #elif (USER_MOTOR == Belt_Drive_Washer_IPM) // 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.832002) // Identified phase to neutral in a Y equivalent circuit (Ohms, float)
    #define USER_MOTOR_Ls_d                 (0.0115) // For IPM, user provided if saliency known, note difference in Ls_d and Ls_q (Henry, float)
    #define USER_MOTOR_Ls_q                 (0.0135) // For IPM, user provided if saliency known, note difference in Ls_d and Ls_q (Henry, float)
    #define USER_MOTOR_RATED_FLUX           (0.5022156) // Identified TOTAL flux linkage between the rotor and the stator (Webers = Volts* Seconds)
    #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          (4.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     (20.0) // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
    #elif (USER_MOTOR == Marathon_5K33GN2A) // 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
    #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          (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.
    #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
    // **************************************************************************
    // the functions
    //! \brief      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
    and i have an other doubt , can we change the Kp_spd and Ki_Spd values when we are executing the project_lab_02.a
    I need to change so that motor which i am using requires speed controller 
    Thanks in advance 
    Archana
  • in your user.h you have set active

    #define USER_MOTOR Anaheim_BLY172S
     
     
    You need to create your own USER_MOTOR.
     
    I think you tried to do this with the Feo motor, but you made some mistakes in the definition and never set it active. Update to this:
     
    #define Feo_Motor_1      105
    //#define USER_MOTOR Anaheim_BLY172S
    #define   USER_MOTOR Feo_Motor_1
     
     
    I also recommend changing these settings to better match your motor.
    #define USER_IQ_FULL_SCALE_VOLTAGE_V      (24.0)
     
    your performance, especially low speed will be greatly improved if you change the voltage sensing circuitry to scale to around 24V also. But don't change this variable until you do.
    #define USER_ADC_FULL_SCALE_VOLTAGE_V       (66.32) // 66.32 drv8301_revd voltage scaling
     
     
     
    #define USER_MOTOR_RES_EST_CURRENT      (2.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          (20.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     (50.0)              // During Motor ID, maximum commanded speed (Hz, float), ~10% rated
     
     
     
  • Hello Chris,

    I tried implementing the values that were suggested by you. 

    But my motor rated speed is 17krpm , when i set 0.75krpm in Speed_ref_krpm . my motor stops spinning for a while then spins in opposite direction with a low speed of 0.05 to 0.1 krpm. 

    and yet i have no idea to implement Speed controller in the given project labs 

    Can you just give me the basic idea ?

    Thank you in advance 

    Archana.

  • Archana,

    Are you following the projects/labs in the back of SPRUHJ1 User's Guide?

    You need to make sure you are initializing all the options correctly (saved proper motor parameters and ADC offset to user.h; load from user.h vs. ID parameters; load Rs from user.h vs. recalibrate Rs; load ADC offsets from user.h vs. recalibrate offsets).

    Make sure that the values loaded into gMotorVars, like gMotorVars.Rs_Ohm, .gLsd_H, .Flux_VpHz match what you put into user.h active USER_MOTOR_Rs, _Ls_d, RATED_FLUX, and make sure those are very close to the values you got from using the GUI.

    Considering you can run just fine with the GUI, moving to the CCS MotorWare projects should be very straightforward and give you identical results.

     

  • Chris ,

    I have done everything as you said . And It works absolutely fine.

    Next step what I am doing is , I have coupled my motor . I have read somewhere in the documentation that motor identification settings should be done without applying any load because some parameters should be determined in the no load condition.

    So I had a clarification , Should i remove the load , identify my motor then again couple it and continue working ?

    Thanks in advance

    Archana 

  • Archana,

    To get your motor parameters: Rs, Ls, Flux; this needs to be done with no load. You save these parameters in your user.h and load them into the controller at start-up.  That way the motor can be coupled or loaded in the future.

    If you are using InstaSPIN-MOTION and the SpinTAC components, the inertia ID should be done with any coupling (like in a washing machine if the motor is attached to the drum with a belt) but without any load (you would not have water or clothes in the machine).

    The RsRecal and OffsetRecal can be done in system with load as they don't attempt to spin the motor.

     

  • Hello Chris,

    I have a doubt , As I have said earlier I am working with BLDC using InstaSpin FOC . 

    I have to tune my speed controller so that the waveform generated will sinusoidal.

    earlier i had tuned tothe following

    The values set for the speed and current controllers are as follows:

    Spd_Kp: 1.0

    Spd_Ki: 0.01

    Cur_Kp: 0.3

    Cur_Ki: 0.001

    and the waveform at 15kRPM is 

    So i need to tune the values of speed controller so that it exactly looks like a sinusoidal wave.

    I am a bit tensed that while tuning the speed controller will the board get damaged ?

    And can you guide me in what range shall i try ?


    Thanks in advance 

    Archana

  • iIs this a phase current with no laod? f you are looking at a phase current then you need to tune your current controller first. What is the size of this current signal in relationship to your max current?  If this is very low current (low load) with a low inductance motor it looks reasonable to be honest.  If at higher load / higher current it is distorted. 

    I see you posted values you are using, how do these differe from the values that were calculated by IntsaSPIN-FOC based on the values of you rmotor? What test did you do to change these values?

    you also need to look at your PWM of the current control. Is it fast enough for the current ripple?  Are you PWM'ing often enough?  Is your board design good?

    once the current response is tuned you can look at your speed control loop. You will want to do a step response with various loads at various speeds to achieve acceptale overshoot & undershoot for your application and insure there is not hunting.

    regarding the protection of the board, version _09 of MotorWare releases on Thursday 8/22. This includes many enhnacements that you will want to use, including updated Trip Zone protection for all three of the inverters.  It also includes new enhancements for high speed motors (both motor ID enhancements and sample+angle compensation for high speed operation).

     

     

  • Hello Chris, 

    Th waveform that I previously posted is with Motor coupled and resistance full load . The values that were calculated by CCS are 

    Spd_Kp: 15.515

    Spd_Ki: 0.103

    Cur_Kp: 0.505

    Cur_Ki: 0.0399

    And my PWM frequency is 45kHz i have not changed it from default:

    Actually after comparing with the earlier what we were using , we found an increase in efficiency 

    with  drv8301 the phase current is 12.9 , and earlier it was 14.1 .

    applying Vin = 25V and Maximum current limit = 20A . 

    For protection we have connected a suppressor diode.

    Thank you in advance 

    Archana

  • Archana,

    First, I just want to comment that I think it's pretty impressive that within a week of starting a project as a self described "new learner" you are running full load tests on YOUR MOTOR with sensorless FOC and seeing a major efficiency gain. :)  Do you realize that in the past this would have been impossible?  This is the exact problem we intended to solve when we created InstaSPIN so it makes me happy to see it's working as planned.

    Back to your problem.  In your previous post you stated that you had changed your PI gains to the following:

    Spd_Kp: 1.0

    Spd_Ki: 0.01

    Cur_Kp: 0.3

    Cur_Ki: 0.001

    and in this post you mention that the values calcualted for you by InstaSPIN-FOC were

    pd_Kp: 15.515

    Spd_Ki: 0.103

    Cur_Kp: 0.505

    Cur_Ki: 0.0399

     

    How did you decide on changing these current gains?  Did you do any step response tests or did you just guess? 

     I do NOT like what you have done with Cur_Ki, you have made it 40x lower. 

    Your Cur_Kp is also too low. We set the current gainst about /4 soft, so with your type of motor that will run at higher speeds you will likely need to adjust it somewhere between 2-4x higher than the default.  A best guess w/o running any tests is that you should be using a Cur_Kp of about 1.0 to 2.0

    As a best guess I would recommend 1.5 and 0.04 for the Cur_Ki

    The speed tuning I can't comment on, but if it's holding your 15K RPM well and handling changing loads and gives you the response you desire when you change speed, it's tuned well.

     

  • In light of the great effort & vast detail supplied w/in this thread - might it benefit from a "promotion" from the effort/consideration-free, generic, subject/title, "Query?"  (almost offensive in its inadequacy!)

    Surely will benefit future, "searchers."  

    Thread demands far better subject titling/representation...

    Update: 09:43 CST - Bravo!  (and - as op endlessly expands cross-exam - perhaps "kitchen-sink" bubbles up...)

    Update2: you da man Chris - sure others will benefit/appreciate - our thanks...

  • noted, appreciated, and applied, cb1 :)

     

  • Hello Chris,

    Thanks and your support , immediate replies helped me a lot too :) .

    Actually , i have guessed the values of speed controller and applied. I have not done any step response

    It was told by one of my colleague to just vary the value and find the appropriate one for.

    This is were i am exactly stuck.  

    So can you tell me "how to find the step response of my system" and I don't know the Inertia of My motor I have asked my senior colleague even they do not know 

    Thank you in advance 

    Archana

  • For the current gains I suggest first trying the values I suggested. It is not very often you even need to change the default values we calculate for current gains in InstSPIN-FOC/-MOTION.  Again, at most you can increase the Kp setting up to 4x if running at higher speeds.

    At this point I would also ask how fast you are running your current controller. The default in all the MotorWare proejects now is 15 KHz. This is usually adequate for any motor, but it does use more MIPS and may be overkill for less dynamic applications (5-10 KHz).  Just make sure you haven't set this too low, especially if you have a motor with a high dI/dt.

    Now, you can do some step response current tuning if you like, but it's not necessary at this point IMO.

    For the speed, just set an extremely high acceleration (like 100 KRPMS) and then set different speeds (0 to 25%, 25% to -25%, etc.), tuning your Kp for over/undershoot and your Ki for settling time.  For safety you may want to choose a lower Vbus approx 2/3 of the wanted Vbus. When you do this you can do a ratio of 2/3 according to the Speed also, so for example when you run the motor at 12krpm with a lower Vbus you are seeing the response as if the motor would be approximatily running at 18krpm. With the lower voltage you reduce the risk of damaging the motor while dooing tests.

    You use this a baseline but then will need to test with regular accelerations and expected speed and load ranges. You will likely end up with set of gains to use over your application, and then you have to manage the setting of these gains depending on the commanded/actual speeds/loads.  It's one of the system challenges to make a real product.

    Or, you could use InstaSPIN-MOTION which lets you do a single variable speed loop tuning very quickly.

     

     

  • Hello Chris, 

    Today I am glad to tell that i completed my first motor's identification , tuning and controlling . It is really interesting working with the drv8301 and TMS28069.

    We have increase in our effiency using thid board  

    Thank you for your guidelines and immense support

    Regards

    Archana

  • Very glad to hear!

    Once your project has progressed if you would like to share your experience and results please share.

  • Hello Chris , 

    I am identifying an E bike motor , identification and tuning process is completely done and the speed controllers work exactly well. An i really feel this is a great innovation by TI which helps the user.

    And as we know E-bike will have an accelarator . so i have thought for the further utilization we can connect the accelarator to the board . So i just need an information, what is the use of the given speed control knob on the drv8301 board ?

    Thank you in advance 

    Archana

  • The POT is connected to ADCB0 of the DIMM interface. So you can add code to sample this pin and translate into a speed command.

    BTW - most E-Bikes and scooters are just sending a torque command to the motor controller.  The speed is controlled by the rider commanding the torque (through pedals or a throttle), just like a passenger car.  Speed control would only be used for a "cruise control" feature.  Are you doing something different?

    Very glad to see that you are happy with InstaSPIN-FOC!

  • Hello Chris,

    I am doing the samething as you mentioned , using throttle to start the motor . After connecting the hammer to the ADC A4 , motor spins . But the initial start up time is a bit long and while starting up, motor will make two to three jerks and then start to spin. 

    The motor's torque at 0 rpm should be 50N.m but i am able to achieve only 30.5 N.m 

    Can you please tell me how to overcome these situations ?

    Thank you in Advance 

    Archana

  • If start-up is taking too much time before starting perhaps you have RsRecal or OffsetRecal enabled? Or you are doing something strange in your background loop?  You should be able to start the inverter very quickly. You can also power up everything but keep your PWMs off, and then use an input command to turn them on.

    Review chapter 15 of SPRUHJ1 regarding full torque and start-up.