How to Generate a New Pulse When Frequency Changes

Dear all,

How can I generate a new pulse when frequency changes? Given the fact that the transition of the switching frequency for a PWM completes only in less than 1 ns (in simulation it is almost a vertical straight line changing from 1 frequency value to another value), how can I detect a frequency change and then generate a new pulse (with duty cycle 50%, starting at rising edge) and repeat until next frequency change hits?

An example switching frequency and the pulse generator I am using are shown in the following figures:


Instead of using a rectangular pulse generated at the beginning of simulation or a delayed block, I need to produce a completely new pulse when detecting a frequency change (we don’t know when the frequency will change).


(Fig. Testing system)

GenerateANewClockBasedOnFSW.plecs (44.4 KB)

Thank you!

Sincerely,
Mark Lin

Mark - have you considered the Variable Frequency PWM block in the PLECS library?

Hi Bryan! Yes, I have tried the latest version of Variable Frequency PWM block in the PLECS library. However, it doesn’t work when I have multiple bridge-legs interleaved together with variable frequency. Especially during the frequency transitions, I always get the asymmetric current spikes.

Thanks for the update Mark. It’s hard to envision exactly what you’re looking for without further details such as a drawing of exactly you envision the synchronization between the PWM for various channels.

I can make a few genera recommendations:

  • You can peruse the forum for other posts about variable frequency ramp generation, such that you can directly control your carrier. Some examples include post1 and post2.
  • You can also use the TI C2000 block which has some more advanced features for offline simulatoin. See this post,

Thank you for the information Bryan! We are looking for a perfect synchronization between different PWMs without any carrier jumps. As shown in the attached figure, there are noticeable carrier jumps in the second subplot when switching frequency changes, which we believe is the cause of the inductor current spikes.

I will look at the posts you recommend. In the meanwhile, do you have any specific suggestions for us to eliminate the carrier jumps and the corresponding current spikes?


(Fig. Clocks, carriers, discrete switching frequency, inductor current for four bridge-legs)