ibpsa / modelica-ibpsa

Modelica library for building and district energy systems developed within IBPSA Project 1
https://ibpsa.github.io/project1
148 stars 84 forks source link

Heater example does no longer work in OpenModelica with new medium #188

Closed mwetter closed 8 years ago

mwetter commented 9 years ago

The commit https://github.com/iea-annex60/modelica-annex60/commit/25376251ea98705b3b12fb4ba2e9d875c802e2a8 causes Annex60.Fluid.HeatExchangers.Examples.Heater_T to fail with

Annex60/Fluid/Interfaces/ConservationEquation.mo:233:7-233:37:writable] Error: Initialization problem is structurally singular, error found sorting equations 
 98: vol.dynBal.medium.p = bou.p;
5: vol.dynBal.medium.p = 101325.0;
 for variables 
 conPI.I.k(18), vol.dynBal.medium.T(108), theCon.G(6)
Error: No system for the symbolic initialization was generated.
mwetter commented 9 years ago

The case Annex60.Fluid.HeatExchangers.Examples.AirHeater_u still has an error in OpenModelica. The other three test cases with T as input signal, and with water instead of air, are working in OpenModelica.

The error message is

[...modelica-annex60/Annex60/Fluid/Interfaces/ConservationEquation.mo:141:7-141:25:writable] Error: Initialization problem is structurally singular, error found sorting equations 
 13: hea.vol.dynBal.medium.p = 101325.0;
111: hea.vol.dynBal.medium.p = vol.dynBal.medium.p;
4: vol.dynBal.medium.p = 101325.0;
 for variables 
 vol.dynBal.ports_H_flow[1](128), hea.vol.dynBal.ports_H_flow[2](44), vol.dynBal.medium.Xi[1](122), vol.m_flow_small(5)
Error: No system for the symbolic initialization was generated.

However, medium.p is 101325 Pa. It looks like OpenModelica fails to properly eliminate alias variables.

mwetter commented 8 years ago

The problem was because the mixing volume was directly connected to the pressure source. This lead in AirHeater_u to a high index DAE which OpenModelica could not handle. Adding a pressure drop element between these two components avoid this high index DAE, and now all four test cases simulate in OpenModelica.

I also changed a few parameters to get more reasonable transient response.