Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Issue of multiple Zero-crossing events during small time duration- ERROR

0 votes
My simulation works sometimes without and sometimes with the message:

Simulink will stop the simulation of model 'MODEL_NAME' because the 1 zero crossing signal(s) identified below caused 1000 consecutive zero crossing events in time interval between Time_INSTANT1 and Time_INSTANT2.

Depending on the initial condition I set or the instant circuit breaker is turned on/off, initial phase angle of the source and many other parameters.

My question is: What are the recommended actions we should take during the design of the circuit to avoid this error. It can turn out to be quite annoying since you are forced to try out many different initial settings that would make the circuit work. Thanks!
asked Aug 6, 2021 by adeel1 (27 points)

1 Answer

0 votes
Best answer
The error message is model dependent.  The message indicates a particular signal that is toggling back and forth during successive solver steps.  The error message will point you towards the component with the zero crossing issue.  The sensitivity to initial conditions may mask an underlying issue in your model.

If you post your model, I can give you more concrete suggestions on potential sources of this error.  Two common causes are comparators without hysteresis and comparators used in modulators without a fixed switching frequency.
answered Aug 17, 2021 by Bryan Lieblick (1,515 points)
selected Aug 30, 2021 by adeel1
Thanks for your answer. Please find attached my model with some parameters defined in the script. I am trying to control the active and reactive power injected into the grid using two control loops. The measurements available are the current through the inductor and voltage at PCC before and after the switch connecting fsine filter to the grid. I will appreciate any suggestions and if you can point out the potential sources of this error exactly.
Thanks for posting your model.  I cannot run it as-is due to the inclusion of various SimScape components.  I do not have a SimScape license, but it seems these components define a 3ph voltage source so if you could replace those I could take another look.  Also it would good if the model you posted generated the zero crossing error message.

That being said two things jumped out at me.

1. The output of the D axis current controller is changing rapidly within each switching cycle, which can lead to this error message. The quick fix is to place a zero-order hold with a duration of a switching period between the controller and the modulator.  The better solution is to take a deeper look at the control parameters, in conjunction with the zero-order hold.

2. The anti-windup scheme implemented in your PI controllers looks like it has the potential for toggling since there are many comparators without hysterisis.
Thanks for your comments. Please find attached the model without simscape components.

Thanks for the modified model. Some additional suggestions, which enabled me to run the model successfully.

  • Replace the triggered subsystem approach for sampling with a "Zero-Order Hold" (ZOH) block with a sample time of 1/20e3.  The triggered subsystem approach here introduces an algebraic loop.  You may want to move the ZOH location to before the modulator.
  • Change the solver type to ode23tb which is faster.

Also, the anti-windup approach you have implemented is still flawed and very sensitive to the solver settings.  One example is below, where one can see the PQ controller anti-windup logic toggling thousands of times in a very short time period. Look at the PI regulators from the PLECS library for an alternate implementation.