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.

PMSM Motor Control

Dear Friends,

I'm working on PMSM Motor Control Project (with Encoder + FOC). 

For that I've imported the HVPM Sensored code from control-suit. I've modified the code as per my requirement and achieved the speed and FOC control as per my need. 

Now it's time for production. 

In production, the drive and motor will be change every-time, so every time I've to execute the procedure of CALIBRATION ANGLE MEASUREMENT. this is not a fair way. 

Can anybody suggest me to skip this process of Calibration Angle measurement? 

What's the following line of QEP.h file means? 

v.RawTheta = EQep1Regs.QPOSCNT + v.CalibratedAngle; 

if (v.RawTheta < 0) 

{
               v.RawTheta = v.RawTheta + EQep1Regs.QPOSMAX; 

}
else if (v.RawTheta > EQep1Regs.QPOSMAX) 

{
              v.RawTheta = v.RawTheta - EQep1Regs.QPOSMAX;

}

  • Hi Chinmay,

    Can you describe the exact situation that you are trying to skip the process?

    Is it:
    1) Every time
    2) Run the process the first time the code is run, then skip every time after that
    3) Some other condition such as 2, but allowing the ability to re-run if the motor is changed
    4) Something else

    Thanks.

  • chinmay,

    if your encoder is not absolute then there exists some offset between the mechanical angle it is generating and the electrical angle. This has to be determined if you want to appropriately orient your stator field to maximize torque.

  • Dear Rick,

    Every-time I want to skip. because the code itself says the measurement of calibration angle is an optional exercise, but it can be commented after taking a calibration angle during first time motor run. 

    Is it possible? there must be any way to do so, because my problem is genuine.

    Also notice that the instruction:

    RAW_THETA = POSCNT + Calibrated_Angle; 

    Can I remove the term Calibrated_Angle from above mentioned instruction and at first index pulse, POSCNT = 0!

    after first index, I'll apply LSW = 3 (FOC). 

    is it possible? 

    If you can't understand waht I've written, then feel free to ask me, I'll explain the matter with program code. 

  • Dear Chris, 

    you are absolutely right. 

    But my Q is genuine, in production hardware, the code itself should not go to measure the calibration angle at every start-up.  Also the motor measures the calibration angle will be different as per different starting point. and for this reason, I've to start the motor in LSW = 1 (w/o FOC) upto first index pulse. 

  • Shah,

    You are right, angle calibration is not always required; you can skip it if like to do so. For maximum toque production, one need to make sure that before spinning the motor, rotor is aligned to magnetic axis of phase-A or d-axis. The Alignment is performed by applying a constant current vector to the stator phase to produce stationary magnetic field and the rotor aligns itself naturally onto this stator field. This is done by setting Id-ref to some pre-determined non-zero value, and keeping Iq-ref and park-angle variable to zero. In the code, setting lsw=0 performs this action; it basically aligns the rotor to d-axis. After this, you can start running the motor and keep reading instantaneous values of qep angle for further processing.

    Best Regards

    Milan-Motor Application Team

  • Hi everyone,

        I have several question about this topic.

       Q1:   I think v.RawTheta will not be negative, right?

       Q2:   In an  Application Report " SPRABQ2–July 2013", there is a equation  "Calibration Angle = Offset Angle ± n . Line Encoder",  what does n.line Encoder mean? I don't find this item in the example code.

       Q3:   Are there any serious results, such as unstable, vibration, over current, if I don't  implement this calibration?

        Thanks!

    Eli

  • Eli,

     For question1 and 2,  Chris from C2000 team would be able provide the right answers.

    For question 3, as I suggested in previous post, you can skip it as long as you make sure that rotor is aligned to d-axis before accelerating to get maximum torque at starting and running conditions. This is standard way followed and it would not cause any unusal behaviour you have mentioned.

    Best Regards

    Milan

  • Hello Milan,

               Thanks for your reply. I got it. If the rotor is aligned to d-axis before starting, there is a uncertain motion, may be forward or backward. Is there any solution to avoid this? Thanks!

    Best Regards

    Eli

  • Eli,

    Yes aliging to d-axis can have uncertain motion in starting in certain rotor position. To over-come this issue there are two solution:

    1. use absolute encoder or resolver which provides rotor position at standstill condition also

    2. Use Initial Position detection algorithm. This is relative challenging and topic of research. Lot of algorithms are availble on this topic. I think there is one application lib for C2000 Mcus is available at Control-suite. I could not locate the document, suggest you to post query on C2000 forum to get the details on this.

    Best Regards

    Milan 

  • Thanks very much!

  • Dear Mr. Milan,

    Here I've tried to describe the situation in briefly. 

    I'm working on PMSM Motor Control Project (with Encoder + FOC: HVPM Sensored). 

    For that I've imported the HVPM Sensored code from control-suit. I've made some modification in the code (for Motor Parameter in setting.h file) as per my Motor Specs and achieved the speed and FOC control as per my need. 

    Now it's time for production. 

    In production, the drive and motor will be change every-time, so every time I've to execute the procedure of CALIBRATION ANGLE MEASUREMENT. this is not a fair way. 

    Every time, we have to adjust the calibration angle (the difference between the Mechanical Zero & Electrical Zero) in our Micro-controller Firmware.

    We want to align the Mechanical Zero & Electrical Zero position. Is there any solution? We don't want to use Absolute Encoder. 

    Feel free to ask me any other details.

    Thanks

  • Chinmay,

    Angle calibration with index pulse is not always required so angle calibration method described Sensored FC document can be skipped. You can run the foc algorithm without depending upon index pulse.

    In the starting, before spinning the motor just make sure that rotor is aligned with d-axis. In the code, lsw=0 does the same thing; it applied constant d-axis current to align the rotor to d-axis. Depending upon the load condition, rotor may oscillate during alignment process, you have to provide sufficient align time so that rotor oscillation dies down before running.

    Best Regards

    Milan

  • Thanks Mr. Milan.

    Really very useful information you have given!