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.

TMS320F28069F: integrate sensor and sensorless into one program

Part Number: TMS320F28069F
Other Parts Discussed in Thread: MOTORWARE, C2000WARE-MOTORCONTROL-SDK, C2000WARE

Dear Yanming Luo:

I want to integrate sensor and sensorless into one program and implement it through motorware lab10e. My plan is as follows:

1. Set the hardware and software of QEP according to Chapter 18 of InstaSPIN-FOC and InstaSPIN-MOTION User's Guide.

2. in main(),Add ENC _ Setup (....), although I still don't understand why this function needs to enter USER_ MOTOR_ NUM_ POLE_ PAIRS/ USER_ IQ_ FULL_ SCALE_ FREQ_ Hz/USER_ ISR_ FREQ_ Hz These parameters? But it does not affect my use.

3. in mainISR(),Add ENC_ run (...)/ENC_ CalcElecAngle(), using ENC_ getElecAngle (...)/ENC_ GetSpeedRPM (...) replaces EST_ getAngle_ pu(ctrlHandle->estHandle)/EST_ getFm_ pu(ctrlHandle->estHandle)。

4. In FS_ In run (...), use ENC_ GetSpeedRPM (...) replaces EST_ getFm_ pu(ctrl->estHandle)。

5. In updateGlobalVariables_ motor (...),  use ENC_ GetSpeedRPM () replaces EST_ getSpeed_ krpm(obj->estHandle)。

Is the above Solution feasible? If possible, ENC_ getElecAngle (...)/ENC_ GetSpeedRPM (...) and EST_ getAngle_ pu(ctrlHandle->estHandle)/EST_ getFm_ pu (ctrlHandle ->estHandle)How do the units of  match?

hope to get your help, thank you!

Regards,

Quan

  • Yes, you just need to replace the angle and speed from FAST estimator with the values from sensor.

    You may take a look at the lab12a and lab12b about how to use the encoder with QEP in motorWare.

     Or you may refer to the lab for the newer C2000 device in motor control SDK.

    The universal motor control lab is available in the current MCSDK, which can support a set of hardware kits and control algorithms for BLDC/PMSM drive. The kits include LAUNCHXL-F280025C, LAUNCHXL-F280039CLAUNCHXL-F2800137 with BOOSTXL-DRV8323RS, BOOSTXL-DRV8323RH, DRV8353Rx-EVMBOOSTXL-3PHGANINV, DRV8316REVM, or  DRV8329AEVM inverter board for low voltage motor . The control algorithms include sensorless InstaSPIN-FOC with FAST, Sensorless-FOC with eSMO, Sensored-FOC with incremental encoder, Sensored-FOC with hall sensor.

    C2000WARE-MOTORCONTROL-SDK: https://www.ti.com/tool/C2000WARE-MOTORCONTROL-SDK

    Universal Project and Lab User’s Guide: https://www.ti.com/lit/spruj26

    Example lab project at the folder: C:\ti\c2000\C2000Ware_MotorControl_SDK_<version>\solutions\universal_motorcontrol_lab\f28002x

    or                                                         C:\ti\c2000\C2000Ware_MotorControl_SDK_<version>\solutions\universal_motorcontrol_lab\f28003x

    or                                                         C:\ti\c2000\C2000Ware_MotorControl_SDK_<version>\solutions\universal_motorcontrol_lab\f280013x

  • Dear Yanming Luo:Thank you for your reply! There should be no problem with the interface settings of QEP, but I am not familiar with how to interface with Sensorless FOC software. For example, whether the angle and speed values involved in control mentioned above are gMotorVars in the motorware lab10e angle_ est_ pu/ gMotorVars. speed_ est_ Two pu parameters? EST_ getAngle_ pu/EST_ getFm_ Pu does not directly participate in control?, What is the range of their values? (as angle, 0-2 π? Or - 2 π to+2 π?; is the speed value scalar? What is the calculation formula of scalar?)。Of course, I may have answers to these contents after referring to the information you provided. I hope so. If me have any questions in the future, I still hope to get your help!

    Thanks!

    Regards!

    Quan

  • As mentioned above, please refer to the example project. The speed and angle is PU (per unit) format in motorWare.

  • Dear Yanming Luo:I checked the code of the Motorware Lab12b and compared it with the code of the Lab10e. I have several questions that I need help with.

    1. In speed sensorless control, EST is directly used to extract F, A, S and T parameters, while in speed sensor control, QEP+ENC+SLIP+EST mode is used to extract A and S from QEP+ENC+SLIP, and F and T parameters from EST. Is that right?

    2. Is it true that ctrlQEP function is used for speed sensors and ctrl function is used for speed sensors?

    3. With speed sensor and FS function, can the speed calculated by ENC function directly replace the speed calculated by EST?

    Thanks!

    Regards!

    Quan

  • 1. In speed sensorless control, EST is directly used to extract F, A, S and T parameters, while in speed sensor control, QEP+ENC+SLIP+EST mode is used to extract A and S from QEP+ENC+SLIP, and F and T parameters from EST. Is that right?

    No. The ST_ functions in lab12 will calculate the speed according the angle from ENC module. It's just an example for you about how to convert the encoder signals to angle with PU format. If you want to implement sensored-FOC, you don't need any functions from EST library.

    2. Is it true that ctrlQEP function is used for speed sensors and ctrl function is used for speed sensors?

    Yes.

    3. With speed sensor and FS function, can the speed calculated by ENC function directly replace the speed calculated by EST?

    Yes, you can use both angle and speed from the ENC functions.

  • Dear Yanming Luo:Thank you very much for your reply! However, there are still some problems not understood:

    1. In Lab12b's mainISR, CTRL_ Run (ctrlHandle, halHandle,&gAdcData,&gPwmData, SLIP_getMagneticAngle (slipHandle)), where SLIP_ The data format of getMagneticAngle (slipHandle) is_ Iq, but in ctrlQEP In C, void CTRL_ run(CTRL_Handle handle,HAL_Handle halHandle,

    const HAL_ AdcData_ t *pAdcData,

    HAL_ PwmData_ t *pPwmData,

    uint32_ T electricalAngle), where the data format of electricalAngle is uint32_ t. The two are inconsistent. Why doesn't electricalAngle adopt_ Iq format?

    2. My purpose is to integrate sensor and sensorless control, and use variables to control whether to use sensorless or sensorless control. In this way, I must integrate CTRL and ctrlQEP. I checked the difference between the two codes. ctrl contains all the functions of ctrlQEP, but ctrl_ Run() and CTRL_ runOnLine_ User () is different, because the electronicalAngle parameter needs to be input for sensor control, but not for sensorless control. In this way, I can create two functions and select the control method through variables, but only need one ctrl instead of ctrlQEP. Is that OK?

    Thanks!

    Regards!

    Quan

  • Adds: The experiment was conducted today (ENC and SLIP functions were added to lab10e mainISR, but they were not involved in the control), and several phenomena were not understood.

    1、EST_ getAngle_ Pu () decreases from+1 to 0 in forward operation and increases from - 1 to 0 in reverse operation, but ENC_ GetElecAngle() increases from 0 to+1 in the forward direction and decreases from+1 to 0 in the reverse direction. Only positive values have no negative values. The encoder installation direction should not affect+or -.

    2、EST_ getFm_ Pu () and EST_ getSpeed_ Krpm () tends to be the same with different values。

    What is the principle of the above phenomenon?

  • SLIP functions

    The SLIP related functions are only for ACIM.

    What is the principle of the above phenomenon?

    The connection sequence of the motor and encoder lines are not right.

    Are you working on a TI kit for evaluation? Or have selected the device to design your own board.

    If no, you may refer to the Universal lab mentioned above that includes the function you want.

  • Dear Yanming Luo:Thank you very much for your reply! 

    1. Yes, I am using ACIM, so use SLIP, use SLIP_ GetMagneticAngle(), PM uses ENC_ getElecAngle()。

    2. I directly check the count value in the QEP register. For 1000Lines, when the motor rotates for one revolution, its count value will be 0 when it is>3999. It is correct.I will further check the ENC_ The calculation process of getElecAngle()。

    3. Yes, I'm my own dashboard.

    First, solve the encoder ENC_ GetElecAngle() and EST_ getAngle_ Pu corresponds to this problem.

    Thanks!

    Regards!

    Quan

  • OK. You have to refer to InstaSPIN-motion example labs or use the speed from the FAST if you are using ACIM.

  • Dear Yanming Luo:

    1. I tried to implement FOC (without MOTION) control with sensors in motoroware lab10e, but failed. This bothered me! Can FOC routines without MOTION not be controlled with sensors? My solution is as follows: in mainISR ,call ENC _ Run() and CTRL_ Run (ctrlHandle, halHandle,&gAdcData,&gPwmData, angle_pu, speed_pu) to replace the original CTRL_ Run (ctrlHandle, halHandle,&gAdcData,&gPwmData) to pass angle_ pu/speed_ Pu two parameters, when using angle_ pu/speed_ pu = EST_ getAngle_ pu()/EST_ getFm_ Pu, running well. When using angle_ pu/speed_ pu =SLIP_ getMagneticAngle()/ENC_ When getFilteredSpeed() is running for a few seconds, the current rises to the maximum and the motor rotates unstably. If only speed_ pu = ENC_ GetFilteredSpeed, while angle_ pu = EST_ getAngle_ Pu(), running well.

    2. Last time you mentioned the reference MOTION, but my chip is 28069F. Can  use the functions or libraries associated with MOTION?

    Hope to get help!

    Regards!

    Quan

  • Add: I didn't give ENC_ getElecAngle (encHandle)=0 for correction,  not called ENC_ setZeroOffset().does it need to be corrected?

  • Refer the InstaSPIN-motion labs to use the encoder modules (ENC_ functions). All of the EST_ functions are not necessary in your project if you are using sensor based FOC.

    2. Last time you mentioned the reference MOTION, but my chip is 28069F. Can  use the functions or libraries associated with MOTION?

    No. InstaSPIN-Motion only supports F2806xM.

    For PMSM, it's must have to do for offset calibration, that should be done for ACIM as well.

  • Dear Yanming Luo:Thank you for your reply! After checking the lab12b code again, there are still several questions for help:

    1、SpinTAC.lib Is the  file also applicable to FOC without motion (such as 28069F)?

    2. In lab12b, if (stCnt++>=ISR_TICKS_PER_SPINTAC_TICK){

    ST_ runPosConv(stHandle, encHandle, ctrlHandle);

    ST_ runVelCtl(stHandle, ctrlHandle);

    stCnt = 1;

    }, Is   ST_runVelCtl (stHandle, ctrlHandle) unnecessary for FOC?

    3. At ST_ How to get speed in?

    4. In lab12b, if RAM is not used, what is the running cycle time of mainISR() in us?

    Regards!

    Quan

  • 1、SpinTAC.lib Is the  file also applicable to FOC without motion (such as 28069F)?

    No. It's for InstaSPIN-Motion on F2805xM.

    Is   ST_runVelCtl (stHandle, ctrlHandle) unnecessary for FOC?

    InstaSPIN-motion for speed control, not for FOC.

    3. At ST_ How to get speed in?

    Instaspin-Motion will calculate the speed according to the rotor angle value.

    4. In lab12b, if RAM is not used, what is the running cycle time of mainISR() in us?

    The same CPU cycles. We don't test the execution time in Flash.

  • Dear Yanming Luo:

    I check my sensor control code (lab10e) again:

    1. In main H Add # include "spintac_velocity. h"

    2. Add//init the ST_PosConv object in main()

          stPosConvHandle = STPOSCONV_ init(&stPosConv, sizeof(stPosConv));

         STPOSCONV_ setSampleTime_ sec(stPosConvHandle, _IQ(0.01));

         STPOSCONV_ setERevMaximums_ erev(stPosConvHandle, _IQ(1.0), 0);

        STPOSCONV_ setUnitConversion(stPosConvHandle, USER_IQ_FULL_SCALE_FREQ_Hz,ST_SAMPLE_TIME,       USER_MOTOR_NUM_POLE_PAIRS);

        STPOSCONV_ setMRevMaximum_ mrev(stPosConvHandle, _IQ(10.0));

        STPOSCONV_ setLowPassFilterTime_ tick(stPosConvHandle, 3);

        STPOSCONV_ setEnable(stPosConvHandle, true);

    3. Add//Run the SpinTAC Components in mainISR()

    if(stCnt++ >= ISR_TICKS_PER_SPINTAC_TICK) {

    ST_ runPosConv(stHandle, encHandle, ctrlHandle);

    stCnt = 1;

    }

    if(USER_MOTOR_TYPE == MOTOR_Type_Induction) {

    SLIP_ setElectricalAngle(slipHandle, ENC_getElecAngle(encHandle));

    SLIP_ run(slipHandle);

    SLIP_ MagAngle = SLIP_ getMagneticAngle(slipHandle);

    }

    else {

    SLIP_ MagAngle = ENC_ getElecAngle(encHandle);

    }

    CTRL_ runQEP(ctrlHandle,halHandle,&gAdcData,&gPwmData,SLIP_MagAngle,EST_getFm_pu(ctrlHandle->estHandle));

    4. In proj_ Add in lab10e. c

    void ST_ runPosConv()/void ST_ RunVelCtl() (copied from lab12b)

    5. Add SpinTAC.lib to the project, If lib is not added, the compilation cannot pass because STPOSCONV_ run(stObj->posConvHandle)/STVELCTL_ Run (stObj ->velCtlHandle) has no corresponding c file

    Abnormal operation, magnetic field angle is equal to electrical angle, slip ->incremental_ Slip=0 remains unchanged. After a few seconds, the current rises to the maximum and the motor is unstable. Can you tell me what's wrong?, and the solution?

    Regards!

    Quan

  • Are you using F2806xM device? If yes, you may try to run an InstaSPIN-motion lab directly and just need to change the encoder lines accordingly.

  • Dear Yanming Luo:No, it's F28069F. If  can't use SpinTAC lib, in lab10e, the magnetic angle cannot be calculated according to the electrical angle. Do  need to write  own code in the project to calculate the magnetic angle? If so, is there any code for reference? (You referred to eSMO last time. Is there any code for calculating the magnetic angle?),I really can't think of any better way. Please help me.

    thanks!

    Regards!

    Quan

  • As replied to you, the F28069F can't support InstaSPIN-motion includes SpinTAC lib.

    eSMO is only for PMSM motor.

    Yes, there is no sensored-FOC for ACIM in motorWare except InstaSPIN-motion, you have to write this code to convert the sensor signals to rotor angle for motor control by yourself.

  • Dear Yanming Luo:Hello, I have implemented sensor FOC in lab10e routine (it does not require motion module), the motor works normally, and the low speed torque can also reach the target value, but there are still several problems that I want to help:

    1. Does the motor parameter of the motorware routine identify the rotor leakage inductance or self inductance? If it is self induction, the calculation of rotor time constant will be a very small number, and the rotor magnetic field angle cannot be calculated, because the identified inductance value of my motor rotor parameter is less than 1mH, the rotor resistance is less than 1 Ω, and the motor power is 2.2kW. But I passed the input leakage inductance test of 30kW 220V ACIM, and there is no problem with sensorless operation. At present, I directly input the rotor time constant value, use the lab12b routine to modify and transplant it to lab10e, implement the sensor FOC (F28069F), and the motor seems to operate normally.

    2. The angle estimation value of FAST is negative when the motor reverses, but I have passed SLIP_ run(slipHandle); After calculation, convert to negative value to replace EST_ getAngle_ Pu, the motor rotates rapidly, and the angle estimation value of FAST is directly replaced without modification. The motor runs normally in reverse. Why?

    thanks!

    Regards!

    Quan

  • 1. Does the motor parameter of the motorware routine identify the rotor leakage inductance or self inductance?

    No. InstaSPIN-FOC doesn't support this for ACIM.

    . The motor runs normally in reverse. Why?

    For ACIM, you need to use the SLIP_ run for angle correction. Yes, the motor can run even the angle is not exact and only has a small error, but the motor efficiency will be lower that having an exact rotor angle.