Opened 6 years ago
Last modified 5 years ago
#5275 new defect
Backend issues with ThermalSeparation library — at Version 9
Reported by: | Per Östlund | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | Backend | Version: | v1.14.0-dev-nightly |
Keywords: | Cc: | Willi Braun, Karim Adbdelhak, thomas.marx@…, Andreas Heuermann, Per Östlund, schmitz@… |
Description (last modified by )
Most of the ThermalSeparation library now flattens using the new frontend (-d=newInst
), but the majority of the models fail in the backend due to various issues.
Most of the failing models gives errors such as (this one is from Examples.Absorption_IdealGases):
BackendDAEOptimize.makeEquationToResidualExp failed to transform equation: column1.balanceEquations.bool_eps[1] = false to residual form!
and seem to finally fail completely with the error:
Internal error function createNonlinearResidualEquations failed
The library can be found at: https://github.com/thom-marx/ThermalSeparation
The current status of the library can be found at: https://libraries.openmodelica.org/branches/newInst/ThermalSeparation/ThermalSeparation.html
Change History (9)
follow-up: 2 comment:1 by , 6 years ago
follow-up: 3 comment:2 by , 6 years ago
Replying to Karim.Abdelhak:
What about asking the library developers to rewrite
model minimal_bool_if Boolean b; Real x; equation if time>0.5 then b = false; x = cos(time); else b = true; time = x; end if; end minimal_bool_if;
as
model minimal_bool_if Boolean b; Real x; equation b = if time > 0.5 then false else true; x = if time > 0.5 then time else cos(time) end minimal_bool_if;
?
comment:3 by , 6 years ago
Replying to casella:
Willi had the same idea, maybe it is a good idea to give out the general advice to avoid mixing types in if cases, or to avoid multiple equations in if cases in general.
I will try it with one small model, since this is only a sub-problem. Mainly the residuals for the jacobian of non-linear systems cannot be generated, quite possibly there is more to it.
comment:4 by , 6 years ago
I mean, if a variable-structure model has some structure, one should try to help the tool exploit it by making it explicit in the Modelica source code.
Ideally, the back-end should be able to do that automatically, but maybe that's asking too much in general.
comment:6 by , 6 years ago
Cc: | added |
---|
comment:7 by , 6 years ago
@thomas.marx, in your e-mail you mention that ThermalSeparation.Components.HeatExchanger.CcounterFlowHeatExchanger
is a single component, so it cannot be simulated because it's singular. In this case, please remove the experiment
annotation from the source code, because it doesn't make sense.
comment:8 by , 6 years ago
The model ThermalSeparation.Examples.Absorption_IdealGases
starts to simulate with the following script and the changes in the the PR2.
loadFile("../ThermalSeparation/package.mo"); getErrorString(); setCommandLineOptions("-d=newInst,-NLSanalyticJacobian"); getErrorString(); simulate(ThermalSeparation.Examples.Absorption_IdealGases); getErrorString();
Also we have to disable the analytical jacobian generation -d=-NLSanalyticJacobian
for some reason. I will create a separate ticket.
comment:9 by , 6 years ago
Description: | modified (diff) |
---|
The problem is, that there are if equations which get processed as residual equations and some equations which cant get processed as residual equations (boolean equations), in the same condition. A minimal example is the following:
the second equation of the else part, time = x, will be reformed to a residual equation, because x is not on the lhs. Maybe we generally want to make a better approach here? The problem here is, that now all other equations in this if equation will get reformed to residual form, which is not possible. I changed that in my local branch such that each equation pair will get processed individually, but that requires a uniform order inside the if equation to always work as intended.
For the given model i am not quite sure if this still is the problem since it is quite complex, the new error message is as follows:
Next i will try to generally skip the simplification and see if that works.