Skip to content

Not possible to use other fluid property engines than coolprop in combustion component #887

@HaSchneider

Description

@HaSchneider

When I try to use other fluid property engines in combustion chamber I get an RuntimeError, because it forces to use coolprop in tespy.tools.global_vars.FluidAliases.get_fluid()

Example:

from tespy.components import (
    Source, Sink, 
    SimpleHeatExchanger, 
    DiabaticCombustionChamber,
)
from tespy.tools.fluid_properties.wrappers import PyromatWrapper

from tespy.connections import Connection


class my_PyromatWrapper(PyromatWrapper):
    def _set_constants(self):
        self._p_min, self._p_max = 100, 1000e5
        self._T_crit, self._p_crit = 0,0#self.AS.critical() not supported by pyromat
        self._T_min, self._T_max = self.AS.Tlim()
        self._molar_mass = self.AS.mw()

class create_solvent_combustion(ModelTemplate):
       
    def _create_network(self) -> None:
        super()._create_network()
        amb = Source('ambient air')
        sf = Source('fuel')
        fg = Sink('flue gas outlet')
        self.comb = DiabaticCombustionChamber('combustion chamber')
        self.hex = SimpleHeatExchanger('heat exchanger')
        
        
        self.amb_comb = Connection(amb, 'out1', self.comb, 'in1')
        self.sf_comb = Connection(sf, 'out1', self.comb, 'in2')
        self.comb_hex = Connection(self.comb, 'out1', self.hex, 'in1')
        self.hex_fg = Connection(self.hex, 'out1', fg, 'in1')
        self.nw.add_conns(self.sf_comb, self.amb_comb, self.comb_hex, self.hex_fg, 
        )
        self.comb.set_attr(ti=500000, pr=0.95, eta=1, lamb=2)
        self.amb_comb.set_attr(
            p=1.2, T=20,
            fluid={'Ar': 0.0129, 'N2': 0.7553, 'CO2': 0.0004, 'O2': 0.2214, 'ig::NO':0.01},
            fluid_engines={"NO": my_PyromatWrapper}, 
        )
        self.sf_comb.set_attr(
            p=1.3, T=25, fluid={'CO2': 0.03, 'H2': 0.01, 'CH4': 0.96},
        )
         
        self.hex.set_attr(pr=0.95)
        self.hex_fg.set_attr(T=200)

rva= create_solvent_combustion()
rva.nw.solve('design')

I get the Error:

RuntimeError: key [NO] was not found in string_to_index_map in JSONFluidLibrary

I fixed that for me in this commit. It is not well tested yet but might be a starting point to fix that in the main branch.

Note:

  • I used the Modeltemplate here
  • I needed to adjust the Pyromat wrapper as the "ig" engine doesnt know the T_crit and p_crit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions