ibpsa / modelica-ibpsa

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

New refrigerant package #1093

Open cvering opened 5 years ago

cvering commented 5 years ago

What is the problem?

Currently, there are no refrigerant models within the IBPSA library. Therefore, we want to add different refrigerants (R134a and probably R410A, R32, R744 and R290).

Why do we want to solve it?

The refrigerants can be used, for example, for detailed heat pumps and refrigerating machines simulation models

How do we want to solve it?

We will use the approach presented by Sangi et al. (see paper “A Medium Model for the Refrigerant Propane for Fast and Accurate Dynamic Simulations”; http://www.ebc.eonerc.rwth-aachen.de/go/id/dncb/file/227214). Sangi et al. calculated functions for the density, specific enthalpy and specific entropy for the three different regimes supercooled, superheated and two-phase. Focusing on high accuracy, we need to have six regions, that need to be implemented. These are not necessarily thermodyanmic regions, but they allow good fitting results within our model development. The regression functions were polynomial and fitted to the inverse energy equation of state.

Who do we think will benefit from our solution?

We think that everyone will benefit from the models who needs refrigerants without using external media libraries. Moreover, the presented approach allows a fast and accurate simulation and, therefore, contributes to everyone who will focus the simulation speed.

cvering commented 5 years ago

Hi all,

within the Refrigerant Package, we found a simople model of R410A. As you can see here: https://github.com/RWTH-EBC/AixLib/tree/development/AixLib/Media/Refrigerants we had to rename our R410A to R410A_HEoS. Ensureing consistent naming, it would be helpful to rename or move your recent R410A model.

All the best, Christian

MassimoCimmino commented 5 years ago

Regarding the issue @cvering pointed out on the conflict with the already implemented R410A model:

Or,

Mathadon commented 5 years ago

Some thoughts about refrigerant models: whenever there is a function e.g. setState_phX its inverse setState_pTX exists, which allows to go from specific enthalpy to temperature and back. When these two functions are not each other's exact inverse (which is usually the case unless you take particular care on how to set up the polynomials) then energy is not conserved when you mix the equations. That's something we have to be careful of, I think. So in that case it may be better not to implement the function inverses and to choose the implementation that is most efficient, i.e. the implementation that causes the simplest algebraic loops. If the polynomials are each other's mathematical inverse then there is no problem =)

cvering commented 5 years ago

Hey all! Thank you for the hints. We will prove this :) All the best, Christian

mwetter commented 5 years ago

If setState_phX and setState_pTX are not exact inverse, we will get problems when comparing results across simulators, as one tool may pick the first and the other the second version, leading to results that differ.

Mathadon commented 5 years ago

The same argument holds for from_dp though, where we do not use the exact mathematical inverse.

thorade commented 5 years ago

A basic test for numerical consistency could look similar to: https://github.com/thorade/HelmholtzMedia/blob/master/HelmholtzMedia/Examples/ConvergenceTest/SinglePhase_setState_a.mo

thorade commented 5 years ago

It seems a quite similar check is already used: https://github.com/RWTH-EBC/AixLib/blob/development/AixLib/Media/Refrigerants/Validation/RefrigerantInversions.mo

lcsgoulart commented 4 years ago

Hello everyone,

How is this project going? I'm new to Modelica and would like to simulate CO2 Heat Pumps, but I am having trouble finding a Package with CO2 media avaiable. Is there any?

thorade commented 4 years ago

There is CO2 in HelmholtzMedia, but as it uses the full Helmholtz energy equation of state for everyhting, it is a bit slow. Testing it should be easy, feel free to file issues. For a big speedup, some spline based approach like SBTL would have to be used.

cvering commented 4 years ago

Hello Icsgoulart! Thank you for your request. I haven't merged my CO2 model, yet. You can use this model: https://github.com/RWTH-EBC/AixLib/tree/issue665_newRefrigerantsModelsR744R32 until I find some time to merge it here. All the best Christian

lcsgoulart commented 4 years ago

Thank you! Is there any place that I can ask questions about the usabiliy of the AixLib? I'm trying to use it with OpenModelica, but there are some many errors that I don't understand... At first I wanted to use the EvaporatorCondenser Model with R744.

cvering commented 4 years ago

Dear Icsgoulart, thank you for interest in using our models. You can start a new Issue within the AixLib, if you have detailed questions on a recent model. The workflow is described in our wiki. Nevertheless, we are developing our models in Dymola and we only prove OpenModelica checks. Therefore, I cannot guarantee that our models run in OpenModelica.

carlesRT commented 3 years ago

I wanted to use Fluid.HeatPumps.ScrollWaterToWater with R134a, so I implemented R134a following the same approach as the one used for Media.Refrigerants.R410A. I just realize there is a pull request open with R134a and some other refrigerants, see #1180. So... not sure it makes sense for upload my models. What is the status? Thanks!

cvering commented 3 years ago

Hey Carles, thanks for your contribution. I guess your approach is the same as MassimoCimmino developed for his heat pump model published at Modelica Conference 2017. These are (I guess) polynomial functions that were fitted to measurement data leading to fast evaluation of thermodynamic states. This model is already available in the master branch. In #1180 are more detailed fluid property models which base on the reduced Helmholtz Equation of State (HEoS), which yields wider validity area (and often better accuracy). Thus, we will merge the detailed property models soon. Since there are naming conflicts (e.g. R134a from MassimoCimmino and R134a from HEoS), we need to carefully distinguish between the two (and any further).

carlesRT commented 3 years ago

Hi @cvering, thanks for the status update 👍 . I will then just wait and see if you keep both approaches.

MassimoCimmino commented 3 years ago

@carlesRT If it can help you with your issue while #1180 is still in development. I have an old branch here that links the ScrollWaterToWater model with the package HelmholtzMedia.

@cvering : This is something to eventually consider to make the existing model compatible with your refrigerant models.

carlesRT commented 3 years ago

Thanks @MassimoCimmino, I will have a look and cross check it with my results.