Closed mvernacc closed 1 year ago
Dear @mvernacc,
thank you for reaching out and sharing your code snippet, I hope you can make use of the software!
To your issue: It looks like CoolProp only supports pressure higher than triple point pressure for CO2 (also see http://www.coolprop.org/fluid_properties/fluids/CarbonDioxide.html#fluid-carbondioxide and http://www.coolprop.org/_downloads/9a4fdd673eb02b49856d14485b27e6e9/CarbonDioxide.pdf):
>>> print(PropsSI("P_min", "CO2")) # minimum possible pressure in CoolProp in Pa
517964.34344772575
If you specify a higher pressure than that value at the compressor's inlet, the problem can be solved. To also quickly answer some of your questions:
When solving the model, I expect the pressures on either side of the
CycleCloser
to be equal. However, the solver fails to converge, and returns different pressures at the inlet and outlet of theCycleCloser
.
The outcome of the equations (not necessarily all of them) applied by the different components will be wrong, if the solver fails to converge. That is why you see the pressure differences. TESPy does not allow the pressure to be lower than the CoolProp provided minimum pressure. Since the pressure c0 will be a result of the equation of the CycleCloser
and the specified pressure c1, the solver tries to find a valid value for c0, but is limited to the CoolProp value range.
I would like help figuring out what is wrong with this model. Have I not properly initialized the component and connection attributes? Am I using the
CycleCloser
improperly? Or is this a bug in TESpy?
Overall looks very good, one small hints for your models:
Starting values for fluid composition are rarely required. With single fluid networks you do not need any actually. In case some connections miss a starting value for the fluid composition, a warning should be printed in the preprocessing. Then you can make use of fluid0
to try and fix it.
Have a nice sunny weekend!
Best
Francesco
First, thank you for the effort of creating TESpy -- it looks like a great tool.
I am trying model closed-cycle networks with gaseous CO2 as the working fluid. Per the advice in the documentation to "set up your system step by step", I've started with a simple model: A compressor circulates CO2 through a heat exchanger and the heat exchanger dissipates the compressor's pressure rise and rejects heat from the compressor work. The network also includes a
CycleCloser
.When solving the model, I expect the pressures on either side of the
CycleCloser
to be equal. However, the solver fails to converge, and returns different pressures at the inlet and outlet of theCycleCloser
.Interestingly, this error only occurs with CO2, and goes away if I change the fluid to another gas.
I would like help figuring out what is wrong with this model. Have I not properly initialized the component and connection attributes? Am I using the
CycleCloser
improperly? Or is this a bug in TESpy?Here is the script:
And here is the output (using python 3.11.1, tespy 0.6.2):
Note that the pressure at c0 is 5.180 bar, whereas the pressure at c1 is 4.0 bar. I would expect the pressure at both c0 and c1 to be 4.0 bar.
I noticed that the warning message says "This frequently happens, if the solver pushes the fluid properties out of their feasible range." However, the returned pressure and temperature range (4-15 bar, 308-431 K) are well within the "feasible range" for gaseous CO2.