General configurations

This page provides a short overview on globally configurable settings. At the moment, these are only concerning prints of components, connections and properties but they will be extended in the future.

Display modes

Connections, components and their data containers provide repr and print output. You can control the level of detail globally with tespy.set_display_mode. Available modes are:

  • "compact" (default)

  • "extensive"

  • "none"

For example, consider the following model:

import tespy
from tespy.components import MovingBoundaryHeatExchanger, Sink, Source
from tespy.connections import Connection, Ref
from tespy.networks import Network

nw = Network(iterinfo=False)
nw.units.set_defaults(
    pressure="bar", pressure_difference="bar", temperature="degC",
    enthalpy="kJ/kg", heat="kW"
)

cond = MovingBoundaryHeatExchanger("condenser")
c1 = Connection(Source("refrigerant inflow"), "out1", cond, "in1", label="1")
c2 = Connection(cond, "out1", Sink("refrigerant outflow"), "in1", label="2")
c11 = Connection(Source("water inflow"), "out1", cond, "in2", label="11")
c12 = Connection(cond, "out2", Sink("water outflow"), "in1", label="12")
nw.add_conns(c1, c2, c11, c12)

c1.set_attr(fluid={"PROPANE": 1}, T=70)
c2.set_attr(x=0)
c11.set_attr(fluid={"water": 1}, p=1, T=30)
c12.set_attr(T=Ref(c11, 1, 10))
cond.set_attr(Q=-15, td_pinch=3, pr1=1, pr2=1)
nw.solve("design")

In the default mode objects render a compact overview:

c1
Connection('1', refrigerant inflow:out1 -> condenser:in1)
c1.T
FluidProperties(val=70, unit='°C', val_SI=343.15, is_set=True)
cond
MovingBoundaryHeatExchanger('condenser')
cond.td_pinch
ComponentProperties(val=3, unit='Δ°C', val_SI=3, is_set=True, is_var=False)
cond.Q_sections
ComponentArrayProperties(val=[ 0.     12.4244 15.    ], unit='kW', quantity='heat')
c12.T_ref
ReferencedFluidProperties(ref=Ref('11', factor=1, delta=10), is_set=True)

The "extensive" mode renders tabular views instead of compact ones.

tespy.set_display_mode("extensive")
c12
Connection('12', condenser:out2 -> water outflow:in1)

property                 value  unit           SI value  spec
------------  ----------------  ----------  -----------  ------
m                       0.3589  kg / s       3.5890e-01
p                       1.0000  bar          1.0000e+05
h                     167.6151  kJ / kg      1.6762e+05
T                      40.0000  °C           3.1315e+02
T_bubble               99.6059  °C           3.7276e+02
T_dew                  99.6059  °C           3.7276e+02
v                       0.0004  m3 / s       3.6172e-04
x                       0.0000               0.0000e+00
td_dew                -59.6059  Δ°C         -5.9606e+01
td_bubble              59.6059  Δ°C          5.9606e+01
T_ref         1 * T('11') + 10                           set
vol                     0.0010  m3 / kg      1.0078e-03
s                     572.3658  J / K / kg   5.7237e+02
fluid[water]            1.0000
c12.T
  value  unit      SI value  spec
-------  ------  ----------  ------
40.0000  °C      3.1315e+02
cond
MovingBoundaryHeatExchanger: condenser

parameter                   value  unit       SI value  spec
----------------------  ---------  ------  -----------  ------
Q                        -15.0000  kW      -1.5000e+04  set
UA                      2206.6694  W / K    2.2067e+03
kA                       783.7019  W / K    7.8370e+02
td_log                     6.7976  Δ°C      6.7976e+00
lmtd                       6.7976  Δ°C      6.7976e+00
ttd_u                     30.0000  Δ°C      3.0000e+01
ttd_l                     11.2829  Δ°C      1.1283e+01
ttd_min                   11.2829  Δ°C      1.1283e+01
pr1                        1.0000           1.0000e+00  set
pr2                        1.0000           1.0000e+00  set
dp1                        0.0000  bar      0.0000e+00
dp2                        0.0000  bar      0.0000e+00
zeta1_d4                   0.0000           0.0000e+00
zeta1                      0.0000           0.0000e+00
zeta2_d4                   0.0000           0.0000e+00
zeta2                      0.0000           0.0000e+00
eff_hot                    0.9197           9.1970e-01
eff_cold                   0.2498           2.4981e-01
eff_max                    0.9197           9.1970e-01
Q_sections                  [...]  kW
T_hot_sections              [...]  °C
T_cold_sections             [...]  °C
Q_per_section               [...]  kW
lmtd_per_section            [...]  Δ°C
td_pinch                   3.0000  Δ°C      3.0000e+00  set
phase_hot_per_section       [...]
phase_cold_per_section      [...]
cond.td_pinch
  value  unit      SI value  spec
-------  ------  ----------  ------
 3.0000  Δ°C     3.0000e+00  set
c12.T_ref
ReferencedFluidProperties(ref=Ref('11', factor=1, delta=10), is_set=True)
cond.Q_sections
heat in kW (SI value in W)

index      value    SI value
-------  -------  ----------
0         0.0000      0.0000
1        12.4244  12424.3954
2        15.0000  15000.0000

"none" restores the plain python output, i.e. just the object references.

tespy.set_display_mode("none")
c1
<tespy.connections.connection.Connection object at 0x78bc5d689e80>
tespy.set_display_mode("compact")