diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 000000000..105ce2da2
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 000000000..35eb1ddfb
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 000000000..8444eb1a0
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ "associatedIndex": 4
+}
+
+
+
+
+
+ {
+ "keyToString": {
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "git-widget-placeholder": "dev",
+ "last_opened_file_path": "C:/Users/rossberg/PycharmProjects/tespy-friederike/tests_friederike/component_tests",
+ "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1700475934807
+
+
+ 1700475934807
+
+
+
+ 1700481521586
+
+
+
+ 1700481521586
+
+
+
+ 1701679504566
+
+
+
+ 1701679504566
+
+
+
+ 1701680160790
+
+
+
+ 1701680160790
+
+
+
+ 1702031044619
+
+
+
+ 1702031044619
+
+
+
+ 1702126000864
+
+
+
+ 1702126000864
+
+
+
+ 1705043234400
+
+
+
+ 1705043234400
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bash.exe.stackdump b/bash.exe.stackdump
new file mode 100644
index 000000000..8cd2b0241
--- /dev/null
+++ b/bash.exe.stackdump
@@ -0,0 +1,16 @@
+Stack trace:
+Frame Function Args
+000FFFFCD30 00210062B0E (0021028A770, 00210275E51, 00000000059, 000FFFFB710)
+000FFFFCD30 0021004846A (000FFFFCD30, 00200000000, 00000000000, 00000000001)
+000FFFFCD30 002100484A2 (00000000000, 00000000000, 00000000059, 99B853482A57)
+000FFFFCD30 0021006E496 (00210045323, 00210358A70, 00000000000, 0000000000D)
+000FFFFCD30 0021006E4A9 (00210045170, 0021023D7E0, 002100448F2, 000FFFFC910)
+000FFFFCD30 00210070DE4 (00000000013, 00000000001, 000FFFFC910, 00210278640)
+000FFFFCD30 0021005AB65 (000FFFFCA60, 00000000000, 00000000000, 008FFFFFFFF)
+000FFFFCD30 0021005B335 (00000000002, 00000000000, 000FFFFCD30, 00000030201)
+000FFFFCD30 0021005B847 (002100DF73E, 00000000000, 00000000000, 00000000000)
+000FFFFCD30 0021005BB86 (00000000000, 000FFFFCD30, FFFFFFFFFFFFFFC6, 00000000000)
+000FFFFCD30 00210048C0C (00000000000, 00000000000, 00000000000, 00000000000)
+000FFFFFFF0 00210047716 (00000000000, 00000000000, 00000000000, 00000000000)
+000FFFFFFF0 002100477C4 (00000000000, 00000000000, 00000000000, 00000000000)
+End of stack trace
diff --git a/src/tespy/components/basics/cycle_closer.py b/src/tespy/components/basics/cycle_closer.py
index 23aba26da..aa837291a 100644
--- a/src/tespy/components/basics/cycle_closer.py
+++ b/src/tespy/components/basics/cycle_closer.py
@@ -174,3 +174,9 @@ def calc_parameters(self):
d2 = self.outl[0].fluid.val
diff = [d1[key] - d2[key] for key in d1.keys()]
self.fluid_deviation.val = np.linalg.norm(diff)
+
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+
+ def exergoeconomic_balance(self, T0):
+ return
diff --git a/src/tespy/components/basics/source.py b/src/tespy/components/basics/source.py
index 35719fa34..e8b70ee21 100644
--- a/src/tespy/components/basics/source.py
+++ b/src/tespy/components/basics/source.py
@@ -122,3 +122,31 @@ def exergy_balance(self, T0):
}
self.E_D = np.nan
self.epsilon = self._calc_epsilon()
+
+
+ """+F+F+F+F++++START++++F+F+F+F+ von Jubran"""
+ def set_source_costs(self, c_tot=None):
+ # c_tot must be in SI unit ($/J)
+
+ if c_tot is not None:
+ self.outl[0].c_tot = c_tot
+ # calculate outlet
+ self.outl[0].Ex_tot = self.outl[0].Ex_physical + self.outl[0].Ex_chemical
+ self.outl[0].C_tot = self.outl[0].c_tot * self.outl[0].Ex_tot
+
+ # approximate costs per exergy unit fot T, M, PH and CH
+ # c_tot = c_therm = c_mech = c_physical = c_chemical
+ self.outl[0].c_therm = c_tot
+ self.outl[0].c_mech = c_tot
+ self.outl[0].c_physical = c_tot
+ self.outl[0].c_chemical = c_tot
+
+ self.outl[0].C_therm = self.outl[0].c_therm * self.outl[0].Ex_therm
+ self.outl[0].C_mech = self.outl[0].c_mech * self.outl[0].Ex_mech
+ self.outl[0].C_physical = self.outl[0].c_physical * self.outl[0].Ex_physical
+ self.outl[0].C_chemical = self.outl[0].c_chemical * self.outl[0].Ex_chemical
+
+ def set_source_costs_standard(self):
+ # determine source costs depending on material, temperature, ...
+ return
+ """+F+F+F+F++++END++++F+F+F+F+ von Jubran"""
diff --git a/src/tespy/components/combustion/base.py b/src/tespy/components/combustion/base.py
index b11151b84..8d167429a 100644
--- a/src/tespy/components/combustion/base.py
+++ b/src/tespy/components/combustion/base.py
@@ -1399,4 +1399,46 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
- self.E_bus = np.nan
+ self.E_bus = {"chemical": np.nan, "physical": np.nan, "massless": np.nan}
+
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+
+ def exergoeconomic_balance(self, T0):
+ self.C_P = self.outl[0].C_therm - (
+ self.inl[0].C_therm + self.inl[1].C_therm
+ )
+ self.C_F = (
+ self.inl[0].C_chemical + self.inl[1].C_chemical -
+ self.outl[0].C_chemical + self.inl[0].C_mech +
+ self.inl[1].C_mech - self.outl[0].C_mech
+ )
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ if self.outl[0].Ex_mech != 0 and self.inl[0].Ex_mech != 0 and self.inl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech * self.inl[0].m.val / (self.inl[0].m.val + self.inl[1].m.val)
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech * self.inl[1].m.val / (self.inl[0].m.val + self.inl[1].m.val)
+ else:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = 1
+
+ if self.outl[0].Ex_chemical != 0 and self.inl[0].Ex_chemical != 0 and self.inl[1].Ex_chemical != 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical * self.inl[0].m.val / (self.inl[0].m.val + self.inl[1].m.val)
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical * self.inl[1].m.val / (self.inl[0].m.val + self.inl[1].m.val)
+ elif self.in1[0].Ex_chemical == 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1
+ elif self.inl[1].Ex_chemical == 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["chemical"]] = 1
+
+ for i in range(2):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+2]
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/components/component.py b/src/tespy/components/component.py
index d82fcbed8..5f98781a0 100644
--- a/src/tespy/components/component.py
+++ b/src/tespy/components/component.py
@@ -12,6 +12,8 @@
SPDX-License-Identifier: MIT
"""
+from collections import OrderedDict
+
import numpy as np
from tespy.tools import logger
@@ -99,8 +101,8 @@ def __init__(self, label, **kwargs):
elif any([True for x in _forbidden if x in label]):
msg = (
- f"You cannot use any of " + ", ".join(_forbidden) + " in a "
- f"component label ({self.component()}"
+ f"You cannot use any of " + ", ".join(_forbidden) + " in a "
+ f"component label ({self.component()}"
)
logger.error(msg)
raise ValueError(msg)
@@ -120,10 +122,30 @@ def __init__(self, label, **kwargs):
self.fkt_group = self.label
# add container for components attributes
- self.parameters = self.get_parameters().copy()
+ self.parameters = OrderedDict(self.get_parameters().copy())
self.__dict__.update(self.parameters)
self.set_attr(**kwargs)
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ # needed for cycle closer, source, sink
+ self.Z_costs = np.nan # will be overwritten in each component
+ self.C_F = np.nan
+ self.C_P = np.nan
+ self.c_F = np.nan
+ self.c_P = np.nan
+ self.C_D = np.nan
+ self.C_L = np.nan
+ self.r = np.nan
+ self.f = np.nan
+ self.C_bus = np.nan
+ self.c_bus = {}
+ self.c_bus["bus"] = np.nan
+ self.c_bus["component"] = np.nan
+ self.dissipative = dc_simple(val=False)
+ self.serving_components = None
+ self.exergy_cost_line = np.nan
+ """+F+F+F+F++++END++++F+F+F+F+"""
+
def set_attr(self, **kwargs):
r"""
Set, reset or unset attributes of a component for provided arguments.
@@ -340,7 +362,7 @@ def preprocess(self, num_nw_vars):
self.num_eq = 0
self.vars = {}
self.num_vars = 0
- self.constraints = self.get_mandatory_constraints().copy()
+ self.constraints = OrderedDict(self.get_mandatory_constraints().copy())
self.prop_specifications = {}
self.var_specifications = {}
self.group_specifications = {}
@@ -413,7 +435,7 @@ def preprocess(self, num_nw_vars):
if data.is_set and data.func is not None:
self.num_eq += data.num_eq
- self.jacobian = {}
+ self.jacobian = OrderedDict()
self.residual = np.zeros(self.num_eq)
sum_eq = 0
@@ -488,10 +510,10 @@ def get_char_expr(self, param, type='rel', inconn=0, outconn=0):
return v / self.inl[inconn].v.design
elif param == 'pr':
return (
- (self.outl[outconn].p.val_SI *
- self.inl[inconn].p.design) /
- (self.inl[inconn].p.val_SI *
- self.outl[outconn].p.design))
+ (self.outl[outconn].p.val_SI *
+ self.inl[inconn].p.design) /
+ (self.inl[inconn].p.val_SI *
+ self.outl[outconn].p.design))
else:
msg = (
f"The parameter {param}) is not available for "
@@ -544,26 +566,26 @@ def get_char_expr_doc(self, param, type='rel', inconn=0, outconn=0):
if type == 'rel':
if param == 'm':
return (
- r'\frac{\dot{m}_\mathrm{in,' + str(inconn + 1) + r'}}'
- r'{\dot{m}_\mathrm{in,' + str(inconn + 1) +
- r',design}}')
+ r'\frac{\dot{m}_\mathrm{in,' + str(inconn + 1) + r'}}'
+ r'{\dot{m}_\mathrm{in,' + str(inconn + 1) +
+ r',design}}')
elif param == 'm_out':
return (
- r'\frac{\dot{m}_\mathrm{out,' + str(outconn + 1) +
- r'}}{\dot{m}_\mathrm{out,' + str(outconn + 1) +
- r',design}}')
+ r'\frac{\dot{m}_\mathrm{out,' + str(outconn + 1) +
+ r'}}{\dot{m}_\mathrm{out,' + str(outconn + 1) +
+ r',design}}')
elif param == 'v':
return (
- r'\frac{\dot{V}_\mathrm{in,' + str(inconn + 1) + r'}}'
- r'{\dot{V}_\mathrm{in,' + str(inconn + 1) +
- r',design}}')
+ r'\frac{\dot{V}_\mathrm{in,' + str(inconn + 1) + r'}}'
+ r'{\dot{V}_\mathrm{in,' + str(inconn + 1) +
+ r',design}}')
elif param == 'pr':
return (
- r'\frac{p_\mathrm{out,' + str(outconn + 1) +
- r'}\cdot p_\mathrm{in,' + str(inconn + 1) +
- r',design}}{p_\mathrm{out,' + str(outconn + 1) +
- r',design}\cdot p_\mathrm{in,' + str(inconn + 1) +
- r'}}')
+ r'\frac{p_\mathrm{out,' + str(outconn + 1) +
+ r'}\cdot p_\mathrm{in,' + str(inconn + 1) +
+ r',design}}{p_\mathrm{out,' + str(outconn + 1) +
+ r',design}\cdot p_\mathrm{in,' + str(inconn + 1) +
+ r'}}')
else:
if param == 'm':
return r'\dot{m}_\mathrm{in,' + str(inconn + 1) + r'}'
@@ -573,8 +595,8 @@ def get_char_expr_doc(self, param, type='rel', inconn=0, outconn=0):
return r'\dot{V}_\mathrm{in,' + str(inconn + 1) + r'}'
elif param == 'pr':
return (
- r'\frac{p_\mathrm{out,' + str(outconn + 1) +
- r'}}{p_\mathrm{in,' + str(inconn + 1) + r'}}')
+ r'\frac{p_\mathrm{out,' + str(outconn + 1) +
+ r'}}{p_\mathrm{in,' + str(inconn + 1) + r'}}')
def solve(self, increment_filter):
"""
@@ -819,20 +841,20 @@ def check_parameter_bounds(self):
for p in self.parameters.keys():
data = self.get_attr(p)
if isinstance(data, dc_cp):
- if data.val > data.max_val + ERR :
+ if data.val > data.max_val + ERR:
msg = (
- f"Invalid value for {p}: {p} = {data.val} above "
- f"maximum value ({data.max_val}) at component "
- f"{self.label}."
- )
+ 'Invalid value for ' + p + ': ' + p + ' = ' +
+ str(data.val) + ' above maximum value (' +
+ str(data.max_val) + ') at component ' + self.label +
+ '.')
logger.warning(msg)
- elif data.val < data.min_val - ERR :
+ elif data.val < data.min_val - ERR:
msg = (
- f"Invalid value for {p}: {p} = {data.val} below "
- f"minimum value ({data.max_val}) at component "
- f"{self.label}."
- )
+ 'Invalid value for ' + p + ': ' + p + ' = ' +
+ str(data.val) + ' below minimum value (' +
+ str(data.min_val) + ') at component ' + self.label +
+ '.')
logger.warning(msg)
elif isinstance(data, dc_cc) and data.is_set:
@@ -870,6 +892,12 @@ def exergy_balance(self, T0):
self.E_D = np.nan
self.epsilon = self._calc_epsilon()
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ # will be overwritten in each component
+ return
+ """+F+F+F+F++++END++++F+F+F+F+"""
+
def _calc_epsilon(self):
if self.E_F == 0:
return np.nan
@@ -917,8 +945,8 @@ def pressure_equality_func_doc(self, label):
else:
indices = str(indices[0])
latex = (
- r'0=p_{\mathrm{in,}i}-p_{\mathrm{out,}i}'
- r'\; \forall i \in [' + indices + r']')
+ r'0=p_{\mathrm{in,}i}-p_{\mathrm{out,}i}'
+ r'\; \forall i \in [' + indices + r']')
return generate_latex_eq(self, latex, label)
def pressure_equality_deriv(self, k):
@@ -975,9 +1003,8 @@ def enthalpy_equality_func_doc(self, label):
else:
indices = str(indices[0])
latex = (
- r'0=h_{\mathrm{in,}i}-h_{\mathrm{out,}i}'
- r'\; \forall i \in [' + indices + r']'
- )
+ r'0=h_{\mathrm{in,}i}-h_{\mathrm{out,}i}'
+ r'\; \forall i \in [' + indices + r']')
return generate_latex_eq(self, latex, label)
def enthalpy_equality_deriv(self, k):
@@ -1030,7 +1057,8 @@ def pr_func(self, pr='', inconn=0, outconn=0):
0 = p_{in} \cdot pr - p_{out}
"""
pr = self.get_attr(pr)
- return self.inl[inconn].p.val_SI * pr.val - self.outl[outconn].p.val_SI
+ return (self.inl[inconn].p.val_SI * pr.val -
+ self.outl[outconn].p.val_SI)
def pr_func_doc(self, label, pr='', inconn=0, outconn=0):
r"""
@@ -1054,8 +1082,8 @@ def pr_func_doc(self, label, pr='', inconn=0, outconn=0):
Residual value of function.
"""
latex = (
- r'0=p_\mathrm{in,' + str(inconn + 1) + r'}\cdot ' + pr +
- r' - p_\mathrm{out,' + str(outconn + 1) + r'}'
+ r'0=p_\mathrm{in,' + str(inconn + 1) + r'}\cdot ' + pr +
+ r' - p_\mathrm{out,' + str(outconn + 1) + r'}'
)
return generate_latex_eq(self, latex, label)
@@ -1153,8 +1181,8 @@ def zeta_func(self, zeta='', inconn=0, outconn=0):
v_i = v_mix_ph(i.p.val_SI, i.h.val_SI, i.fluid_data, i.mixing_rule, T0=i.T.val_SI)
v_o = v_mix_ph(o.p.val_SI, o.h.val_SI, o.fluid_data, o.mixing_rule, T0=o.T.val_SI)
return (
- data.val - (i.p.val_SI - o.p.val_SI) * np.pi ** 2
- / (8 * abs(i.m.val_SI) * i.m.val_SI * (v_i + v_o) / 2)
+ data.val - (i.p.val_SI - o.p.val_SI) * np.pi ** 2
+ / (8 * abs(i.m.val_SI) * i.m.val_SI * (v_i + v_o) / 2)
)
def zeta_func_doc(self, label, zeta='', inconn=0, outconn=0):
@@ -1181,14 +1209,14 @@ def zeta_func_doc(self, label, zeta='', inconn=0, outconn=0):
inl = r'_\mathrm{in,' + str(inconn + 1) + r'}'
outl = r'_\mathrm{out,' + str(outconn + 1) + r'}'
latex = (
- r'0 = \begin{cases}' + '\n' +
- r'p' + inl + r'- p' + outl + r' & |\dot{m}' + inl +
- r'| < \unitfrac[0.0001]{kg}{s} \\' + '\n' +
- r'\frac{\zeta}{D^4}-\frac{(p' + inl + r'-p' + outl + r')'
- r'\cdot\pi^2}{8\cdot\dot{m}' + inl + r'\cdot|\dot{m}' + inl +
- r'|\cdot\frac{v' + inl + r' + v' + outl + r'}{2}}' +
- r'& |\dot{m}' + inl + r'| \geq \unitfrac[0.0001]{kg}{s}' + '\n'
- r'\end{cases}'
+ r'0 = \begin{cases}' + '\n' +
+ r'p' + inl + r'- p' + outl + r' & |\dot{m}' + inl +
+ r'| < \unitfrac[0.0001]{kg}{s} \\' + '\n' +
+ r'\frac{\zeta}{D^4}-\frac{(p' + inl + r'-p' + outl + r')'
+ r'\cdot\pi^2}{8\cdot\dot{m}' + inl + r'\cdot|\dot{m}' + inl +
+ r'|\cdot\frac{v' + inl + r' + v' + outl + r'}{2}}' +
+ r'& |\dot{m}' + inl + r'| \geq \unitfrac[0.0001]{kg}{s}' + '\n'
+ r'\end{cases}'
)
return generate_latex_eq(self, latex, label)
@@ -1232,3 +1260,24 @@ def zeta_deriv(self, increment_filter, k, zeta='', inconn=0, outconn=0):
# custom variable zeta
if data.is_var:
self.jacobian[k, data.J_col] = self.numeric_deriv(f, zeta, None, **kwargs)
+
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ return
+
+ # @Z_costs.setter
+ def set_Z_costs(self, value=0):
+ self.Z_costs = value
+
+ def set_Z_costs_standard(self):
+ # if no Z cost is given by user, implement standard price functions for each component
+ self.Z_costs = 0 # to be implemented in each component
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ return [exergy_cost_matrix, exergy_cost_vector, counter]
+
+ def dis_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ return
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/components/heat_exchangers/base.py b/src/tespy/components/heat_exchangers/base.py
index 5ad36b254..531a44f46 100644
--- a/src/tespy/components/heat_exchangers/base.py
+++ b/src/tespy/components/heat_exchangers/base.py
@@ -830,9 +830,11 @@ def calc_parameters(self):
for i in range(2):
self.get_attr('pr' + str(i + 1)).val = (
self.outl[i].p.val_SI / self.inl[i].p.val_SI)
- self.get_attr('zeta' + str(i + 1)).val = self.calc_zeta(
- self.inl[i], self.outl[i]
- )
+ self.get_attr('zeta' + str(i + 1)).val = (
+ (self.inl[i].p.val_SI - self.outl[i].p.val_SI) * np.pi ** 2 / (
+ 4 * self.inl[i].m.val_SI ** 2 *
+ (self.inl[i].vol.val_SI + self.outl[i].vol.val_SI)
+ ))
# kA and logarithmic temperature difference
if self.ttd_u.val < 0 or self.ttd_l.val < 0:
@@ -840,10 +842,8 @@ def calc_parameters(self):
elif self.ttd_l.val == self.ttd_u.val:
self.td_log.val = self.ttd_l.val
else:
- self.td_log.val = (
- (self.ttd_l.val - self.ttd_u.val)
- / np.log(self.ttd_l.val / self.ttd_u.val)
- )
+ self.td_log.val = ((self.ttd_l.val - self.ttd_u.val) /
+ np.log(self.ttd_l.val / self.ttd_u.val))
self.kA.val = -self.Q.val / self.td_log.val
def entropy_balance(self):
@@ -1023,6 +1023,7 @@ def exergy_balance(self, T0):
self.outl[1].Ex_physical + self.outl[0].Ex_mech)
elif (self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0 and
self.inl[1].T.val_SI <= T0 and self.outl[1].T.val_SI <= T0):
+ self.dissipative.val = True
self.E_P = np.nan
self.E_F = self.inl[0].Ex_physical - self.outl[0].Ex_physical + (
self.inl[1].Ex_physical - self.outl[1].Ex_physical)
@@ -1038,6 +1039,389 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+ """+F+F+F+F++++START++++F+F+F+F+"""
+
+ def exergoeconomic_balance(self, T0):
+ if self.dissipative.val:
+ self.C_P = np.nan
+ self.C_F = self.inl[0].C_tot + self.inl[1].C_tot
+ elif all([c.T.val_SI > T0 for c in self.inl + self.outl]):
+ self.C_P = self.outl[1].C_therm - self.inl[1].C_therm
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical + (
+ self.inl[1].C_mech - self.outl[1].C_mech)
+ elif all([c.T.val_SI <= T0 for c in self.inl + self.outl]):
+ self.C_P = self.outl[0].C_therm - self.inl[0].C_therm
+ self.C_F = self.inl[1].C_physical - self.outl[1].C_physical + (
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ elif (self.inl[0].T.val_SI > T0 and self.outl[1].T.val_SI > T0 and
+ self.outl[0].T.val_SI <= T0 and self.inl[1].T.val_SI <= T0):
+ self.C_P = self.outl[0].C_therm + self.outl[1].C_therm
+ self.C_F = self.inl[0].C_physical + self.inl[1].C_physical - (
+ self.outl[0].C_mech + self.outl[1].C_mech)
+ elif (self.inl[0].T.val_SI > T0 and self.inl[1].T.val_SI <= T0 and
+ self.outl[0].T.val_SI <= T0 and self.outl[1].T.val_SI <= T0):
+ self.C_P = self.outl[0].C_therm
+ self.C_F = self.inl[0].C_physical + self.inl[1].C_physical - (
+ self.outl[1].C_physical + self.outl[0].C_mech)
+ else:
+ self.C_P = self.outl[1].C_therm
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical + (
+ self.inl[1].C_physical - self.outl[1].C_mech)
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # inserts aux eqs into matrix and vector
+ if all([c.T.val_SI > T0 for c in self.inl + self.outl]):
+ # therm1
+ if self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[0].Ex_therm == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ elif self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1
+
+ # chemical doesn't change
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+ elif all([c.T.val_SI <= T0 for c in self.inl + self.outl]):
+ # therm2
+ if self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1 / self.inl[1].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[1].Ex_therm
+ elif self.inl[1].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1
+ elif self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1
+ else:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1
+ # chem doesn't change, either 0 in and out or not 0 in and out
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+
+ elif (self.inl[0].T.val_SI > T0 and self.outl[1].T.val_SI > T0 and
+ self.outl[0].T.val_SI <= T0 and self.inl[1].T.val_SI <= T0):
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = -1
+ # two products c^T_out1 = c^T_out2
+ if self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1 / self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[1].Ex_therm
+ elif self.outl[0].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ elif self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["therm"]] = -1
+ # chemical doesn't change
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+
+ elif (self.inl[0].T.val_SI > T0 and self.inl[1].T.val_SI <= T0 and
+ self.outl[0].T.val_SI <= T0 and self.outl[1].T.val_SI <= T0):
+ # therm2
+ if self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1 / self.inl[1].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[1].Ex_therm
+ elif self.inl[1].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1
+ elif self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[1].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["mech"]] = -1
+ # chemical doesn't change
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+
+ elif (self.inl[0].T.val_SI > T0 and self.inl[1].T.val_SI <= T0 and
+ self.outl[0].T.val_SI > T0 and self.outl[1].T.val_SI > T0):
+ # therm1
+ if self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[0].Ex_therm == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ elif self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1
+
+ # chem doesn't change, either 0 in and out or not 0 in and out
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+ elif (self.inl[0].T.val_SI > T0 and self.inl[1].T.val_SI <= T0 and
+ self.outl[0].T.val_SI > T0 and self.outl[1].T.val_SI <= T0):
+ # dissipative, should not reach this point in the programm
+ print("you shouldn't see this")
+ return
+
+ else:
+ # therm1
+ if self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[0].Ex_therm == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ elif self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ # mech2
+ if self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.inl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.inl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["mech"]] = -1
+
+ # chemical doesn't change
+ exergy_cost_matrix[counter+3, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+4, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.inl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+ for i in range(5):
+ exergy_cost_vector[counter+i]=0
+ return [exergy_cost_matrix, exergy_cost_vector, counter+5]
+
+
+ def dis_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # nothing changes for the working fluid
+ # therm1
+ if self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[0].Ex_therm == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ elif self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1
+ # therm2
+ if self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[1].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["therm"]] = 1
+ elif self.inl[1].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["therm"]] = -1
+ # mech1
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+2, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["mech"]] = 1
+ # mech2
+ if self.outl[1].Ex_mech != 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+3, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech
+ exergy_cost_matrix[counter+3, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech
+ elif self.outl[1].Ex_mech == 0 and self.outl[1].Ex_mech != 0:
+ exergy_cost_matrix[counter+3, self.inl[1].Ex_C_col["mech"]] = 1
+ elif self.outl[1].Ex_mech != 0 and self.outl[1].Ex_mech == 0:
+ exergy_cost_matrix[counter+3, self.outl[1].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+3, self.inl[1].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+3, self.outl[1].Ex_C_col["mech"]] = -1
+ # chem doesn't change
+ # chem1
+ exergy_cost_matrix[counter+4, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ # chem2
+ exergy_cost_matrix[counter+5, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+5, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+
+ for i in range(6):
+ exergy_cost_vector[counter+i]=0
+
+ # füge die dissipativen Kosten der Komponente(n) zu, die davon profitiert/-en
+ if self.serving_components is None:
+ print("there should be a serving component, you shouldn't see this")
+ for comp in self.serving_components:
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["therm"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[1].Ex_C_col["therm"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["therm"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[1].Ex_C_col["therm"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["mech"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[1].Ex_C_col["mech"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["mech"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[1].Ex_C_col["mech"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["chemical"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[1].Ex_C_col["chemical"]] += 1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["chemical"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[1].Ex_C_col["chemical"]] += -1 / len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.Ex_C_col["dissipative"]] = 1 / len(self.serving_components)
+
+ exergy_cost_matrix[counter+6, self.Ex_C_col["dissipative"]] = 1
+ exergy_cost_vector[counter+6] = self.Z_costs
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+7]
+
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
+
+
def get_plotting_data(self):
"""Generate a dictionary containing FluProDia plotting information.
diff --git a/src/tespy/components/heat_exchangers/simple.py b/src/tespy/components/heat_exchangers/simple.py
index a9e555079..489bdabad 100644
--- a/src/tespy/components/heat_exchangers/simple.py
+++ b/src/tespy/components/heat_exchangers/simple.py
@@ -884,7 +884,10 @@ def calc_parameters(self):
self.Q.val = i.m.val_SI * (o.h.val_SI - i.h.val_SI)
self.pr.val = o.p.val_SI / i.p.val_SI
- self.zeta.val = self.calc_zeta(i, o)
+ self.zeta.val = (
+ (i.p.val_SI - o.p.val_SI) * np.pi ** 2
+ / (4 * i.m.val_SI ** 2 * (i.vol.val_SI + o.vol.val_SI))
+ )
if self.Tamb.is_set:
ttd_1 = i.T.val_SI - self.Tamb.val_SI
@@ -1060,7 +1063,7 @@ def exergy_balance(self, T0):
}
elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
self.E_P = self.outl[0].Ex_therm - self.inl[0].Ex_therm
- self.E_F = self.outl[0].Ex_therm - self.outl[0].Ex_therm + (
+ self.E_F = self.outl[0].Ex_therm - self.outl[0].Ex_therm + ( # ??????
self.inl[0].Ex_mech - self.outl[0].Ex_mech)
self.E_bus = {
"chemical": 0, "physical": 0, "massless": self.E_P
@@ -1076,7 +1079,7 @@ def exergy_balance(self, T0):
"chemical": np.nan, "physical": np.nan, "massless": np.nan
}
elif self.Q.val > 0:
- if self.inl[0].T.val_SI >= T0 - 1e-6 and self.outl[0].T.val_SI >= T0 - 1e-6:
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
self.E_P = self.outl[0].Ex_physical - self.inl[0].Ex_physical
self.E_F = self.outl[0].Ex_therm - self.inl[0].Ex_therm
self.E_bus = {
@@ -1125,6 +1128,64 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ # TO DO: check if C_P and C_F are correct
+ if self.Q.val < 0:
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
+ if self.dissipative.val:
+ self.C_P = np.nan
+ else:
+ self.C_P = self.inl[0].C_therm - self.outl[0].C_therm
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical
+ # self.C_F = self.C_bus
+ elif self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI < T0:
+ self.C_P = self.outl[0].C_therm
+ self.C_F = self.inl[0].C_therm + self.outl[0].C_therm + (
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ # self.C_F = self.C_bus + self.inl[0].C_therm
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.outl[0].C_therm - self.inl[0].C_therm
+ self.C_F = self.outl[0].C_therm - self.outl[0].C_therm + ( # ????
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ elif self.Q.val > 0:
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
+ self.C_P = self.outl[0].C_physical - self.inl[0].C_physical
+ self.C_F = self.outl[0].C_therm - self.inl[0].C_therm
+ # self.C_P = self.outl[0].C_therm - self.inl[0].C_therm
+ # self.C_F = self.C_bus
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI > T0:
+ self.C_P = self.outl[0].C_therm + self.inl[0].C_therm
+ self.C_F = self.inl[0].C_therm + (
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ elif self.inl[0].T.val_SI < T0 and self.outl[0].T.val_SI < T0:
+ if self.dissipative.val:
+ self.C_P = np.nan
+ else:
+ self.C_P = self.inl[0].C_therm - self.outl[0].C_therm + (
+ self.outl[0].C_mech - self.inl[0].C_mech
+ )
+ self.C_F = self.inl[0].C_therm - self.outl[0].C_therm
+ else:
+ # fully dissipative
+ self.C_P = np.nan
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical
+
+ print("difference C_P = ", self.C_P, "-", self.C_F + self.Z_costs, "=", self.C_P - (self.C_F + self.Z_costs))
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.C_P - self.C_F) / self.C_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # each line needs to equal 0
+ return
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
+
def get_plotting_data(self):
"""Generate a dictionary containing FluProDia plotting information.
@@ -1148,6 +1209,10 @@ def get_plotting_data(self):
}
}
+ def set_Z_costs_standard(self):
+ # if no Z cost is given by user, implement standard price function
+ self.Z_costs = 120
+
class HeatExchangerSimple(SimpleHeatExchanger):
diff --git a/src/tespy/components/nodes/droplet_separator.py b/src/tespy/components/nodes/droplet_separator.py
index 9bed7a934..75fe5332c 100644
--- a/src/tespy/components/nodes/droplet_separator.py
+++ b/src/tespy/components/nodes/droplet_separator.py
@@ -10,6 +10,9 @@
SPDX-License-Identifier: MIT
"""
+
+import numpy as np
+
from tespy.components.nodes.base import NodeBase
from tespy.tools.document_models import generate_latex_eq
from tespy.tools.fluid_properties import dh_mix_dpQ
@@ -407,3 +410,80 @@ def get_plotting_data(self):
'ending_point_property': 'v',
'ending_point_value': self.outl[i].vol.val
} for i in range(2)}
+
+ def exergy_balance(self, T0):
+ r"""
+ Calculate exergy balance of a merge.
+
+ Parameters
+ ----------
+ T0 : float
+ Ambient temperature T0 / K.
+
+ Note
+ ----
+ Please note, that the exergy balance accounts for physical exergy only.
+
+ .. math::
+
+ \dot{E}_\mathrm{P} = \sum \dot{E}_{\mathrm{out,}j}^\mathrm{PH}\\
+ \dot{E}_\mathrm{F} = \sum \dot{E}_{\mathrm{in,}i}^\mathrm{PH}
+ """
+ self.E_P = self.outl[0].Ex_physical + self.outl[1].Ex_physical
+ self.E_F = self.inl[0].Ex_physical
+
+ self.E_bus = {
+ "chemical": np.nan, "physical": np.nan, "massless": np.nan
+ }
+ self.E_D = self.E_F - self.E_P
+ self.epsilon = self.E_P / self.E_F
+
+ def exergoeconomic_balance(self, T0):
+ self.C_P = self.outl[0].C_physical + self.outl[1].C_physical
+ self.C_F = self.inl[0].C_physical
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # chemical exergy doesn't change
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+ # product is both thermal and mechanical exergy of both outlets
+ # if one of E is 0 and the others aren't:
+ # only the other form of exergy is part of the product
+ # therm_out
+ if self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1 / self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[1].Ex_therm
+ elif self.outl[0].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1
+ elif self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = -1
+ # mech_out: e^P should be the same of both outlets
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["mech"]] = 1 / self.outl[0].Ex_mech if self.outl[0].Ex_mech != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech if self.outl[1].Ex_mech != 0 else -1
+ # therm_out = mech_out
+ if self.outl[0].Ex_therm != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1 / self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.outl[0].Ex_therm == 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1
+ elif self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1
+
+ for i in range(5):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+5]
\ No newline at end of file
diff --git a/src/tespy/components/nodes/drum.py b/src/tespy/components/nodes/drum.py
index dc48d5397..120dd84cc 100644
--- a/src/tespy/components/nodes/drum.py
+++ b/src/tespy/components/nodes/drum.py
@@ -405,6 +405,56 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+ def exergoeconomic_balance(self, T0):
+ self.C_P = self.outl[0].C_physical + self.outl[1].C_physical
+ self.C_F = (self.inl[0].C_physical) + (self.inl[1].C_physical)
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # chemical exergy doesn't change
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+1, self.outl[1].Ex_C_col["chemical"]] = -1 / self.outl[1].Ex_chemical if self.outl[1].Ex_chemical != 0 else -1
+ # product is both thermal and mechanical exergy of both outlets
+ # if one of E is 0 and the others aren't:
+ # only the other form of exergy is part of the product
+ # therm_out
+ if self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1 / self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = -1 / self.outl[1].Ex_therm
+ elif self.outl[0].Ex_therm == 0 and self.outl[1].Ex_therm != 0:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1
+ elif self.outl[0].Ex_therm != 0 and self.outl[1].Ex_therm == 0:
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+2, self.outl[1].Ex_C_col["therm"]] = -1
+ # mech_out: e^P should be the same of both outlets
+ exergy_cost_matrix[counter+3, self.outl[0].Ex_C_col["mech"]] = 1 / self.outl[0].Ex_mech if self.outl[0].Ex_mech != 0 else 1
+ exergy_cost_matrix[counter+3, self.outl[1].Ex_C_col["mech"]] = -1 / self.outl[1].Ex_mech if self.outl[1].Ex_mech != 0 else -1
+ # therm_out = mech_out
+ if self.outl[0].Ex_therm != 0 and self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1 / self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.outl[0].Ex_therm == 0 and self.outl[0].Ex_mech == 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1
+ elif self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+4, self.outl[0].Ex_C_col["mech"]] = -1
+
+ for i in range(5):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+5]
+
def get_plotting_data(self):
"""
Generate a dictionary containing FluProDia plotting information.
diff --git a/src/tespy/components/nodes/merge.py b/src/tespy/components/nodes/merge.py
index b3b286cb2..0941bd9cb 100644
--- a/src/tespy/components/nodes/merge.py
+++ b/src/tespy/components/nodes/merge.py
@@ -460,6 +460,7 @@ def exergy_balance(self, T0):
self.E_P = np.nan
for i in self.inl:
self.E_F += i.Ex_physical
+ self.dissipative.val = True
else:
for i in self.inl:
if i.T.val_SI > self.outl[0].T.val_SI:
@@ -479,6 +480,87 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+ def exergoeconomic_balance(self, T0):
+ self.C_P = 0
+ self.C_F = 0
+ if self.outl[0].T.val_SI > T0:
+ for i in self.inl:
+ if i.T.val_SI < self.outl[0].T.val_SI:
+ # cold inlets
+ self.C_F += i.C_mech + i.C_chemical
+ else:
+ # hot inlets
+ self.C_F += - i.m.val_SI * i.c_therm * i.ex_therm + (
+ i.C_therm + i.C_mech + i.C_chemical)
+ self.C_F += (-self.outl[0].C_mech - self.outl[0].C_chemical)
+ elif self.outl[0].T.val_SI - 1e-6 < T0 and self.outl[0].T.val_SI + 1e-6 > T0:
+ # dissipative
+ for i in self.inl:
+ self.C_F += i.C_tot
+ else:
+ for i in self.inl:
+ if i.T.val_SI > self.outl[0].T.val_SI:
+ # hot inlets
+ self.C_F += i.C_mech + i.C_chemical
+ else:
+ # cold inlets
+ self.C_F += - i.m.val_SI * i.c_therm * i.ex_therm + (
+ i.C_therm + i.C_mech + i.C_chemical)
+ self.C_F += (-self.outl[0].C_mech - self.outl[0].C_chemical)
+ self.C_P = self.C_F + self.Z_costs # +1/num_serving_comps * C_diff
+ # ToDo: add case that merge profits from dissipative component(s)
+
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ if self.outl[0].Ex_chemical != 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical
+ for i, h in enumerate(self.inl):
+ exergy_cost_matrix[counter+0, self.inl[i].Ex_C_col["chemical"]] = h.m.val_SI / (self.outl[0].m.val_SI * h.Ex_chemical)
+ else:
+ exergy_cost_matrix[counter+0, self.outl[i].Ex_C_col["chemical"]] = 1
+
+ if self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ for i, h in enumerate(self.inl):
+ exergy_cost_matrix[counter+1, self.inl[i].Ex_C_col["mech"]] = h.m.val_SI / (self.outl[0].m.val_SI * h.Ex_mech)
+ else:
+ exergy_cost_matrix[counter+1, self.outl[i].Ex_C_col["mech"]] = 1
+
+ for i in range(2):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+2]
+
+
+ def dis_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ if self.outl[0].Ex_chemical != 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical
+ for i, h in enumerate(self.inl):
+ exergy_cost_matrix[counter+0, self.inl[i].Ex_C_col["chemical"]] = h.m.val_SI / (self.outl[0].m.val_SI * h.Ex_chemical)
+ else:
+ exergy_cost_matrix[counter+0, self.outl[i].Ex_C_col["chemical"]] = 1
+
+ if self.outl[0].Ex_mech != 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ for i, h in enumerate(self.inl):
+ exergy_cost_matrix[counter+1, self.inl[i].Ex_C_col["mech"]] = h.m.val_SI / (self.outl[0].m.val_SI * h.Ex_mech)
+ else:
+ exergy_cost_matrix[counter+1, self.outl[i].Ex_C_col["mech"]] = 1
+
+ exergy_cost_matrix[counter+2, self.outl[i].Ex_C_col["therm"]] = 1
+
+ for i in range(3):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+3]
+
def get_plotting_data(self):
"""Generate a dictionary containing FluProDia plotting information.
diff --git a/src/tespy/components/nodes/splitter.py b/src/tespy/components/nodes/splitter.py
index ed774a076..675090904 100644
--- a/src/tespy/components/nodes/splitter.py
+++ b/src/tespy/components/nodes/splitter.py
@@ -210,3 +210,57 @@ def energy_balance_deriv(self, k):
self.jacobian[k + eq, self.inl[0].h.J_col] = 1
if o.h.is_var:
self.jacobian[k + eq, o.h.J_col] = -1
+
+ def exergy_balance(self, T0):
+ r"""
+ Calculate exergy balance of a Splitter.
+
+ Parameters
+ ----------
+ T0 : float
+ Ambient temperature T0 / K.
+
+ Note
+ ----
+ no exergy is being produced or destroyed.
+
+ .. math::
+
+ """
+ self.E_P = sum(conn.Ex_physical for conn in self.outl)
+ self.E_F = self.inl[0].Ex_physical
+
+ self.E_bus = {
+ "chemical": np.nan, "physical": np.nan, "massless": np.nan
+ }
+ self.E_D = self.E_F - self.E_P
+ self.epsilon = self.E_P / self.E_F
+
+ def exergoeconomic_balance(self, T0):
+ self.C_P = 0
+ for o in self.outl:
+ self.C_P += o.C_tot
+ self.C_F = self.inl[0].C_tot
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # either all Ex 0 or or unequal 0
+ for i, o in enumerate(self.outl):
+ exergy_cost_matrix[counter+3*i, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm if self.inl[0].Ex_therm != 0 else 1
+ exergy_cost_matrix[counter+3*i, o.Ex_C_col["therm"]] = -1 / o.Ex_therm if o.Ex_therm != 0 else -1
+ exergy_cost_matrix[counter+3*i+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech if self.inl[0].Ex_mech != 0 else 1
+ exergy_cost_matrix[counter+3*i+1, o.Ex_C_col["mech"]] = -1 / o.Ex_mech if o.Ex_mech != 0 else .1
+ if counter+3*i+2 < len(exergy_cost_vector):
+ exergy_cost_matrix[counter+3*i+2, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+3*i+2, o.Ex_C_col["chemical"]] = -1 / o.Ex_chemical if o.Ex_chemical != 0 else -1
+
+ for i in range(3*len(self.outl)-1):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+3*len(self.outl)-1]
diff --git a/src/tespy/components/piping/valve.py b/src/tespy/components/piping/valve.py
index 723e1d829..a48744e72 100644
--- a/src/tespy/components/piping/valve.py
+++ b/src/tespy/components/piping/valve.py
@@ -369,6 +369,7 @@ def exergy_balance(self, T0):
\end{cases}
"""
if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ self.dissipative.val = True
self.E_P = np.nan
self.E_F = self.inl[0].Ex_physical - self.outl[0].Ex_physical
elif self.outl[0].T.val_SI <= T0 and self.inl[0].T.val_SI > T0:
@@ -394,6 +395,109 @@ def exergy_balance(self, T0):
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+ def exergoeconomic_balance(self, T0):
+ if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical
+ self.C_P = np.nan
+ # dissipative
+ elif self.outl[0].T.val_SI <= T0 and self.inl[0].T.val_SI > T0:
+ self.C_P = self.outl[0].C_therm
+ self.C_F = self.inl[0].C_therm + (
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.outl[0].C_therm - self.inl[0].C_therm
+ self.C_F = self.inl[0].C_mech - self.outl[0].C_mech
+ else:
+ msg = ('Exergy balance of a valve, where outlet temperature is '
+ 'larger than inlet temperature is not implmented.')
+ logger.warning(msg)
+ self.C_P = np.nan
+ self.C_F = np.nan
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.c_P - self.c_F) / self.c_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ print("you shouldn't see this")
+ elif self.outl[0].T.val_SI <= T0:
+ # mech
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter, self.outl[0].Ex_C_col["mech"]] = -1
+ # chemical doesn't change either both 0 or not 0
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ else:
+ msg = ('Exergy balance of a valve, where outlet temperature is '
+ 'larger than inlet temperature is not implmented.')
+ logger.warning(msg)
+
+ for i in range(2):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+2]
+
+
+ def dis_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # nothing changes for the working fluid
+ # therm
+ if self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm
+ elif self.inl[0].Ex_therm == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ elif self.inl[0].Ex_therm != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = 1
+ else:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1
+ # mech
+ if self.inl[0].Ex_mech != 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
+ elif self.inl[0].Ex_mech == 0 and self.outl[0].Ex_therm != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ elif self.inl[0].Ex_mech != 0 and self.outl[0].Ex_therm == 0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = 1
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1
+ # chemical doesn't change either both 0 or not 0
+ exergy_cost_matrix[counter+2, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+
+ for i in range(3):
+ exergy_cost_vector[counter+i]=0
+
+ if self.serving_components is None:
+ print("there should be a serving component, you shouldn't see this")
+ for comp in self.serving_components:
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["therm"]] += 1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["therm"]] += -1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["mech"]] += 1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["mech"]] += -1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.inl[0].Ex_C_col["chemical"]] += 1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.outl[0].Ex_C_col["chemical"]] += -1/len(self.serving_components)
+ exergy_cost_matrix[comp.exergy_cost_line, self.Ex_C_col["dissipative"]] = 1/len(self.serving_components)
+
+ exergy_cost_matrix[counter+3, self.Ex_C_col["dissipative"]] = 1
+ exergy_cost_vector[counter+3] = self.Z_costs
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+4]
+
+
def get_plotting_data(self):
"""Generate a dictionary containing FluProDia plotting information.
diff --git a/src/tespy/components/turbomachinery/compressor.py b/src/tespy/components/turbomachinery/compressor.py
index 5c7668d92..6535372cc 100644
--- a/src/tespy/components/turbomachinery/compressor.py
+++ b/src/tespy/components/turbomachinery/compressor.py
@@ -732,3 +732,58 @@ def exergy_balance(self, T0):
}
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
+ self.C_P = self.outl[0].C_physical - self.inl[0].C_physical
+ self.C_F = self.C_bus
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI > T0:
+ self.C_P = self.outl[0].C_therm + (
+ self.outl[0].C_mech - self.inl[0].C_mech)
+ self.C_F = self.C_bus + self.inl[0].C_therm
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.outl[0].C_mech - self.inl[0].C_mech
+ self.C_F = self.C_bus + (
+ self.inl[0].C_therm - self.outl[0].C_therm)
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.C_P - self.C_F) / self.C_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ # c_in_ch = c_out_ch
+ # delta c_therm = delta c_mech # alt: c_out_th - c_in_th = c_out_mech - c_in_mech -> c_out_th - c_in_th - c_out_mech + c_in_mech = 0
+
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else 1
+
+ dET = self.outl[0].Ex_therm - self.inl[0].Ex_therm
+ dEM = self.outl[0].Ex_mech - self.inl[0].Ex_mech
+
+ if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ if dET != 0 and dEM != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["therm"]] = -1/dET
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/dET
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1/dEM
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1/dEM
+ else:
+ print("case that thermal or mechanical exergy at pump outlet doesn't change is not implemented in exergoeconomics yet")
+
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI > T0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1/dEM
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1/dEM
+
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["therm"]] = -1/self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/self.outl[0].Ex_therm
+
+
+ for i in range(2):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+2]
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/components/turbomachinery/pump.py b/src/tespy/components/turbomachinery/pump.py
index 2fd0568f8..df29c196f 100644
--- a/src/tespy/components/turbomachinery/pump.py
+++ b/src/tespy/components/turbomachinery/pump.py
@@ -573,3 +573,58 @@ def exergy_balance(self, T0):
}
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
+ self.C_P = self.outl[0].C_physical - self.inl[0].C_physical
+ self.C_F = self.C_bus
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI > T0:
+ self.C_P = self.outl[0].C_therm + (
+ self.outl[0].C_mech - self.inl[0].C_mech)
+ self.C_F = self.C_bus + self.inl[0].C_therm
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.outl[0].C_mech - self.inl[0].C_mech
+ self.C_F = self.C_bus + (
+ self.inl[0].C_therm - self.outl[0].C_therm)
+
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.C_P - self.C_F) / self.C_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+
+ if self.inl[0].Ex_chemical != 0 and self.outl[0].Ex_chemical != 0:
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else 1
+
+ dET = self.outl[0].Ex_therm - self.inl[0].Ex_therm
+ dEM = self.outl[0].Ex_mech - self.inl[0].Ex_mech
+
+ if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ if dET != 0 and dEM != 0:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["therm"]] = -1/dET
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/dET
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1/dEM
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1/dEM
+ else:
+ print("case that thermal or mechanical exergy at pump outlet doesn't change is not implemented in exergoeconomics yet")
+
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI > T0:
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/self.outl[0].Ex_therm
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1/dEM
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1/dEM
+
+ else:
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["therm"]] = -1/self.inl[0].Ex_therm
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["therm"]] = 1/self.outl[0].Ex_therm
+
+
+ for i in range(2):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+2]
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/components/turbomachinery/turbine.py b/src/tespy/components/turbomachinery/turbine.py
index 8995e265d..5e43127e1 100644
--- a/src/tespy/components/turbomachinery/turbine.py
+++ b/src/tespy/components/turbomachinery/turbine.py
@@ -23,6 +23,7 @@
class Turbine(Turbomachine):
+
r"""
Class for gas or steam turbines.
@@ -577,3 +578,43 @@ def exergy_balance(self, T0):
self.E_bus = {"chemical": 0, "physical": 0, "massless": -self.P.val}
self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def exergoeconomic_balance(self, T0):
+ if self.inl[0].T.val_SI >= T0 and self.outl[0].T.val_SI >= T0:
+ self.C_P = self.C_bus # Jubran: self.C_P = self.C_F + self.Z_costs
+ self.C_F = self.inl[0].C_physical - self.outl[0].C_physical # same as Jubran
+ elif self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.C_bus + self.outl[0].C_therm
+ self.C_F = self.inl[0].C_therm + ( # same as Jubran
+ self.inl[0].C_mech - self.outl[0].C_mech)
+ elif self.inl[0].T.val_SI <= T0 and self.outl[0].T.val_SI <= T0:
+ self.C_P = self.C_bus + (
+ self.outl[0].C_therm - self.inl[0].C_therm)
+ self.C_F = self.inl[0].C_mech - self.outl[0].C_mech # same as Jubran
+
+
+ self.c_F = self.C_F / self.E_F
+ self.c_P = self.C_P / self.E_P
+ self.C_D = self.c_F * self.E_D
+ self.r = (self.C_P - self.C_F) / self.C_F
+ self.f = self.Z_costs / (self.Z_costs + self.C_D)
+
+
+ def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
+ if self.inl[0].T.val_SI > T0 and self.outl[0].T.val_SI > T0:
+ # wenn Temperaturen größer T0 düfte Ex_therm sowieso nicht 0 sein
+ exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["therm"]] = 1 / self.inl[0].Ex_therm if self.inl[0].Ex_therm != 0 else 1
+ exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["therm"]] = -1 / self.outl[0].Ex_therm if self.outl[0].Ex_therm != 0 else -1
+ exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech if self.inl[0].Ex_mech != 0 else 1
+ exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech if self.outl[0].Ex_mech != 0 else -1
+ exergy_cost_matrix[counter+2, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical if self.inl[0].Ex_chemical != 0 else 1
+ exergy_cost_matrix[counter+2, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical if self.outl[0].Ex_chemical != 0 else -1
+ else:
+ print("Turbine with outlet below T0 not implemented in exergoeconomics yet")
+
+ for i in range(3):
+ exergy_cost_vector[counter+i]=0
+
+ return [exergy_cost_matrix, exergy_cost_vector, counter+3]
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/connections/connection.py b/src/tespy/connections/connection.py
index 333709154..78abb8aa1 100644
--- a/src/tespy/connections/connection.py
+++ b/src/tespy/connections/connection.py
@@ -9,6 +9,8 @@
SPDX-License-Identifier: MIT
"""
+from collections import OrderedDict
+
import numpy as np
from tespy.components.component import Component
@@ -259,6 +261,19 @@ def __init__(self, source, outlet_id, target, inlet_id,
self.local_design = False
self.local_offdesign = False
self.printout = True
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ self.Ex_C_col = np.nan
+ self.c_therm = np.nan
+ self.c_mech = np.nan
+ self.c_physical = np.nan
+ self.c_chemical = np.nan
+ self.c_tot = np.nan
+ self.C_therm = np.nan
+ self.C_mech = np.nan
+ self.C_physical = np.nan
+ self.C_chemical = np.nan
+ self.C_tot = np.nan
+ """+F+F+F+F++++START++++F+F+F+F+"""
# set default values for kwargs
self.property_data = self.get_parameters()
@@ -302,7 +317,7 @@ def _check_connector_id(self, component, connector_id, connecter_locations):
if connector_id not in connecter_locations:
msg = (
"Error creating connection. Specified connector for "
- f"{component.label} ({connector_id}) is not available. Choose "
+ f"{component.label} ({connector_id} is not available. Choose "
f"from " + ", ".join(connecter_locations) + "."
)
logger.error(msg)
@@ -626,7 +641,7 @@ def preprocess(self):
container._solved = False
self.residual = np.zeros(self.num_eq)
- self.jacobian = {}
+ self.jacobian = OrderedDict()
def simplify_specifications(self):
systemvar_specs = []
@@ -726,7 +741,7 @@ def primary_ref_func(self, k, **kwargs):
ref = self.get_attr(f"{variable}_ref").ref
self.residual[k] = (
self.get_attr(variable).val_SI
- - (ref.obj.get_attr(variable).val_SI * ref.factor + ref.delta_SI)
+ - ref.obj.get_attr(variable).val_SI * ref.factor + ref.delta_SI
)
def primary_ref_deriv(self, k, **kwargs):
@@ -763,7 +778,7 @@ def T_deriv(self, k, **kwargs):
def T_ref_func(self, k, **kwargs):
ref = self.T_ref.ref
self.residual[k] = (
- self.calc_T() - (ref.obj.calc_T() * ref.factor + ref.delta_SI)
+ self.calc_T() - ref.obj.calc_T() * ref.factor + ref.delta_SI
)
def T_ref_deriv(self, k, **kwargs):
@@ -812,7 +827,7 @@ def v_ref_func(self, k, **kwargs):
ref = self.v_ref.ref
self.residual[k] = (
self.calc_vol(T0=self.T.val_SI) * self.m.val_SI
- - (ref.obj.calc_vol(T0=ref.obj.T.val_SI) * ref.obj.m.val_SI * ref.factor + ref.delta_SI)
+ - ref.obj.calc_vol(T0=ref.obj.T.val_SI) * ref.obj.m.val_SI * ref.factor + ref.delta_SI
)
def v_ref_deriv(self, k, **kwargs):
diff --git a/src/tespy/tools/analyses.py b/src/tespy/tools/analyses.py
index c3dba2de3..3e44e05a6 100644
--- a/src/tespy/tools/analyses.py
+++ b/src/tespy/tools/analyses.py
@@ -490,6 +490,280 @@ def analyse(self, pamb, Tamb, Chem_Ex=None):
self.create_group_data()
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ def evaluate_exergoeconomics(self, Exe_Eco_Costs, Tamb):
+ Tamb_SI = hlp.convert_to_SI('T', Tamb, self.nw.T_unit)
+ # TO DO: need to add checks and error messages
+
+ # DETERMINE NUMBER OF VARIABLES FOR MATRIX AND THEIR POSITION
+ col_number = 0
+ for comp in self.nw.comps["object"]:
+ comp.Ex_C_col = {}
+ comp.C_bus = np.nan
+
+ for bus in self.E_F + self.E_P:
+ bus.Ex_C_col = {}
+ bus.E_external = {}
+ bus.C_external = {}
+
+ if not any([comp.component() in ["source", "sink"] for comp in bus.comps.index]):
+ bus.Ex_C_col["external_bus"] = col_number
+ col_number += 1
+ # calculate exergy transportet to/from external
+ bus.E_external["bus"] = 0
+ for comp, comp_data in bus.comps.iterrows():
+ if comp_data["base"] == "bus":
+ bus.E_external["bus"] += comp.E_bus["massless"] / comp.calc_bus_efficiency(bus)
+ # E_external > 0 means bus gets energy from external source
+ else:
+ bus.E_external["bus"] -= comp.E_bus["massless"] * comp.calc_bus_efficiency(bus)
+ # E_external < 0 means bus gives energy to external sink
+
+ # WRITE GIVEN POWER AND HEAT COSTS INTO OBJECTS
+ if f"{bus.label}_c" in Exe_Eco_Costs:
+ bus.C_external["bus"] = Exe_Eco_Costs[f"{bus.label}_c"] * 10**-9 * abs(bus.E_external["bus"])
+ elif bus.E_external["bus"] > 0:
+ # standard values
+ bus.C_external["bus"] = 10 * 10**-9 * abs(bus.E_external["bus"])
+ print("no bus costs provided")
+ for comp in bus.comps.index:
+ if comp.component() not in ["source", "sink"]:
+ comp.Ex_C_col[f"{bus.label}_bus"] = col_number
+ col_number += 1
+ comp.Ex_C_col[f"{bus.label}_component"] = col_number
+ col_number += 1
+
+ for comp in self.nw.comps['object']:
+ if comp.dissipative.val:
+ comp.Ex_C_col["dissipative"] = col_number
+ col_number += 1
+ num_variables = (
+ len(self.nw.conns) * 3
+ + col_number
+ )
+
+ for conn in self.nw.conns["object"]:
+ conn.Ex_C_col = {
+ "therm": col_number,
+ "mech": col_number + 1,
+ "chemical": col_number + 2
+ }
+ col_number += 3
+
+ # WRITE GIVEN COMPONENT AND SOURCE COSTS INTO OBJECTS
+ for bus in self.E_F + self.E_P + self.E_L + self.internal_busses:
+ for i, comp in enumerate(bus.comps.index):
+ if comp.component() == "source":
+ c_id = f"{comp.label}_c" # material costs
+ if c_id in Exe_Eco_Costs:
+ comp.set_source_costs(Exe_Eco_Costs[f"{c_id}"]*10**-9)
+ else:
+ comp.set_source_costs_standard()
+ print("no source costs entered")
+
+ for comp in self.nw.comps['object']:
+ Z_id = f"{comp.label}_Z" # component costs
+ if Z_id in Exe_Eco_Costs:
+ comp.set_Z_costs(Exe_Eco_Costs[f"{Z_id}"]/3600)
+ else:
+ if not comp.component() in["source", "sink"]:
+ comp.set_Z_costs_standard()
+
+ # SETTING UP THE MATRIX
+ exergy_cost_matrix = np.zeros([num_variables,num_variables])
+ exergy_cost_vector = np.zeros(num_variables)
+ counter = 0
+
+ # ADD KNOWN BUS COSTS TO MATRIX
+ for bus in self.E_F:
+ # bus.Ex_C_col is the position of the variable going over the system boarder (external)
+ if len(bus.Ex_C_col)>0 and len(bus.C_external)>0:
+ exergy_cost_matrix[counter][bus.Ex_C_col["external_bus"]] = 1
+ exergy_cost_vector[counter] = bus.C_external["bus"]
+ counter += 1
+
+ # ADD AUXILIARY EQUATION FOR BUS
+ for bus in self.E_F + self.E_P + self.internal_busses:
+ # all outputs have same c
+ if not any([comp.component() in ["source", "sink"] for comp in bus.comps.index]):
+ supplied_components = []
+ for comp, comp_data in bus.comps.iterrows():
+ if comp_data["base"] == "bus": # goes out of bus
+ supplied_components.append(comp)
+ # if connected to external
+ if len(bus.Ex_C_col)>0:
+ if bus.E_external["bus"] < 0: # bus gives exergy to external
+ for comp in supplied_components:
+ exergy_cost_matrix[counter][bus.Ex_C_col["external_bus"]] = 1 / abs(bus.E_external["bus"])
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_bus"]] = -1 / (comp.E_bus["massless"] / comp.calc_bus_efficiency(bus))
+ exergy_cost_vector[counter] = 0
+ counter += 1
+ elif bus.E_external["bus"] > 0: # bus needs external power
+ for i in range(len(supplied_components) -1):
+ exergy_cost_matrix[counter][supplied_components[i].Ex_C_col[f"{bus.label}_bus"]] = 1 / (supplied_components[i].E_bus["massless"] / comp.calc_bus_efficiency(bus))
+ exergy_cost_matrix[counter][supplied_components[i+1].Ex_C_col[f"{bus.label}_bus"]] = -1 / (comp.E_bus["massless"] / comp.calc_bus_efficiency(bus))
+ exergy_cost_vector[counter] = 0
+ counter += 1
+ # if not connected to external --> same as if needs external power
+ else:
+ for i in range(len(supplied_components) -1):
+ exergy_cost_matrix[counter][supplied_components[i].Ex_C_col[f"{bus.label}_bus"]] = 1 / (supplied_components[i].E_bus["massless"] / comp.calc_bus_efficiency(bus))
+ exergy_cost_matrix[counter][supplied_components[i+1].Ex_C_col[f"{bus.label}_bus"]] = -1 / (supplied_components[i+1].E_bus["massless"] / comp.calc_bus_efficiency(bus))
+ exergy_cost_vector[counter] = 0
+ counter += 1
+
+ # for each component C_bus = C_component (also for internal busses) as long as there are no bus costs
+ for comp in bus.comps.index:
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_bus"]] = 1
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_component"]] = -1
+ exergy_cost_vector[counter] = 0
+ counter += 1
+
+
+ # BUS BALANCE
+ for bus in self.E_F + self.E_P + self.internal_busses:
+ if not any([comp.component() in ["source", "sink"] for comp in bus.comps.index]):
+ for comp, comp_data in bus.comps.iterrows():
+ if comp_data["base"] == "bus": # seen from position of bus
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_bus"]] = -1
+ # goes out of the bus and into the component
+ else:
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_bus"]] = +1
+ # goes out of the component and into the bus
+
+ if len(bus.Ex_C_col) > 0: # bus is connected to external source/sink
+ if bus.E_external["bus"] < 0: # bus gives exergy to external same as if bus in self.E_P:
+ exergy_cost_matrix[counter][bus.Ex_C_col["external_bus"]] = -1
+ elif bus.E_external["bus"] > 0: # bus needs exergy from external same as elif bus in self.E_F:
+ exergy_cost_matrix[counter][bus.Ex_C_col["external_bus"]] = +1
+
+ counter += 1
+
+ # productive components
+ for comp in self.nw.comps['object']:
+ comp.exergy_cost_line = counter
+ if not comp.dissipative.val:
+
+ # ADD KNOWN SOURCE COSTS TO MATRIX
+ if comp.component() == "source":
+ # thermal exergy related source costs
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["therm"]] = +1
+ exergy_cost_vector[counter] = comp.outl[0].C_therm
+ counter +=1
+
+ # mechanical exergy related source costs
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["mech"]] = +1
+ exergy_cost_vector[counter] = comp.outl[0].C_mech
+ counter +=1
+
+ # chemical exergy related source costs
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["chemical"]] = +1
+ exergy_cost_vector[counter] = comp.outl[0].C_chemical
+ counter +=1
+
+ # ADD COST BALANCE FOR EACH COMPONENT that isn't a source or sink
+ # and has an associated cost value or is a cycle closer (-> cost value = 0)
+ if comp.component() == "cycle closer":
+ exergy_cost_matrix[counter][comp.inl[0].Ex_C_col["therm"]] = +1
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["therm"]] = -1
+ exergy_cost_vector[counter] = 0
+ counter +=1
+ exergy_cost_matrix[counter][comp.inl[0].Ex_C_col["mech"]] = +1
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["mech"]] = -1
+ exergy_cost_vector[counter] = 0
+ counter +=1
+ exergy_cost_matrix[counter][comp.outl[0].Ex_C_col["chemical"]] = +1
+ # for closed systems, one value has to be predetermined in order to make the system solvable
+ exergy_cost_vector[counter] = 0
+ counter +=1
+ if not (comp.component() in ["source", "sink", "cycle closer"] or np.isnan(comp.Z_costs)):
+ for comp_inl in comp.inl:
+ exergy_cost_matrix[counter][comp_inl.Ex_C_col["therm"]] = +1
+ exergy_cost_matrix[counter][comp_inl.Ex_C_col["mech"]] = +1
+ exergy_cost_matrix[counter][comp_inl.Ex_C_col["chemical"]] = +1
+ for comp_outl in comp.outl:
+ exergy_cost_matrix[counter][comp_outl.Ex_C_col["therm"]] = -1
+ exergy_cost_matrix[counter][comp_outl.Ex_C_col["mech"]] = -1
+ exergy_cost_matrix[counter][comp_outl.Ex_C_col["chemical"]] = -1
+
+ for bus in self.E_F + self.E_P + self.E_L + self.internal_busses:
+ if comp in bus.comps.index:
+ if bus.comps.loc[comp, 'base'] == 'bus':
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_component"]] = +1 # goes into component
+ else:
+ exergy_cost_matrix[counter][comp.Ex_C_col[f"{bus.label}_component"]] = -1 # goes out of component
+
+ exergy_cost_vector[counter] = -comp.Z_costs
+ counter +=1
+
+ # ADD AUXILIARY EQUATIONS (F AND P RULES)
+ aux_eqs = comp.aux_eqs(exergy_cost_matrix, exergy_cost_vector, counter, Tamb_SI)
+ exergy_cost_matrix = aux_eqs[0]
+ exergy_cost_vector = aux_eqs[1]
+ counter = aux_eqs[2]
+
+ # DISSIPATIVE COMPONENTS (need to be handled last)
+ for comp in self.nw.comps['object']:
+ if comp.dissipative.val:
+ if comp.serving_components is None:
+ numComps = sum(1 for comp in self.nw.comps['object'] if comp.component() not in ["source", "sink"])
+ if numComps ==1:
+ print("Network consists of dissipative component only")
+ comp.serving_components = []
+ for c in self.nw.comps['object']:
+ if not c == comp and not c.component() in ["source", "sink", "cycle closer"] and not c.dissipative.val:
+ comp.serving_components.append(c)
+ dis_eqs = comp.dis_eqs(exergy_cost_matrix, exergy_cost_vector, counter, Tamb_SI) # changes Z_costs of serving component
+ exergy_cost_matrix = dis_eqs[0]
+ exergy_cost_vector = dis_eqs[1]
+ counter = dis_eqs[2]
+
+ if counter!=num_variables:
+ print("not enough equations: ", num_variables-counter, " missing")
+
+
+ try:
+ C_sol = np.linalg.solve (exergy_cost_matrix, exergy_cost_vector)
+ except np.linalg.LinAlgError:
+ msg = f"System is not solvable\nA = \n{np.round(exergy_cost_matrix,3)} \n b =\n{np.round(exergy_cost_vector,3)}"
+ logger.error(msg)
+ raise hlp.TESPyNetworkError(msg)
+ if np.isnan(exergy_cost_matrix).any():
+ msg = f"System contains nan value\nA = \n{np.round(exergy_cost_matrix,3)} \n b =\n{np.round(exergy_cost_vector,3)}"
+ logger.error(msg)
+ raise hlp.TESPyNetworkError(msg)
+
+ # WRITE SOLUTIONS INTO OBJECTS
+ for conn in self.nw.conns["object"]:
+ conn.C_therm = C_sol[conn.Ex_C_col["therm"]]
+ conn.C_mech = C_sol[conn.Ex_C_col["mech"]]
+ conn.C_physical = conn.C_therm + conn.C_mech
+ conn.C_chemical = C_sol[conn.Ex_C_col["chemical"]]
+ conn.C_tot = conn.C_physical + conn.C_chemical
+
+ conn.c_therm = conn.C_therm / conn.Ex_therm if conn.Ex_therm != 0 else 0
+ conn.c_mech = conn.C_mech / conn.Ex_mech if conn.Ex_mech != 0 else 0
+ conn.c_physical = conn.C_physical / conn.Ex_physical if conn.Ex_physical != 0 else 0
+ conn.c_chemical = conn.C_chemical / conn.Ex_chemical if conn.Ex_chemical != 0 else 0
+ conn.c_tot = conn.C_tot / (conn.Ex_physical + conn.Ex_chemical) if (conn.Ex_physical + conn.Ex_chemical) != 0 else 0
+
+ for bus in self.E_F + self.E_P:
+ for comp, comp_data in bus.comps.iterrows():
+ if not comp.component() in["source", "sink"]:
+ comp.C_bus = C_sol[comp.Ex_C_col[f"{bus.label}_bus"]]
+ comp.c_bus["component"] = comp.C_bus / comp.E_bus["massless"] if comp.E_bus["massless"] != 0 else 0
+ if comp_data["base"] == "bus":
+ comp.c_bus["bus"] = comp.C_bus / (comp.E_bus["massless"]/comp.calc_bus_efficiency(bus)) if comp.E_bus["massless"] != 0 else 0
+ else:
+ comp.c_bus["bus"] = comp.C_bus / (comp.E_bus["massless"]*comp.calc_bus_efficiency(bus)) if comp.E_bus["massless"] != 0 else 0
+
+
+ #CALCULATE C_F, C_P, C_L of components
+ for cp in self.nw.comps['object']:
+ cp.exergoeconomic_balance(Tamb_SI)
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
+
def evaluate_busses(self, cp):
"""Evaluate the exergy balances of busses.
@@ -812,7 +1086,7 @@ def generate_plotly_sankey_input(
def print_results(
self, sort_desc=True,
busses=True, components=True, connections=True, groups=True,
- network=True, aggregation=True):
+ network=True, aggregation=True, Exe_Eco_An = False):
r"""Print the results of the exergy analysis to prompt.
- The results are sorted beginning with the component having the
@@ -892,3 +1166,47 @@ def print_results(
print('##### RESULTS: Functional groups exergy flows #####')
print(tabulate(
df, headers='keys', tablefmt='psql', floatfmt='.3e'))
+
+ """+F+F+F+F++++START++++F+F+F+F+"""
+ # Exergoeconomic Results for Connections
+ # creating data frame here bc this is after analysis where c and C values have been calculated already
+
+ conn_exergoec_data_cols = ['c_T', 'c_M', 'c_CH', 'c_tot', 'C_T', 'C_M', 'C_CH', 'C_tot']
+ self.connection_exergoec_data = pd.DataFrame(
+ columns=conn_exergoec_data_cols,
+ dtype='float64'
+ )
+ for conn in self.nw.conns['object']:
+ conn_exergoec_data = [
+ conn.c_therm*10**9, conn.c_mech*10**9, conn.c_chemical*10**9, conn.c_tot*10**9,
+ conn.C_therm*3600, conn.C_mech*3600, conn.C_chemical*3600, conn.C_tot*3600
+ ]
+ self.connection_exergoec_data.loc[conn.label] = conn_exergoec_data
+
+ if connections and Exe_Eco_An:
+ print('##### RESULTS: Connection exergoeconomic analysis #####')
+ print(tabulate(
+ self.connection_exergoec_data, headers='keys',
+ tablefmt='psql', floatfmt='.3e'))
+
+
+ # Exergoeconomic Results for Components
+ # creating data frame here bc this is after analysis where c and C values have been calculated already
+ comp_exergoec_data_cols = ['C_F', 'C_P', 'C_D', 'C_bus', 'Z', 'r', 'f']
+ self.component_exergoec_data = pd.DataFrame(
+ columns=comp_exergoec_data_cols,
+ dtype='float64'
+ )
+ for comp in self.nw.comps['object']:
+ comp_exergoec_data = [
+ comp.C_F*3600, comp.C_P*3600, comp.C_D*3600, comp.C_bus*3600, comp.Z_costs*3600, comp.r, comp.f
+ ]
+ self.component_exergoec_data.loc[comp.label] = comp_exergoec_data
+
+ if components and Exe_Eco_An:
+ print('##### RESULTS: Component exergoeconomic analysis #####')
+ print(tabulate(
+ self.component_exergoec_data, headers='keys',
+ tablefmt='psql', floatfmt='.3e'))
+
+ """+F+F+F+F++++END++++F+F+F+F+"""
diff --git a/src/tespy/tools/helpers.py b/src/tespy/tools/helpers.py
index 6bb7df624..28447f230 100644
--- a/src/tespy/tools/helpers.py
+++ b/src/tespy/tools/helpers.py
@@ -15,11 +15,44 @@
from copy import deepcopy
import CoolProp.CoolProp as CP
+from CoolProp.CoolProp import PropsSI as CPPSI
from tespy import __datapath__
from tespy.tools import logger
from tespy.tools.global_vars import ERR
from tespy.tools.global_vars import fluid_property_data
+from tespy.tools.global_vars import molar_masses
+
+
+def mass_flow(flow):
+ r"""
+ Calculate mass flow from mol flow.
+
+ Parameters
+ ----------
+ flow : list
+ Fluid property vector containing mass fraction
+ fluid composition.
+
+ Returns
+ -------
+ m_m : dict
+ mass fraction fluid composition m_m / ( ).
+
+ .. math::
+
+ \dot{m}_\mathrm{m} = \frac{x_{i} \cdot M_{i}}{M_{sum}}
+ """
+ molmass = 0
+ mass_fractions = {}
+ for f, back_end in flow.items():
+ molar_masses[f] = CPPSI('M', f)
+ for fluid, n in flow.items():
+ if n > ERR:
+ molmass += n * molar_masses[fluid]
+ for fluid, n in flow.items():
+ mass_fractions[fluid] = n * molar_masses[fluid] / molmass
+ return mass_fractions
def get_all_subdictionaries(data):
diff --git a/tests_friederike/component_tests/combustion_chamber.py b/tests_friederike/component_tests/combustion_chamber.py
new file mode 100644
index 000000000..ef96ff27a
--- /dev/null
+++ b/tests_friederike/component_tests/combustion_chamber.py
@@ -0,0 +1,70 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, CombustionChamber)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 1
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+chamber = CombustionChamber('Combustion Chamber')
+air = Source('Air Inlet')
+fuelgas = Source('Fuel Gas')
+exhaust = Sink('Exhaust')
+
+# connections
+c1 = Connection(air, 'out1', chamber, 'in1', label='Air to Chamber')
+c2 = Connection(fuelgas, 'out1', chamber, 'in2', label='Fuel to Chamber')
+c3 = Connection(chamber, 'out1', exhaust, 'in1', label='to Exhaust')
+
+nw.add_conns(c1, c2, c3)
+
+# define parameters
+match testCase:
+ case 1: # lambda > 1
+ chamber.set_attr(ti=10e6, lamb=1.5)
+ c1.set_attr(
+ p=1.5, T=20,
+ fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+ c2.set_attr(
+ T=20,
+ fluid={"CO2": 0.04, "CH4": 0.96})
+ case 2: # lambda = 1
+ # outlet temperature too high...
+ chamber.set_attr(ti=10e1, lamb=1)
+ c1.set_attr(
+ p=1.0, T=20,
+ fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+ c2.set_attr(
+ T=20,
+ fluid={"H2": 1})
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1.0
+T_amb = 25
+
+# define busses (no need to add them to system)
+heat_in = Bus('Heat In')
+heat_in.add_comps({'comp': fuelgas, 'base': 'bus'})
+
+air_in = Bus('Air In')
+air_in.add_comps({'comp': air, 'base': 'bus'})
+
+exhaust_out = Bus('Exhaust Gas')
+exhaust_out.add_comps({'comp': exhaust})
+
+# exergy analysis
+exe_eco_input = {'Combustion Chamber_Z': 500, 'Air Inlet_c': 2, 'Fuel Gas_c': 5}
+ean = ExergyAnalysis(nw, E_P=[exhaust_out], E_F=[heat_in, air_in], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/compressor.py b/tests_friederike/component_tests/compressor.py
new file mode 100644
index 000000000..1246ab4b2
--- /dev/null
+++ b/tests_friederike/component_tests/compressor.py
@@ -0,0 +1,62 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Compressor)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 3
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+comp = Compressor('Compressor')
+src = Source('Source')
+snk = Sink('Sink')
+
+# connections
+c1 = Connection(src, 'out1', comp, 'in1', label='Source to Compressor')
+c2 = Connection(comp, 'out1', snk, 'in1', label='Compressor to Sink')
+
+nw.add_conns(c1, c2)
+
+# define parameters
+match testCase:
+ case 1: # Tin, Tout >= T0
+ comp.set_attr(pr=5, eta_s=0.8)
+ c1.set_attr(fluid={'O2': 1}, p=1, T=30, v=50)
+ case 2: # Tin <= T0, Tout > T0
+ comp.set_attr(pr=5, eta_s=0.8)
+ c1.set_attr(fluid={'O2': 1}, p=1, T=10, v=50)
+ case 3: # Tin, Tout <= T0
+ comp.set_attr(pr=1.01, eta_s=0.8)
+ c1.set_attr(fluid={'O2': 1}, p=1, T=2, v=50)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 0.1
+T_amb = 25
+
+# define busses (no need to add them to system)
+power = Bus('Power Input')
+power.add_comps({'comp': comp, 'base': 'bus', 'char': 0.9})
+
+air_in = Bus('Air In')
+air_in.add_comps({'comp': src, 'base': 'bus'})
+
+air_out = Bus('Air Out')
+air_out.add_comps({'comp': snk})
+
+
+# exergy analysis
+exe_eco_input = {'Compressor_Z': 500, 'Source_c': 0.0001, 'Power Input_c': 0.002}
+ean = ExergyAnalysis(nw, E_P=[air_out], E_F=[air_in, power], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/condenser.py b/tests_friederike/component_tests/condenser.py
new file mode 100644
index 000000000..e5827cf4a
--- /dev/null
+++ b/tests_friederike/component_tests/condenser.py
@@ -0,0 +1,54 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Condenser)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+cond = Condenser('Heat Exchanger')
+so_h = Source("Source Hot")
+si_h = Sink("Sink Hot")
+so_c = Source("Source Cold")
+si_c = Sink("Sink Cold")
+
+# connections
+c1 = Connection(so_h, 'out1', cond, 'in1', label='Hot In')
+c2 = Connection(so_c, 'out1', cond, 'in2', label='Cold In')
+c3 = Connection(cond, 'out1', si_h, 'in1', label='Hot Out')
+c4 = Connection(cond, 'out2', si_c, 'in1', label='Cold Out')
+
+nw.add_conns(c1, c2, c3, c4)
+
+# define parameters
+cond.set_attr(pr1=1, pr2=1)
+c1.set_attr(T=110, p=1.2, fluid={'Water': 1}, m=5)
+c2.set_attr(T=20, p=1.2, fluid={'Water': 1})
+c4.set_attr(T=30)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 10
+p_amp = 1
+
+# define busses (no need to add them to system)
+working_fluid_heat_out = Bus('Heat In')
+working_fluid_heat_out.add_comps({'comp': so_h, 'base': 'bus'}, {'comp':si_h})
+
+cooling_fluid_heat_in = Bus('Heated fluid')
+cooling_fluid_heat_in.add_comps({'comp':so_c, 'base': 'bus'}, {'comp': si_c})
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Heat Exchanger_Z': 5e3, 'Source Hot_c': 0.02, 'Source Cold_c': 0.05}
+ean = ExergyAnalysis(nw, E_F=[working_fluid_heat_out], E_P=[cooling_fluid_heat_in], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/desuperheater.py b/tests_friederike/component_tests/desuperheater.py
new file mode 100644
index 000000000..5edac75c3
--- /dev/null
+++ b/tests_friederike/component_tests/desuperheater.py
@@ -0,0 +1,55 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Desuperheater)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+desu = Desuperheater('Desuperheater') # cools fluid to saturated gas state
+et_in = Source("Ethanol Inlet")
+et_out = Sink("Ethanol Outlet")
+cw_in = Source("Cooling Water Inlet")
+cw_out = Sink("Cooling Water Outlet")
+
+# connections
+c1 = Connection(et_in, 'out1', desu, 'in1', label='Ethanol In')
+c2 = Connection(cw_in, 'out1', desu, 'in2', label='Water In')
+c3 = Connection(desu, 'out1', et_out, 'in1', label='Ethanol Out')
+c4 = Connection(desu, 'out2', cw_out, 'in1', label='Water Out')
+
+nw.add_conns(c1, c2, c3, c4)
+
+# define parameters
+desu.set_attr(pr1=1, pr2=1)
+c1.set_attr(Td_bp=100, v=10, fluid={'ethanol': 1})
+c3.set_attr(p=1)
+c2.set_attr(T=15, v=1, fluid={'water': 1})
+c4.set_attr(p=1)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses (no need to add them to system)
+ethanol = Bus('Ethanol')
+ethanol.add_comps({'comp': et_in, 'base': 'bus'}, {'comp':et_out})
+
+cooling_water = Bus('Cooling Water')
+cooling_water.add_comps({'comp':cw_in, 'base': 'bus'}, {'comp': cw_out})
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Desuperheater_Z': 5e3, 'Ethanol Inlet_c': 0.02, 'Cooling Water Inlet_c': 0.05}
+ean = ExergyAnalysis(nw, E_F=[cooling_water], E_P=[ethanol], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/diabatic_combustion_chamber.py b/tests_friederike/component_tests/diabatic_combustion_chamber.py
new file mode 100644
index 000000000..78296b324
--- /dev/null
+++ b/tests_friederike/component_tests/diabatic_combustion_chamber.py
@@ -0,0 +1,69 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, DiabaticCombustionChamber)
+from tespy.connections import Connection, Bus, Ref
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 1
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+chamber = DiabaticCombustionChamber('Combustion Chamber')
+air = Source('Air Inlet')
+fuelgas = Source('Fuel Gas')
+exhaust = Sink('Exhaust')
+
+# connections
+c1 = Connection(air, 'out1', chamber, 'in1', label='Air to Chamber')
+c2 = Connection(fuelgas, 'out1', chamber, 'in2', label='Fuel to Chamber')
+c3 = Connection(chamber, 'out1', exhaust, 'in1', label='to Exhaust')
+
+nw.add_conns(c1, c2, c3)
+
+# define parameters
+match testCase:
+ case 1: # lambda > 1
+ chamber.set_attr(pr=0.95, eta=0.99, ti=10e6, lamb=1.5)
+ c1.set_attr(
+ p=1.1, T=20,
+ fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+ c2.set_attr(
+ p=1.1, T=20,
+ fluid={"CO2": 0.04, "CH4": 0.96})
+ case 2: # lambda = 1
+ chamber.set_attr(pr=0.95, eta=0.99, ti=10e6, lamb=1)
+ c1.set_attr(
+ p=1.0, T=20,
+ fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+ c2.set_attr(
+ p=1.0, T=20,
+ fluid={"CO2": 0.04, "CH4": 0.96})
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 25
+
+# define busses (no need to add them to system)
+heat_in = Bus('Heat In')
+heat_in.add_comps({'comp': fuelgas, 'base': 'bus'})
+
+air_in = Bus('Air In')
+air_in.add_comps({'comp': air, 'base': 'bus'})
+
+exhaust_out = Bus('Exhaust Gas')
+exhaust_out.add_comps({'comp': exhaust})
+
+# exergy analysis
+exe_eco_input = {'Combustion Chamber_Z': 500, 'Air Inlet_c': 0.0001, 'Fuel Gas_c': 0.005}
+ean = ExergyAnalysis(nw, E_P=[exhaust_out], E_F=[heat_in, air_in], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/droplet_separator.py b/tests_friederike/component_tests/droplet_separator.py
new file mode 100644
index 000000000..62857d047
--- /dev/null
+++ b/tests_friederike/component_tests/droplet_separator.py
@@ -0,0 +1,54 @@
+
+from tespy.components import Sink, Source, DropletSeparator
+from tespy.connections import Connection, Bus
+from tespy.connections import Connection
+from tespy.tools import ExergyAnalysis
+from tespy.networks import Network
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', iterinfo=False)
+
+# components
+so = Source('Two Phase Inflow')
+si_gas = Sink('Gas Outflow')
+si_liq = Sink('Liquid Outflow')
+ds = DropletSeparator('Droplet Separator')
+
+# connections
+so_ds = Connection(so, 'out1', ds, 'in1', label='Two Phase Inflow')
+ds_si_gas = Connection(ds, 'out2', si_gas, 'in1', label='Gas')
+ds_si_liq = Connection(ds, 'out1', si_liq, 'in1', label='Liquid')
+
+nw.add_conns(so_ds, ds_si_gas, ds_si_liq)
+
+# define parameters
+so_ds.set_attr(x=0.5, p=1.2, fluid={'Water': 1}, m=5)
+
+# solve
+nw.solve('design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 10
+
+# define busses (no need to add them to system)
+two_phase_in = Bus('Two Phase In')
+two_phase_in.add_comps({'comp': so, 'base': 'bus'})
+
+liquid_out = Bus('Liquid Out')
+liquid_out.add_comps({'comp': si_liq})
+
+gas_out = Bus('Gas Out')
+gas_out.add_comps({'comp': si_gas})
+
+# exergy analysis
+exe_eco_input = {'Droplet Separator_Z': 50, 'Two Phase Inflow_c': 10}
+ean = ExergyAnalysis(nw, E_P=[gas_out, liquid_out], E_F=[two_phase_in], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/drum.py b/tests_friederike/component_tests/drum.py
new file mode 100644
index 000000000..67764aab5
--- /dev/null
+++ b/tests_friederike/component_tests/drum.py
@@ -0,0 +1,63 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Drum)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+# network
+nw = Network(fluids=["Water"], T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+drum = Drum('Drum')
+so1 = Source("source 1")
+so2 = Source("source 2")
+si_sat_l = Sink("sat liquid")
+si_sat_g = Sink("sat gas")
+
+# connections
+liq_in_2_hx = Connection(so1, 'out1', drum, 'in1', label='inlet 1')
+gas_in_2_hx = Connection(so2, 'out1', drum, 'in2', label='inlet 2')
+sat_liq_out = Connection(drum, 'out1', si_sat_l, 'in1', label='saturated liquid')
+sat_gas_out = Connection(drum, 'out2', si_sat_g, 'in1', label='saturated gas')
+
+nw.add_conns(liq_in_2_hx, sat_liq_out)
+nw.add_conns(gas_in_2_hx, sat_gas_out)
+
+
+# define parameters
+liq_in_2_hx.set_attr(T=60, p=1, fluid={'Water': 1}, m=5)
+gas_in_2_hx.set_attr(T=200, fluid={'Water': 1}, m=50)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 10
+p_amp = 1
+
+# define busses (no need to add them to system)
+eco_out = Bus('liquid in')
+eco_out.add_comps({'comp': so1, 'base': 'bus'})
+
+liq_out = Bus('liquid out')
+liq_out.add_comps({'comp': si_sat_l})
+
+eva_out = Bus('gas in')
+eva_out.add_comps({'comp': so2, 'base': 'bus'})
+
+gas_out = Bus('gas out')
+gas_out.add_comps({'comp': si_sat_g})
+
+
+
+ean = ExergyAnalysis(nw, E_F=[eco_out, eva_out], E_P=[liq_out, gas_out], E_L=[])
+exe_eco_input = {'Drum_Z': 50, 'source 1_c': 10/(10**9/3600), 'source 2_c': 10/(10**9/3600)}
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex= chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/heat_exchanger.py b/tests_friederike/component_tests/heat_exchanger.py
new file mode 100644
index 000000000..f2eb80c19
--- /dev/null
+++ b/tests_friederike/component_tests/heat_exchanger.py
@@ -0,0 +1,94 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, HeatExchanger)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 2
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+hx = HeatExchanger('Heat Exchanger')
+so_h = Source("Source Hot")
+si_h = Sink("Sink Hot")
+so_c = Source("Source Cold")
+si_c = Sink("Sink Cold")
+
+# connections
+c1 = Connection(so_h, 'out1', hx, 'in1', label='Hot In')
+c2 = Connection(so_c, 'out1', hx, 'in2', label='Cold In')
+c3 = Connection(hx, 'out1', si_h, 'in1', label='Hot Out')
+c4 = Connection(hx, 'out2', si_c, 'in1', label='Cold Out')
+
+nw.add_conns(c1, c2, c3, c4)
+
+# define parameters
+match testCase:
+ case 1:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=110, p=1.2, fluid={'Water': 1}, m=5)
+ c2.set_attr(T=25, p=1.2, fluid={'Water': 1}, m=6)
+ c4.set_attr(T=30)
+ case 2:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=15, p=1.2, fluid={'Water': 1}, m=5)
+ c2.set_attr(T=2, p=1.2, fluid={'Water': 1}, m=6)
+ c4.set_attr(T=10)
+ case 3:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=35, p=1.2, fluid={'Water': 1}, m=5)
+ c2.set_attr(T=15, p=1.2, fluid={'Water': 1}, m=6)
+ c4.set_attr(T=30)
+ case 4:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=22, p=1.2, fluid={'Water': 1}, m=2)
+ c2.set_attr(T=15, p=1.2, fluid={'Water': 1}, m=6)
+ c4.set_attr(T=19)
+ case 5:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=30, p=1.2, fluid={'Water': 1}, m=5)
+ c2.set_attr(T=10, p=1.2, fluid={'Water': 1}, m=5)
+ c4.set_attr(T=15)
+ case 6:
+ hx.set_attr(pr1=1, pr2=1)
+ c1.set_attr(T=40, p=1.2, fluid={'Water': 1}, m=5)
+ c2.set_attr(T=18, p=1.2, fluid={'Water': 1}, m=5)
+ c4.set_attr(T=21)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses (no need to add them to system)
+warm_stream = Bus('Warm Stream')
+warm_stream.add_comps({'comp': so_h, 'base': 'bus'}, {'comp':si_h})
+
+cold_stream = Bus('Cold Stream')
+cold_stream.add_comps({'comp':so_c, 'base': 'bus'}, {'comp': si_c})
+
+# exergy and exergoeconomic analysis
+match testCase:
+ case 1:
+ # hot heats up cold
+ exe_eco_input = {'Heat Exchanger_Z': 5e1, 'Source Hot_c': 0.05, 'Source Cold_c': 0.02}
+ ean = ExergyAnalysis(nw, E_F=[warm_stream], E_P=[cold_stream], E_L=[])
+ case 2:
+ # cold cools hot
+ exe_eco_input = {'Heat Exchanger_Z': 5e1, 'Source Hot_c': 0.02, 'Source Cold_c': 0.05}
+ ean = ExergyAnalysis(nw, E_F=[cold_stream], E_P=[warm_stream], E_L=[])
+ case _:
+ exe_eco_input = {'Heat Exchanger_Z': 5e1, 'Source Hot_c': 0.05, 'Source Cold_c': 0.02}
+ ean = ExergyAnalysis(nw, E_F=[warm_stream], E_P=[cold_stream], E_L=[])
+
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/merge.py b/tests_friederike/component_tests/merge.py
new file mode 100644
index 000000000..85763bb30
--- /dev/null
+++ b/tests_friederike/component_tests/merge.py
@@ -0,0 +1,91 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Merge)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 3 # (1: out > T0, 2: out = T0, 3: out < T0)
+numInlets = 2 # 2 or 3
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+so_cold = Source("cold_stream")
+si = Sink("out_mix")
+so_hot = Source("hot_stream")
+match numInlets:
+ case 2:
+ hx = Merge('Mixer', num_in = 2)
+ case 3:
+ hx = Merge('Mixer', num_in = 3)
+ so_hot_2 = Source("hot_stream_2")
+
+
+# connections
+cold_in_mixer = Connection(so_cold, 'out1', hx, 'in1', label='cold_stream to Mixer')
+hot_in_mixer = Connection(so_hot, 'out1', hx, 'in2', label='hot_stream to Mixer')
+out_mix = Connection(hx, 'out1', si, 'in1', label='out as mix')
+
+nw.add_conns(cold_in_mixer, out_mix, hot_in_mixer)
+
+if numInlets > 2:
+ hot2_in_mixer = Connection(so_hot_2, 'out1', hx, 'in3', label='hot_stream_2 to Mixer')
+ nw.add_conns(hot2_in_mixer)
+
+
+# define parameters
+match testCase:
+ case 1:
+ out_mix.set_attr(T=80, p=2, fluid={'Water': 1}, m=10)
+ cold_in_mixer.set_attr(T=70, fluid={'Water': 1}, m=3)
+ if numInlets > 2:
+ hot_in_mixer.set_attr(T=90, fluid={'Water': 1}, m=2)
+ case 2:
+ out_mix.set_attr(T=20, p=2, fluid={'Water': 1}, m=10)
+ cold_in_mixer.set_attr(T=10, fluid={'Water': 1}, m=3)
+ if numInlets > 2:
+ hot_in_mixer.set_attr(T=30, fluid={'Water': 1}, m=2)
+ case 3:
+ out_mix.set_attr(T=15, p=2, fluid={'Water': 1}, m=10)
+ cold_in_mixer.set_attr(T=5, fluid={'Water': 1}, m=3)
+ if numInlets > 2:
+ hot_in_mixer.set_attr(T=18, fluid={'Water': 1}, m=2)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses
+cold_in = Bus('cold')
+cold_in.add_comps({'comp': so_cold, 'base': 'bus'})
+
+hot_in = Bus('hot')
+hot_in.add_comps({'comp': so_hot, 'base': 'bus'})
+
+if numInlets > 2:
+ hot2_in = Bus('hot2')
+ hot2_in.add_comps({'comp': so_hot_2, 'base': 'bus'})
+
+out_mix_B = Bus('out')
+out_mix_B.add_comps({'comp': si})
+
+
+match numInlets:
+ case 2:
+ exe_eco_input = {'Mixer_Z': 10, 'cold_stream_c': 1, 'hot_stream_c': 2}
+ ean = ExergyAnalysis(nw, E_F=[cold_in, hot_in], E_P=[out_mix_B], E_L=[])
+ case 3:
+ exe_eco_input = {'Mixer_Z': 10, 'cold_stream_c': 1, 'hot_stream_c': 2, 'hot_stream_2_c': 3}
+ ean = ExergyAnalysis(nw, E_F=[cold_in, hot_in, hot2_in], E_P=[out_mix_B], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/pipe.py b/tests_friederike/component_tests/pipe.py
new file mode 100644
index 000000000..443261c7e
--- /dev/null
+++ b/tests_friederike/component_tests/pipe.py
@@ -0,0 +1,49 @@
+from tespy.networks import Network
+from tespy.components import Source, Sink, Pipe
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(p_unit='bar', T_unit='C', iterinfo=False)
+
+# components
+pi = Pipe('Pipe')
+so = Source('Inlet')
+si = Sink('Outlet')
+
+# connections
+c1 = Connection(so, 'out1', pi, 'in1', label='in')
+c2 = Connection(pi, 'out1', si, 'in1', label='out')
+nw.add_conns(c1, c2)
+
+# define parameters
+pi.set_attr(pr=0.975, Q=0, design=['pr'], L=100, D='var', ks=5e-5)
+c1.set_attr(fluid={'ethanol': 1}, m=10, T=30, p=3)
+
+
+# solve
+nw.solve('design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses
+so_in_B = Bus('in')
+so_in_B.add_comps({'comp': so, 'base': 'bus'})
+
+si_out = Bus('out')
+si_out.add_comps({'comp': si})
+
+
+# exergoeconomic analysis
+ean = ExergyAnalysis(nw, E_F=[so_in_B], E_P=[si_out], E_L=[])
+exe_eco_input = {'Pipe_Z': 5e3, 'Inlet_c': 10}
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
\ No newline at end of file
diff --git a/tests_friederike/component_tests/pump.py b/tests_friederike/component_tests/pump.py
new file mode 100644
index 000000000..7bb8ec028
--- /dev/null
+++ b/tests_friederike/component_tests/pump.py
@@ -0,0 +1,62 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Pump)
+from tespy.connections import Connection, Bus, Ref
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 3
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+comp = Pump('Pump')
+src = Source('Source')
+snk = Sink('Sink')
+
+# connections
+c1 = Connection(src, 'out1', comp, 'in1', label='Source to Pump')
+c2 = Connection(comp, 'out1', snk, 'in1', label='Pump to Sink')
+
+nw.add_conns(c1, c2)
+
+# define parameters
+match testCase:
+ case 1: # Tin, Tout >= T0
+ comp.set_attr(pr=5, eta_s=0.8)
+ c1.set_attr(fluid={'water': 1}, p=1, T=30, v=50)
+ case 2: # Tin <= T0, Tout > T0
+ comp.set_attr(pr=5, eta_s=0.8)
+ c1.set_attr(fluid={'water': 1}, p=1, T=24, v=50)
+ case 3: # Tin, Tout <= T0
+ comp.set_attr(pr=1.5, eta_s=0.8)
+ c1.set_attr(fluid={'water': 1}, p=1, T=10, v=50)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 0.1
+T_amb = 25
+
+# define busses (no need to add them to system)
+power = Bus('Power Input')
+power.add_comps({'comp': comp, 'base': 'bus', 'char': 0.9})
+
+water_in = Bus('Water In')
+water_in.add_comps({'comp': src, 'base': 'bus'})
+
+water_out = Bus('Water Out')
+water_out.add_comps({'comp': snk})
+
+
+# exergy analysis
+exe_eco_input = {'Pump_Z': 500, 'Source_c': 0.0001, 'Power Input_c': 0.002}
+ean = ExergyAnalysis(nw, E_P=[water_out], E_F=[water_in, power], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/separator.py b/tests_friederike/component_tests/separator.py
new file mode 100644
index 000000000..dbab0bf36
--- /dev/null
+++ b/tests_friederike/component_tests/separator.py
@@ -0,0 +1,62 @@
+from tespy.networks import Network
+from tespy.components import Sink, Source, Separator
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(p_unit='bar', T_unit='C',iterinfo=False)
+
+# components
+so = Source('Source')
+si1 = Sink('Sink1')
+si2 = Sink('Sink2')
+sep = Separator('Separator', num_out=2)
+
+# connections
+inc = Connection(so, 'out1', sep, 'in1')
+outg1 = Connection(sep, 'out1', si1, 'in1')
+outg2 = Connection(sep, 'out2', si2, 'in1')
+nw.add_conns(inc, outg1, outg2)
+
+# define parameters
+inc.set_attr(fluid={'O2': 0.23, 'N2': 0.77}, p=1, T=20, m=5)
+outg1.set_attr(fluid={'O2': 0.1, 'N2': 0.9}, m=1)
+outg2.set_attr(fluid0={'O2': 0.5, 'N2': 0.5})
+
+# solve
+nw.solve('design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses
+so_in_B = Bus('in')
+so_in_B.add_comps({'comp': so, 'base': 'bus'})
+
+si_out_B = Bus('out')
+si_out_B.add_comps({'comp': si1})
+
+si2_out_B = Bus('out2')
+si2_out_B.add_comps({'comp': si2})
+
+
+
+# exergy analysis
+ean = ExergyAnalysis(nw, E_F=[so_in_B], E_P=[si2_out_B, si_out_B], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.print_results()
+
+"""
+# exergoeconomic analysis
+ean = ExergyAnalysis(nw, E_F=[so_in_B], E_P=[si2_out_B, si_out_B], E_L=[])
+exe_eco_input = {'Separator_Z': 5e3, 'Source_c': 10}
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
+"""
diff --git a/tests_friederike/component_tests/simple_heat_exchanger.py b/tests_friederike/component_tests/simple_heat_exchanger.py
new file mode 100644
index 000000000..2f86d93dd
--- /dev/null
+++ b/tests_friederike/component_tests/simple_heat_exchanger.py
@@ -0,0 +1,47 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, SimpleHeatExchanger)
+from tespy.connections import Connection, Bus
+from tespy.tools import analyses, ExergyAnalysis
+import numpy as np
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+hx = SimpleHeatExchanger("My Heat Exchanger")
+so = Source("My Source")
+si = Sink("My Sink")
+
+# connections
+c1 = Connection(so, 'out1', hx, 'in1', label="My Inlet")
+c2 = Connection(hx, 'out1', si, 'in1', label="My Outlet")
+nw.add_conns(c1, c2)
+
+# define parameters
+hx.set_attr(pr=0.95, Q=1000000)
+c1.set_attr(fluid={'Water': 1.0}, T=350, p=10, m=40)
+
+# solve network
+nw.solve(mode='design')
+nw.print_results()
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amb = 1
+
+# define busses
+heat_in_B = Bus('Heat In')
+heat_in_B.add_comps({'comp': hx, 'base': 'bus'})
+
+mass_flow_B = Bus('water flow')
+mass_flow_B.add_comps({'comp': so, 'base': 'bus'}, {'comp': si})
+
+nw.add_busses(heat_in_B)
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'My Heat Exchanger_Z': 100, 'My Source_c': 2e-4, 'Heat In_c': 5e-4}
+ean = ExergyAnalysis(nw, E_F=[heat_in_B], E_P=[mass_flow_B], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
\ No newline at end of file
diff --git a/tests_friederike/component_tests/splitter.py b/tests_friederike/component_tests/splitter.py
new file mode 100644
index 000000000..c3230b13d
--- /dev/null
+++ b/tests_friederike/component_tests/splitter.py
@@ -0,0 +1,61 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Splitter)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# out3 is not available. Choose from out1, out2.
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+sp = Splitter('Splitter', num_out = 2)
+so = Source("source_stream")
+si = Sink("out_1")
+si_2 = Sink("out_2")
+#si_3 = Sink("out_3")
+
+# connections
+inl = Connection(so, 'out1', sp, 'in1', label='stream in splitter')
+out1 = Connection(sp, 'out1', si, 'in1', label='out 1')
+out2 = Connection(sp, 'out2', si_2, 'in1', label='out 2')
+#out3 = Connection(sp, 'out3', si_3, 'in1', label='out 3')
+
+nw.add_conns(inl, out1, out2) # out3
+
+
+# define parameters
+inl.set_attr(T=60, p=2, fluid={'Water': 1}, m=5)
+out1.set_attr(m=1)
+#out1.set_attr(m=2)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 20
+p_amp = 1
+
+# define busses
+so_in_B = Bus('in')
+so_in_B.add_comps({'comp': so, 'base': 'bus'})
+
+si_out = Bus('out')
+si_out.add_comps({'comp': si})
+
+si_out2 = Bus('out2')
+si_out2.add_comps({'comp': si_2})
+
+# exergy balance not closed if si und si_2 in einem bus zsm
+
+# exergoeconomic analysis
+ean = ExergyAnalysis(nw, E_F=[so_in_B], E_P=[si_out2, si_out], E_L=[])
+exe_eco_input = {'Splitter_Z': 5e3, 'source_stream_c': 10}
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/component_tests/turbine.py b/tests_friederike/component_tests/turbine.py
new file mode 100644
index 000000000..0419e8e19
--- /dev/null
+++ b/tests_friederike/component_tests/turbine.py
@@ -0,0 +1,69 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Turbine)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 3
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+tu = Turbine("Turbine")
+so = Source("Source")
+si = Sink("Sink")
+
+# connections
+c1 = Connection(so, 'out1', tu, 'in1', label="Inlet")
+c2 = Connection(tu, 'out1', si, 'in1', label="Outlet")
+
+nw.add_conns(c1,c2)
+
+# define parameters
+tu.set_attr(eta_s=1)
+
+c1.set_attr(fluid={'Water': 1}, p=100, m=20)
+c2.set_attr(p=1.2)
+
+match testCase:
+ case 1:
+ c1.set_attr(T=600)
+ case 2:
+ c1.set_attr(T=25.1)
+ case 3:
+ c1.set_attr(T=24)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 25
+
+# define busses
+power = Bus('power output')
+power.add_comps({'comp': tu, 'char': 0.9, 'base': 'component'})
+
+steam = Bus('fresh steam dif')
+steam.add_comps({'comp': so, 'base': 'bus'}, {'comp': si})
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Source_c': 0.02, 'Turbine_Z': 5e3}
+ean = ExergyAnalysis(nw, E_F=[steam], E_P=[power], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
+
+# print(power.P.is_set)
+# print(power.P)
+# print(power.get_attr("P"))
+# print(tu.E_bus)
+# print(tu.E_bus["massless"])
+# print(steam.comps.index[0].component())
+# print(steam.comps.loc[steam.comps.index.str.contains("u")])
diff --git a/tests_friederike/component_tests/valve.py b/tests_friederike/component_tests/valve.py
new file mode 100644
index 000000000..78c8f17e7
--- /dev/null
+++ b/tests_friederike/component_tests/valve.py
@@ -0,0 +1,59 @@
+from tespy.components import Sink, Source, Valve
+from tespy.connections import Connection, Bus
+from tespy.tools.analyses import ExergyAnalysis
+from tespy.networks import Network
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+testCase = 1
+
+# network
+nw = Network(p_unit='bar', T_unit='C', iterinfo=False)
+
+# components
+so = Source('source')
+si = Sink('sink')
+v = Valve('valve')
+
+# connections
+so_v = Connection(so, 'out1', v, 'in1', label='in')
+v_si = Connection(v, 'out1', si, 'in1', label='out')
+nw.add_conns(so_v, v_si)
+
+# define parameters
+v.set_attr(offdesign=['zeta'])
+so_v.set_attr(fluid={'CH4': 1}, m=1, design=['m'])
+match testCase:
+ case 1: # Tin, Tout > T0 -> dissipativ
+ so_v.set_attr(p=1.5)
+ v_si.set_attr(T=70, p=1.2) # non-dissipative
+ case 2: # Tin > T0, Tout <= T0
+ so_v.set_attr(p=1.5)
+ v_si.set_attr(T=49.9, p=1.2) # non-dissipative
+ case 3: # Tin, Tout <= T0
+ so_v.set_attr(p=1.5)
+ v_si.set_attr(T=20, p=1.2) # non-dissipative
+
+# solve
+nw.solve('design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 50
+
+# define busses
+inlet = Bus('in')
+inlet.add_comps({'comp': so, 'base': 'bus'})
+
+outlet = Bus('out')
+outlet.add_comps({'comp': si, 'base': 'component'})
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'source_c': 0.02, 'valve_Z': 5e3}
+ean = ExergyAnalysis(nw, E_F=[inlet], E_P=[outlet], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/mini_network_tests/comp_turb.py b/tests_friederike/mini_network_tests/comp_turb.py
new file mode 100644
index 000000000..0999e6b25
--- /dev/null
+++ b/tests_friederike/mini_network_tests/comp_turb.py
@@ -0,0 +1,57 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Turbine, Compressor)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+turb = Turbine("Turbine")
+compr = Compressor("Compressor")
+so = Source("Source")
+si = Sink("Sink")
+
+# Connections
+so_2_compr = Connection(so, 'out1', compr, 'in1', label="Inlet")
+compr_2_turb = Connection(compr, 'out1', turb, 'in1', label="Compr-Turbine")
+turb_2_si = Connection(turb, 'out1', si, 'in1', label="Outlet")
+
+nw.add_conns(so_2_compr, compr_2_turb, turb_2_si)
+
+# define parameters
+turb.set_attr(eta_s=0.8)
+compr.set_attr(pr=2, eta_s=0.9)
+so_2_compr.set_attr(fluid={'Water': 1}, T=600, p=100, m=20)
+turb_2_si.set_attr(p=1.1)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+pamb = 1
+Tamb = 25
+
+# define busses
+power = Bus('power output')
+power.add_comps(
+ {'comp': turb, 'char': 0.6, 'base': 'component'}, {'comp': compr, 'char': 1, 'base': 'bus'})
+
+hot_steam = Bus('fresh steam dif')
+hot_steam.add_comps(
+ {'comp': so, 'base': 'bus'},
+ {'comp': si})
+
+
+# can't define power input costs for compressor: need to add this part in code
+exe_eco_input = {'Source_c': 0.2, 'Turbine_Z': 5e3, 'Compressor_Z': 4e3}
+ean = ExergyAnalysis(nw, E_P=[power], E_F=[hot_steam], E_L=[], internal_busses=[])
+ean.analyse(pamb=pamb, Tamb=Tamb, Chem_Ex=chemexlib)
+ean.print_results()
+ean.evaluate_exergoeconomics(Tamb=Tamb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/mini_network_tests/comp_turb_closed.py b/tests_friederike/mini_network_tests/comp_turb_closed.py
new file mode 100644
index 000000000..3db5a07b9
--- /dev/null
+++ b/tests_friederike/mini_network_tests/comp_turb_closed.py
@@ -0,0 +1,56 @@
+from tespy.networks import Network
+from tespy.components import (Turbine, Compressor, CycleCloser)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+turb = Turbine("Turbine")
+compr = Compressor("Compressor")
+cc = CycleCloser("Closer")
+
+# Connections
+closer_2_compr = Connection(cc, 'out1', compr, 'in1', label="Closer-Compr")
+compr_2_turb = Connection(compr, 'out1', turb, 'in1', label="Compr-Turbine")
+turb_2_closer = Connection(turb, 'out1', cc, 'in1', label="Turbine-Closer")
+
+nw.add_conns(closer_2_compr, compr_2_turb, turb_2_closer)
+
+# define parameters
+turb.set_attr(eta_s=1)
+compr.set_attr(pr=1.5, eta_s=1)
+closer_2_compr.set_attr(fluid={'Water': 1}, m=2, p=1)
+#compr_2_turb.set_attr(T=30)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+pamb = 1
+Tamb = 25
+
+# define busses
+power_out = Bus('power output')
+power_out.add_comps(
+ {'comp': turb, 'char': 0.9, 'base': 'component'})
+
+power_in = Bus('power input')
+power_in.add_comps(
+ {'comp': compr, 'char': 0.8, 'base': 'bus'})
+
+
+
+# can't define power input costs for compressor: need to add this part in code
+exe_eco_input = {'power input_c': 10, 'Turbine_Z': 50, 'Compressor_Z': 50}
+ean = ExergyAnalysis(nw, E_P=[power_out], E_F=[power_in], E_L=[], internal_busses=[])
+ean.analyse(pamb=pamb, Tamb=Tamb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=Tamb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
+#ean.print_results()
\ No newline at end of file
diff --git a/tests_friederike/mini_network_tests/comp_turb_valv.py b/tests_friederike/mini_network_tests/comp_turb_valv.py
new file mode 100644
index 000000000..e4bf64fb9
--- /dev/null
+++ b/tests_friederike/mini_network_tests/comp_turb_valv.py
@@ -0,0 +1,60 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Turbine, Compressor, Valve)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+turb = Turbine("Turbine")
+compr = Compressor("Compressor")
+valv = Valve("Valve")
+so = Source("Source")
+si = Sink("Sink")
+
+# Connections
+so_2_compr = Connection(so, 'out1', compr, 'in1', label="Inlet")
+compr_2_turb = Connection(compr, 'out1', turb, 'in1', label="Compr-Turbine")
+turb_2_valv = Connection(turb, 'out1', valv, 'in1', label="Turbine-Valve")
+valv_2_si = Connection(valv, 'out1', si, 'in1', label="Outlet")
+
+nw.add_conns(so_2_compr, compr_2_turb,
+ turb_2_valv, valv_2_si)
+
+# define parameters
+compr.set_attr(pr=2, eta_s=0.9)
+valv.set_attr(pr=0.9)
+turb.set_attr(eta_s=0.8)
+so_2_compr.set_attr(fluid={'Water': 1}, T=600, p=100, m=20)
+turb_2_valv.set_attr(T=200)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+pamb = 1
+Tamb = 15
+
+# define busses
+power = Bus('power output')
+power.add_comps(
+ {'comp': turb, 'char': 0.6, 'base': 'component'}, {'comp': compr, 'char': 0.9, 'base': 'bus'})
+
+hot_steam = Bus('fresh steam dif')
+hot_steam.add_comps(
+ {'comp': so, 'base': 'bus'},
+ {'comp': si})
+
+#valv.serving_components = [turb]
+# can't define power input costs for compressor: need to add this part in code
+exe_eco_input = {'Source_c': 10, 'Turbine_Z': 50, 'Compressor_Z': 40, 'Valve_Z': 10}
+ean = ExergyAnalysis(nw, E_P=[power], E_F=[hot_steam], E_L=[], internal_busses=[])
+ean.analyse(pamb=pamb, Tamb=Tamb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=Tamb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/mini_network_tests/cooler_compressor.py b/tests_friederike/mini_network_tests/cooler_compressor.py
new file mode 100644
index 000000000..0f1d4ac37
--- /dev/null
+++ b/tests_friederike/mini_network_tests/cooler_compressor.py
@@ -0,0 +1,66 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, HeatExchanger, Compressor)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+wf_in = Source("Working Fluid Inlet")
+hx = HeatExchanger('Cooler')
+cp = Compressor("Compressor")
+wf_out = Sink("Working Fluid Outlet")
+cw_in = Source("Cooling Water Inlet")
+cw_out = Sink("Cooling Water Outlet")
+
+
+# connections
+c1 = Connection(wf_in, 'out1', hx, 'in1', label='Inlet')
+c2 = Connection(hx, 'out1', cp, 'in1', label='Cooler to Compressor')
+c3 = Connection(cp, 'out1', wf_out, 'in1', label='Outlet')
+c4 = Connection(cw_in, 'out1', hx, 'in2', label='Cooling Water Inlet')
+c5 = Connection(hx, 'out2', cw_out, 'in1', label='Cooling Water Outlet')
+
+nw.add_conns(c1, c2, c3, c4, c5)
+
+
+# define parameters
+hx.set_attr(pr1=1, pr2=1)
+cp.set_attr(pr=5, eta_s=0.8)
+c1.set_attr(T=25, p=1.2, fluid={'N2': 1}, m=5)
+c2.set_attr(T=20)
+c4.set_attr(T=10, p=1.2, fluid={'H2O': 1}, m=2)
+
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 15
+p_amp = 1
+
+# define busses (no need to add them to system)
+working_fluid = Bus('Working Fluid')
+working_fluid.add_comps({'comp': wf_in, 'base': 'bus'}, {'comp':wf_out, 'base': 'component'})
+
+cooling_water = Bus('Cooling Water')
+cooling_water.add_comps({'comp':cw_in, 'base': 'bus'}, {'comp': cw_out, 'base': 'component'})
+
+power = Bus('Power Input')
+power.add_comps({'comp': cp, 'base': 'bus'})
+
+
+# exergy and exergoeconomic analysis
+#hx.dissipative.val = True
+hx.serving_component = cp
+exe_eco_input = {'Cooler_Z': 5e1, 'Compressor_Z': 8e1, 'Working Fluid Inlet_c': 0.05, 'Cooling Water Inlet_c': 0.02, 'Power Input_c': 0.2}
+ean = ExergyAnalysis(nw, E_F=[cooling_water, power], E_P=[working_fluid], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/mini_network_tests/turb_valv.py b/tests_friederike/mini_network_tests/turb_valv.py
new file mode 100644
index 000000000..da6f2643e
--- /dev/null
+++ b/tests_friederike/mini_network_tests/turb_valv.py
@@ -0,0 +1,56 @@
+from tespy.networks import Network
+from tespy.components import (Source, Sink, Turbine, Compressor, Valve)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit="C", p_unit="bar", h_unit="kJ / kg")
+
+# components
+turb = Turbine("Turbine")
+valv = Valve("Valve")
+so = Source("Source")
+si = Sink("Sink")
+
+# Connections
+so_2_turb = Connection(so, 'out1', turb, 'in1', label="Inlet")
+turb_2_valv = Connection(turb, 'out1', valv, 'in1', label="Turbine-Valve")
+valv_2_si = Connection(valv, 'out1', si, 'in1', label="Outlet")
+
+nw.add_conns(so_2_turb,
+ turb_2_valv, valv_2_si)
+
+# define parameters
+turb.set_attr(eta_s=0.8)
+valv.set_attr(pr=0.5)
+so_2_turb.set_attr(fluid={'Water': 1}, T=600, p=100, m=20)
+turb_2_valv.set_attr(T=30)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+pamb = 1
+Tamb = 15
+
+# define busses
+power = Bus('power output')
+power.add_comps(
+ {'comp': turb, 'char': 0.6, 'base': 'component'})
+
+hot_steam = Bus('fresh steam dif')
+hot_steam.add_comps(
+ {'comp': so, 'base': 'bus'},
+ {'comp': si})
+
+#valv.serving_components = [turb]
+exe_eco_input = {'Source_c': 10, 'Turbine_Z': 50, 'Valve_Z': 10}
+ean = ExergyAnalysis(nw, E_P=[power], E_F=[hot_steam], E_L=[], internal_busses=[])
+ean.analyse(pamb=pamb, Tamb=Tamb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Tamb=Tamb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/CGAM.py b/tests_friederike/network_tests/CGAM.py
new file mode 100644
index 000000000..36741d6d2
--- /dev/null
+++ b/tests_friederike/network_tests/CGAM.py
@@ -0,0 +1,98 @@
+from CoolProp.CoolProp import PropsSI as CPSI
+from tespy.networks import Network
+from tespy.components import (
+ HeatExchanger, Turbine, Compressor, Drum,
+ DiabaticCombustionChamber, Sink, Source
+)
+from tespy.connections import Connection, Bus
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+nw = Network(p_unit='bar', T_unit='C')
+
+air_molar = {'O2': 0.2059, 'N2': 0.7748, 'CO2': 0.0003, 'H2O': 0.019, 'CH4': 0}
+molar_masses = {key: CPSI('M', key) * 1000 for key in air_molar}
+M_air = sum([air_molar[key] * molar_masses[key] for key in air_molar])
+
+air = {key: value / M_air * molar_masses[key] for key, value in air_molar.items()}
+
+amb = Source('ambient air')
+ch4 = Source('methane')
+fw = Source('feed water')
+
+ch = Sink('chimney')
+ls = Sink('live steam')
+
+cmp = Compressor('compressor')
+aph = HeatExchanger('air preheater')
+cb = DiabaticCombustionChamber('combustion chamber')
+tur = Turbine('gas turbine')
+
+eva = HeatExchanger('evaporator')
+eco = HeatExchanger('economizer')
+dr = Drum('drum')
+
+c1 = Connection(amb, 'out1', cmp, 'in1', label='1')
+c2 = Connection(cmp, 'out1', aph, 'in2', label='2')
+c3 = Connection(aph, 'out2', cb, 'in1', label='3')
+c10 = Connection(ch4, 'out1', cb, 'in2', label='10')
+
+nw.add_conns(c1, c2, c3, c10)
+
+c4 = Connection(cb, 'out1', tur, 'in1', label='4')
+c5 = Connection(tur, 'out1', aph, 'in1', label='5')
+c6 = Connection(aph, 'out1', eva, 'in1', label='6')
+c6p = Connection(eva, 'out1', eco, 'in1', label='6p')
+c7 = Connection(eco, 'out1', ch, 'in1', label='7')
+
+nw.add_conns(c4, c5, c6, c6p, c7)
+
+c8 = Connection(fw, 'out1', eco, 'in2', label='8')
+c8p = Connection(eco, 'out2', dr, 'in1', label='8p')
+c11 = Connection(dr, 'out1', eva, 'in2', label='11')
+c11p = Connection(eva, 'out2', dr, 'in2', label='11p')
+c9 = Connection(dr, 'out2', ls, 'in1', label='9')
+
+nw.add_conns(c8, c8p, c11, c11p, c9)
+
+c8.set_attr(p=20, T=25, m=14, fluid={'water': 1})
+c1.set_attr(p=1.013, T=25, fluid=air, m=91.753028)
+c10.set_attr(T=25, fluid={'CH4': 1}, p=12)
+c7.set_attr(p=1.013)
+c3.set_attr(T=850 - 273.15)
+c4.set_attr(T=1520 - 273.15)
+c8p.set_attr(Td_bp=-15)
+c11p.set_attr(x=0.5)
+
+cmp.set_attr(pr=10, eta_s=0.86)
+cb.set_attr(eta=0.98, pr=0.95)
+tur.set_attr(eta_s=0.86)
+aph.set_attr(pr1=0.97, pr2=0.95)
+eva.set_attr(pr1=0.95 ** 0.5)
+eco.set_attr(pr1=0.95 ** 0.5, pr2=1)
+
+power = Bus('total power')
+power.add_comps({'comp': cmp, 'base': 'bus'}, {'comp': tur})
+
+nw.add_busses(power)
+
+heat_output = Bus('heat output')
+power_output = Bus('power output')
+fuel_input = Bus('fuel input')
+
+heat_output.add_comps(
+ {'comp': eco, 'char': -1},
+ {'comp': eva, 'char': -1})
+power_output.add_comps(
+ {'comp': cmp, 'base': 'bus', 'char': 1},
+ {'comp': tur, 'char': 1})
+fuel_input.add_comps({'comp': cb, 'base': 'bus'})
+nw.add_busses(heat_output, power_output, fuel_input)
+
+nw.solve('design')
+nw.print_results()
+
+'''
+Singularity in jacobian matrix, calculation aborted!
+Make sure your network does not have any linear dependencies in the parametrisation
+'''
diff --git a/tests_friederike/network_tests/CGAM2.py b/tests_friederike/network_tests/CGAM2.py
new file mode 100644
index 000000000..941da1bc6
--- /dev/null
+++ b/tests_friederike/network_tests/CGAM2.py
@@ -0,0 +1,88 @@
+from tespy.networks import Network
+from tespy.components import (Sink, Source, Compressor, DiabaticCombustionChamber, HeatExchanger, Turbine, Drum, Pump)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+from CoolProp.CoolProp import PropsSI as CP
+
+# fluids
+air_molar = {'O2': 0.2059, 'N2': 0.7748, 'CO2': 0.0003, 'H2O': 0.019}
+molar_masses = {key: CP('M', key) * 1000 for key in air_molar}
+M_air = sum([air_molar[key] * molar_masses[key] for key in air_molar])
+
+air = {key: value / M_air * molar_masses[key] for key, value in air_molar.items()}
+fuel = {'CH4': 1}
+
+# network
+cgam = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# components
+src_air = Source('air-source')
+src_fuel = Source('fuel-source')
+snk_fluegas = Sink('flue-gas-sink')
+cmp_AC = Compressor('air-compressor')
+cmp_APH = HeatExchanger('air-pre-heater')
+cmp_CC = DiabaticCombustionChamber('combustion-chamber')
+cmp_EXP = Turbine('expander')
+
+# connections
+c1 = Connection(src_air, 'out1', cmp_AC, 'in1', label='1')
+c2 = Connection(cmp_AC, 'out1', cmp_APH, 'in2', label='2')
+c3 = Connection(cmp_APH, 'out2', cmp_CC, 'in1', label='3')
+c4 = Connection(cmp_CC, 'out1', cmp_EXP, 'in1', label='4')
+c5 = Connection(cmp_EXP, 'out1', cmp_APH, 'in1', label='5')
+c6 = Connection(cmp_APH, 'out1', snk_fluegas, 'in1', label='6')
+c10 = Connection(src_fuel, 'out1', cmp_CC, 'in2', label='10')
+
+cgam.add_conns(c1,c2,c3,c4,c5,c6,c10)
+
+# parameters
+
+# components
+cmp_AC.set_attr(eta_s=0.86, pr=10)
+cmp_CC.set_attr(eta=0.98, pr=0.95)
+cmp_EXP.set_attr(eta_s=0.86)
+cmp_APH.set_attr(pr1=0.97, pr2=0.95)
+
+# connections
+c1.set_attr(p=1.013, T=25, fluid=air, m=100)
+c3.set_attr(T=850 - 273.15)
+c6.set_attr(p=1.013)
+c10.set_attr(p=12, T=25, fluid=fuel, m=1.644)
+
+# solve network
+cgam.solve('design')
+cgam.print_results()
+
+c1.set_attr(m=None)
+c4.set_attr(T=1520 - 273.15)
+
+cgam.solve('design')
+cgam.print_results()
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 25
+p_amb = 1.02
+
+# define busses
+fuel_bus = Bus("fuel")
+fuel_bus.add_comps({"comp": src_fuel, "base": "bus",
+ "comp": src_air, "base": "bus"})
+
+loss_bus = Bus("loss")
+loss_bus.add_comps({"comp": snk_fluegas, "base": "component"})
+
+generator = Bus("product")
+generator.add_comps({"comp": cmp_EXP, "base": "component",
+ "comp": cmp_AC, "base": "bus"})
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'air-compressor_Z': 5, 'air-pre-heater_Z': 2, 'combustion-chamber_Z': 2, 'expander_Z': 4,
+ 'air-source_c': 0.02, 'fuel-source_c': 0.01}
+ean = ExergyAnalysis(cgam, E_P=[generator], E_F=[fuel_bus], E_L=[loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/CGAM_1994.py b/tests_friederike/network_tests/CGAM_1994.py
new file mode 100644
index 000000000..d3a0e54da
--- /dev/null
+++ b/tests_friederike/network_tests/CGAM_1994.py
@@ -0,0 +1,79 @@
+from tespy.networks import Network
+from tespy.components import (Sink, Source, Compressor, DiabaticCombustionChamber, HeatExchanger, Turbine, Drum, Pump)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+from CoolProp.CoolProp import PropsSI as CP
+
+# fluids
+air_molar = {'O2': 0.2059, 'N2': 0.7748, 'CO2': 0.0003, 'H2O': 0.019}
+molar_masses = {key: CP('M', key) * 1000 for key in air_molar}
+M_air = sum([air_molar[key] * molar_masses[key] for key in air_molar])
+
+air = {key: value / M_air * molar_masses[key] for key, value in air_molar.items()}
+fuel = {'CH4': 1}
+
+# network
+cgam = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# components
+src_air = Source('air-source')
+src_fuel = Source('fuel-source')
+snk_fluegas = Sink('flue-gas-sink')
+cmp_AC = Compressor('air-compressor')
+cmp_APH = HeatExchanger('air-pre-heater')
+cmp_CC = DiabaticCombustionChamber('combustion-chamber')
+cmp_EXP = Turbine('expander')
+
+# connections
+c1 = Connection(src_air, 'out1', cmp_AC, 'in1', label='1')
+c2 = Connection(cmp_AC, 'out1', cmp_APH, 'in2', label='2')
+c3 = Connection(cmp_APH, 'out2', cmp_CC, 'in1', label='3')
+c4 = Connection(cmp_CC, 'out1', cmp_EXP, 'in1', label='4')
+c5 = Connection(cmp_EXP, 'out1', cmp_APH, 'in1', label='5')
+c6 = Connection(cmp_APH, 'out1', snk_fluegas, 'in1', label='6')
+c10 = Connection(src_fuel, 'out1', cmp_CC, 'in2', label='10')
+
+cgam.add_conns(c1,c2,c3,c4,c5,c6,c10)
+
+# parameters
+# connections
+c1.set_attr(p=1.013, T=25, fluid=air, m=95.9185)
+c2.set_attr(p=10.13, T=347.66)
+c3.set_attr(p=9.62, T=576.85)
+c4.set_attr(p=9.14, T=1246.85)
+c5.set_attr(p=1.1, T=712.48)
+c6.set_attr(p=1.07)
+c10.set_attr(p=12, T=25, fluid=fuel, m=1.7653)
+
+# solve network
+cgam.solve('design')
+cgam.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 25
+p_amb = 1.02
+
+# define busses
+fuel_bus = Bus("fuel")
+fuel_bus.add_comps({"comp": src_fuel, "base": "bus",
+ "comp": src_air, "base": "bus"})
+
+loss_bus = Bus("loss")
+loss_bus.add_comps({"comp": snk_fluegas, "base": "component"})
+
+generator = Bus("product")
+generator.add_comps({"comp": cmp_EXP, "base": "component",
+ "comp": cmp_AC, "base": "bus"})
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'air-compressor_Z': 5, 'air-pre-heater_Z': 2, 'combustion-chamber_Z': 2, 'expander_Z': 4,
+ 'air-source_c': 0.02, 'fuel-source_c': 0.01}
+ean = ExergyAnalysis(cgam, E_P=[generator], E_F=[fuel_bus], E_L=[loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/district_heating.py b/tests_friederike/network_tests/district_heating.py
new file mode 100644
index 000000000..efd421dbe
--- /dev/null
+++ b/tests_friederike/network_tests/district_heating.py
@@ -0,0 +1,253 @@
+from tespy.networks import Network
+from tespy.components import (CycleCloser, Pipe, Pump, Valve, SimpleHeatExchanger, HeatExchanger, Source, Sink)
+from tespy.connections import Connection, Bus, Ref
+from tespy.tools import ExergyAnalysis
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# central heating plant
+hs = HeatExchanger('heat source')
+cc = CycleCloser('cycle closer')
+pu = Pump('feed pump')
+plant_so = Source("plant in")
+plant_si = Sink("plant out")
+
+# consumer
+cons = HeatExchanger('consumer')
+val = Valve('control valve')
+con_so = Source("consumer in")
+con_si = Sink("consumer out")
+
+
+# connections
+c0 = Connection(cc, "out1", hs, "in1", label="0")
+c1 = Connection(hs, "out1", pu, "in1", label="1")
+c2 = Connection(pu, "out1", cons, "in1", label="2")
+c3 = Connection(cons, "out1", val, "in1", label="3")
+c4 = Connection(val, "out1", cc, "in1", label="4")
+
+c11 = Connection(con_so, "out1", cons, "in2", label="11")
+c12 = Connection(cons, "out2", con_si, "in1", label="12")
+
+c21 = Connection(plant_so, "out1", hs, "in2", label="21")
+c22 = Connection(hs, "out2", plant_si, "in1", label="22")
+nw.add_conns(c0, c1, c2, c3, c4, c11, c12, c21, c22)
+
+
+# define parameters
+cons.set_attr(Q=-10000)
+hs.set_attr(Q=-12000)
+pu.set_attr(eta_s=0.75)
+
+c1.set_attr(T=90, p=10, fluid={'water': 1.0})
+c2.set_attr(p=13)
+c4.set_attr(T=65, p=Ref(c3, 1, 0))
+
+c11.set_attr(T=25, p=1, fluid={'water': 1.0})
+c12.set_attr(T=40, p=1)
+
+c21.set_attr(T=70, p=1, fluid={'water': 1.0})
+c22.set_attr(T=50, p=1)
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 5
+p_amb = 1
+
+# define busses
+consumer = Bus("consumer bus")
+consumer.add_comps(
+ {'comp': con_so, 'base': 'bus'},
+ {'comp': con_si})
+heat_source = Bus("heat source bus")
+heat_source.add_comps(
+ {'comp': plant_so, 'base': 'bus'},
+ {'comp': plant_si})
+pump = Bus("feed pump bus")
+pump.add_comps({"comp": pu})
+# nw.add_busses(consumer, heat_source, pump)
+
+# solve network
+nw.solve(mode='design')
+nw.print_results()
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'heat source_Z': 100, 'consumer_Z': 80,
+ 'plant in_c': 0.1, 'consumer in_c': 0.001, 'feed pump bus_c': 0.1}
+ean = ExergyAnalysis(nw, E_F=[heat_source, pump], E_P=[consumer], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb)
+#ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results()
+
+
+
+# following code is with heating plant as SimpleHeatExchanger instead of HeatExchanger
+# then exergoeconomic analysis doesn't work since not implemented for SimpleHeatExchanger yet
+
+'''
+from tespy.networks import Network
+from tespy.components import (CycleCloser, Pipe, Pump, Valve, SimpleHeatExchanger, HeatExchanger, Source, Sink)
+from tespy.connections import Connection, Bus, Ref
+from tespy.tools import ExergyAnalysis
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# central heating plant
+hs = SimpleHeatExchanger('heat source')
+cc = CycleCloser('cycle closer')
+pu = Pump('feed pump')
+
+# consumer
+cons = HeatExchanger('consumer')
+val = Valve('control valve')
+con_so = Source("consumer in")
+con_si = Sink("consumer out")
+
+# pipes
+pipe_feed = Pipe('feed pipe')
+pipe_return = Pipe('return pipe')
+
+# connections
+c0 = Connection(cc, "out1", hs, "in1", label="0")
+c1 = Connection(hs, "out1", pu, "in1", label="1")
+c2 = Connection(pu, "out1", pipe_feed, "in1", label="2")
+c3 = Connection(pipe_feed, "out1", cons, "in1", label="3")
+c4 = Connection(cons, "out1", val, "in1", label="4")
+c5 = Connection(val, "out1", pipe_return, "in1", label="5")
+c6 = Connection(pipe_return, "out1", cc, "in1", label="6")
+
+c11 = Connection(con_so, "out1", cons, "in2", label="11")
+c12 = Connection(cons, "out2", con_si, "in1", label="12")
+nw.add_conns(c0, c1, c2, c3, c4, c5, c6, c11, c12)
+
+
+# define parameters
+cons.set_attr(Q=-10000)
+hs.set_attr(pr=1)
+pu.set_attr(eta_s=0.75)
+pipe_feed.set_attr(Q=-250, pr=0.98)
+pipe_return.set_attr(Q=-200, pr=0.98)
+
+c1.set_attr(T=90, p=10, fluid={'water': 1.0})
+c2.set_attr(p=13)
+c4.set_attr(T=65, p=Ref(c3, 1, 0))
+
+c11.set_attr(T=25, p=1, fluid={'water': 1.0})
+c12.set_attr(T=40, p=1)
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 5
+p_amp = 1
+
+# define busses
+consumer = Bus("consumer bus")
+consumer.add_comps(
+ {'comp': con_so, 'base': 'bus'},
+ {'comp': con_si})
+heat_source = Bus("heat source bus")
+heat_source.add_comps({"comp": hs})
+pump = Bus("feed pump bus")
+pump.add_comps({"comp": pu})
+# nw.add_busses(consumer, heat_source, pump)
+
+# solve network
+nw.solve(mode='design')
+nw.print_results()
+
+
+# exergy analysis
+ean = ExergyAnalysis(nw, E_F=[heat_source, pump], E_P=[consumer], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb)
+ean.print_results()
+
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'heat source_Z': 100, 'consumer_Z': 80, 'feed pipe_Z': 70, 'return pipe_Z': 120,
+ 'consumer in_c': 0.001, 'feed pump bus_c': 0.1, 'heat source bus_c': 0.01}
+ean = ExergyAnalysis(nw, E_F=[heat_source, pump], E_P=[consumer], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb)
+#ean.evaluate_exergoeconomics(Tamb=T_amb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results()
+
+
+
+# following code is with both heat exchangers as SimpleHeatExchanger instead of HeatExchanger
+# then exergy analysis doesn't work since product is removal of Exergy from system
+
+from tespy.networks import Network
+from tespy.components import (CycleCloser, Pipe, Pump, Valve, SimpleHeatExchanger)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# central heating plant
+hs = SimpleHeatExchanger('heat source')
+cc = CycleCloser('cycle closer')
+pu = Pump('feed pump')
+
+# consumer
+cons = SimpleHeatExchanger('consumer')
+val = Valve('control valve')
+
+# pipes
+pipe_feed = Pipe('feed pipe')
+pipe_return = Pipe('return pipe')
+
+# connections
+c0 = Connection(cc, "out1", hs, "in1", label="0")
+c1 = Connection(hs, "out1", pu, "in1", label="1")
+c2 = Connection(pu, "out1", pipe_feed, "in1", label="2")
+c3 = Connection(pipe_feed, "out1", cons, "in1", label="3")
+c4 = Connection(cons, "out1", val, "in1", label="4")
+c5 = Connection(val, "out1", pipe_return, "in1", label="5")
+c6 = Connection(pipe_return, "out1", cc, "in1", label="6")
+nw.add_conns(c0, c1, c2, c3, c4, c5, c6)
+
+
+# define parameters
+cons.set_attr(Q=-10000, pr=0.98)
+hs.set_attr(pr=1)
+pu.set_attr(eta_s=0.75)
+pipe_feed.set_attr(Q=-250, pr=0.98)
+pipe_return.set_attr(Q=-200, pr=0.98)
+
+c1.set_attr(T=90, p=10, fluid={'water': 1.0})
+c2.set_attr(p=13)
+c4.set_attr(T=65)
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 5
+p_amp = 1
+
+# define busses
+consumer = Bus("consumer bus")
+consumer.add_comps({"comp": cons})
+heat_source = Bus("heat source bus")
+heat_source.add_comps({"comp": hs})
+pump = Bus("feed pump bus")
+pump.add_comps({"comp": pu})
+# nw.add_busses(consumer, heat_source, pump)
+
+# solve network
+nw.solve(mode='design')
+nw.print_results()
+
+# exergy analysis
+ean = ExergyAnalysis(nw, E_F=[heat_source, pump], E_P=[consumer], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb)
+ean.print_results()
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'heat source_Z': 100, 'consumer_Z': 80, 'feed pipe_Z': 70, 'return pipe_Z': 120}
+ean = ExergyAnalysis(nw, E_F=[heat_source, pump], E_P=[consumer], E_L=[])
+ean.analyse(pamb=p_amp, Tamb=T_amb, Exe_Eco_An=True, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
+
+
+'''
diff --git a/tests_friederike/network_tests/gas_turbine.py b/tests_friederike/network_tests/gas_turbine.py
new file mode 100644
index 000000000..069057724
--- /dev/null
+++ b/tests_friederike/network_tests/gas_turbine.py
@@ -0,0 +1,68 @@
+from tespy.networks import Network
+from tespy.components import (CombustionChamber, Turbine, Source, Sink, Compressor)
+from tespy.connections import Connection, Ref, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# entsprechend Tut3 aufgebaut
+
+# Definition des Netwerks
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# Definition der Komponenten
+cp = Compressor("compressor")
+cc = CombustionChamber("combustion chamber")
+tu = Turbine("turbine")
+air = Source("air source")
+fuel = Source("fuel source")
+fg = Sink("flue gas sink")
+
+# Definition der Verbindungen
+c1 = Connection(air, "out1", cp, "in1", label="1")
+c2 = Connection(cp, "out1", cc, "in1", label="2")
+c3 = Connection(cc, "out1", tu, "in1", label="3")
+c4 = Connection(tu, "out1", fg, "in1", label="4")
+c5 = Connection(fuel, "out1", cc, "in2", label="5")
+nw.add_conns(c1, c2, c3, c4, c5)
+
+# Definition der Parameter
+c1.set_attr(
+ m=151, p=4.5, T=100,
+ fluid={"Ar": 0, "N2": 0.79, "CO2": 0, "O2": 0.21}
+)
+c2.set_attr(p=20, T=326.3)
+c4.set_attr(p=1.1, T=609.86)
+c5.set_attr(m=3.83, T=25, fluid={"CH4": 1})
+
+
+# Bud
+generator = Bus("generator")
+generator.add_comps(
+ {"comp": tu, "char": 0.95, "base": "component"},
+ {"comp": cp, "char": 0.98, "base": "bus"},
+)
+nw.add_busses(generator)
+
+# Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+
+# Umgebung
+T_amb = 25
+p_amb = 1.02
+
+# Busse, die für Exergieanalyse benötigt werden
+fuel_bus = Bus("fuel")
+fuel_bus.add_comps({"comp": fuel, "base": "bus"}, {"comp": air, "base": "bus"})
+
+loss_bus = Bus("loss")
+loss_bus.add_comps({"comp": fg, "base": "component"})
+
+# Exergie- und exergoökonomische Analyse
+exe_eco_input = {'turbine_Z': 50, 'compressor_Z': 40, 'combustion chamber_Z': 60, 'air source_c': 0, 'fuel source_c': 10}
+ean = ExergyAnalysis(network=nw, E_F=[fuel_bus], E_P=[generator], E_L=[loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/gas_turbine_system_all.py b/tests_friederike/network_tests/gas_turbine_system_all.py
new file mode 100644
index 000000000..840581756
--- /dev/null
+++ b/tests_friederike/network_tests/gas_turbine_system_all.py
@@ -0,0 +1,126 @@
+from tespy.networks import Network
+from tespy.components import (Source, Compressor, DiabaticCombustionChamber, Turbine, Sink, Valve, Merge, Splitter)
+from tespy.connections import Connection, Ref, Bus
+from CoolProp.CoolProp import PropsSI as PSI
+from tespy.tools.helpers import mass_flow
+
+# von Jubran
+
+# network
+fluid_list = ["Ar", "N2", "O2", "CO2", "CH4", "H2O", "H2", "ethane", "C3H8", "n-Butane", "n-Pentane", "n-Hexane"]
+nw = Network(fluids=fluid_list, p_unit="bar", T_unit="C")
+
+# components
+exp = Turbine('EXP')
+ac = Compressor('AC')
+spl = Splitter('Split')
+tv1 = Valve('TV1')
+# tv2 = Valve('TV2')
+# m_lambda = Merge('lambda')
+m_tit = Merge('TIT')
+sc = DiabaticCombustionChamber('Stoichiometric combustion')
+c1 = Source('Air')
+c14 = Sink('Exaust')
+c10 = Source('Fuel')
+sink_abgas = Sink("Sink Abgas")
+sink_cooling = Sink("Sink Cooling")
+sink_spliter = Sink("Sink Splitter")
+sink_merge_tit = Sink("Sink Mix tit")
+
+# connections
+so_to_comp = Connection(c1, 'out1', ac, 'in1', label='1')
+comp_to_split = Connection(ac, 'out1', spl, 'in1', label='2')
+split_to_sc = Connection(spl, 'out1', sc, 'in1', label='3')
+split_to_tv1 = Connection(spl, 'out2', tv1, 'in1', label='7')
+
+# later
+sc_to_m_tit = Connection(sc, 'out1', m_tit, 'in1', label='12')
+tv1_to_m_tit = Connection(tv1, 'out1', m_tit, 'in2', label='8')
+#m_tit_to_sink = Connection(m_tit, 'out1', sink_merge_tit, 'in1', label='13')
+
+# later 2
+m_tit_to_exp = Connection(m_tit, 'out1', exp, 'in1', label='13')
+exp_to_exit = Connection(exp, 'out1', c14, 'in1', label='14')
+fuel_to_sc = Connection(c10, 'out1', sc, 'in2', label='10')
+
+
+# nw.add_conns(so_to_comp,comp_to_split, split_to_sc, split_to_tv1, sc_to_m_tit, tv1_to_m_tit, m_tit_to_exp, exp_to_exit, fuel_to_sc)
+nw.add_conns(so_to_comp,comp_to_split, split_to_sc, sc_to_m_tit, split_to_tv1, tv1_to_m_tit, fuel_to_sc, m_tit_to_exp, exp_to_exit)
+
+#
+generator = Bus("generator")
+generator.add_comps(
+ {"comp": exp, "char": 0.995, "base": "component"}, # 99.5 % mech. ele. efficiency
+ {"comp": ac, "char": 0.995, "base": "bus"}, # 99.5 % mech. ele. efficiency
+)
+generator.set_attr(P=-4.3e8)
+#nw.add_busses(generator)
+# total 400 instead of mass flow as input
+
+# parameters
+# air source
+air_0= {
+ "CO2": 0.00027, "ethane": 0, "N2": 0.78092,
+ "C3H8": 0, "CH4": 0, "O2": 0.20947, "H2O":0,
+ "n-Butane": 0, "n-Pentane": 0, "n-Hexane": 0,
+ "Ar":0.00934, "H2": 0
+ }
+
+psatH2O = PSI('P', 'Q', 0, 'T', 5+273.15, 'water') * 0.00001
+rh = 75
+pH2O = float(rh) / 100 * psatH2O
+
+xH2O = PSI('M', 'water') * (pH2O / 1.013) / (
+ pH2O/1.013 * PSI('M', 'water') + (1 - pH2O/1.013) * PSI('M', 'air'))
+
+air_0 = {key: value * (1-xH2O) for key, value in air_0.items()}
+air_0['H2O'] = xH2O
+air_0 = mass_flow(air_0)
+
+so_to_comp.set_attr(m=841.75,
+ p=1.013, T=5,
+ fluid=air_0
+)
+
+# Fuel
+fuel_n = {
+ "CO2": 0.01800, "ethane": 0.03600, "N2": 0.10300,
+ "C3H8": 0.00600, "CH4": 0.83380, "O2": 0.000010, "H2O":0,
+ "n-Butane": 0.00200, "n-Pentane": 0.00050, "n-Hexane": 0.00069,
+ "Ar":0, "H2": 0
+ }
+fuel = mass_flow(fuel_n)
+fuel_to_sc.set_attr(p=19.25,
+ T=195,
+ fluid=fuel
+)
+
+
+# Chamber
+sc.set_attr(pr=0.95, eta=0.98, lamb=1.9)
+#sc_to_sink.set_attr(T=1700)
+
+# # TIT
+# m_tit_to_exp.set_attr(T=1340)
+
+# compressor
+ac.set_attr(eta_s=0.90, pr=19)
+
+# # expander
+exp.set_attr(eta_s=0.90)
+exp_to_exit.set_attr(p=1.051)
+
+# splitter
+split_to_tv1.set_attr(m=148.83)
+#m_tit_to_exp.set_attr(T=1340)
+
+
+# valve
+#tv1.set_attr(pr=1)
+
+# starting values for out
+m_tit_to_exp.set_attr(fluid0={"O2": 0.001})
+
+# solve
+nw.solve(mode="design")
+nw.print_results()
diff --git a/tests_friederike/network_tests/heat_pump.py b/tests_friederike/network_tests/heat_pump.py
new file mode 100644
index 000000000..bb178be24
--- /dev/null
+++ b/tests_friederike/network_tests/heat_pump.py
@@ -0,0 +1,142 @@
+from tespy.networks import Network
+from tespy.components import (CycleCloser, Compressor, Valve, SimpleHeatExchanger, HeatExchanger, Source, Sink)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# components
+cc = CycleCloser('cycle closer')
+ev = SimpleHeatExchanger('evaporator')
+cp = Compressor('compressor')
+co = HeatExchanger('condenser')
+va = Valve('expansion valve')
+con_so = Source('consumer in')
+con_si = Sink('consumer out')
+
+# connections
+c1 = Connection(cc, 'out1', ev, 'in1', label='1')
+c2 = Connection(ev, 'out1', cp, 'in1', label='2')
+c3 = Connection(cp, 'out1', co, 'in1', label='3')
+c4 = Connection(co, 'out1', va, 'in1', label='4')
+c0 = Connection(va, 'out1', cc, 'in1', label='0')
+
+c11 = Connection(con_so, 'out1', co, 'in2', label='11')
+c12 = Connection(co, 'out2', con_si, 'in1', label='22')
+nw.add_conns(c1, c2, c3, c4, c0, c11, c12)
+
+# define parameters
+co.set_attr(pr1=0.98, pr2=1)
+ev.set_attr(pr=0.98)
+cp.set_attr(eta_s=0.85)
+
+c2.set_attr(T=20, x=1, fluid={'CO2': 1}) # war R134a aber das gibt es nicht im Ahrendts Stoffmodell
+c4.set_attr(T=80, x=0)
+
+c11.set_attr(T=20, p=1, m=1, fluid={'H2O': 1})
+c12.set_attr(T=40)
+
+# define necessary busses
+power_in = Bus('power_in') # compressor needs power (fuel of the heat pump)
+power_in.add_comps({'comp': cp})
+nw.add_busses(power_in)
+
+heat_out = Bus('heat_out') # condenser removes heat (product of the heat pump)
+heat_out.add_comps({'comp': con_so, 'base': 'bus'}, {'comp': con_si})
+nw.add_busses(heat_out)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 28
+p_amb = 1.013
+
+# exergy analysis
+ean = ExergyAnalysis(nw, E_F=[power_in], E_P=[heat_out], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.print_results()
+
+
+"""
+# exergy and exergoeconomic analysis
+exe_eco_input = {'condenser_Z': 50, 'evaporator_Z': 20, 'expansion valve_Z': 40, 'compressor_Z': 100, 'power in_c': 0.003}
+ean = ExergyAnalysis(nw, E_F=[power_in], E_P=[heat_out], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Exe_Eco_An = True, Exe_Eco_Costs = exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
+"""
+
+# before changing condenser from SimpleHeatExchanger ot HeatExchanger in order
+# to be able to assign an exergetic product to the system
+
+"""
+from tespy.networks import Network
+from tespy.components import (CycleCloser, Compressor, Valve, SimpleHeatExchanger)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# components
+cc = CycleCloser('cycle closer')
+ev = SimpleHeatExchanger('evaporator')
+cp = Compressor('compressor')
+co = SimpleHeatExchanger('condenser')
+va = Valve('expansion valve')
+
+# connections
+c1 = Connection(cc, 'out1', ev, 'in1', label='1')
+c2 = Connection(ev, 'out1', cp, 'in1', label='2')
+c3 = Connection(cp, 'out1', co, 'in1', label='3')
+c4 = Connection(co, 'out1', va, 'in1', label='4')
+c0 = Connection(va, 'out1', cc, 'in1', label='0')
+
+nw.add_conns(c1, c2, c3, c4, c0)
+
+# define parameters
+co.set_attr(pr=0.98, Q=-1e6)
+ev.set_attr(pr=0.98)
+cp.set_attr(eta_s=0.85)
+
+c2.set_attr(T=20, x=1, fluid={'R134a': 1})
+c4.set_attr(T=80, x=0)
+
+# define necessary busses
+power_in = Bus('power_in') # compressor needs power (fuel of the heat pump)
+power_in.add_comps({'comp': cp})
+nw.add_busses(power_in)
+
+heat_out = Bus('heat_out') # condenser removes heat (product of the heat pump)
+heat_out.add_comps({'comp': co})
+nw.add_busses(heat_out)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
++++ exergy analysis +++
+# define ambient
+T_amb = 28
+p_amb = 1.013
+
+# exergy analysis
+ean = ExergyAnalysis(nw, E_F=[power_in], E_P=[heat_out], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb)
+ean.print_results()
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'condenser_Z': 50, 'evaporator_Z': 20, 'expansion valve_Z': 40, 'compressor_Z': 100, 'power in_c': 0.003}
+ean = ExergyAnalysis(nw, E_F=[power_in], E_P=[heat_out], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Exe_Eco_An = True, Exe_Eco_Costs = exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
+
+"""
\ No newline at end of file
diff --git a/tests_friederike/network_tests/heat_pump_NH3.py b/tests_friederike/network_tests/heat_pump_NH3.py
new file mode 100644
index 000000000..24293a385
--- /dev/null
+++ b/tests_friederike/network_tests/heat_pump_NH3.py
@@ -0,0 +1,146 @@
+# -*- coding: utf-8 -*-
+# from tutorial
+
+from tespy.components import Compressor
+from tespy.components import Condenser
+from tespy.components import CycleCloser
+from tespy.components import HeatExchanger
+from tespy.components import Sink
+from tespy.components import Source
+from tespy.components import Valve
+from tespy.components import Pump
+from tespy.connections import Connection
+from tespy.connections import Bus
+from tespy.networks import Network
+from tespy.tools.characteristics import CharLine
+from tespy.tools.characteristics import load_default_char as ldc
+from tespy.tools import ExergyAnalysis
+import numpy as np
+
+pamb = 1.013 # ambient pressure
+Tamb = 2.8 # ambient temperature
+
+# mean geothermal temperature (mean value of ground feed and return flow)
+Tgeo = 9.5
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# %% components
+
+cc = CycleCloser('cycle closer')
+
+# heat pump system
+cd = Condenser('condenser')
+va = Valve('valve')
+ev = HeatExchanger('evaporator')
+cp = Compressor('compressor')
+
+# geothermal heat collector
+gh_in = Source('ground heat feed flow')
+gh_out = Sink('ground heat return flow')
+ghp = Pump('ground heat loop pump')
+
+# heating system
+hs_feed = Sink('heating system feed flow')
+hs_ret = Source('heating system return flow')
+hsp = Pump('heating system pump')
+
+# %% connections
+
+# heat pump system
+cc_cd = Connection(cc, 'out1', cd, 'in1')
+cd_va = Connection(cd, 'out1', va, 'in1')
+va_ev = Connection(va, 'out1', ev, 'in2')
+ev_cp = Connection(ev, 'out2', cp, 'in1')
+cp_cc = Connection(cp, 'out1', cc, 'in1')
+nw.add_conns(cc_cd, cd_va, va_ev, ev_cp, cp_cc)
+
+# geothermal heat collector
+gh_in_ghp = Connection(gh_in, 'out1', ghp, 'in1')
+ghp_ev = Connection(ghp, 'out1', ev, 'in1')
+ev_gh_out = Connection(ev, 'out1', gh_out, 'in1')
+nw.add_conns(gh_in_ghp, ghp_ev, ev_gh_out)
+
+# heating system
+hs_ret_hsp = Connection(hs_ret, 'out1', hsp, 'in1')
+hsp_cd = Connection(hsp, 'out1', cd, 'in2')
+cd_hs_feed = Connection(cd, 'out2', hs_feed, 'in1')
+nw.add_conns(hs_ret_hsp, hsp_cd, cd_hs_feed)
+
+
+# %% component parametrization
+
+# condenser
+cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'],
+ offdesign=['zeta2', 'kA_char'])
+# evaporator
+kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', CharLine)
+kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', CharLine)
+ev.set_attr(pr1=0.99, pr2=0.99, ttd_l=5,
+ kA_char1=kA_char1, kA_char2=kA_char2,
+ design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA_char'])
+# compressor
+cp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
+# heating system pump
+hsp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+# ground heat loop pump
+ghp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+
+
+# %% connection parametrization
+
+# heat pump system
+cc_cd.set_attr(fluid={'NH3': 1})
+ev_cp.set_attr(Td_bp=3)
+
+# geothermal heat collector
+gh_in_ghp.set_attr(T=Tgeo + 1.5, p=1.5, fluid={'water': 1})
+ev_gh_out.set_attr(T=Tgeo - 1.5, p=1.5)
+
+# heating system
+cd_hs_feed.set_attr(T=40, p=2, fluid={'water': 1})
+hs_ret_hsp.set_attr(T=35, p=2)
+
+# starting values
+ev_cp.set_attr(p0=5)
+cc_cd.set_attr(p0=18)
+
+# %% create busses
+
+# characteristic function for motor efficiency
+x = np.array([0, 0.2, 0.4, 0.6, 0.8, 1, 1.2])
+y = np.array([0, 0.86, 0.9, 0.93, 0.95, 0.96, 0.95])
+
+# power bus
+char = CharLine(x=x, y=y)
+power = Bus('power input')
+power.add_comps(
+ {'comp': cp, 'char': char, 'base': 'bus'},
+ {'comp': ghp, 'char': char, 'base': 'bus'},
+ {'comp': hsp, 'char': char, 'base': 'bus'}
+)
+
+# consumer heat bus
+heat_cons = Bus('heating system')
+heat_cons.add_comps({'comp': hs_ret, 'base': 'bus'}, {'comp': hs_feed})
+
+# geothermal heat bus
+heat_geo = Bus('geothermal heat')
+heat_geo.add_comps({'comp': gh_in, 'base': 'bus'}, {'comp': gh_out})
+
+
+nw.add_busses(power, heat_cons, heat_geo)
+
+
+# %% key parameter
+cd.set_attr(Q=-4e3)
+nw.solve('design')
+nw.print_results()
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'condenser_Z': 100, 'evaporator_Z': 80, 'valve_Z': 20, 'compressor_Z': 50,
+ 'ground heat feed flow_c': 0.001, 'heating system return flow_c': 0.001, 'power input_c': 0.1}
+ean = ExergyAnalysis(nw, E_F=[heat_geo, power], E_P=[heat_cons], E_L=[])
+ean.analyse(pamb=pamb, Tamb=Tamb)
+ean.evaluate_exergoeconomics(Tamb=Tamb, Exe_Eco_Costs=exe_eco_input)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/heat_pump_R410A.py b/tests_friederike/network_tests/heat_pump_R410A.py
new file mode 100644
index 000000000..7676ce7da
--- /dev/null
+++ b/tests_friederike/network_tests/heat_pump_R410A.py
@@ -0,0 +1,145 @@
+# -*- coding: utf-8 -*-
+# from tutorial
+
+from tespy.components import Compressor
+from tespy.components import Condenser
+from tespy.components import CycleCloser
+from tespy.components import HeatExchanger
+from tespy.components import Sink
+from tespy.components import Source
+from tespy.components import Valve
+from tespy.components import Pump
+from tespy.connections import Connection
+from tespy.connections import Bus
+from tespy.networks import Network
+from tespy.tools.characteristics import CharLine
+from tespy.tools.characteristics import load_default_char as ldc
+import numpy as np
+
+# %% network
+pamb = 1.013 # ambient pressure
+Tamb = 2.8 # ambient temperature
+
+# mean geothermal temperature (mean value of ground feed and return flow)
+Tgeo = 9.5
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# %% components
+
+cc = CycleCloser('cycle closer')
+
+# heat pump system
+cd = Condenser('condenser')
+va = Valve('valve')
+ev = HeatExchanger('evaporator')
+cp = Compressor('compressor')
+
+# geothermal heat collector
+gh_in = Source('ground heat feed flow')
+gh_out = Sink('ground heat return flow')
+ghp = Pump('ground heat loop pump')
+
+# heating system
+hs_feed = Sink('heating system feed flow')
+hs_ret = Source('heating system return flow')
+hsp = Pump('heating system pump')
+
+# %% connections
+
+# heat pump system
+cc_cd = Connection(cc, 'out1', cd, 'in1')
+cd_va = Connection(cd, 'out1', va, 'in1')
+va_ev = Connection(va, 'out1', ev, 'in2')
+ev_cp = Connection(ev, 'out2', cp, 'in1')
+cp_cc = Connection(cp, 'out1', cc, 'in1')
+nw.add_conns(cc_cd, cd_va, va_ev, ev_cp, cp_cc)
+
+# geothermal heat collector
+gh_in_ghp = Connection(gh_in, 'out1', ghp, 'in1')
+ghp_ev = Connection(ghp, 'out1', ev, 'in1')
+ev_gh_out = Connection(ev, 'out1', gh_out, 'in1')
+nw.add_conns(gh_in_ghp, ghp_ev, ev_gh_out)
+
+# heating system
+hs_ret_hsp = Connection(hs_ret, 'out1', hsp, 'in1')
+hsp_cd = Connection(hsp, 'out1', cd, 'in2')
+cd_hs_feed = Connection(cd, 'out2', hs_feed, 'in1')
+nw.add_conns(hs_ret_hsp, hsp_cd, cd_hs_feed)
+
+
+# %% component parametrization
+
+# condenser
+cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'],
+ offdesign=['zeta2', 'kA_char'])
+# evaporator
+kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', CharLine)
+kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', CharLine)
+ev.set_attr(pr1=0.99, pr2=0.99, ttd_l=5,
+ kA_char1=kA_char1, kA_char2=kA_char2,
+ design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA_char'])
+# compressor
+cp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
+# heating system pump
+hsp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+# ground heat loop pump
+ghp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+
+
+# %% connection parametrization
+
+# heat pump system
+cc_cd.set_attr(fluid={'R410A': 1})
+ev_cp.set_attr(Td_bp=3)
+
+# geothermal heat collector
+gh_in_ghp.set_attr(T=Tgeo + 1.5, p=1.5, fluid={'water': 1})
+ev_gh_out.set_attr(T=Tgeo - 1.5, p=1.5)
+
+# heating system
+cd_hs_feed.set_attr(T=40, p=2, fluid={'water': 1})
+hs_ret_hsp.set_attr(T=35, p=2)
+
+# starting values
+va_ev.set_attr(h0=275)
+cc_cd.set_attr(p0=18)
+
+# %% create busses
+
+# characteristic function for motor efficiency
+x = np.array([0, 0.2, 0.4, 0.6, 0.8, 1, 1.2])
+y = np.array([0, 0.86, 0.9, 0.93, 0.95, 0.96, 0.95])
+
+# power bus
+char = CharLine(x=x, y=y)
+power = Bus('power input')
+power.add_comps(
+ {'comp': cp, 'char': char, 'base': 'bus'},
+ {'comp': ghp, 'char': char, 'base': 'bus'},
+ {'comp': hsp, 'char': char, 'base': 'bus'}
+)
+
+# consumer heat bus
+heat_cons = Bus('heating system')
+heat_cons.add_comps({'comp': hs_ret, 'base': 'bus'}, {'comp': hs_feed})
+
+# geothermal heat bus
+heat_geo = Bus('geothermal heat')
+heat_geo.add_comps({'comp': gh_in, 'base': 'bus'}, {'comp': gh_out})
+
+
+nw.add_busses(power, heat_cons, heat_geo)
+
+# %% key parameter
+
+cd.set_attr(Q=-4e3)
+
+# %% design calculation
+
+path = 'R410A'
+nw.solve('design')
+# alternatively use:
+# nw.solve('design', init_path=path)
+print("\n##### DESIGN CALCULATION #####\n")
+nw.print_results()
diff --git a/tests_friederike/network_tests/heat_pump_ground_couped.py b/tests_friederike/network_tests/heat_pump_ground_couped.py
new file mode 100644
index 000000000..53776474f
--- /dev/null
+++ b/tests_friederike/network_tests/heat_pump_ground_couped.py
@@ -0,0 +1,134 @@
+from tespy.components import Compressor
+from tespy.components import Condenser
+from tespy.components import CycleCloser
+from tespy.components import HeatExchanger
+from tespy.components import Sink
+from tespy.components import Source
+from tespy.components import Valve
+from tespy.components import Pump
+from tespy.connections import Connection
+from tespy.connections import Bus
+from tespy.networks import Network
+from tespy.tools import ExergyAnalysis
+from tespy.tools.characteristics import CharLine
+from tespy.tools.characteristics import load_default_char as ldc
+import numpy as np
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+Tgeo = 9.5 # mean geothermal temperature (mean value of ground feed and return flow)
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# components
+cc = CycleCloser('cycle closer')
+
+# heat pump system
+cd = Condenser('condenser')
+va = Valve('valve')
+ev = HeatExchanger('evaporator')
+cp = Compressor('compressor')
+
+# geothermal heat collector
+gh_in = Source('ground heat feed flow')
+gh_out = Sink('ground heat return flow')
+ghp = Pump('ground heat loop pump')
+
+# heating system
+hs_feed = Sink('heating system feed flow')
+hs_ret = Source('heating system return flow')
+hsp = Pump('heating system pump')
+
+# connections
+# heat pump system
+cc_cd = Connection(cc, 'out1', cd, 'in1')
+cd_va = Connection(cd, 'out1', va, 'in1')
+va_ev = Connection(va, 'out1', ev, 'in2')
+ev_cp = Connection(ev, 'out2', cp, 'in1')
+cp_cc = Connection(cp, 'out1', cc, 'in1')
+nw.add_conns(cc_cd, cd_va, va_ev, ev_cp, cp_cc)
+
+# geothermal heat collector
+gh_in_ghp = Connection(gh_in, 'out1', ghp, 'in1')
+ghp_ev = Connection(ghp, 'out1', ev, 'in1')
+ev_gh_out = Connection(ev, 'out1', gh_out, 'in1')
+nw.add_conns(gh_in_ghp, ghp_ev, ev_gh_out)
+
+# heating system
+hs_ret_hsp = Connection(hs_ret, 'out1', hsp, 'in1')
+hsp_cd = Connection(hsp, 'out1', cd, 'in2')
+cd_hs_feed = Connection(cd, 'out2', hs_feed, 'in1')
+nw.add_conns(hs_ret_hsp, hsp_cd, cd_hs_feed)
+
+# define parameters
+# condenser
+cd.set_attr(pr1=0.99, pr2=0.99, ttd_u=5, design=['pr2', 'ttd_u'],
+ offdesign=['zeta2', 'kA_char'])
+# evaporator
+kA_char1 = ldc('heat exchanger', 'kA_char1', 'DEFAULT', CharLine)
+kA_char2 = ldc('heat exchanger', 'kA_char2', 'EVAPORATING FLUID', CharLine)
+ev.set_attr(pr1=0.99, pr2=0.99, ttd_l=5,
+ kA_char1=kA_char1, kA_char2=kA_char2,
+ design=['pr1', 'ttd_l'], offdesign=['zeta1', 'kA_char'])
+# compressor
+cp.set_attr(eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
+# heating system pump
+hsp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+# ground heat loop pump
+ghp.set_attr(eta_s=0.75, design=['eta_s'], offdesign=['eta_s_char'])
+
+# heat pump system
+cc_cd.set_attr(fluid={'NH3': 1})
+ev_cp.set_attr(Td_bp=3)
+
+# geothermal heat collector
+gh_in_ghp.set_attr(T=Tgeo + 1.5, p=1.5, fluid={'water': 1})
+ev_gh_out.set_attr(T=Tgeo - 1.5, p=1.5)
+
+# heating system
+cd_hs_feed.set_attr(T=40, p=2, fluid={'water': 1})
+hs_ret_hsp.set_attr(T=35, p=2)
+
+# starting values
+ev_cp.set_attr(p0=5)
+cc_cd.set_attr(p0=18)
+
+# characteristic function for motor efficiency
+x = np.array([0, 0.2, 0.4, 0.6, 0.8, 1, 1.2])
+y = np.array([0, 0.86, 0.9, 0.93, 0.95, 0.96, 0.95])
+
+# busses
+# power bus
+char = CharLine(x=x, y=y)
+power = Bus('power input')
+power.add_comps(
+ {'comp': cp, 'char': char, 'base': 'bus'},
+ {'comp': ghp, 'char': char, 'base': 'bus'},
+ {'comp': hsp, 'char': char, 'base': 'bus'}
+)
+
+# consumer heat bus
+heat_cons = Bus('heating system')
+heat_cons.add_comps({'comp': hs_ret, 'base': 'bus'}, {'comp': hs_feed})
+
+# geothermal heat bus
+heat_geo = Bus('geothermal heat')
+heat_geo.add_comps({'comp': gh_in, 'base': 'bus'}, {'comp': gh_out})
+
+nw.add_busses(power, heat_cons, heat_geo)
+
+cd.set_attr(Q=-4e3)
+
+# solve
+nw.solve('design')
+nw.print_results()
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1.013
+T_amb = 2.8
+
+# exergy analysis
+ean = ExergyAnalysis(network=nw, E_F=[power, heat_geo], E_P=[heat_cons], E_L=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.print_results()
diff --git a/tests_friederike/network_tests/jerry/heat_pump.py b/tests_friederike/network_tests/jerry/heat_pump.py
new file mode 100644
index 000000000..61cca3c51
--- /dev/null
+++ b/tests_friederike/network_tests/jerry/heat_pump.py
@@ -0,0 +1,109 @@
+from tespy.networks import Network
+from tespy.components import (HeatExchanger, Compressor, CycleCloser, Valve, Source, Sink)
+from tespy.connections import Connection, Bus
+from CoolProp.CoolProp import PropsSI as CPSI
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+wf = 'R1233ZD(E)' # REFPROP::
+si = 'H2O' # REFPROP::
+
+# Definition des Netwerks
+nw = Network(fluids=[wf, si], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# Definition der Komponenten
+GK = HeatExchanger('Gaskühler')
+VD = HeatExchanger('Verdampfer')
+DR = Valve('Drossel')
+KP = Compressor('Kompressor')
+
+# Definition der Quelle, Senke und des Kreislaufzusammenschlusses
+se_ein = Source('Senke ein')
+se_aus = Sink('Senke aus')
+
+qu_ein = Source('Quelle ein')
+qu_aus = Sink('Quelle aus')
+
+KR = CycleCloser('Kreislaufzusammenschluss')
+
+# Verbindungen des Kreislaufs
+c1 = Connection(KR, 'out1', GK, 'in1', label="1")
+c2 = Connection(GK, 'out1', DR, 'in1', label="2")
+c3 = Connection(DR, 'out1', VD, 'in2', label="3")
+c4 = Connection(VD, 'out2', KP, 'in1', label="4")
+c1_cc = Connection(KP, 'out1', KR, 'in1', label="1_cc")
+
+# Verbindungen der Quelle
+c11 = Connection(qu_ein, 'out1', VD, 'in1', label="11")
+c12 = Connection(VD, 'out1', qu_aus, 'in1', label="12")
+
+# Verbindungen der Senke
+c13 = Connection(se_ein, 'out1', GK, 'in2', label="13")
+c14 = Connection(GK, 'out2', se_aus, 'in1', label="14")
+
+nw.add_conns(c1, c2, c3, c4, c1_cc, c11, c12, c13, c14)
+
+# Setzen der Startparameter für die Komponenten
+GK.set_attr(pr1=1, pr2=1, Q=-1e7)
+VD.set_attr(pr1=1, pr2=1)
+KP.set_attr(eta_s=0.76)
+
+# Setzen Startparameter der Verbindungen des Kreislaufs
+h_c22 = CPSI("H", "P", 57 * 1e5, "T", 273.15+165, wf) * 1e-3
+c2.set_attr(h=h_c22, p=57)
+c3.set_attr(p=8.334)
+h_c24 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15+90.1, wf) * 1e-3
+c4.set_attr(h=h_c24, fluid={'R1233ZD(E)': 1, 'H2O': 0})
+
+# Setzen Startparameter der Verbindungen der Quelle
+c11.set_attr(T=95, p=5, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c12.set_attr(T=90)
+
+# Setzen Startparameter der Verbindungen der Senke
+c13.set_attr(T=160, p=20, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c14.set_attr(T=190)
+
+# Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+# Setzen der Betriebsparameter
+c2.set_attr(h=None, p=80.18)
+GK.set_attr(ttd_l=10)
+c3.set_attr(p=None)
+VD.set_attr(ttd_l=5)
+c4.set_attr(h=None, Td_bp=0.1)
+
+# Definition der Energieströme
+el = Bus('elektrische Leistung')
+el.add_comps(
+ {'comp': KP, 'char': 1, 'base': 'bus'})
+
+wae_zu = Bus('Wärmequelle')
+wae_zu.add_comps(
+ {'comp': qu_ein, 'base': 'bus'},
+ {'comp': qu_aus})
+
+wae_ab = Bus('Wärmesenke')
+wae_ab.add_comps(
+ {'comp': se_ein, 'base': 'bus'},
+ {'comp': se_aus})
+
+nw.add_busses(el, wae_zu, wae_ab)
+
+# Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+# Umgebung
+p_umg = 1
+T_umg = 25
+
+# Exergie- und exergoökonomische Analyse
+exe_eco_input = {'Gaskühler_Z': 5, 'Drossel_Z': 2, 'Kompressor_Z': 4, 'Verdampfer_Z': 4,
+ 'Quelle ein_c': 10, 'Senke ein_c': 0, 'elektrische Leistung_c': 72}
+ean = ExergyAnalysis(nw, E_P=[wae_ab], E_F=[el, wae_zu])
+ean.analyse(pamb=p_umg, Tamb=T_umg)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_umg)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/network_tests/jerry/heat_pump_intercooling.py b/tests_friederike/network_tests/jerry/heat_pump_intercooling.py
new file mode 100644
index 000000000..7f7454cad
--- /dev/null
+++ b/tests_friederike/network_tests/jerry/heat_pump_intercooling.py
@@ -0,0 +1,151 @@
+from tespy.networks import Network
+from tespy.components import (HeatExchanger, Compressor, CycleCloser, Valve, Source, Sink, Merge, DropletSeparator)
+from tespy.connections import Connection, Bus
+from CoolProp.CoolProp import PropsSI as CPSI
+from tespy.tools import ExergyAnalysis
+#import plotly.graph_objects as go
+
+wf = 'R1233ZD(E)' # REFPROP::
+si = 'H2O' # REFPROP::
+
+# Definition des Netwerks
+nw = Network(fluids=[wf, si], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s', iterinfo=False)
+
+# Definition der Komponenten
+GK = HeatExchanger('Gaskühler')
+VD = HeatExchanger('Verdampfer')
+DR1 = Valve('Drossel 1')
+DR2 = Valve('Drossel 2')
+KP1 = Compressor('Kompressor 1')
+KP2 = Compressor('Kompressor 2')
+IWUE = HeatExchanger("Interner Wärmeübertrager")
+PH = DropletSeparator('Phasentrenner')
+ZU = Merge('Zusammenführung', num_in=2)
+
+# Definition der Quelle, Senke und des Kreislaufzusammenschlusses
+se_ein = Source('Senke ein')
+se_aus = Sink('Senke aus')
+
+qu_ein = Source('Quelle ein')
+qu_aus = Sink('Quelle aus')
+
+KR = CycleCloser('Kreislaufzusammenschluss')
+
+# Verbindungen des Kreislaufs
+c21 = Connection(KR, 'out1', GK, 'in1', label="21")
+c22 = Connection(GK, 'out1', IWUE, 'in1', label="22")
+c23 = Connection(IWUE, 'out1', DR1, 'in1', label="23")
+c24 = Connection(DR1, 'out1', PH, 'in1', label="24")
+c25 = Connection(PH, 'out1', DR2, 'in1', label="25")
+c26 = Connection(DR2, 'out1', VD, 'in2', label="26")
+c27 = Connection(VD, 'out2', IWUE, 'in2', label="27")
+c28 = Connection(IWUE, 'out2', KP1, 'in1', label="28")
+c29 = Connection(KP1, 'out1', ZU, 'in1', label="29")
+c30 = Connection(PH, 'out2', ZU, 'in2', label="30")
+c31 = Connection(ZU, 'out1', KP2, 'in1', label="31")
+c21_cc = Connection(KP2, 'out1', KR, 'in1', label="21_cc")
+
+# Verbindungen der Quelle
+c11 = Connection(qu_ein, 'out1', VD, 'in1', label="11")
+c12 = Connection(VD, 'out1', qu_aus, 'in1', label="12")
+
+# Verbindungen der Senke
+c13 = Connection(se_ein, 'out1', GK, 'in2', label="13")
+c14 = Connection(GK, 'out2', se_aus, 'in1', label="14")
+
+nw.add_conns(c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c21_cc, c11, c12, c13, c14)
+
+# Setzen der Startparameter für die Komponenten
+GK.set_attr(pr1=1, pr2=1, Q=-1e7)
+IWUE.set_attr(pr1=1, pr2=1)
+VD.set_attr(pr1=1, pr2=1)
+KP1.set_attr(eta_s=0.76)
+KP2.set_attr(eta_s=0.76)
+
+# Setzen Startparameter der Verbindungen des Kreislaufs
+h_c22 = CPSI("H", "P", 38 * 1e5, "T", 273.15+165, wf) * 1e-3
+c22.set_attr(h=h_c22, p=38)
+
+h_c27 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15+90.1, wf) * 1e-3
+c27.set_attr(h=h_c27)
+
+h_c28 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15+155, wf) * 1e-3
+c28.set_attr(h=h_c28, p=8.334, fluid={'R1233ZD(E)': 1, 'H2O': 0})
+
+c29.set_attr(p=14.5)
+
+# Setzen Startparameter der Verbindungen der Quelle
+c11.set_attr(T=95, p=5, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c12.set_attr(T=90)
+
+# Setzen Startparameter der Verbindungen der Senke
+c13.set_attr(T=160, p=20, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c14.set_attr(T=190)
+
+#Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+#Setzen der Betriebsparameter
+c22.set_attr(h=None, p=43.52)
+GK.set_attr(ttd_l=10)
+c27.set_attr(h=None, Td_bp=0.1)
+c28.set_attr(p=None, h=None)
+VD.set_attr(ttd_l=5)
+IWUE.set_attr(ttd_u=15)
+c29.set_attr(p=16.52)
+
+# Definition der Energieströme
+el = Bus('elektrische Leistung')
+el.add_comps(
+ {'comp': KP1, 'char': 1, 'base': 'bus'},
+ {'comp': KP2, 'char': 1, 'base': 'bus'})
+
+wae_zu = Bus('Wärmequelle')
+wae_zu.add_comps(
+ {'comp': qu_ein, 'base': 'bus'},
+ {'comp': qu_aus})
+
+wae_ab = Bus('Wärmesenke')
+wae_ab.add_comps(
+ {'comp': se_ein, 'base': 'bus'},
+ {'comp': se_aus})
+
+nw.add_busses(el, wae_zu, wae_ab)
+
+#Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+#Durchführung der Exergianalyse
+p_umg = 1
+T_umg = 25
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Gaskühler_Z': 5, 'Drossel 1_Z': 2, 'Drossel 2_Z': 2, 'Phasentrenner_Z': 4,
+ 'Kompressor 1_Z': 4, 'Kompressor 2_Z': 4, 'Verdampfer_Z': 4,
+ 'Interner Wärmeübertrager_Z': 2,
+ 'Zusammenführung_Z': 1,
+ 'Quelle ein_c': 0.02, 'Senke ein_c': 0.01, 'elektrische Leistung_c': 0.1}
+ean = ExergyAnalysis(nw, E_P=[wae_ab], E_F=[el, wae_zu])
+ean.analyse(pamb=p_umg, Tamb=T_umg)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_umg)
+ean.print_results(Exe_Eco_An=True)
+
+"""
+# Erstellung des Grassmanndiagramms
+links, nodes = ean.generate_plotly_sankey_input()
+fig = go.Figure(go.Sankey(
+ arrangement="snap",
+ node={
+ "label": nodes,
+ 'pad': 11,
+ 'color': 'orange'},
+ link=links),
+ layout=go.Layout({'width': 1450})
+ )
+fig.update_layout(
+ font_size=20
+)
+fig.show()
+"""
diff --git a/tests_friederike/network_tests/jerry/heat_pump_internal_heat_recovery.py b/tests_friederike/network_tests/jerry/heat_pump_internal_heat_recovery.py
new file mode 100644
index 000000000..d4654462d
--- /dev/null
+++ b/tests_friederike/network_tests/jerry/heat_pump_internal_heat_recovery.py
@@ -0,0 +1,140 @@
+
+from tespy.networks import Network
+from tespy.components import (HeatExchanger, Compressor, CycleCloser, Valve, Source, Sink)
+from tespy.connections import Connection, Bus
+from CoolProp.CoolProp import PropsSI as CPSI
+from tespy.tools import ExergyAnalysis
+#import plotly.graph_objects as go
+
+wf = 'R1233ZD(E)' # REFPROP::
+si = 'H2O' # REFPROP::
+
+# Definition des Netwerks
+nw = Network(fluids=[wf, si], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s', Q_unit='kW')
+
+# Definition der Komponenten
+GK = HeatExchanger('Gaskühler')
+VD = HeatExchanger('Verdampfer')
+DR = Valve('Drossel')
+KP = Compressor('Kompressor')
+IWUE = HeatExchanger("Interner Wärmeübertrager")
+
+#Definition der Quelle, Senke und des Kreislaufzusammenschlusses
+se_ein = Source('Senke ein')
+se_aus = Sink('Senke aus')
+
+qu_ein = Source('Quelle ein')
+qu_aus = Sink('Quelle aus')
+
+KR = CycleCloser('Kreislaufzusammenschluss')
+
+# Verbindungen des Kreislaufs
+c21 = Connection(KR, 'out1', GK, 'in1', label="21")
+c22 = Connection(GK, 'out1', IWUE, 'in1', label="22")
+c23 = Connection(IWUE, 'out1', DR, 'in1', label="23")
+c24 = Connection(DR, 'out1', VD, 'in2', label="24")
+c25 = Connection(VD, 'out2', IWUE, 'in2', label="25")
+c26 = Connection(IWUE, 'out2', KP, 'in1', label="26")
+c21_cc = Connection(KP, 'out1', KR, 'in1', label="21_cc")
+
+# Verbindungen der Quelle
+c11 = Connection(qu_ein, 'out1', VD, 'in1', label="11")
+c12 = Connection(VD, 'out1', qu_aus, 'in1', label="12")
+
+# Verbindungen der Senke
+c13 = Connection(se_ein, 'out1', GK, 'in2', label="13")
+c14 = Connection(GK, 'out2', se_aus, 'in1', label="14")
+
+nw.add_conns(c21, c22, c23, c24, c25, c26, c21_cc, c11, c12, c13, c14)
+
+# Setzen der Startparameter der Komponenten
+GK.set_attr(pr1=1, pr2=1, Q=-1e7)
+IWUE.set_attr(pr1=1, pr2=1)
+VD.set_attr(pr1=1, pr2=1)
+KP.set_attr(eta_s=0.76)
+
+# Setzen Startparameter der Verbindungen des Kreislaufs
+h_c22 = CPSI("H", "P", 46 * 1e5, "T", 273.15+165, wf) * 1e-3
+c22.set_attr(h=h_c22, p=46)
+
+h_c25 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15+90.1, wf) * 1e-3
+c25.set_attr(h=h_c25)
+
+h_c26 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15+155, wf) * 1e-3
+c26.set_attr(h=h_c26, p=8.334, fluid={'R1233ZD(E)': 1, 'H2O': 0})
+
+# Setzen Startparameter der Verbindungen der Quelle
+c11.set_attr(T=95, p=5, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c12.set_attr(T=90)
+
+# Setzen Startparameter der Verbindungen der Senke
+c13.set_attr(T=160, p=20, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c14.set_attr(T=190)
+
+
+# Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+# Setzen der Betriebsparameter
+c22.set_attr(h=None, p=44.43)
+GK.set_attr(ttd_l=10)
+c25.set_attr(h=None, Td_bp=0.1)
+c26.set_attr(p=None, h=None)
+VD.set_attr(ttd_l=5)
+IWUE.set_attr(ttd_u=15)
+
+# Definition der Energieströme
+el = Bus('elektrische Leistung')
+el.add_comps(
+ {'comp': KP, 'char': 1, 'base': 'bus'})
+
+wae_zu = Bus('Wärmequelle')
+wae_zu.add_comps(
+ {'comp': qu_ein, 'base': 'bus'},
+ {'comp': qu_aus})
+
+wae_ab = Bus('Wärmesenke')
+wae_ab.add_comps(
+ {'comp': se_ein, 'base': 'bus'},
+ {'comp': se_aus})
+
+nw.add_busses(el, wae_zu, wae_ab)
+
+#Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+#Durchführung der Exergianalyse
+p_umg = 1
+T_umg = 25
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Gaskühler_Z': 5, 'Drossel_Z': 2,
+ 'Kompressor_Z': 4, 'Verdampfer_Z': 4,
+ 'Interner Wärmeübertrager_Z': 2,
+ 'Quelle ein_c': 0.02, 'Senke ein_c': 0.01, 'elektrische Leistung_c': 0.1}
+ean = ExergyAnalysis(nw, E_P=[wae_ab], E_F=[el, wae_zu])
+ean.analyse(pamb=p_umg, Tamb=T_umg)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_umg)
+ean.print_results(Exe_Eco_An=True)
+#print(ean.network_data.loc['epsilon'])
+
+"""
+# Erstellung des Grassmanndiagramms
+links, nodes = ean.generate_plotly_sankey_input()
+fig = go.Figure(go.Sankey(
+ arrangement="snap",
+ node={
+ "label": nodes,
+ "line": dict(width=0.5),
+ 'pad': 11,
+ 'color': 'orange'},
+ link=links),
+ layout=go.Layout({'width': 1450})
+ )
+fig.update_layout(
+ font_size=20
+)
+fig.show()
+"""
\ No newline at end of file
diff --git a/tests_friederike/network_tests/jerry/heat_pump_parallel_compression.py b/tests_friederike/network_tests/jerry/heat_pump_parallel_compression.py
new file mode 100644
index 000000000..1ce476560
--- /dev/null
+++ b/tests_friederike/network_tests/jerry/heat_pump_parallel_compression.py
@@ -0,0 +1,164 @@
+from tespy.networks import Network
+from tespy.components import (HeatExchanger, Compressor, CycleCloser, Valve, Source, Sink, DropletSeparator, Merge)
+from tespy.connections import Connection, Bus
+from CoolProp.CoolProp import PropsSI as CPSI
+from tespy.tools import ExergyAnalysis
+#import plotly.graph_objects as go
+import numpy as np
+
+wf = 'R1233ZD(E)' # REFPROP::
+si = 'H2O' # REFPROP::
+
+# Definition des Netwerks
+nw = Network(fluids=[wf, si], T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s', Q_unit='kW', iterinfo=False)
+
+# Definition der Komponenten
+PH = DropletSeparator('Phasentrenner')
+KP1 = Compressor('Kompressor 1')
+KP2 = Compressor('Kompressor 2')
+DR1 = Valve('Drossel 1')
+DR2 = Valve('Drossel 2')
+VD = HeatExchanger('Verdampfer')
+GK = HeatExchanger('Gaskühler')
+IWUE1 = HeatExchanger('Interner Wärmeübertrager 1')
+IWUE2 = HeatExchanger('Interner Wärmeübertrager 2')
+ZU = Merge('Zusammenführung', num_in=2)
+
+#Definition der Quelle, Senke und des Kreislaufzusammenschlusses
+se_ein = Source('Senke ein')
+se_aus = Sink('Senke aus')
+
+qu_ein = Source('Quelle ein')
+qu_aus = Sink('Quelle aus')
+
+KR = CycleCloser('Kreislaufzusammenschluss')
+
+# Verbindungen des Kreislaufs
+c21 = Connection(KR, 'out1', GK, 'in1', label="21")
+c22 = Connection(GK, 'out1', IWUE2, 'in1', label="22")
+c23 = Connection(IWUE2, 'out1', DR1, 'in1', label="23")
+c24 = Connection(DR1, 'out1', PH, 'in1', label="24")
+c25 = Connection(PH, 'out1', IWUE1, 'in1', label="25")
+c26 = Connection(IWUE1, 'out1', DR2, 'in1', label="26")
+c27 = Connection(DR2, 'out1', VD, 'in2', label="27")
+c28 = Connection(VD, 'out2', IWUE1, 'in2', label="28")
+c29 = Connection(IWUE1, 'out2', KP1, 'in1', label="29")
+c30 = Connection(KP1, 'out1', ZU, 'in1', label="30")
+c31 = Connection(PH, 'out2', IWUE2, 'in2', label="31")
+c32 = Connection(IWUE2, 'out2', KP2, 'in1', label="32")
+c33 = Connection(KP2, 'out1', ZU, 'in2', label="33")
+c21_cc = Connection(ZU, 'out1', KR, 'in1', label="21_cc")
+
+# Verbindungen der Quelle
+c11 = Connection(qu_ein, 'out1', VD, 'in1', label="11")
+c12 = Connection(VD, 'out1', qu_aus, 'in1', label="12")
+
+# Verbindungen der Senke
+c13 = Connection(se_ein, 'out1', GK, 'in2', label="13")
+c14 = Connection(GK, 'out2', se_aus, 'in1', label="14")
+
+nw.add_conns(c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c21_cc, c11, c12, c13, c14)
+
+# Setzen der Startparameter der Komponenten
+VD.set_attr(pr1=1, pr2=1)
+GK.set_attr(pr1=1, pr2=1, Q=-1e7)
+IWUE1.set_attr(pr1=1, pr2=1)
+IWUE2.set_attr(pr1=1, pr2=1)
+KP1.set_attr(eta_s=0.76)
+KP2.set_attr(eta_s=0.76)
+
+# Setzen Startparameter der Verbindungen des Kreislaufs
+h_c22 = CPSI("H", "P", 48 * 1e5, "T", 273.15 + 165, wf) * 1e-3
+c22.set_attr(h=h_c22, p=48)
+
+c24.set_attr(p=29, fluid={'R1233ZD(E)': 1, 'H2O': 0})
+
+c27.set_attr(p=8.334)
+
+h_c28 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15 + 90.1, wf) * 1e-3
+c28.set_attr(h=h_c28)
+
+h_c29 = CPSI("H", "P", 8.334 * 1e5, "T", 273.15 + 150, wf) * 1e-3
+c29.set_attr(h=h_c29)
+
+h_c32 = CPSI("H", "P", 29 * 1e5, "T", 273.15 + 155, wf) * 1e-3
+c32.set_attr(h=h_c32)
+
+# Setzen Startparameter der Verbindungen der Quelle
+c11.set_attr(T=95, p=5, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c12.set_attr(T=90)
+
+# Setzen Startparameter der Verbindungen der Senke
+c13.set_attr(T=160, p=20, fluid={'R1233ZD(E)': 0, 'H2O': 1})
+c14.set_attr(T=190)
+
+# Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+# Setzen der Betriebsparameter
+c22.set_attr(h=None, p=40.49)
+GK.set_attr(ttd_l=10)
+c24.set_attr(p=24.47)
+c27.set_attr(p=None)
+VD.set_attr(ttd_l=5)
+c28.set_attr(h=None, Td_bp=0.1)
+c29.set_attr(h=None)
+IWUE1.set_attr(ttd_u=15)
+c32.set_attr(h=None)
+IWUE2.set_attr(ttd_u=15)
+
+# Definition der Energieströme
+el = Bus('elektrische Leistung')
+el.add_comps(
+ {'comp': KP1, 'char': 1, 'base': 'bus'},
+ {'comp': KP2, 'char': 1, 'base': 'bus'})
+
+wae_zu = Bus('Wärmequelle')
+wae_zu.add_comps(
+ {'comp': qu_ein, 'base': 'bus'},
+ {'comp': qu_aus})
+
+wae_ab = Bus('Wärmesenke')
+wae_ab.add_comps(
+ {'comp': se_ein, 'base': 'bus'},
+ {'comp': se_aus})
+
+nw.add_busses(el, wae_zu, wae_ab)
+
+#Lösen des Netzwerks
+nw.solve(mode='design')
+nw.print_results()
+
+#Durchführung der Exergianalyse
+p_umg = 1
+T_umg = 25
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Gaskühler_Z': 5, 'Drossel 1_Z': 2, 'Drossel 2_Z': 2, 'Phasentrenner_Z': 4,
+ 'Kompressor 1_Z': 4, 'Kompressor 2_Z': 4, 'Verdampfer_Z': 4,
+ 'Interner Wärmeübertrager 1_Z': 2, 'Interner Wärmeübertrager 2_Z': 2,
+ 'Zusammenführung_Z': 1,
+ 'Quelle ein_c': 0.02, 'Senke ein_c': 0.01, 'elektrische Leistung_c': 0.1}
+ean = ExergyAnalysis(nw, E_P=[wae_ab], E_F=[el, wae_zu])
+ean.analyse(pamb=p_umg, Tamb=T_umg)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_umg)
+ean.print_results(Exe_Eco_An=True)
+
+"""
+# Erstellung des Grassmanndiagramms
+links, nodes = ean.generate_plotly_sankey_input()
+fig = go.Figure(go.Sankey(
+ arrangement="snap",
+ node={
+ "label": nodes,
+ 'pad': 11,
+ 'color': 'orange'},
+ link=links),
+ layout=go.Layout({'width': 1450})
+ )
+fig.update_layout(
+ font_size=20
+)
+fig.show()
+"""
\ No newline at end of file
diff --git a/tests_friederike/network_tests/rankine.py b/tests_friederike/network_tests/rankine.py
new file mode 100644
index 000000000..04c6a8565
--- /dev/null
+++ b/tests_friederike/network_tests/rankine.py
@@ -0,0 +1,73 @@
+from tespy.networks import Network
+from tespy.connections import Bus
+from tespy.components import (
+ CycleCloser, Pump, Condenser, Turbine, SimpleHeatExchanger, Source, Sink
+)
+from tespy.connections import Connection
+from tespy.tools import ExergyAnalysis
+
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg')
+
+# components
+cc = CycleCloser('cycle closer')
+sg = SimpleHeatExchanger('steam generator')
+co = Condenser('main condenser')
+tu = Turbine('steam turbine')
+fp = Pump('feed pump')
+
+cwso = Source('cooling water source')
+cwsi = Sink('cooling water sink')
+
+# connections
+c1 = Connection(cc, 'out1', tu, 'in1', label='1')
+c2 = Connection(tu, 'out1', co, 'in1', label='2')
+c3 = Connection(co, 'out1', fp, 'in1', label='3')
+c4 = Connection(fp, 'out1', sg, 'in1', label='4')
+c0 = Connection(sg, 'out1', cc, 'in1', label='0')
+
+nw.add_conns(c1, c2, c3, c4, c0)
+
+c11 = Connection(cwso, 'out1', co, 'in2', label='11')
+c12 = Connection(co, 'out2', cwsi, 'in1', label='12')
+
+nw.add_conns(c11, c12)
+
+# define parameters
+co.set_attr(pr1=1, pr2=0.98)
+sg.set_attr(pr=0.9)
+tu.set_attr(eta_s=0.9)
+fp.set_attr(eta_s=0.75)
+
+c11.set_attr(T=20, p=1.2, fluid={'water': 1})
+c12.set_attr(T=30)
+c1.set_attr(T=600, p=150, m=10, fluid={'water': 1})
+c2.set_attr(p=0.1)
+
+# busses
+power = Bus("electrical power output")
+power.add_comps(
+ {"comp": tu, "char": 0.97, "base": "component"},
+ {"comp": fp, "char": 0.97, "base": "bus"},
+)
+nw.add_busses(power)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1.013
+T_amb = 2.8
+
+heat_source = Bus("heat effort")
+heat_source.add_comps({"comp": sg})
+
+heat_sink = Bus("heat loss")
+heat_sink.add_comps({"comp": cwso, "base": "bus"}, {"comp": cwsi})
+
+# exergy analysis
+ean = ExergyAnalysis(network=nw, E_F=[heat_source], E_P=[power], E_L=[heat_sink])
+ean.analyse(pamb=p_amb, Tamb=T_amb)
+ean.print_results()
+
diff --git a/tests_friederike/network_tests/refrigerator.py b/tests_friederike/network_tests/refrigerator.py
new file mode 100644
index 000000000..5e58c10f4
--- /dev/null
+++ b/tests_friederike/network_tests/refrigerator.py
@@ -0,0 +1,94 @@
+from tespy.networks import Network
+from tespy.components import (Sink, Source, Turbine, HeatExchanger, CycleCloser, Compressor)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s', s_unit="kJ / kgK")
+
+# components
+closer = CycleCloser('Cycle closer')
+cp = Compressor('Compressor')
+turb = Turbine('Turbine')
+ev = HeatExchanger('Cooling heat exchanger')
+co = HeatExchanger('Heat sink heat exchanger')
+water_in = Source('Water source')
+water_out = Sink('Water sink')
+air_in = Source('Air source')
+air_out = Sink('Air sink')
+
+# connections
+c0 = Connection(ev, 'out2', closer, 'in1', label='0')
+c1 = Connection(closer, 'out1', cp, 'in1', label='1')
+c2 = Connection(cp, 'out1', co, 'in1', label='2')
+c3 = Connection(co, 'out1', turb, 'in1', label='3')
+c4 = Connection(turb, 'out1', ev, 'in2', label='4')
+
+c11 = Connection(air_in, 'out1', ev, 'in1', label='11')
+c12 = Connection(ev, 'out1', air_out, 'in1', label='12')
+
+c21 = Connection(water_in, 'out1', co, 'in2', label='21')
+c22 = Connection(co, 'out2', water_out, 'in1', label='22')
+
+nw.add_conns(c0, c1, c2, c3, c4, c11, c12, c21, c22)
+
+# define parameters
+turb.set_attr(eta_s=0.8)
+cp.set_attr(eta_s=0.8)
+ev.set_attr(Q=-100e3)
+
+c0.set_attr(T=-30, p=1, fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+c2.set_attr(p=5.25)
+c3.set_attr(p=5, T=35)
+c4.set_attr(p=1.05)
+
+c11.set_attr(fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314}, T=-10, p=1)
+c12.set_attr(p=1, T=-20)
+
+c21.set_attr(fluid={'H2O': 1}, T=25, p=1.5)
+c22.set_attr(p=1.5, T=40)
+
+
+# busses
+power = Bus('power input')
+power.add_comps(
+ {'comp': turb, 'char': 0.95, 'base': 'component'},
+ {'comp': cp, 'char': 0.9, 'base': 'bus'})
+
+cool_product_bus = Bus('cooling')
+cool_product_bus.add_comps(
+ {'comp': air_in, 'base': 'bus'},
+ {'comp': air_out})
+
+heat_loss_bus = Bus('heat sink')
+heat_loss_bus.add_comps(
+ {'comp': water_in, 'base': 'bus'},
+ {'comp': water_out})
+
+nw.add_busses(power, cool_product_bus, heat_loss_bus)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 25
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Turbine_Z': 700, 'Compressor_Z': 600, 'Cooling heat exchanger_Z': 180,
+ 'Heat sink heat exchanger_Z': 80, 'Water source_c': 0.1, 'Air source_c': 0.2,
+ 'power input_c': 10}
+ean = ExergyAnalysis(network=nw, E_F=[power], E_P=[cool_product_bus], E_L=[heat_loss_bus], internal_busses=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
+"""
+ean = ExergyAnalysis(network=nw, E_F=[power], E_P=[cool_product_bus], E_L=[heat_loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib) # Exe_Eco_An=True, Exe_Eco_Costs=exe_eco_input
+ean.print_results() # Exe_Eco_An=True
+"""
diff --git a/tests_friederike/network_tests/refrigerator_2busses.py b/tests_friederike/network_tests/refrigerator_2busses.py
new file mode 100644
index 000000000..eca9c53d3
--- /dev/null
+++ b/tests_friederike/network_tests/refrigerator_2busses.py
@@ -0,0 +1,95 @@
+from tespy.networks import Network
+from tespy.components import (Sink, Source, Turbine, HeatExchanger, CycleCloser, Compressor)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+
+# network
+nw = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s', s_unit="kJ / kgK")
+
+# components
+closer = CycleCloser('Cycle closer')
+cp = Compressor('Compressor')
+turb = Turbine('Turbine')
+ev = HeatExchanger('Cooling heat exchanger')
+co = HeatExchanger('Heat sink heat exchanger')
+water_in = Source('Water source')
+water_out = Sink('Water sink')
+air_in = Source('Air source')
+air_out = Sink('Air sink')
+
+# connections
+c0 = Connection(ev, 'out2', closer, 'in1', label='0')
+c1 = Connection(closer, 'out1', cp, 'in1', label='1')
+c2 = Connection(cp, 'out1', co, 'in1', label='2')
+c3 = Connection(co, 'out1', turb, 'in1', label='3')
+c4 = Connection(turb, 'out1', ev, 'in2', label='4')
+
+c11 = Connection(air_in, 'out1', ev, 'in1', label='11')
+c12 = Connection(ev, 'out1', air_out, 'in1', label='12')
+
+c21 = Connection(water_in, 'out1', co, 'in2', label='21')
+c22 = Connection(co, 'out2', water_out, 'in1', label='22')
+
+nw.add_conns(c0, c1, c2, c3, c4, c11, c12, c21, c22)
+
+# define parameters
+turb.set_attr(eta_s=0.8)
+cp.set_attr(eta_s=0.8)
+ev.set_attr(Q=-100e3)
+
+c0.set_attr(T=-30, p=1, fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314})
+c2.set_attr(p=5.25)
+c3.set_attr(p=5, T=35)
+c4.set_attr(p=1.05)
+
+c11.set_attr(fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314}, T=-10, p=1)
+c12.set_attr(p=1, T=-20)
+
+c21.set_attr(fluid={'H2O': 1}, T=25, p=1.5)
+c22.set_attr(p=1.5, T=40)
+
+
+# busses
+power_in = Bus('power input')
+power_in.add_comps({'comp': cp, 'char': 0.9, 'base': 'bus'})
+
+power_out = Bus('power output')
+power_out.add_comps({'comp': turb, 'char': 0.95, 'base': 'component'})
+
+cool_product_bus = Bus('cooling')
+cool_product_bus.add_comps(
+ {'comp': air_in, 'base': 'bus'},
+ {'comp': air_out})
+
+heat_loss_bus = Bus('heat sink')
+heat_loss_bus.add_comps(
+ {'comp': water_in, 'base': 'bus'},
+ {'comp': water_out})
+
+nw.add_busses(power_in, power_out, cool_product_bus, heat_loss_bus)
+
+# solve
+nw.solve(mode='design')
+nw.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+p_amb = 1
+T_amb = 25
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'Turbine_Z': 7e3, 'Compressor_Z': 5e3, 'Cooling heat exchanger_Z': 1e3,
+ 'Heat sink heat exchanger_Z': 1e3, 'Water source_c': 0.001, 'Air source_c': 0.001,
+ 'power input_c': 0.01}
+ean = ExergyAnalysis(network=nw, E_F=[power_in], E_P=[cool_product_bus, power_out], E_L=[heat_loss_bus], internal_busses=[])
+ean.analyse(pamb=p_amb, Tamb=T_amb)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
+"""
+ean = ExergyAnalysis(network=nw, E_F=[power], E_P=[cool_product_bus], E_L=[heat_loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib) # Exe_Eco_An=True, Exe_Eco_Costs=exe_eco_input
+ean.print_results() # Exe_Eco_An=True
+"""
diff --git a/tests_friederike/network_tests/steamboiler.py b/tests_friederike/network_tests/steamboiler.py
new file mode 100644
index 000000000..6c82b505e
--- /dev/null
+++ b/tests_friederike/network_tests/steamboiler.py
@@ -0,0 +1,95 @@
+from tespy.networks import Network
+from tespy.components import (Sink, Source, CombustionChamber, HeatExchanger, Drum, Pump)
+from tespy.connections import Connection, Bus
+from tespy.tools import ExergyAnalysis
+from tespy.tools.helpers import get_chem_ex_lib
+chemexlib = get_chem_ex_lib("Ahrendts")
+from CoolProp.CoolProp import PropsSI as CP
+
+# fluids
+air = {'O2': 0.21, 'N2': 0.79}
+fuel = {'CH4': 1}
+water = {'H2O': 1}
+
+# network
+steamboiler = Network(T_unit='C', p_unit='bar', h_unit='kJ / kg', m_unit='kg / s')
+
+# components
+src_air = Source('air-source')
+src_fuel = Source('fuel-source')
+snk_fluegas = Sink('flue-gas-sink')
+src_water = Source('water')
+snk_steam = Sink('steam')
+cmp_cc = CombustionChamber('combustion chamber')
+cmp_pump = Pump('pump')
+cmp_econ = HeatExchanger('economizer')
+cmp_drum = Drum('drum')
+cmp_evap = HeatExchanger('evaporator')
+
+# connections
+c11 = Connection(src_air, 'out1', cmp_cc, 'in1', label='11 (air)')
+c12 = Connection(src_fuel, 'out1', cmp_cc, 'in2', label='12 (fuel)')
+c13 = Connection(cmp_cc, 'out1', cmp_evap, 'in1', label='13 (fluegas)')
+c14 = Connection(cmp_evap, 'out1', cmp_econ, 'in1', label='14 (fluegas)')
+c15 = Connection(cmp_econ, 'out1', snk_fluegas, 'in1', label='15 (fluegas)')
+c21 = Connection(src_water, 'out1', cmp_pump, 'in1', label='21 (water, lq.)')
+c22 = Connection(cmp_pump, 'out1', cmp_econ, 'in2', label='22 (water, lq.)')
+c23 = Connection(cmp_econ, 'out2', cmp_drum, 'in1', label='23 (water, x=0)')
+c24 = Connection(cmp_drum, 'out1', cmp_evap, 'in2', label='24 (drum circulation)')
+c25 = Connection(cmp_evap, 'out2', cmp_drum, 'in2', label='25 (drum circulation)')
+c26 = Connection(cmp_drum, 'out2', snk_steam, 'in1', label='26 (steam, x=1)')
+
+steamboiler.add_conns(c11,c12,c13,c14,c15,c21,c22,c23,c24,c25,c26)
+
+# parameters
+
+# components
+cmp_cc.set_attr(lamb=1.1)
+cmp_pump.set_attr(eta_s=0.8)
+cmp_econ.set_attr(pr1=1, pr2=1)
+cmp_evap.set_attr(pr1=1)
+
+# connections
+c11.set_attr(p=1, T=25, fluid=air)
+c12.set_attr(m=1.5, T=25, fluid=fuel)
+c21.set_attr(m=25, p=1, T=60, fluid=water)
+c22.set_attr(p=40)
+c23.set_attr(h=CP('H', 'P', 40*1E5, 'Q', 0, 'water')/1E3)
+c25.set_attr(x=0.6)
+
+# solve
+steamboiler.solve(mode='design')
+steamboiler.print_results()
+
+c12.set_attr(m=None)
+cmp_econ.set_attr(ttd_l=50)
+
+steamboiler.solve(mode='design')
+steamboiler.print_results()
+
+
+""" +++ exergy analysis +++ """
+# define ambient
+T_amb = 25
+p_amb = 1.02
+
+# define busses
+fuel_bus = Bus("fuel")
+fuel_bus.add_comps({"comp": src_fuel, "base": "bus",
+ "comp": src_air, "base": "bus"})
+
+loss_bus = Bus("loss")
+loss_bus.add_comps({"comp": snk_fluegas, "base": "component"})
+
+product_bus = Bus("product")
+product_bus.add_comps({"comp": src_water, "base": "bus",
+ "comp": snk_steam, "base": "component"})
+
+
+# exergy and exergoeconomic analysis
+exe_eco_input = {'pump_Z': 5, 'economizer_Z': 2, 'combustion-chamber_Z': 2, 'drum_Z': 4, 'evaporator_Z': 3,
+ 'air-source_c': 0.02, 'fuel-source_c': 0.01, 'water_c': 0.01}
+ean = ExergyAnalysis(steamboiler, E_P=[product_bus], E_F=[fuel_bus], E_L=[loss_bus])
+ean.analyse(pamb=p_amb, Tamb=T_amb, Chem_Ex=chemexlib)
+ean.evaluate_exergoeconomics(Exe_Eco_Costs=exe_eco_input, Tamb=T_amb)
+ean.print_results(Exe_Eco_An=True)
diff --git a/tests_friederike/tests.py b/tests_friederike/tests.py
new file mode 100644
index 000000000..d9d0f4d82
--- /dev/null
+++ b/tests_friederike/tests.py
@@ -0,0 +1,110 @@
+import numpy as np
+
+A=np.array([[1,-1],
+ [-1,1]])
+b=np.array([2,2])
+print([b])
+print(np.append(A,b,1))
+print(np.linalg.matrix_rank(A))
+print(np.linalg.matrix_rank(A,b))
+print(np.linalg.solve(A,b))
+
+"""
+# HEAT PUMP JERRY
+ #P_ext P_bus P_comp Z_dros 21t 21m 21ch 22t 22m 22ch 23t 23m 23ch 24t 24m 24ch cct ccm ccch 11t 11m 11ch 12t 12m 12ch 13t 13m 13ch 14t 14m 14ch
+# bus: C_ext vorgeben, C_bus=C_comp, C_ext=C_bus
+ [[ 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 1. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 1. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+# Kompressor KP: Komponentenbilanz, c_ch_in=c_ch_aus, delta c_t = delta c_m
+ [ 0. 0. 1. 0.333 0. 0. 0. 0.333 0.333 0.333 -0.333 -0.333 -0.333 1. 1. 1. -1. -1. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+# Gaskühler GK: Komponentenbilanz, 5 aux
+ [ 0. 0. 0. 0.333 1. 1. 1. -0.667 -0.667 -0.667 -0.333 -0.333 -0.333 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1. 1. -1. -1. -1. ]
+ [ 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 1. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. -1. ]
+# sources
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+# Verdampfer VD: Komponentenbilanz, 5 aux
+ [ 0. 0. 0. 0.333 0. 0. 0. 0.333 0.333 0.333 0.667 0.667 0.667 -1. -1. -1. 0. 0. 0. 1. 1. 1. -1. -1. -1. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. -1. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+# Kreislaufzusammenschluss KR: C_in = C_out
+ [ 0. 0. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. -1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+# Drossel DR: c_in=c_out, Z_drossel festlegen
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. -1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]
+ [ 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]]
+
+
+A=np.array([[1,-1,1/3,-1/3,1,0,0,0,0,1/3],
+ [0,1,-1+1/3,-1/3,0,1,-1,0,0,1/3],
+ [-1,0,1/3,1-1/3,0,0,0,1,-1,1/3],
+ [0,0,0,0,0,0,0,0,0,1],
+ [0,0,1/8,-1/7,0,0,0,0,0,0],
+ [0,0,0,0,0,0,0,1/8,-1/7,0],
+ [0,1/10,-1/8,0,0,0,0,0,0,0],
+ [0,0,0,0,1,0,0,0,0,0],
+ [0,0,0,0,0,1,0,0,0,0],
+ [0,0,0,0,0,0,0,1,0,0]])
+b=np.array([-3,-4,-7,5,0,0,0,12,14,15])
+
+print(np.linalg.solve(A,b))
+
+b=np.array((10,20))
+b = np.append(b, np.zeros(3)) if 'b' in locals() else np.array(0)
+print(b)
+
+a = np.zeros((1,7))
+
+A = np.vstack([A, a]) if 'A' in locals() else a # if A exists, add line a, otherwise A=a
+A = np.vstack([A, a]) if 'A' in locals() else a # if A exists, add line a, otherwise A=a
+
+b = np.ones((2,7))
+A = np.concatenate((a,b))
+print(A)
+
+b=[1,2]
+c=[3,4]
+for a in b + c:
+ print(a)
+
+Ex_C_col = { }
+Ex_C_col["therm"] = 3
+
+print(Ex_C_col)
+
+print(type("therm"))
+
+
+
+# don't delete: still important!
+A=np.array([[2,1]])
+b=np.array([2])
+print(A)
+print(b)
+print(np.linalg.lstsq(A,b)[0]) # for overdetermined matrix use lstsq instead of solve
+
+types = {"therm": 0, "mech": 1, "chemical": 2}
+aux_eqs=[[2, "therm"],[3, "mech"],[1, "chemical"]]
+aux_eq = aux_eqs[0]
+print(types[aux_eq[1]])
+
+a=[0,0,0,1,0]
+print(np.any(a))
+"""
\ No newline at end of file