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.

Realtime Switching between the Fast estimator and sensored feedback

Genius 5910 points

Hi,

I like to know if, and how, it is possible to switch between sensored and fast estimator motor feedback in my program. I compared lab 6B and Lab 13B. But I can't find it  in lab6 the angle feedback.

 Can you give me a hint?


Thanks,

 

  • Evs,

    I don't see why it wouldn't be possible.  I would recommend that you do a gradual switch since there will be slight differences between the FAST angle and the sensored angle.  If you do a immediate switch over there could be a spike in the output of your motor.  

    You can get the angle from FAST with the function EST_getAngle_pu.  Look at the ctrl.h or ctrlQEP.h files in the function CTRL_runOnline_User.  This is where the FOC is ran, and where the angle is updated.

  • Adam, Thank for the reply.

    I changed this in My MainISR:

    This line:

    CTRL_run(intr->ctrlHandle,intr->halHandle,&intr->AdcData,&intr->PwmData,ENC_getElecAngle(intr->encHandle));

    To this:

              CLARKE_run(obj->clarkeHandle_I,&intr->AdcData.I,CTRL_getIab_in_addr(intr->ctrlHandle));
              // run Clarke transform on voltage
              CLARKE_run(obj->clarkeHandle_V,&intr->AdcData.V,CTRL_getVab_in_addr(intr->ctrlHandle));
              // run the estimator
    EST_run(obj->estHandle,CTRL_getIab_in_addr(intr->ctrlHandle),CTRL_getVab_in_addr(intr->ctrlHandle),intr->AdcData.dcBus,TRAJ_getIntValue(obj->trajHandle_spd));
    CTRL_run(intr->ctrlHandle,intr->halHandle,&intr->AdcData,&intr->PwmData,EST_getAngle_pu(intr->estHandle));

    In which unit is ENC_getElecAngle also in PU? Or is there a conversion needed?

    I don't know, if the Clark transformation is done somewhere else, so Is it  needed? And probably only the voltage.

    I also didn't find something like EST_setup So isn't there one or didn't I find it.

    The big question is. Will this work?

    Ernst

  • Ernst,

    ENC_getElecAngle is in the units of PU angle.  It will vary from 0.0 to 1.0 in IQ24 for each electrical revolution in the motor.

    For FAST you need to run the CLARKE on both I and V because it uses both sets of feedback in order to do the estimation.  

    Isn't that code that you added into the ISR already running in the function CTRL_runOnLine_User in ctrlQEP.h?  I was imagining that you would do the logic to switch over between FAST angle and sensored angle within that function since at that point we have information from both angle sources.  

  • ADam,

     I didn 't find CTRL_runOnLine_User yet.

     In ctrlQEP.h on line 2089 - 2092:

     // generate the motor electrical angle
     angle_pu = EST_getAngle_pu(obj->estHandle);

     // Update electrical angle from the sensor
     angle_pu = electricalAngle;

     So This is the place to make the switch . Only this is pretty deep in the library code so switching between the angles at my application in an elegant way isn't that easy.

     

     

  • I  Still have a problem. I command out , in ctrlQEP line 2092:  // angle_pu = electricalAngle. So it use the estimator, this works fine.

    But when I remove the encoder cable, I got error 2002 in PosMoveErrorID. So the position feedback still use the encoder. Now have change that. Can you please point me where the encoder feedback is past through to the estimator?

     Thanks,

     Ernst

  • Ernst,

    The angle_pu = electricalAngle line only handles the angle for the FOC.  The angle provided to the position control is passed in via the ST_runPosConv function in the main source file.