Add fluids to Simscape model using twoPhaseFluidTables()
29 views (last 30 days)
Show older comments
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.
The function works like this (see : https://www.mathworks.com/help/simscape/ref/twophasefluidtables.html#d126e116310 )
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 Comment
Yifeng Tang
on 29 Sep 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.
Accepted Answer
SAI SRUJAN
on 5 Oct 2023
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 Comments
Yifeng Tang
on 11 Oct 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.
More Answers (0)
See Also
Categories
Find more on Two-Phase Fluid Library in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!