Borrar filtros
Borrar filtros

Add fluids to Simscape model using twoPhaseFluidTables()

18 visualizaciones (últimos 30 días)
Ilan el 28 de Sept. de 2023
Comentada: Yifeng Tang el 11 de Oct. de 2023
In my Heat-pump Simscape model, i want to test several refrigerants.
One solution I saw is to use twoPhaseFluidTables() with CoolProp to import properties of your fluid, and use the bloc Two-Phase Fluid Properties (2P) where you can add this properties.
However, since I would like to test several fluids, I want to automate the process bu calculating uRange and pRange with CoolProp.
I have tried several things by calling Tmax/Tmin and Pmax/Tmin to calculate the U range and the P range, but I have always issues.
Do you have any solution to determine uRange and pRange ?
  1 comentario
Yifeng Tang
Yifeng Tang el 29 de Sept. de 2023
I've never tried to do this for many cases such that it requires a script to automate things, but finding the right U range and P range can be a headache even for one fluid. The most common error message is that Coolprop or RefProp can't return a value for some corner values, usually at high pressure.
I'm wondering if you can write a script to query individual points first in the corner regions, using the wrapper function for Coolprop. If it returns an error, reduce the P & U and try again. If it runs OK, expand the P & U. Basically iteratively finding a big rectangular region where the P & U ranges are large and valid.
Just a thought. Hope it helps.

Iniciar sesión para comentar.

Respuesta aceptada

SAI SRUJAN el 5 de Oct. de 2023
Yifeng Tang ha marcado con alerta este/a respuesta
Hi Ilan,
I understand that you want to automate the process of testing several fluids by caluculating the "uRange" and "pRange" using "Coolprop".
To determine the uRange and pRange for the Simscape model, follow these steps using CoolProp:
  • Install CoolProp: Ensure CoolProp is installed on your system (installation instructions available at Coolprop website).
  • Import CoolProp
  • Calculate temperature and pressure ranges: Use CoolProp functions to determine the minimum and maximum temperature (Tmin and Tmax) and pressure (Pmin and Pmax) values for each refrigerant.
  • Set uRange and pRange: Assign the minimum and maximum temperature and pressure values to uRange and pRange variables, respectively.
  • Utilize the calculated ranges: Pass the uRange and pRange variables to the twoPhaseFluidTables() function in your Simscape model. This enables importing properties of different refrigerants and automates the testing process.
By following these steps, you can determine the uRange and pRange values for your heat-pump Simscape model using CoolProp and automate testing with different refrigerants.
You might encounter an error message for some corner values, usually at high pressure.This issue can be addressed by utilizing the wrapper function designed for CoolProp.
You can find the documentation to wrapper function at Coolprop website.For further insights, I have provided links to relevant documentation.
  2 comentarios
Ilan el 11 de Oct. de 2023
Hi !
Thank you for your answer. I understand your words, but my problem is at your fourth point. Here's my matlab script :
fluid = 'R1234yf';
Tmin = py.CoolProp.CoolProp.PropsSI('Tmin',fluid);
Tmax = py.CoolProp.CoolProp.PropsSI('Tmax',fluid);
Pmin = py.CoolProp.CoolProp.PropsSI('pmin',fluid);
Pmax = py.CoolProp.CoolProp.PropsSI('pmax',fluid);
Umin = py.CoolProp.CoolProp.PropsSI('U','P',Pmin,'T',Tmin,fluid)*10^-3;
Umax = py.CoolProp.CoolProp.PropsSI('U','P',Pmax,'T',Tmax,fluid)*10^-3;
FluidTables = twoPhaseFluidTables([Umin,Umax],[Pmin*10^-6,Pmax*10^-6],25,25,60,fluid,'py.CoolProp.CoolProp.PropsSI')
However I have an error that I didn't succeed to solve :
Error using assert
Minimum pressure (0.031508 MPa) must be greater than triple point pressure or minimum valid pressure (0.031508 MPa) for R1234yf.
Error in twoPhaseFluidTables (line 101)
assert(pRange(1) > p_triple, ...
Error in Script_Fluids_Simscape (line 10)
FluidTables = twoPhaseFluidTables([Umin,Umax],[Pmin*10^-6,Pmax*10^-6],25,25,60,fluid,'py.CoolProp.CoolProp.PropsSI')
I have tried several things to solve this error but the only solution I found was iterative and by feeling.
Since i want to automate the process, it's not a solution for me to do it for every single refrigerants. Using minimum and maximum temperature and pressure values to uRange and pRange variables, respectively seems to not be the solution.
Thank you.
Yifeng Tang
Yifeng Tang el 11 de Oct. de 2023
After reading the error message, I wonder if it can be resolved by increasing pmin by a small amount, like multiplying by 1.01. Looks like the pmin from CoolProp happens to be the triple point, and Simscape doesn't like that.

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Foundation and Custom Domains en Help Center y File Exchange.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by