- 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.
Non-converging initial conditions issue while using custom components in simscape
4 次查看(过去 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
0 个评论
采纳的回答
Sebastian Castro
2017-4-25
I can't guarantee that any of these solutions will work, but they may be worth a try.
- Sebastian
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File 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!