RWTH-EBC / vclibpy

Framework for steady state vapor compression simulation
BSD 3-Clause "New" or "Revised" License
10 stars 0 forks source link

Incompressible eva sec medium (Brine), Definition #16

Open WolffISE opened 2 weeks ago

WolffISE commented 2 weeks ago

Is it possible to use brine mediums of coolprop like MPG-20% or MEG-20% at the secondary side of the evaporator? How can i set them up?

Regards Christian

FWuellhorst commented 2 weeks ago

Yes, I guess it should be possible if you know what the name in coolprop is (e.g. brine_mpg20) you can specify e.g. secondary_medium="brine_mpg20" in the heat exchanger. The only code part which is fixed on water and air is the calculation of transport properties for cp. Here, you would have to add an elif with an assumption for the pressure in the brine. If you know a good default, we could also add the change to main via a fork. In vclibpy\components\heat_exchangers\heat_exchanger.py:

            if self.secondary_medium == "water":
                p = 2e5  # 2 bar (default hydraulic pressure)
            elif self.secondary_medium == "air":
                p = 101325  # 1 atm
            else:
                raise NotImplementedError(
                    "Default pressures for secondary_mediums aside from water and air are not supported yet."
                )
WolffISE commented 2 weeks ago

Thanks for the suggestion. I think one of the main problems is, that mpg20 is not listed as a fluid in Coolprop. Instead it is listed as an incompressible mixture. So i think we do need to change some more code, or?

FWuellhorst commented 2 weeks ago

As far as I can see here (http://www.coolprop.org/fluid_properties/Incompressibles.html), you can also specify incompressible mixtures using PropsSI?

WolffISE commented 2 weeks ago

Thx, i think i found a solution, but i still need to test it. The key was, that also the backend needs to be changed. For this i added the pressure assumption and modified: media/cool_prop.py init() to

def __init__(self, fluid_name, use_high_level_api: bool = False):
        super().__init__(fluid_name=fluid_name)
        # Set molar mass and trigger a possible fluid-name error
        # if the fluid is not supported.
        if "::" in fluid_name:
            back_end, fluid_name = fluid_name.split("::")
            if "[" in fluid_name:
                fluid_name, _fractions = fluid_name.split("[")
                _fractions = _fractions.replace("]", "")
            else:
                _fractions = None
            self._helmholtz_equation_of_state = CoolPropInternal.AbstractState(back_end, fluid_name)
            self._helmholtz_equation_of_state.set_mass_fractions([float(_fractions)]) #TODO check if a mixture could also be volume based
        else:
            self._helmholtz_equation_of_state = CoolPropInternal.AbstractState("HEOS", self.fluid_name)
            self.M = self._helmholtz_equation_of_state.molar_mass()
        self.use_high_level_api = use_high_level_api

The fluid can be defined like: INCOMP::MEG[20] (backend::fluid_name)

FWuellhorst commented 1 week ago

Ok, this looks good and makes sense. Do you want to create a pull request with the change? :)

WolffISE commented 1 week ago

Yes i will do one soon, after i tested it a little more. :)