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

조회 수: 6 (최근 30일)
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

채택된 답변

Sebastian Castro
Sebastian Castro 2017년 4월 25일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating Custom Components and Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by