Hello,
I am implementing a PWM control system on an RT Box using the PWM Out block. In my control algorithm, I need to perform a sampling operation exactly at the positive peak of the triangular carrier used by the PWM Out block, once per PWM period.
Is it possible to obtain a trigger or synchronization signal corresponding to the positive peak of the internal PWM carrier?
If the internal carrier signal is not accessible, I could generate a separate triangular waveform in the model and use its peak to generate the sampling trigger. However, how can I ensure that this additional carrier is strictly synchronized with the carrier used internally by the PWM Out block?
In particular, I would like to ensure that:
Both carriers use the same time base and switching period.
Their phases and initial counter states are aligned.
No phase offset or accumulated drift occurs during real-time operation.
Does the PWM Out block provide access to its carrier counter, a synchronization event, or another signal that can be used for carrier-peak sampling? If not, what is the recommended way to implement this on an RT Box?
Thank you!