#5769 closed defect (fixed)
Initialization of HeatingSystem model broken because of questionable choice of tearing variables
Reported by: | Francesco Casella | Owned by: | Andreas Heuermann |
---|---|---|---|
Priority: | blocker | Milestone: | 1.16.0 |
Component: | *unknown* | Version: | |
Keywords: | Cc: | Karim Adbdelhak |
Description
Please check Modelica.Fluid.Examples.HeatingSystem. The initialization fails because of a torn nonlinear system with the following unknowns:
[1] Real tank.s[2](start=2, nominal=1) [10] Real pipe.mediums[2].d(start=1, nominal=1) [11] Real pipe.mediums[2].h(start=334960, nominal=1e+006) [12] Real pipe.mediums[1].p(start=130000, nominal=100000) [13] Real pipe.mediums[1].d(start=1, nominal=1) [14] Real radiator.mediums[1].p(start=110000, nominal=100000) [15] Real radiator.mediums[1].d(start=1, nominal=1) [16] Real radiator.mediums[1].h(start=167666, nominal=1e+006) [17] Real m_flow(start=0.01, nominal=1) [18] Real tank.medium.d(start=1, nominal=1) [2] Real tank.s[1](start=2, nominal=1) [3] Real tank.ports[2].p(start=110000, nominal=100000) [4] Real sensor_m_flow.port_b.h_outflow(start=167684, nominal=1e+006) [5] Real radiator.statesFM[1].p(start=100000, nominal=100000) [6] Real radiator.statesFM[3].p(start=100000, nominal=100000) [7] Real heater.mediums[1].p(start=130000, nominal=100000) [8] Real heater.mediums[1].d(start=1, nominal=1) [9] Real pipe.mediums[2].p(start=130000, nominal=100000)
I don't know why the backend chose these variables, but it is clear to me that choosing densities, such as mediums[1].d
over enthalpies, such as mediums[1].h
, is not a good idea, because of bad sensitivity (density doesn't change much with enthalpy in liquids), and because density is not given a reasonable start value (the value is around 1000, but the start value is 1).
In principle, the start values of enthalpies are given in the model, while the start values of density are only set in the basic Modelica.SIunits
types, so I would expect enthalpies to have priority.
Another good reason to prefer enthalpies is that they are state variables. Since state variables are usualy given meaningful start values, and are usually chosen to make the computation of other stuff easy starting from them, I think they should be preferred over non-state variables as tearing variables in general.
@AnHeuermann, can you please check and report? Thanks!
I tested this with OMCompiler v1.16.0-dev.400+gfc2c716261 and everything seems to work fine! For new as well as old frontend, so i will close this ticket.