ibpsa / modelica-ibpsa

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

Validity range Media.Air #1542

Closed PMehrfeld closed 2 years ago

PMehrfeld commented 3 years ago

Problem

At our institute (@martinkremer, @larissakuehn) we came accross the issue that the simplifications of IBPSA.Media.Air might lead to significant temperature-related and energy-related deviations in comparison to Modelica.Media.Air.MoistAir.
For this purpose I created an example library containing two examples:

  1. CompareMediaInSimpleCircuits: Focus on temperature development (constant negative Q_flow as boundary condition).
    Leads at simulation stop time to a temperature difference of 27.07 °C - 14.59 °C = 12.48 K
  2. CompareMediaInSimpleCircuitsControlled: Focus on energy consumption (controlled Q_flow to reach ).
    Leads at simulation stop time to a relative energy-consumption difference of (46885.7-30507.3) J / ((46885.7+30507.3) J / 2) = 42.3 %

Both values are extremly significant deviations. Of course we hope to not have overseen anything while modeling this minimal example library.

The volume starts with a temperature of 50 °C and a low relative humidity and ends with a temperature of around 20 °C and a higher relative humidity (no water added).

I added the library including a ReadMe.txt: CompareMediaMoistAir.zip

Solution / Discussion

In order to create faster simulations with the IBPSA media compared to MSL media, the simplifications make sense. However, eventually a validity range (temperature, moisture/humidity) should be set and asserted. Or at least a strong indication (bold, red font or something similar) should be added to the documentation of IBPSA.Media.Air.

What do you think @mwetter?
We would welcome any discussion /explenation since this topic is probably not new to you.

mwetter commented 3 years ago

@PMehrfeld : I reproduced the problem 1, but I am not quite sure what is being modeled here. The volume is set up to have a dynamic energy balance and a steady-state mass balance. With the moist air model of the MSL, the density changes with temperature, while for IBPSA.Media.Air, density is assumed to be independent of temperature (which allows decoupling mass from energy equations). Because mass dynamics is configured steady-state, the model uses

m = fluidVolume*rho_start;

So, in the MSL test, density is d = p/(R*T); or inverse proportional to T. So density changes, but not m and not fluidVolume of the volume. I don't know what that means physically.

I went ahead and changed the model as follows: image and I set massDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial for both volumes. Then I get image

which looks plausible. So the main cause of the difference seems to be the selection of massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, together with energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, which it appears to me you selected to allow Dymola to do the index reduction with the MSL media.

Maybe best would be to set final massDynamics = energyDynamics as I don't know why a user would choose them to be different, other than maybe to work around issues related to index reduction, but then we are in this territory where it is not clear what that means physically.

mwetter commented 2 years ago
PMehrfeld commented 2 years ago

@mwetter: Thank you very much for having a deeper look into the example!

You are right, the selection of massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState does not really make sense. However, shouldn't it be possible to decouple the two dynamics, in order to define the initialization type (e. g. fixed temperature in volumes and defined m_flow(t=0) = m_flow_start in components)? This would be a reason against setting final massDynamics = energyDynamics, right?!

Furthermore, I tried to get running the original example of the MSL-media test (the closed loop instead of your revised model to an open loop). Here, when using energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, only massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState. I also enabled the inputFilter of the m_flow fan. Otherwise, I receive the DAE-index-reduction error. Probably this was the reason for using this combination in the uploaded examples. Anyway, I have no deep knowledge about the MSL-media classes.

I have heard that you discussed this issue in an project 1 meeting. Therefore, I absolutely trust your proposed changes from your last comment. However, I want to communicate my thoughts about the two above-mentioned points:

  1. Is setting final massDynamics = energyDynamics in the HVAC components really the best way?
  2. How to simulate a closed loop with IBPSA fluid components and MSL media (energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial and massDynamics NOT Modelica.Fluid.Types.Dynamics.SteadyState)?
mwetter commented 2 years ago

Next changes:

mwetter commented 2 years ago