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!
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.
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.
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.
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 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.