Solving 1001 consecutive zero-crossings caused by a comparator

I am trying to simulate a synchronous rectifier using a control scheme to output constant voltage/current/power. However the range of the reference into the PI controller is very limited and is not allowing to fully explore capabilites of my circuit. The problems seems to be with the comparator that I am using, but I do not find any other options in PLECS. When I change the maximum number of consecutive zero crossing to 0, the simulation runs extremely slowly. I have attached my model. Could someone suggest how to solve this problem?

Active_rectifier.plecs (56.5 KB)

I believe there is an underlying design issue in your system/controller design. The change in Po * Kp following a switch event can exceed the other comparator threshold, causing the switch state to toggle. There is no limitation on the switching frequency in the circuit, so zooming in on the comparator output when the comparator inputs cross each other clearly shows this issue.

One can implement a comparator with hysteresis or reduce the PI gains (e.g. Kp=1), but neither of these really fixes the underlying issue in my opinion.

Is there supposed to be a minimum on-time, fixed switching frequency, or something similar for this circuit?