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.

Apply speed control Algorithms in Drv8301-69M

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE

Hi ~
 
I use a Ti kit of "8301+F28069" to control PMSM with a resolver.
My control architecture is a "Sensored Field Oriented Control to control 3-Phase Permanent Magnet Synchronous Motors" as below.
 
The project is based the lab12b of Motorware MOTION. After finishing motor parameter identification, I have already controled the speed of motor using SpinTAC Velocity Algorithm within Ti software.
 
In this project , I hope to modify my control alogrithms(PID ,Fuzzy, ...etc ) to replace the algorithm of SpinTAC Velocity Algorithm .
Is it possible to apply speed control algorithm in it? How can I do it?
 
 
 
Below is my program code.

interrupt void mainISR(void)

{

static uint16_t stCnt = 0;

CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle;

// toggle status LED

if(gLEDcnt++ > (uint_least32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz))

{

   HAL_toggleLed(halHandle,(GPIO_Number_e)HAL_Gpio_LED2);

   gLEDcnt = 0;

}

---------------------------------------------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----------------------------------------------------------

// compute the electrical angle

ENC_calcElecAngle(encHandle, HAL_getQepPosnCounts(halHandle));

 
--------------------------------------------
 CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData,ENC_getElecAngle(encHandle));

---------------------------------------------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----------------------------------------------------------

}

void ST_runPosConv(ST_Handle handle, ENC_Handle encHandle, CTRL_Handle ctrlHandle)

{

ST_Obj *stObj = (ST_Obj *)handle;

// get the electrical angle from the ENC module

   STPOSCONV_setElecAngle_erev(stObj->posConvHandle, ENC_getElecAngle(encHandle));

   if(USER_MOTOR_TYPE == MOTOR_Type_Induction) {

     // The CurrentVector feedback is only needed for ACIM

     // get the vector of the direct/quadrature current input vector values from CTRL

     STPOSCONV_setCurrentVector(stObj->posConvHandle, CTRL_getIdq_in_addr(ctrlHandle));

   }

// run the SpinTAC Position Converter

STPOSCONV_run(stObj->posConvHandle);

if(USER_MOTOR_TYPE == MOTOR_Type_Induction) {

// The Slip Velocity is only needed for ACIM

// update the slip velocity in electrical angle per second, Q24

SLIP_setSlipVelocity(slipHandle, STPOSCONV_getSlipVelocity(stObj->posConvHandle));

}

}

void ST_runVelCtl(ST_Handle handle, CTRL_Handle ctrlHandle)

{

   _iq speedFeedback, iqReference;

   ST_Obj *stObj = (ST_Obj *)handle;

   CTRL_Obj *ctrlObj = (CTRL_Obj *)ctrlHandle;

   // Get the mechanical speed in pu

   speedFeedback = STPOSCONV_getVelocityFiltered(stObj->posConvHandle);

// Run the SpinTAC Controller

// Note that the library internal ramp generator is used to set the speed reference

   STVELCTL_setVelocityReference(stObj->velCtlHandle, TRAJ_getIntValue(ctrlObj->trajHandle_spd));

STVELCTL_setAccelerationReference(stObj->velCtlHandle, _IQ(0.0));// Internal ramp generator does not provide Acceleration Reference

STVELCTL_setVelocityFeedback(stObj->velCtlHandle, speedFeedback);

STVELCTL_run(stObj->velCtlHandle);

// select SpinTAC Velocity Controller

iqReference = STVELCTL_getTorqueReference(stObj->velCtlHandle);

// Set the Iq reference that came out of SpinTAC Velocity Control

CTRL_setIq_ref_pu(ctrlHandle, iqReference);

}

 
  • I suppose you can.
    The output of the speed controller is an Iq_Ref to the torque control system.
    Your speed controller needs to output this Iq_Ref_pu to the control system

    iqReference = output of your speed controller
  • Dear ChrisClearman:

    Thanks your help and I will try later.

    Best Regards,

    ShengHua

  • Dear ChrisClearman:

    After applying PI speed control algorithm, we can correctly control the motor speed. Thanks a lot.

    Best Regards,

    ShengHua

    //  Below is my partial program code ........................................................................

       Kp=(gMotorVars.SpeedRef_krpm-gMotorVars.Speed_krpm);

       Ki=Ki+(gMotorVars.SpeedRef_krpm-gMotorVars.Speed_krpm)/10000;

       ctr_gain=Kp+Ki;

       iqReference= _IQmpy(ctr_gain,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A));

       CTRL_setIq_ref_pu(ctrlHandle, iqReference);

    // ..................................................................................................................................

  • that's interesting...I'm not sure the logic you have used to create this mapping of speed difference to Kp or Ki....this means when speed ref = speed est your gains will be 0. and then your iqRef will end up being zero. it really makes no sense.
  • Dear ChrisClearman:

    Thanks your hint.

    In our algorithm, the ctr_gain for IqRef to control motor speed should be able to hold a constant value of Ki even through Kp=0 when speed reference is equal to speed estimation. I am not sure whether it is right or is there a better alogrithm for speed control of motor?

    //    Below is partial program code for speed control .....

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Ts= 1/10000;  // 10kHz

     Ki=Ki+(gMotorVars.SpeedRef_krpm-gMotorVars.Speed_krpm)*Ts;

      ctr_gain=Kp+Ki;

      iqReference= _IQmpy(ctr_gain,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A));

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Best Regards,

    ShengHua

  • I'm sorry, I don't understand your method of setting Kp = 0 when you are close to your speed reference....maybe in the case of a very stable load system, but not typically.

    I hope it's working for your system.
  • Dear Chris:

    Thanks your help.

    I found HV Motor kit with DMC used at F2803x device in the document of "Sensored Field Oriented Control of 3-Phase Permanent Magnet Synchronous Motors".
    I have a question for Digital Motor Control (DMC) library. Can we use the library to control and drive PMSM motor in Drv8301-F28069 device?

    Best Regards,
    ShengHua

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    TI Literature and Digital Motor Control (DMC) Library
    The Digital Motor Control (DMC) library is composed of functions represented as blocks. These blocks are
    categorized as Transforms and Estimators (Clarke, Park, Sliding Mode Observer, Phase Voltage
    Calculation, and Resolver, Flux, and Speed Calculators and Estimators), Control (Signal Generation, PID,
    BEMF Commutation, Space Vector Generation), and Peripheral Drivers (PWM abstraction for multiple
    topologies and techniques, ADC drivers, and motor sensor interfaces). Each block is a modular software
    macro is separately documented with source code, use, and technical theory. For the source codes and
    explanations of macro blocks, install controlSUITE from www.ti.com/controlsuite and choose the
    HVMotorKit installation.
    • C:\TI\controlSUITE\libs\app_libs\motor_control\math_blocks\v4.0
    • C:\TI\controlSUITE\libs\app_libs\motor_control\drivers\f2803x_v2.0
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  • ShengHua Yang said:
    Can we use the library to control and drive PMSM motor in Drv8301-F28069 device?

    Yes, a sensorless version is shown here

    C:\ti\controlSUITE\development_kits\DRV830x-HC-C2-KIT_v105\PM_Sensorless

    the default build configuration is for F2803x, but you can change (right click on the project --> Build Configurations --> )

    For sensored you could use this as starting point and add in sensored code from the HVKit.

    Note this is for the standard F28069 device. If you are using the InstaSPIN version of the controlCARD (69M) you may have some problems as the project does use some tables from ROM which may not be in the same location on the 69M device. 

  • Dear Chris:

    I got it. Thanks a lot.

    Best Regards,
    ShengHua