How to use integrator block to integrate over a switching cycle, Ts?

Hi

I want to integrate the inductor current for a converter over a switching cycle Ts and not the simulation clock time. How can I do that?

E.g Simulation running time = 0.1s, switching frequency = 15kHz, switching cycle Ts = 66.66e-6s, inductor current IL = 150 A. I want to integrate IL from 0 to Ts and compare the resultant value after each step to a reference charge value.

When I use the integrator block, it integrates IL from 0 to 0.1 giving the final result to be 15. But what I want is to repeatedly integrate from 0 to Ts.

Thanks

Sneha

The Periodic Average block in the library periodically computes the integral over a given interval and divides it by the duration to calculate the average value. To get the integral itself, you could connect a Gain block to the output. Alternatively, you could break the library link and modify the underlying C-Script to remove the unwanted division.

Thank you Wolfgang.