Skip to content

Commit

Permalink
Merge a9f4c64 into 4aecead
Browse files Browse the repository at this point in the history
  • Loading branch information
fwitte committed Jan 4, 2021
2 parents 4aecead + a9f4c64 commit 81930d4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
9 changes: 4 additions & 5 deletions docs/whats_new/v0-3-5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ API Changes
New Features
############
- Add methods for exergy and entropy analyses of networks.
Examples will follow (`PR #215 <https://github.com/oemof/tespy/pull/215>`_),

Examples will follow (`PR #215 <https://github.com/oemof/tespy/pull/215>`_).
- Add a method :code:`get_plotting_data` to each component to export the input
data required by FluProDia in order to generate the data required to display
state changes in the components in a fluid property diagram. Each component
Expand Down Expand Up @@ -91,7 +90,6 @@ New Features
For more information see the respective
:ref:`documentation section <FluProDia_label>`
(`PR #234 <https://github.com/oemof/tespy/pull/234>`_).

- Add a flag to deactivate calculation of all component equations in every
iteration. This improves stability in some cases but may reduce calculation
speed (`PR #226 <https://github.com/oemof/tespy/pull/226>`_). To deactivate
Expand All @@ -101,7 +99,6 @@ New Features
.. code-block:: python
mynetwork.solve('design', always_all_equations=False)
- Add a flag use cuda instead of numpy for matrix inversion. With cuda matrix
inversion is outsourced to the graphics card. Using cuda additionally
requires :code:`cupy` installed on your machine
Expand Down Expand Up @@ -166,14 +163,16 @@ Other Changes
- An error message is raised in case the user specifies a fluid vector
containing fluids, that are not part of the network's fluid list
(`PR #233 <https://github.com/oemof/tespy/pull/233>`_).

- For improved convergence stability of the methods
:py:meth:`tespy.components.heat_exchangers.heat_exchanger_simple.HeatExchangerSimple.kA_func` and
:py:meth:`tespy.components.heat_exchangers.heat_exchanger_simple.HeatExchangerSimple.kA_char_func`,
the logarithmic temperature difference is calculated based on the mean
temperature difference between ambient and inlet and outlet temperature, if
the terminal temperature differences do not have the same sign
(`PR #225 <https://github.com/oemof/tespy/pull/225>`_).
- An understandable error message is raised in case the user misses out on
fluids required by components of class CombustionChamber or CombustionEngine
(`PR #242 <https://github.com/oemof/tespy/pull/242>`_).

Contributors
############
Expand Down
25 changes: 17 additions & 8 deletions src/tespy/components/combustion/combustion_chamber.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,23 @@ def setup_reaction_parameters(self):
self.component() + ' are: ' + str(self.fuel_list) + '.')
logging.debug(msg)

self.o2 = [x for x in self.nw_fluids if x in [
a.replace(' ', '') for a in CP.get_aliases('O2')]][0]
self.co2 = [x for x in self.nw_fluids if x in [
a.replace(' ', '') for a in CP.get_aliases('CO2')]][0]
self.h2o = [x for x in self.nw_fluids if x in [
a.replace(' ', '') for a in CP.get_aliases('H2O')]][0]
self.n2 = [x for x in self.nw_fluids if x in [
a.replace(' ', '') for a in CP.get_aliases('N2')]][0]
for fluid in ['o2', 'co2', 'h2o', 'n2']:
try:
setattr(
self, fluid, [x for x in self.nw_fluids if x in [
a.replace(' ', '') for a in
CP.get_aliases(fluid.upper())
]][0])
except IndexError:
msg = (
'The component ' + self.label + ' (class ' +
self.__class__.__name__ + ') requires that the fluid '
'[fluid] is in the network\'s list of fluids.')
aliases = ', '.join(CP.get_aliases(fluid.upper()))
msg = msg.replace(
'[fluid]', fluid.upper() + ' (aliases: ' + aliases + ')')
logging.error(msg)
raise TESPyComponentError(msg)

self.fuels = {}
for f in self.fuel_list:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ def test_CombustionChamber_missing_fuel():
with raises(TESPyComponentError):
nw.solve('design', init_only=True)


def test_CombustionChamber_missing_oxygen():
"""Test no fuel in network."""
nw = Network(['H2O', 'N2', 'Ar', 'CO2', 'CH4'])
instance = CombustionChamber('combustion chamber')
c1 = Connection(Source('air'), 'out1', instance, 'in1')
c2 = Connection(Source('fuel'), 'out1', instance, 'in2')
c3 = Connection(instance, 'out1', Sink('flue gas'), 'in1')
nw.add_conns(c1, c2, c3)
with raises(TESPyComponentError):
nw.solve('design', init_only=True)

##############################################################################
# CombustionChamberStoich

Expand Down

0 comments on commit 81930d4

Please sign in to comment.