How to Generate a New Pulse When Frequency Changes

MarkLin
Fri, 07 Mar 2025 19:59:13 +0000
PLECS

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

9 posts - 2 participants