19
1 TUTORIAL Motor Parameter Identification with PSIM February 2017

TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

  • Upload
    buihanh

  • View
    291

  • Download
    3

Embed Size (px)

Citation preview

Page 1: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

    1 

TUTORIAL

Motor Parameter Identification with PSIMFebruary 2017

Page 2: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    2 

PSIM provides the motor identification capability for PMSM motors. It provides a set of code for TI DRV8305 EVM, DRV8312 EVM, and high‐voltage hardware kit. With small changes, users can adopt the code to their own motor drive inverter hardware.  

With this capability, PSIM provides the easiest way for users to identify motor parameters first and then evaluate  the performance of  a  sensorless motor  control  algorithm with  InstaSPIN  (See  the tutorial  “Simulation  and  Code  Generation  of  TI  InstaSPIN  Using  DRV8305  EVM.pdf”  for  more details). 

The core of  the  InstaSPIN algorithm  is a FAST estimator  that performs parameter  identifications and calculates flux, angle, speed, and torque based on motor phase voltages and currents and dc bus voltage. The FAST block is illustrated below. 

 

Motor  identification  is  a  feature  of  InstaSPIN  that  allows  identification  of  parameters  for sensorless control. This feature enables users to run their motor to its highest performance even when motor parameters are unknown. A side benefit of the InstaSPIN motor identification is that it  also provides  controller design of  inner  current  loop and outer  speed  loop PI  controllers,  and with these controller parameters, the motor drive system is ready to run. 

The code provided in PSIM is  largely based on TI’s Motorware InstaSPIN Lab2a. The difference is that,  in PSIM’s code, parameters needed for motor  identification and InstaSPIN are conveniently grouped  in  a  parameter  file,  and  the  parameter  file  can  be  easily  recreated  and  updated  using PSIM’s  InstaSPIN Parameter Editor  (under the Utilities menu). This makes  it easier to adopt the code for different operating conditions or power converter hardware. 

Page 3: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    3 

When using the code for different hardware, one should compare the control hardware with the control hardware of the sample code in terms of the DSP peripherals (for example, ADC and PWM channels). If the DSP peripherals are used in the same way, no change is needed to the code, and one  needs  to  update  the  parameter  file  only.  If  DSP  peripherals  are  configured  differently,  the code needs to be changed to match the control hardware. 

Note that, at the moment, the code is for parameter identification is for surface‐mounted PMSM (SPM) only (where Ld = Lq).  It  is not for  internal PMSM (IPM) (where Ld and Lq are different) or any other types of motors. 

The following motor identification examples and code are provided in PSIM: 

‐ “examples\Motor Identification\TI DRV8305”:              For TI DRV8305 EVM ‐ “examples\Motor Identification\TI DRV8312”:              For TI DRV8312 EVM ‐ “examples\Motor Identification\TI High‐Voltage Kit”:  For TI high‐voltage kit 

For further information on TI DRV8305, DRV8312, and High‐Voltage Kit, please refer to relevant TI documents. 

This tutorial describes how to use PSIM’s InstaSPIN Parameter Editor and the motor identification code and examples to obtain motor parameters with the DRV8305 EVM hardware. The procedure for other hardware is similar. In this tutorial, the DRV8305 example files are copied to a new folder “C:\New folder\PSIM Project\InstaSPIN\Drv8305InstaSpinMotorID”. 

1. Preparing for Motor Identification 

There are four steps to identify motor parameters with PSIM and motor drive hardware.  

‐ Collect motor drive inverter hardware information. The following parameters are needed: 

‐ Current sensor gain ‐ Voltage sensor gain ‐ Voltage sensor filter cut‐off frequency ‐ ADC configuration ‐ PWM configuration 

‐ Enter  the current and voltage sensor  information  into PSIM’s  InstaSPIN Parameter Editor and generate  the parameter  file  “InstaSPIN_params_MotorID.h”  for motor  identification. Note that this file name is hard coded and cannot be changed. 

‐ From TI CCS, load and run the motor identification code from the example folder.  

‐ Once  motor  parameters  are  determined  from  the  step  above,  record  the  following parameters into a text file “Motor_ID_Parameter.txt” for later use: 

Motor parameters: 

‐ gMotorVars.Flux_VpHz:    Motor rated flux ‐ gMotorVars.Rs_Ohm:     Motor stator resistance ‐ gMotorVars.Lsd_H:      Motor d‐axis inductance ‐ gMotorVars.Lsq_H:      Motor q‐axis inductance 

Page 4: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    4 

Voltage/current sensing offsets: 

‐ gMotorVars.I_bias_value[0]:   Current A sensing offset ‐ gMotorVars.I_bias_value[1]:   Current B sensing offset ‐ gMotorVars.I_bias_value[2]:   Current C sensing offset ‐ gMotorVars.V_bias_value[0]:  Voltage A sensing offset ‐ gMotorVars.V_bias_value[1]:  Voltage B sensing offset ‐ gMotorVars.V_bias_value[2]:  Voltage C sensing offset 

PI Controller parameters: 

‐ gMotorVars.Kp_Idq:      Current loop proportional gain ‐ gMotorVars.Kp_spd:      Current loop integral gain 

There are many parameters that need to be defined and calculated for motor identification with InstaSPIN, based on  inverter operating conditions and how voltages and currents are sensed. To ease the process of preparing the parameter file, PSIM provides a tool called InstaSPIN Parameter Editor to help users quickly generate the required “InstaSPIN_params_MotorID.h” file.   

To generate the InstaSPIN parameter file “InstaSPIN_params_MotorID.h” for motor identification, in PSIM, go  to Utilities  >>  InstaSPIN Parameter  Editor. The dialog window  is  shown below.  For more information on how to use the Parameter Editor, click on the Help button. 

The entry of the InstaSPIN Parameter Editor can be saved to a text file for later use. Sample files are provided in the “examples\SimCoder\F2806x Target” folder for the following hardware setup: 

‐ “InstaSpinMotorID_DRV8305” for TI DRV8305 EVM  ‐ “InstaSpinMotorID_DRV8312” for TI DRV8312 EVM  ‐ “InstaSpinMotorID_HVKit” for TI high‐voltage PFC and Motor Control Kit 

To create the parameter file from an entry saved previously, click on the Load button and load the file  into the InstaSPIN Parameter Editor. Then check the “Motor  Identification” box, and click on the Generate button. 

The dialog window below shows the entry for the motor identification with TI DRV8305 EVM. The dialog window is divided into several sections, and they are explained below. 

Page 5: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    5 

 

For the Motor section:  

This section defines the motor type and motor parameters. Two types of motors can be defined: BLDC/PMSM  (including  IPM  and  SPM),  and  induction  motor.  But  for  motor  identification,  only BLDC/PMSM  can  be  selected.  For  the  PMSM  motor  identification  with  DRV8305  EVM,  the following parameters are defined: 

BLDC/PMSM box checked Back emf Cofficient Ke:  disabled (need to identify) Stator Resistance Rs:    disabled (need to identify) d‐axis Inductance Ls_d:  disabled (need to identify) q‐axis Inductance Ls_q:  disabled (need to identify) Number of Poles:    8 

Page 6: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    6 

Motor Max. Current    5A Motor Max. RPM:    11000 rpm 

For the Inverter section:  

This section defines the maximum dc bus voltage that can occur during the operation and inverter PWM switching frequency. For DRV8305 EVM, the following are defined: 

DC Bus Voltage:    24 V Switching Frequency (kHz):  15 kHz 

For the DC Voltage Sensing section:  

This section defines how the dc bus voltage  is sensed. There are two ways to sense the voltage: either  Voltage  Divider  or  User  Defined.  With  Voltage  Divider,  divider  resistances  need  to  be specified. With User Defined, the dc sensing gain is defined directly. For DRV8305 EVM, it uses a voltage divider, and based on the DRV8305 EVM schematic, the resistances are: 

Divider box checked Resistance R1:     62k Ohm Resistance R2:     4.99k Ohm 

For the AC Voltage Sensing section:  

This section defines how ac voltages are sensed. There are two ways to sense the voltage: either RC Circuit or User Defined. With RC Circuit, resistances R1 and R2 and capacitance C1 need to be specified. With User Defined, the ac voltage sensing filter cut‐off frequency is defined directly. For DRV8305 EVM, it uses a RC circuit, and based on the DRV8305 EVM schematic, the values are: 

RC Circuit box checked Resistance R1:     62k Ohm Resistance R2:     4.99k Ohm Capacitance C1:    0.1u F 

For the AC Current Sensing section:  

This section defines how ac currents are sensed. There are three choices: either User Defined, or DRV8305 EVM, or DRV8312 EVM.  

For User Defined,  the  shunt  resistance  and  current  gain  are  defined. Note  that when  the  shunt resistance is not 0,  it  is assumed that the current  is measured through the shunt resistance, and the overall gain is equal to the shunt resistance multiplied by the current gain entered. If the shunt resistance  is 0,  it  is  assumed  that  the current  is measured  through a hall  effect  sensor,  and  the overall gain is the same as the current gain entered. 

For DRV8305  EVM,  the  op.  amp.  circuit  that  it  uses  is  fixed,  but  the  reference  can  be  changed through the Reference Divider k, and the gain can be changed through the resistance Rgain. Both can be set through SPI commands.  

For DRV8312 EVM, the op. amp. Circuit that it uses is fixed, and the and the current gain is 19.1. 

For  this example, we will use the default settings of  the DRV8305 EVM.   Based on the DRV8305 EVM schematic, the values are: 

Page 7: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    7 

DRV8305 EVM box checked Reference Divider k:        2 Resistance Rgain:        50k Ohm 

For the DSP Control section:  

This  section  defines  the  parameters  related  to  DSP  and  InstaSPIN  settings.  The  following parameters are defined:   

DSP Frequency (MHz):      90 MHz No. of PWM Periods Per Interrupt:    1 Ratio of InstaSPIN vs. ISR Rate:    1 Ratio of InstaSPIN vs. Current Loop Rate:   1 Ratio of InstaSPIN vs. Estimator Rate:   1 

For more information on the parameter definition, refer to the Help page.   

For the InstaSPIN Parameters section:  

This  section  defines  InstaSPIN  parameters  that  can  be  set  directly.  They  are  used  for  motor identification. For this example, the parameters are defined as:   

USER_MAX_VS_MAG_PU:      0.5   USER_R_OVER_L_EST_FREQ_Hz    300 USER_MOTOR_RES_EST_CURRENT    1.0 USER_MOTOR_IND_EST_CURRENT    ‐1.0 USER_MOTOR_FLUX_EST_FREQ_Hz   20 USER_MAX_ACCEL_EST_Hzps    2 

For more information on the parameter definition, refer to the Help page.   

Once above data are entered into their respective fields, click on the Save button to save the data to a text file for later retrieval using the Load button. To generate the InstaSPIN parameter file for PSIM, click on the Generate button and save the file “InstaSPIN_params_MotorID.h” to the same location as the rest of the code, as shown below. 

Page 8: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    8 

 

The generated InstaSPIN parameter file  is shown below. For easy inspection, the parameters are divided  into  4  sections:  commonly  changed  parameters,  rarely  changed  parameters,  constants, and derived parameters.  

 

 

 

 

 

 

 

 

 

 

 

Page 9: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    9 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

// InstaSPIN Parameters for Motor Identification // Commonly changed //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ #define USER_PWM_FREQ_kHz                        15.0          // User defined #define USER_NUM_PWM_TICKS_PER_ISR_TICK  1             // User defined #define USER_MOTOR_TYPE                          1             // Motor dependent #define USER_MOTOR_NUM_POLE_PAIRS              4             // Motor dependent #define USER_MOTOR_RATED_FLUX                    0.0           // Motor dependent #define USER_MOTOR_Rr                            0.0           // Motor dependent #define USER_MOTOR_Rs                            0.0           // Motor dependent #define USER_MOTOR_Ls_d                          0.0           // Motor dependent #define USER_MOTOR_Ls_q                          0.0           // Motor dependent #define USER_MOTOR_MAX_CURRENT                   5.0           // Motor dependent #define USER_MOTOR_RES_EST_CURRENT            0.5           // Motor dependent #define USER_MOTOR_IND_EST_CURRENT            ‐0.5          // Motor dependent #define USER_MOTOR_MAGNETIZING_CURRENT 0.0           // Motor dependent #define USER_MOTOR_FLUX_EST_FREQ_Hz           20.0          // Motor dependent //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ // Rarely changed //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ #define USER_IQ_FULL_SCALE_CURRENT_A           24.0          // Hardware dependent #define USER_IQ_FULL_SCALE_VOLTAGE_V           24.0          // Hardware dependent #define USER_MAX_ACCEL_EST_Hzps                  2.0           // Hardware dependent #define USER_ADC_FULL_SCALE_VOLTAGE_V        44.302        // Hardware dependent #define USER_ADC_FULL_SCALE_CURRENT_A        47.1429       // Hardware dependent #define USER_VOLTAGE_FILTER_POLE_Hz              344.618       // Hardware dependent #define USER_NUM_ISR_TICKS_PER_CTRL_TICK    1             // User defined #define USER_NUM_CTRL_TICKS_PER_CURRENT_TICK   1             // User defined #define USER_NUM_CTRL_TICKS_PER_EST_TICK    1             // User defined #define USER_NUM_CTRL_TICKS_PER_SPEED_TICK   15            // User defined #define USER_NUM_CTRL_TICKS_PER_TRAJ_TICK      15            // User defined #define USER_SYSTEM_FREQ_MHz                     90.0          // DSP dependent #define USER_NUM_CURRENT_SENSORS                3             // Hardware dependent #define USER_NUM_VOLTAGE_SENSORS                3             // Hardware dependent #define USER_IQ_FULL_SCALE_FREQ_Hz               806.667       // Motor dependent #define USER_IDRATED_DELTA                       0.00002       // Hardware dependent #define USER_R_OVER_L_EST_FREQ_Hz                100.0         // Motor dependent //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ // Constants //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ #ifndef MATH_PI #define MATH_PI                                    3.1415926535897932384626433832795 #endif #define USER_OFFSET_POLE_rps                     20.0    #define USER_FLUX_POLE_rps                       100.0   #define USER_MAX_ACCEL_Hzps                      20.0    #define USER_MAX_VS_MAG_PU                       0.5             #define USER_DIRECTION_POLE_rps                  6.0     #define USER_SPEED_POLE_rps                      100     #define USER_DCBUS_POLE_rps                      100     #define USER_FLUX_FRACTION                       1.0     #define USER_SPEEDMAX_FRACTION_FOR_L_IDENT     1.0     #define USER_POWERWARP_GAIN                      1.0     #define USER_EST_KAPPAQ                          1.5     #define USER_IDRATED_FRACTION_FOR_L_IDENT  1.0     #define USER_IDRATED_FRACTION_FOR_RATED_FLUX   1.0     //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ // Derived variables //‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐ #define USER_ZEROSPEEDLIMIT                      (0.5 / USER_IQ_FULL_SCALE_FREQ_Hz)  #define USER_FORCE_ANGLE_FREQ_Hz                 (2.0 * USER_ZEROSPEEDLIMIT * USER_IQ_FULL_SCALE_FREQ_Hz)  #define USER_PWM_PERIOD_usec                     (1000.0/USER_PWM_FREQ_kHz)  #define USER_VOLTAGE_SF                          (USER_ADC_FULL_SCALE_VOLTAGE_V/USER_IQ_FULL_SCALE_VOLTAGE_V)  #define USER_CURRENT_SF                          (USER_ADC_FULL_SCALE_CURRENT_A/USER_IQ_FULL_SCALE_CURRENT_A)  #define USER_VOLTAGE_FILTER_POLE_rps             (2.0 * MATH_PI * USER_VOLTAGE_FILTER_POLE_Hz)  #define USER_ISR_FREQ_Hz                         (USER_PWM_FREQ_kHz * 1000.0 / USER_NUM_PWM_TICKS_PER_ISR_TICK)  #define USER_CTRL_FREQ_Hz                        (USER_ISR_FREQ_Hz/USER_NUM_ISR_TICKS_PER_CTRL_TICK)  #define USER_TRAJ_FREQ_Hz                        (USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_TRAJ_TICK)  #define USER_EST_FREQ_Hz                         (USER_CTRL_FREQ_Hz/USER_NUM_CTRL_TICKS_PER_EST_TICK)  #define USER_MAX_CURRENT_SLOPE                   (USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz)  #define USER_MAX_CURRENT_SLOPE_POWERWARP  (0.3*USER_MOTOR_RES_EST_CURRENT/USER_IQ_FULL_SCALE_CURRENT_A/USER_TRAJ_FREQ_Hz)  #define USER_ISR_PERIOD_usec                     (USER_PWM_PERIOD_usec * USER_NUM_PWM_TICKS_PER_ISR_TICK)  #define USER_CTRL_PERIOD_usec                    (USER_ISR_PERIOD_usec * USER_NUM_ISR_TICKS_PER_CTRL_TICK)  #define USER_CTRL_PERIOD_sec                     (USER_CTRL_PERIOD_usec/1000000.0)  #define USER_MAX_NEGATIVE_ID_REF_CURRENT_A   (‐0.5 * USER_MOTOR_MAX_CURRENT)  

Page 10: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    10 

2. Running Motor Identification Code in CCS 

TI Code Composer Studio v6.1 is used to show how to load and run the motor identification code. 

2.1  Importing the Motor Identification Project into CCS 

Launch CCS v6.1. Go to Project >> Import CCS projects. The dialog window is shown below. Click on  Browse…  to  go  to  “C:\New  folder\Psim  Project\InstaSPIN\Drv8305InstaSpinMotorID”  and check the “DRV8305MotorID” project. Then click on Finish to start importing. 

 

 

 

 

 

 

Page 11: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    11 

The CCS Project Explorer will appear as shown below. 

 

2.2   CCS Target Configuration 

Before  loading  the code  to  the DRV8305 EVM, we need  to create a  target configuration  for  the DSP.  Select  View  >>  Target  Configurations.  Right  click  on  “User  Defined”  in  the  Target Configuration dialog. A dialog window will appear as shown below.  

 

 

 

Page 12: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    12 

Select New Target Configuration in the pop‐up menu. A dialog will appear as shown below.  

 

Change the file name to F28069.ccxml,  then click on Finish. A dialog named “F28069.ccxml” will appear  as  shown  in  the  figure  below.  In  the  “Connection”  box,  choose  “Texas  Instruments XDS100v2  USB  Debug  Probe”  or  a  choice  that  matches  your  hardware,  then  check “TMS320F28069” in the list box of “Board or Device”. Click on Save to save the configuration. 

 

 

Page 13: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    13 

Back  to  the  “Target  Configurations”  dialog,  right  click  on  the  “F28069.ccxml”  configuration,  and select “Set as Default” as shown in figure below. 

 

2.3   Compiling the Motor Identification Project 

To compile the project, right click on the project name “Drv8305MotorID” in the Project Explorer, and then click on Build Project in the menu. Or click on the project name in the Project Explorer to select it as the current project (the project name changes to bold). Select Project >> Build to build the project or Project >> Rebuild All to rebuild the whole project. After the compiling is complete, CCS will display the following messages in figure below: 

 

When the output file “Drv8305MotorID.out” is generated, it is ready to be loaded onto DSP. 

Page 14: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    14 

2.4 Hardware Setup for Motor Identification  

Before running the generated code on the DRV8305 EVM board, one has to set up the DRV8305 EVM and F28069M LaunchPad according to the following procedure: 

‐ Set the LaunchPad jumper and DPI switch positions as:  

Jumpers: JP1 = off, JP2 = off, JP3 = on, JP4 = on, JP5 = on, JP6 = off, and JP7 = on DIP switch S1: S1_1 = on, S1_2 = on, and S1_3=on 

‐ Connect  the DRV8305 board to connectors  J1‐2‐3‐4 of  the LaunchPad, with the DRV8305 board on top of the LaunchPad. Note that the LaunchPad has two sets of connectors, J1‐2‐3‐4 and J5‐6‐7‐8, that can be connected to the DRV8305 EVM board, and the PSIM example provided  is  for  connectors  J1‐2‐3‐4.  Make  sure  that  the  power  and  motor  connection terminals  of  the  DRV8305  board  is  on  the  same  side  as  the  USB  connector  of  the LaunchPad. The  image below shows how the DRV8305 EVM board  is connected with the F28069F LaunchPad.  

 

‐ Connect the motor to the J4 connector of the DRV8305 EVM board (MOTA = black, MOTB = red, and MOTC = yellow). 

‐ Connect the LaunchPad USB connector CON1 to the computer USB port. 

‐ Connect a 24‐V dc power supply to the J3 connector (PVDD and GND) of the DRV8305 EVM board. 

 

 

 

 

 

 

 

DRV8305 EVM

LaunchPad 

Page 15: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    15 

2.5   Running the Motor Identification Program on DRV8305 EVM 

To  load  the  program  into  DSP,  click  on  the  project  “Drv8305MotorID”  to  set  it  as  the  current 

project (the current project name will appear in bold). Then select Run >> Debug to connect the 

computer to the DSP. If the connection is successful, the program will be uploaded to the DSP, and 

the F28069 DSP will automatically reset and run to the start place of the main function as shown 

below. 

 

 

 

 

 

Start of program 

Page 16: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    16 

To run the DSP program in CCS, click on “Enable Silicon Real‐time Mode” to enable the real‐time mode, then click on “Resume” on the toolbar as shown below.  

 

If  the  Scripting  Console  is  not  displayed  in  CCS,  go  to View  >> Scripting  Console  to  display  the Scripting Console window. In the Scripting Console window, click on the “Open file” icon, and load and run the script file “MotorID.js” as shown below.  

 

 

 

 

Enable Silicon Real‐time Mode 

Script file  

Project folder  

Open file 

Resume

Page 17: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    17 

After  the  script  runs,  a  list  of motor  identification  variables will  be  displayed  in  the  CCS watch window as shown below.  

 

Click on the “Continuous Refresh” icon. Set the values of the flags gMotorVars.Flag_enableSys and gMotorVars.Flag_Run_Identify to 1 as shown below.  

 

Continuous Refresh 

Enable Flags 

Controller & Estimator States 

Motor identification variables 

Page 18: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    18 

Then the motor identification process will start. During the motor identification process, monitor the controller state gMotorVars.CtrlState  and the estimator state gMotorVars.EstState . They will change from one state to another in the following way: 

gMotorVars.CtrlState:    CTRL_State_Idle     ‐>   CTRL_State_OnLine gMotorVars.EstState:   EST_State_Idle            ‐>   EST_State_RoverL        ‐>    EST_State_Rs    ‐> 

EST_State_RampUp  ‐>   EST_State_RatedFlux   ‐>    EST_State_Ls    ‐> EST_State_RampDown ‐> EST_State_Idle 

The complete process will last around 90 seconds. 

3. Obtaining Motor and Other Parameters  

Once  the  motor  parameter  identification  process  is  completed,  one  can  obtain  the  motor parameters,  hardware  offset  parameters,  and  control  loop  PID  parameters  from  CCS’s  watch window as shown below. 

 

Motor Parameters:  

Motor parameters obtained from CCS are: gMotorVars.Rs_Ohm         =     0.3814004 gMotorVars.Lsd_H            =     0.0006486884  

Motor Parameters

Hardware Offsets

Controller Parameters

Page 19: TUTORIAL Motor Parameter Identification with PSIM · TUTORIAL Motor Parameter Identification with PSIM February 2017 Motor Parameter Identification with PSIM 2 PSIM provides ... The

          Motor Parameter Identification with PSIM 

    19 

gMotorVars.Lsq_H            =     0.0006486884  gMotorVars.Flux_VpHz    =     0.03385419 

Voltage/Current Offset Parameters:  

Voltage/current offset parameters obtained from CCS are: gMotorVars.I_bias.value[0]   =     1.000818074  gMotorVars.I_bias.value[1]   =     1.001404524 gMotorVars.I_bias.value[2]   =     1.001073182 gMotorVars.V_bias.value[0]   =     0.4976398945  gMotorVars.V_bias.value[1]   =     0.4967572689  gMotorVars.V_bias.value[2]   =     0.4971625209 

Control Loop Parameters:  

Current loop PID controller parameters obtained from CCS are: 

controller_obj‐>pid_id.Kp   =     2.42086     controller_obj‐>pid_id.Ki   =     0.039197     controller_obj‐>pid_id.Kd   =     0.0     controller_obj‐>pid_id.Kp   =     2.42086     controller_obj‐>pid_id.Ki   =     0.039197     controller_obj‐>pid_id.Kd   =     0.0 

The  parameters  obtained  from  the  motor  identification  process  can  be  entered  into  a  PSIM schematic  circuit  for  simulation.  Refer  to  the  tutorial  “Simulation  and  Code  Generation  of  TI InstaSPIN Using DRV8305 EVM.pdf” for more details.