Filter löschen
Filter löschen

Non-converging initial conditions issue while using custom components in simscape

3 Ansichten (letzte 30 Tage)
Hello again everyone, I'm actually working on modelling hydraulic systems, and I had to create my own custom simscape block with this code:
It's quite similar to the hydraulic restive pipe in the foundation library, the main difference is that it uses a relation of type: p = K * q^2 .
In order to test the block, I made this simple model:
with a pressure source at 25 bars (as an example). When running the simulation, I have the common error: Initial conditions failed to converged .. Equations (including nonlinear equations) of one or more components may be dependent or inconsistent with almost all of the components being involved. If I replace it with the foundation's hydraulic restive tube, there's not any problem. After trying to understand where the mistake come from, I have noticed (by tinkering the equations) that the fact that the relationship between p and q is not linear ( p = r * q) but quadratic (p = r' * q^2) is the origin of the issue.
Any idea of why ? And if you fave any idea of solution, I'm all opened !
Don't hesitate to ask,
Thanks in advance

Akzeptierte Antwort

Sebastian Castro
Sebastian Castro am 25 Apr. 2017
I can't guarantee that any of these solutions will work, but they may be worth a try.
  • Try handling the negative pressure/flow rate condition to give results that make physical sense, e.g. p = r * sign(q)*q^2
  • Instead of p = r *q^2, try using sqrt(p) = sqrt(r) * q. I've heard that avoiding large numbers from exponentiating physical quantities can be helpful.
  • Add a small "linear threshold" region. For example, p = r*q for abs(q) < 0.01, and quadratic outside that range. A lot of blocks, like the mechanical friction blocks, have something similar going on to improve numerical stability around zero.
- Sebastian

Weitere Antworten (0)

Kategorien

Mehr zu Creating Custom Components and Libraries finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by