Model/Solver configuration error for numerical solution

1 次查看(过去 30 天)
Hi,
I'm struggling to get the following implicit expression to solve in sumulink, which it should handle in a breeze: hGross - hf(u) = u^2/(2g)
hf(u) is a simulink block that models the frictional headloss of a hydraulic system as a function of flow velocity. hGross-hf(u) = u^2/(2g) is the implicit energy equation that determines flow-velocity.
If an explicit flow velocity is used the system solves in all tested cases. Where flow is implicitly defined in terms of the losses as above, then the model will only solve if the losses are not too great, and there comes a point as energy dissipating components are added where the model fails to solve with the following error:
"Simulink cannot solve the algebraic loop containing 'testModel/GDF/Unary Minus1' at time 0.0 using the TrustRegion-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues. To rule out solver convergence as the cause of this error, either a) switch to LineSearch-based algorithm using set_param('testModel','AlgebraicLoopSolver','LineSearch') b) reducing the ode45 solver RelTol parameter so that the solver takes smaller time steps. If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification."
I have tried fiddling with various solvers and settings but nothing seems to solve. It occurs to me that the problem may be with 0 or -ve values for flow... Water clearly doesn't flow up hill and the actual solution would always be a positive flow-rate, but maybe the model needs to handle the reverse flow case in order to evaluate all iterations?
I have tried the following: 1) All flow direction insensitive values such a reynolds number, friction factors and k values are defined in terms of abs(u).
2) In the block for the above energy equation i pass abs(u) to the sqrt(u) function then make the output flow negative if (H-HF < 0)
3) I have tried constraining signals using saturation blocks (HF: 0 ... hGross, u: 0...inf, etc)
None of these things seem to make a difference and as a new simulink user i'm poking in the dark somewhat, so any pointers would be most appreciated.
Kind Regards
Chris

回答(1 个)

Walter Roberson
Walter Roberson 2015-7-20
  1 个评论
chris tonic
chris tonic 2015-7-20
Great thanks Walter,
I've definitely got an algebraic loop and will read up on discrete and continuous time blocks. Your link also led me to references to Initial Condition and Algebraic Constraint blocks, which i'd not heard of either and might help.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by