Error using System-Level Refrigeration Cycle (2P)

Hi
while shifting from r134a to ammonia i get this strange error message :"The values in the table grid vector are not strictly monotonic".
the same cycle run normally with r600a or with r1234yf. can you guys help me solving this issue? I'd really like to test the ammonia behaviour.
carlo

Antworten (2)

Yifeng Tang
Yifeng Tang am 30 Jun. 2023

0 Stimmen

Hi Carlo,
We believe the error has to do with the fact that NH3 has a non-monotonic supercritical line. It needs to be fixed in the future.
For now, the easiest workaround is to use the Two-Phase Fluid Properties (2P) block instead, and get NH3 properties from REFPROP or Coolprop for a pressure range below the supercritical line. You can use the twoPhaseFluidTables command to generate the tables needed. You will need either REFPROP or Coolprop on your computer though.
I tried this:
NH3props = twoPhaseFluidTables([10,2000],[0.01,10],25,25,60,'Ammonia','C:\Program Files (x86)\REFPROP\')
gcb % select the Two-Phase Fluid Properties (2P) block when you do this
twoPhaseFluidTables(gcb,NH3props)
And it seems to work OK.

6 Kommentare

Hi Yifeng,
yes this problem is identical to mine. However, I can't figure out how to enter the code string in matlab to directly define the ammonia parameters.
Not using REFPROP not being integrated in the free version ammonia but CoolProp how should I proceed?
I have tried in entering the various vectors in the Two-Phase Fluid Properties (2P) block, but I get lost in entering the data.
twoPhaseFluidTables also works with CoolProp. See Documentation. The syntax seems to suggest that you'll need Python, likely the wrapper for CoolProp.
Hi,
I downloaded and instaled with success both python and coolprop. while this example command (r134aTables = twoPhaseFluidTables([80,500],[0.001,3],25,25,60,'R134a','py.CoolProp.CoolProp.PropsSI'))provide me the strut with all the paramenters useful when I am switching to ammonia a suggested above (twoPhaseFluidTables([10,2000],[0.01,10],25,25,60,'Ammonia','py.CoolProp.CoolProp.PropsSI') I obtain this list of error:
Error using twoPhaseFluidTables>coolpropFluidProperties
CoolProp failed to return fluid properties at P = 0.1 MPa, U = 10 kJ/kg.
Error in twoPhaseFluidTables>@(p,u)coolpropFluidProperties(p,u,substance,coolpropFun) (line 789)
fluidProperties = @(p, u) coolpropFluidProperties(p, u, substance, coolpropFun);
Error in twoPhaseFluidTables (line 233)
= fluidProperties(p(j), u_liq(i,j));
Error in NH3 (line 4)
nh3props=twoPhaseFluidTables([10,2000],[0.1,10],25,25,60,'ammonia','py.CoolProp.CoolProp.PropsSI')
Caused by:
Error using CoolProp/CoolProp.__Props_err2
Python Error: ValueError: unable to solve 1phase PY flash with Tmin=239.585, Tmax=1087.5 due to error:
HSU_P_flash_singlephase_Brent could not find a solution because Umolar [170.305 J/mol] is below the minimum value of
24693.3614754 J/mol : PropsSI("D","P",100000,"U",10000,"ammonia")
I think there is an error in the setup, but where?
I am not sure, but CoolProp may have different bounds for the properties of NH3. I also needed to play with the [u_min, u_max] and [p_min p_max] when setting up the command to query from REFPROP.
One thing that may help: if you can plot a p-u plot in CoolProp, that may inform you of the range that CoolProp is able to support.
Thank you for your reply. In fact we have followed this approach and now it seems to be working. Now I should control the 2P cooling block in another way: limit the maximum mechanincal power avaiable to a certain value and varying the mass flow of the gas according to that. do you think it is possible to achieve this goal?
Yifeng Tang
Yifeng Tang am 11 Jul. 2023
That I am not sure.
I would imagine it's possible, since you can use the pwr output from the block as a feedback signal and adjust the S input (load fraction). You may need to add a PS transfer function to provide some time delay.
On the other side, the gas mass flow on the condenser side can be used to control the refrigerant pressure / sat. temperature in the condenser. It probably also has an effect on other parts of the cycle, but I'm not sure.

Melden Sie sich an, um zu kommentieren.

carlo ferro
carlo ferro am 3 Jul. 2023

0 Stimmen

Hi Yifeng,
thank you for your reply. We are trying with Coolprop due to the fact that is opensource, and it seems to be an excel addon. Do you think that copying the data of nh3 from the excel table into the interface mask would work or do we have to replace all the function script?

3 Kommentare

twoPhaseFluidTables function should also work with coolprop. Check out the documentation page.
i have another question:
what do you mean in line 2 with
"gcb % select the Two-Phase Fluid Properties (2P) block when you do this"
how can I paste the Two-Phase Fluid Properties (2P) block in the command line 2 ?
gcb will give you the path name of the currently selected block in Simulink. So you go to your model, select the Two-Phase Fluid Properties (2P) block by left click on it with your mouse, switch to MATLAB, run gcb command, or assign the output of gcb to a variable.
I know, it's confusing for the first time, lol. Same thing as this short example:

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Foundation and Custom Domains finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2023a

Gefragt:

am 29 Jun. 2023

Kommentiert:

am 11 Jul. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by