Replies: 7 comments 3 replies
-
@bjl25 Could you post the full error traceback and warnings you are seeing? It is hard to tell exactly what is going on from just your description. However the fact that you are getting a warning about a value outside of bounds is a strong indication that the values you are using are not feasible. Also, note that you have to be careful when directly compare values between different implementations of properties (i.e. checking values against CoolProp). You have to make sure the reference states are the same, or apply an offset to align the values (although it is likely that the reference state is the same here). |
Beta Was this translation helpful? Give feedback.
-
Thank you for the reply @andrewlee94 the full error traceback is below. To re-explain basically the solver converges when I use R32 Helmholtz in vapor only and TPx mode. If I use Pressure Enthalpy mode for the property package it fails to converge and if I use the LG or mixed for the phase type with TPx receive a different answer. (The pressure and enthalpy I use is calculated using htpx with the same T and P from the case that converges). The traceback error for PH StateVars mode: |
Beta Was this translation helpful? Give feedback.
-
@andrewlee94 Here are the results for the same conditions 290K, 8.1 bar to 32.4 bar inlet vapor fraction of 1 (for the mix phase case) just changing the PhaseType. Gas Only: Mix: |
Beta Was this translation helpful? Give feedback.
-
@bjl25 Firstly, you cannot put any value on a result when the solver returns infeasible or fails to initialize - the solver failed to find a solution so whatever values are there are just what was left when the solver gave up. So, there is no point in comparing the mechanical work between a case which solved and one which didn't. Secondly, the fact that you are getting warnings about variables outside of bounds is suggesting that you are working outside the feasible range for the given property package, and thus it is not unexpected that it might fail to solve. I would suggest trying to solve the model within the feasible range first to see if that solves - if you see a failure with a feasible value then there is an issue with the model/initialization but if the issue is just the bounds then you need to ask if the range you are solving for is valid. |
Beta Was this translation helpful? Give feedback.
-
The key issue here is this output you showed:
WARNING (W1002): Setting Var
'fs.Comp.control_volume.properties_in[0.0].enth_mol' to a numeric value
27704.73042940659 outside the bounds (-992.1972213327272,
26013.433049962445).
This indicates that the value you are using for enthalpy (from the htpx function) is outside the bounds supported by the property package. The property packages puts upper and lower bounds on the enthalpy to indicate the range over which the correlations are reliable, and it will fail to converge if you use values outside of this . In this case, the enthalpy you are trying to solve for is above the upper bound (27704.73042940659 > 26013.433049962445), thus when you go to solve the model it is infeasible because the bounds are violated.
The issue is not the htpx function, but the conditions you are trying to solve for. You note that you are operating in the outer regions for the refrigerant, and in this case you are pushing further than the model is willing to allow. This doesn’t mean the region is non-physical, but it does indicate that the correlations used were not fitted in this region and thus would require extrapolation and the added uncertainty that implies.
You basically have three options:
1. Limit yourself to be within the current bounds of trusted space.
2. Find new parameters that cover the space you are interested in and set up a new property package (the Helmholtz property package can accept custom parameters).
3. Understanding the risks of extrapolation, relax the bounds set in the property package.
|
Beta Was this translation helpful? Give feedback.
-
@bjl25 Note that the CoolProp integration is a prototype and only supports cubic equations of state, so it might not actually do what you require. If you want to use Helmholtz equations of state, then you would need to look at loading the parameter values from CoolProp into IDAES. Also note that CoolProp might just be less restrictive on extrapolation than we are but suffer from the same limitations on the fitting data (I believe we both used the same data sources). |
Beta Was this translation helpful? Give feedback.
-
@andrewlee94 Hello Andrew, I have circled back around to my heat pump modeling project. You are 100% correct that it is a bounding issue that is causing the initialization issue. I investigated your Helmohotz property package and CoolProps property package and found that they use the same source (https://pubs.aip.org/aip/jpr/article-abstract/26/6/1273/241752/An-International-Standard-Equation-of-State-for?redirectedFrom=fulltext). I found that it is rated for temperatures from the Triple Point at 136.34 K to 435 K and Pressures up to 70 MPa which encompasses my maximum P and T conditions of 400K and 3.2 MPa. Therefore I am confident in the property parameters and wish to extend the bounds but I can not figure out how to. Could you please point me in the right direction? Thank you |
Beta Was this translation helpful? Give feedback.
-
I have started to model an R32 heat pump system in IDAES and have selected the HelmholtzParameterBlock to model the properties of R32.
I started by modeling the compressor to test how the package performs. I had the following major code snippets:
m.fs.propertiesRC = HelmholtzParameterBlock(
pure_component="R32",
phase_presentation=PhaseType.MIX,
state_vars=StateVars.PH
)
m.fs.Comp = PressureChanger(
property_package=m.fs.propertiesRC,
compressor=True,
thermodynamic_assumption=ThermodynamicAssumption.isentropic,
)
h1= m.fs.propertiesRC.htpx(288 * units.K, 813100 * units.Pa)
print(h1)
m.fs.Comp.inlet.flow_mol.fix(50)
#m.fs.Comp.inlet.temperature[0].fix(288)
m.fs.Comp.inlet.enth_mol.fix(h1)
m.fs.Comp.inlet.pressure.fix(813100)
m.fs.Comp.outlet.pressure.fix(3248913)
m.fs.Comp.efficiency_isentropic.fix(0.70)
DOF_final = degrees_of_freedom(m)
I received a warning stating my molar enthalpy was outside the bounds then flags = blk.initialize_build(*args, **kwargs) portion failed to initialize. I checked the enthlpy generated from Helmholtz against Coolprop and it matched.
I then changed the phase-type to vapor only and the StateVars to TPx which subsequently initialized fine and produced the same answer as my Excel model. I then changed the state variables back to PH, with the phase type still set to Vapour only, and produced the same error. Finally, I tested a mixed phase type with TPx as the state variable and initialized fine but got dramatically reduced work input.
Please help I would love to use this program further for modeling heat pumps.
PS Code is below and sorry for the mess I was testing out connecting the unit ops together and creating a R32 PR property package.
Heat Pump.txt
Beta Was this translation helpful? Give feedback.
All reactions