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.

Trapezoidal output with InstaSPIN-FOC

Other Parts Discussed in Thread: DRV8312

I'm developing a motor control board using F28027F/InstaSPIN-FOC. I don't quite understand on trapezoidal waveform control.

What I want to achieve is to set the maximum duty cycle of PWM to a certain value, let's say 95%, and secondly, be able to switch back and forth sinusoidal and trapezoidal waveform on the fly.

I tried setting different values USER_MAX_VS_MAG_PU and gMotorVars.Overmodulation but I am not able to observe any obvious change in current waveform or Vbemf, using codes from lab10a.
I can observe PWM max duty cycle is changed accordingly, and current waveform is cut off at the peak & valley if USER_MAX_VS_MAG_PU is set to values lower than 1.1547.

1. How to convert PWM duty cycle (in percentage) to the value to assign to USER_MAX_VS_MAG_PU?
2. How to force InstaSPIN-FOC to output trapezoidal waveform?
3. Which will take precedence, USER_MAX_VS_MAG_PU in user.h or gMotorVars.Overmodulation?
4. Can I change gMotorVars.Overmodulation on the fly?

Thanks

  • Hi, Soon.

    What you want to do is no problem.

    1. In user.h you should leave USER_MAX_VS_MAG_PU (1.0) unless you are for sure using proj_lab10a.  In proj_lab10a you will be updating this value directly into the control structure using this set function:
     CTRL_setMaxVsMag_pu(ctrlHandle,gMotorVars.OverModulation);

    But once you know you are using proj_lab10a as your code based - and are using the special svgen_current module - you can hard code this in your user.h

    2. The modulation will go trapezoidal with a value of (1.3333)

    3. In proj_lab10a, gMotorVars.Overmodulation is writing to the controller the value you want to use.  You should leave user.h USER_MAX_VS_MAG_PU (1.0) at all times unless you are sure you are using the svgen_current.c in your project

    4. Yes, but you should be careful, if you are commanding more torque/speed than can be provided by the current modulation and you change the modulation you will get a sudden increase which could potentially fault your inverter (that depends on your inverter design and power supply)

     

  • 1. I noticed that gMotorVars.OverModulation is initialized to USER_MAX_VS_MAG_PU, is this the only usage of USER_MAX_VS_MAG_PU?

    2. Must be something wrong with my codes that I don't see any changes.

    4. When running in speed control loop, what I'd expect is the speed/torque maintains, and the waveform will go trapezoidal, is this correct?

  • 1. USER_MAX_VS_MAG_PU is pushed into gUserParams and set as the default for the .OverModulation variable

    2. Yes, must be

    4. If you are hitting your speed/torque and you change the modulation, you won't see any change. With .OverModulation set to 1.0 run the motor as fast as possible (this is even beter done in Torque Mode where the speed controller won't cause any degradation).  Note the maximum speed.  Reduce the speed and increase Modulation to 1.15. Find a new maximum speed.  Reduce speed.  Increase .OverModulation to 1.333 and find new maximum.  It is only when you NEED the extra voltage to reach your Torque/Speed reference that the swtiching scheme will change to effect the voltage/current of the motor.

     

  • Hi Chris,

    Thanks for the explanation, I tried that and with over-modulation I can achieve higher speed on my motor. Unfortunately what I want is to force trapezoidal waveform output at PWM duty cycle below 100% (USER_MAX_VS_MAG_PU =1.0), is this possible?

    I am doing this because my (loaded) motor current waveform when reaching ~180rpm starts to have sudden increase at the peaks, causing vibrations, and can only achieve 185rpm. I need to drive it to 200~220rpm. Was hoping I can use trapezoidal to achieve higher speeds, while staying under a PWM duty cycle threshold.

    Rs=0.4, Ls=0.0002, Flux=0.177, Pole=8 pairs. 12V/4A, 3-phase PM.

    Currently I am testing on both DRV8312 kit and custom hardware, both setups are facing the same problem.

    Since we are at it, can field weakening be used when USER_MAX_VS_MAG_PU set to 1.0?

  • "I am doing this because my (loaded) motor current waveform when reaching ~180rpm starts to have sudden increase at the peaks, causing vibrations, and can only achieve 185rpm. I need to drive it to 200~220rpm. Was hoping I can use trapezoidal to achieve higher speeds, while staying under a PWM duty cycle threshold."

    1. I suggest testing this first in torque mode. Find out how fast you can go under load with an IqRef_A of your maximum current and Modulation of 1.0.  Then, using lab10 (you will need to update the .c to take the controller out of speed loop mode) try the same and just start increasing your Modulation to 1.33

    The svgen and svgen_current don't support going into an earlier trapezoidal mode as-is.  It will use sinusoid and then space vector and then trapezoid to product the voltage output required.  You can probably update this to meet your needs, but you would have to insure that you are getting valid current samples for FAST each cycle.

    Yes, you can add field weakening (a negative IdRef_A) whenver you like. It doesn't make any sense to do so unless you have used up the voltage available under your maximum modulation allowed though.  But if you are at 1.0 and maxed out on speed, adding negative IdRef_A will allow you to go faster (assuming your speed or torque ret point is above the feedback and your motor has sufficient Bemf to reduce of course).