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.

Instaspin Lab12b speed control problem

Hi~ ,

  I am trying to control my 3-phase PMSM motor with lab12b and I use EST_getAngle_pu(obj->estHandle)  to estimation elctric angle  for controling motor speed. The PMSM set @1k rpm (SpeedRef_krpm),but I got 2k rpm (Speed_krpm)  in watch window as below.

Below is speed relation between SpeedRef_krpm and Speed_krpm.

2* SpeedRef_krpm= Speed_krpm

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

SpeedRef_krpm   Speed_krpm

0.5k rpm                1k rpm

1k rpm               2k rpm

2k rpm               4k rpm

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

I don't know the reason for speed mismatch.

Best Regards,

ShengHua

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

 rvl_ang_pu=EST_getAngle_pu(obj->estHandle);
 
--------------------------------------------
// CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData,ENC_getElecAngle(encHandle));
CTRL_run(ctrlHandle,halHandle,&gAdcData,&gPwmData,rvl_ang_pu);

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

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

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

}

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

// 2015.0706 by ysh .....

STPOSCONV_setElecAngle_erev(stObj->posConvHandle, rvl_ang_pu /*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);

}

 

  • Is you number of pole pairs correct? It seems a factor of two out :)
  • 12b is a sensored example, yet you are removing the encoder feedback and just using the sensorless estimation from FAST. So you are essentially changing your 12b to proj_lab05e.

    why are you doing this?

    your results may be as simple as having incorrect # of pole pairs (although if this is the case the Speed would still match the SpeedRef, but an actual Tachometer would show the Speed is actually different).
  • Dear RichB:

    Thanks your hint.

    After I change my motor paramer at correct pole pair (4-->2 ), the ouput speed can meet setting speed.

    Best Regards,

    Sheng-Hua

  • Dear ChrisClearman:

    Thanks your reply and I got it.
    In this project, I use a TI reslover Kit to estimaiton angle of rotator in F28035 and transmit the angle to F28069 via SPI interface in Ti-8301 Driver Board.I only want to verify the angle of rotator from reolver which can meet the angle of FAST correctly.

    This file of usr.h in FOC directory have correct pole pairs of motor parameter and I forget to modify usr.h in MOTION dirctory.
    The motor parameter should be modify in MOTION directory rather than FOC directory.
    After I change my motor paramer at correct pole pair (4-->2 ) in usr.h of MOTION directory , the ouput speed can meet setting speed.


    Best Regards,
    Sheng-Hua