MATLAB Answers

Zero Crossing Detection in Simscape (specifically SimHydraulics)

14 views (last 30 days)
I run a lot of simulations using Simscape, mostly in SimHydraulics. I find that for almost all of my simulations, which vary in physical complexity from moderate to heavy, attempting to run with zero crossing detection enabled brings the solver to its knees (at best, solutions take hours, at worst, they error out due to excessive zero crossings). I find that the most problematic blocks appear to be orifices (which I think fail due to the integral ABS function) and any component with a hard stop (such as a hydraulic cylinder).
I am close to giving up and running all of my models with zero crossing detection disabled by default, but I've read that it can compromise solution accuracy. The help documentation is vauge as to exactly what the consequences are, so I would like to know the implications of doing this. Is the global accuracy of the solution affected, or only the signals (states) with ZCD enabled? Is the solution compromised only around the zero crossing event, or for all simulated time?
Can you give me any information specific to SimHydraulics? For example, does an orifice block solve differently with ACD disabled?
Thanks in advance for any advice.

Accepted Answer

Guy Rouleau
Guy Rouleau on 23 Aug 2011
Based on my experience, I do NOT recommend to turn off zero-crossing in a Simscape model. As you probably saw in the next link, "Disabling it can lead to major simulation inaccuracies"
The thing is that when there is a zero-crossing, the Simscape engine recomputes the Transition Initialization, see next link for where this steps is involved:
Without zero-crossing, the Simscape could miss (or see later) an event (like a step in an input signal, or the switching of an if/else statement inside an simscape file, for example).
Instead of disabling zero-crossing, I would look at the dynamics involved in your network. Most of the times, to many zero-crossings is a sign of undesired oscillations or chattering. For example, with a hard-stop, it is important to pick stiffness and damping carefully. My rule of thumb is that stiffness should be as small as possible, without compromising results accuracy. Usually a stiffness 10 times smaller does a good job. You should do something similar with hydraulic parts.
In case you do not know this submission, I recommend using the Simscape explorer, which I highlighted in that post:
It really helps identifying the source of oscillation in a model.
  1 Comment
Daniel Kluk
Daniel Kluk on 23 Aug 2011
Thanks for the reply. I did not know about the Simscape explorer tool; it looks like it will be very helpful.
I have had the same experience with hard stops; I generally try to set the stiffness just high enough to avoid excessive penetration into the stop, and then I have to increase the damping significantly to avoid oscillations.
Hydraulically, my simulations typically involve large hose and/or accumulator volumes interacting with valves and other orifices, which tend to generate oscillatory flows and waterhammer at many different frequencies. Unfortunately, these dynamics are typically what I am interested in, so simplifying them out of my simulation defeats the purpose.
I think what I will do is start modeling and debugging with zero crossing control disabled, and then enable it for my final runs--which will probably have to take place overnight.
Thanks again for the advice.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!