Closed AbuHenaToslim closed 8 months ago
@AbuHenaToslim, Hi!
sorry for the late reply, I oversaw this issue in my holidays… This warning always shows up with a couple of incompressibles as far as I know, still the fluid properties work. I‘ll take care of the erroneous logging with the rework of the fluid property back end in #384
Hi all,
Based on this conversation I am getting the impression that we can now run TESPy networks with non-pure incompressibles such as mass-based and volume-based binary mixtures from CoolProp as MPG is one such example. However, my impression from reading the documentation for fluid properties is that fluid mixtures are not yet supported and this is one of the things that is supposed to be addressed in the upcomming PR384.
With this in mind, I wanted to clarify if binary mixtures from incompressibles given here are considered as fluid mixtures in this context or not? If so, are they supposed to be supported now or is this support comming in the mentioned PR?
My testing with fluids such as MPG in the current version of TESPy (0.6.3) results in errors as it appears that the quick fix from the PR271 discussion is no longer supported with the temperature falling out of range.
Thanks!
Hi, thank you for reaching out. I will be able to give you an answer on Sunday. Have a nice weekend
@jelic1marko, thank you for your patience.
My testing with fluids such as MPG in the current version of TESPy (0.6.3) results in errors as it appears that the quick fix from the https://github.com/oemof/tespy/pull/271#issuecomment-933285127 discussion is no longer supported with the temperature falling out of range.
I guess the re-appearing issue has to do with the starting value guesses. You could directly provide enthalpy values in an initial calculation (or enthalpy starting values), which might circumvent the issue you are seeing.
With this in mind, I wanted to clarify if binary mixtures from incompressibles given here are considered as fluid mixtures in this context or not? If so, are they supposed to be supported now or is this support comming in the mentioned PR?
There will be two additions on that PR with respect to the incompressibles:
Have a nice week
Francesco
Hi @fwitte,
Thank you for your reply. I can confirm from re-testing that the quick fix from #271 can indeed work when adequate starting enthalpy values are provided. I don't remember this being required for my use case previously, but anyhow it's important that it can work when needed.
We are looking forward to the new PR, so would love to test it when it comes out.
Best regards, Marko
Thank you for your offer Marko, I appreciate it and I will reach out to you for testing as soon as I have finished work on the PR. I hope the first release candidate is ready by the end of the month from the implementation side, a lot of documentation will have to follow... ;)
Best
@jelic1marko
So far this is, what the implementation could look like with the current state of the pull request (likely it does not work for you yet, I have to commit two more small things, which I wanted to find a complete solution first). It is basically a little conceptual idea, I will let you know once that is ready to test out:
from tespy.networks import Network
from tespy.connections import Connection
from tespy.components import Source
from tespy.components import Sink
from tespy.components import SimpleHeatExchanger
from tespy.components import HeatExchanger
from tespy.components import Pump
nw = Network(iterinfo=False)
so1 = Source("Source1")
so2 = Source("Source2")
pu = Pump("Pump")
he = HeatExchanger("Heat")
si1 = Sink("Sink1")
si2 = Sink("Sink2")
c1 = Connection(so1, "out1", pu, "in1", label="1")
c2 = Connection(pu, "out1", he, "in2", label="2")
c3 = Connection(he, "out2", si1, "in1", label="3")
c4 = Connection(so2, "out1", he, "in1", label="4")
c5 = Connection(he, "out1", si2, "in1", label="5")
nw.add_conns(c1, c2, c3, c4, c5)
c1.set_attr(v=1, p=1e5, T=300, fluid={"MPG": 1}, fluid_back_ends={"MPG": "INCOMP"})
c2.set_attr(h0=2e4)
c3.set_attr(p=1e5, T=320, h0=1e5)
he.set_attr(pr1=0.98, pr2=0.98, ttd_l=10)
pu.set_attr(eta_s=0.7)
c1._create_fluid_wrapper()
c1.fluid.wrapper['MPG'].AS.set_mass_fractions([0.2])
# he2.set_attr(pr=1, Q=-1e5)
c4.set_attr(p=1e5, T=350, h0=2e5, fluid={"MEG": 1}, fluid_back_ends={"MEG": "INCOMP"})
c5.set_attr(h0=1e5)
c4._create_fluid_wrapper()
c4.fluid.wrapper['MEG'].AS.set_mass_fractions([0.4])
nw.solve("design")
print([c.h.val_SI for c in nw.conns["object"]])
# you can also change the water fractions between runs
c1.fluid.wrapper['MPG'].AS.set_mass_fractions([0.5])
nw.solve("design")
print([c.h.val_SI for c in nw.conns["object"]])
# and you can have the same mixture but with different mass fractions in the same network
c4.set_attr(fluid={"MPG": 1}, fluid_back_ends={"MPG": "INCOMP"})
c4._create_fluid_wrapper()
c4.fluid.val["MEG"] = 0
c5.fluid.val["MEG"] = 0
# specify mass fraction
c4.fluid.wrapper['MPG'].AS.set_mass_fractions([0.2])
nw.solve("design")
print([c.h.val_SI for c in nw.conns["object"]])
# change it again
c4.fluid.wrapper['MPG'].AS.set_mass_fractions([0.6])
nw.solve("design")
print([c.h.val_SI for c in nw.conns["object"]])
The output of the script is the enthalpy values of the individual streams. Note how they change between runs without changing pressure or temperature values. That is due to the different water mass fractions and the different fluids.
[27287.379723742153, 27290.26000944312, 107530.25290219138, 206159.2995882896, 59860.630483603694]
[24270.02088554959, 24272.838982289373, 96165.24600159038, 206159.2995882896, 59860.880169065655]
[24270.020885549588, 24272.83898228937, 96165.24600159038, 229470.48093634236, 67302.36722779844]
[24270.020885549577, 24272.83898228937, 96165.24600159038, 197179.6558093269, 56923.641978866224
Best
I am working with Propylene Glycol (25% by weight) which is listed as incompressible under CoolProp library. Using it in Network FluidList generates this error, WARNING:root:Could not find the fluid "MPG[25]" in the fluid property database. How to actually use it tespy connections or import it from CoolProp and use it in tespy?