Components

This section provides an overview on all available component classes, how to specify simple inputs to components, implement custom values in context of characteristic lines or maps, and give hints as to how to implement custom equations to existing components or create custom components yourself.

List of components

Below we have collected the different components available in tespy per module. In the tabs you can view the available parameters per component and relevant links to the underlying equations, the class documentation and example.

Component

Class documentation and example: Component

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

CycleCloser

Class documentation and example: CycleCloser

Table of constraints

Parameter

Description

Method

pressure_equality_constraint

pressure equality constraint

variable_equality_structure_matrix

enthalpy_equality_constraint

enthalpy equality constraint

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

mass_deviation

absolute deviation of mass flow between inlet and outlet

mass_flow

None

fluid_deviation

norm of absolute deviation of fluid composition between inlet and outlet

None

None

Sink

Class documentation and example: Sink

Source

Class documentation and example: Source

SubsystemInterface

Class documentation and example: SubsystemInterface

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

pressure_equality_constraint

pressure equality constraint

variable_equality_structure_matrix

enthalpy_equality_constraint

enthalpy equality constraint

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

num_inter

number of interfacing connections

None

None

CombustionChamber

Class documentation and example: CombustionChamber

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow balance over all inflows and outflows

mass_flow_func

reactor_pressure_constraints

pressure equality constraints

combustion_pressure_structure_matrix

stoichiometry_constraints

constraints for stoichiometry of the reaction

stoichiometry_func

energy_balance_constraints

constraint for energy balance

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

lamb

available oxygen to stoichiometric oxygen ratio

ratio

lambda_func

ti

thermal input (fuel LHV multiplied with mass flow)

heat

ti_func

DiabaticCombustionChamber

Class documentation and example: DiabaticCombustionChamber

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow balance over all inflows and outflows

mass_flow_func

stoichiometry_constraints

constraints for stoichiometry of the reaction

stoichiometry_func

Table of parameters

Parameter

Description

Quantity

Method

lamb

available oxygen to stoichiometric oxygen ratio

ratio

lambda_func

ti

thermal input (fuel LHV multiplied with mass flow)

heat

ti_func

pr

outlet 0 to inlet 0 pressure ratio

ratio

pr_structure_matrix

dp

inlet 0 to outlet 0 absolute pressure change

pressure

dp_structure_matrix

eta

heat dissipation ratio relative to thermal input

efficiency

energy_balance_func

Qloss

heat dissipation

heat

None

CombustionEngine

Class documentation and example: CombustionEngine

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow balance over all inflows and outflows

mass_flow_func

reactor_pressure_constraints

pressure equality constraints

combustion_pressure_structure_matrix

stoichiometry_constraints

constraints for stoichiometry of the reaction

stoichiometry_func

energy_balance_constraints

constraint for energy balance

energy_balance_func

power_constraints

equation for thermal input to power generation relation

tiP_char_func

heat1_constraints

equation for thermal input to heating port 1 heat generation relation

Q1_char_func

heat2_constraints

equation for thermal input to heating port 2 heat generation relation

Q2_char_func

heatloss_constraints

equation for thermal input to heat dissipation relation

Qloss_char_func

mass_flow_cooling_constraints

equation for mass flow equality at heating ports

variable_equality_structure_matrix

fluid_cooling_constraints

equation for fluid composition equality at heating ports

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

lamb

available oxygen to stoichiometric oxygen ratio

ratio

lambda_func

ti

thermal input (fuel LHV multiplied with mass flow)

heat

ti_func

P [1]

mechanical power generated by the engine

power

None

Q1

heating port 1 heat production

heat

Q1_func

Q2

heating port 2 heat production

heat

Q2_func

Qloss [1]

heat dissipation

heat

None

pr1

heating port 1 outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

heating port 2 outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

heating port 1 inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

heating port 2 inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

heating port 1 non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

heating port 2 non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eta_mech

None

None

None

T_v_inner

None

None

None

Table of characteristic lines and maps

Parameter

Description

Method

tiP_char

thermal input to power lookup table

None

Q1_char

thermal input to heat production of port 1 lookup table

None

Q2_char

thermal input to heat production of port 2 lookup table

None

Qloss_char

thermal input to heat dissipation lookup table

None

DisplacementMachine

Class documentation and example: DisplacementMachine

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

PolynomialCompressor

Class documentation and example: PolynomialCompressor

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power consumption

power

None

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

Q_diss

heat dissipation

heat

None

eta_vol

volumetric efficiency

efficiency

None

dissipation_ratio

heat dissipation ratio relative to power consumption

ratio

None

Q_diss_rel

heat dissipation ratio relative to power consumption(deprecated)

ratio

None

rpm [1]

compressor frequency

None

None

reference_state

reference state definition for the scaling of displacement with compressor rpm

None

None

eta_s_poly

polynomial coefficients for isentropic efficiency

None

None

eta_vol_poly

polynomial coefficients for volumetric efficiency

None

None

eta_s

isentropic efficiency

efficiency

None

Table of parameter groups

Parameter

Description

Required parameters

Method

eta_vol_poly_group

displacement equation based on polynomial coefficients for volumetric efficiency

reference_state, eta_vol_poly, rpm

eta_vol_poly_group_func

eta_vol_group

displacement equation based on fixed volumetric efficiency

reference_state, eta_vol, rpm

eta_vol_group_func

eta_s_poly_group

isentropic efficiency equation based on polynomial coefficients

eta_s_poly, dissipation_ratio

eta_s_poly_group_func

eta_s_group

isentropic efficiency equation with fixed efficiency

eta_s, dissipation_ratio

eta_s_group_func

energy_balance_group

energy balance equation for fixed power and dissipation ratio

P, dissipation_ratio

energy_balance_group_func

PolynomialCompressorWithCooling

Class documentation and example: PolynomialCompressorWithCooling

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

cooling_energy_balance_constraints

energy balance for the cooling ports

cooling_energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

P

power consumption

power

None

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

Q_diss

heat dissipation

heat

None

eta_vol

volumetric efficiency

efficiency

None

dissipation_ratio

heat dissipation ratio relative to power consumption

ratio

None

Q_diss_rel

heat dissipation ratio relative to power consumption(deprecated)

ratio

None

rpm [1]

compressor frequency

None

None

reference_state

reference state definition for the scaling of displacement with compressor rpm

None

None

eta_s_poly

polynomial coefficients for isentropic efficiency

None

None

eta_vol_poly

polynomial coefficients for volumetric efficiency

None

None

eta_s

isentropic efficiency

efficiency

None

eta_recovery

share of dissipated heat usable in cooling port

efficiency

None

td_minimal

theoretical minimal temperature difference between working and cooling fluid

temperature_difference

None

dp_cooling

cooling port inlet to outlet absolute pressure change

pressure

dp_structure_matrix

pr_cooling

cooling port outlet to inlet pressure ratio

ratio

pr_structure_matrix

Table of parameter groups

Parameter

Description

Required parameters

Method

eta_vol_poly_group

displacement equation based on polynomial coefficients for volumetric efficiency

reference_state, eta_vol_poly, rpm

eta_vol_poly_group_func

eta_vol_group

displacement equation based on fixed volumetric efficiency

reference_state, eta_vol, rpm

eta_vol_group_func

eta_s_poly_group

isentropic efficiency equation based on polynomial coefficients

eta_s_poly, dissipation_ratio

eta_s_poly_group_func

eta_s_group

isentropic efficiency equation with fixed efficiency

eta_s, dissipation_ratio

eta_s_group_func

energy_balance_group

energy balance equation for fixed power and dissipation ratio

P, dissipation_ratio

energy_balance_group_func

HeatExchanger

Class documentation and example: HeatExchanger

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

ttd_min

minimum terminal temperature difference

temperature_difference

ttd_min_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eff_cold

heat exchanger effectiveness for cold side

efficiency

eff_cold_func

eff_hot

heat exchanger effectiveness for hot side

efficiency

eff_hot_func

eff_max

maximum heat exchanger effectiveness

efficiency

eff_max_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

Condenser

Class documentation and example: Condenser

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

ttd_min

minimum terminal temperature difference

temperature_difference

ttd_min_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eff_cold

heat exchanger effectiveness for cold side

efficiency

eff_cold_func

eff_hot

heat exchanger effectiveness for hot side

efficiency

eff_hot_func

eff_max

maximum heat exchanger effectiveness

efficiency

eff_max_func

subcooling

allow subcooling in the condenser

None

subcooling_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

Desuperheater

Class documentation and example: Desuperheater

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

saturated_gas_constraints

equation for saturated gas at hot side outlet

saturated_gas_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

ttd_min

minimum terminal temperature difference

temperature_difference

ttd_min_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eff_cold

heat exchanger effectiveness for cold side

efficiency

eff_cold_func

eff_hot

heat exchanger effectiveness for hot side

efficiency

eff_hot_func

eff_max

maximum heat exchanger effectiveness

efficiency

eff_max_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

SectionedHeatExchanger

Class documentation and example: SectionedHeatExchanger

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

ttd_min

minimum terminal temperature difference

temperature_difference

ttd_min_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eff_cold

heat exchanger effectiveness for cold side

efficiency

eff_cold_func

eff_hot

heat exchanger effectiveness for hot side

efficiency

eff_hot_func

eff_max

maximum heat exchanger effectiveness

efficiency

eff_max_func

num_sections

number of sections of the heat exchanger

None

None

UA

sum of UA values of all sections of heat exchanger

heat_transfer_coefficient

UA_func

refrigerant_index

side on which the refrigerant is flowing (0: hot, 1:cold)

None

None

re_exp_r

Reynolds exponent for UA modification based on refrigerant side mass flow

None

None

re_exp_sf

Reynolds exponent for UA modification based on secondary fluid side mass flow

None

None

alpha_ratio

secondary to refrigerant side convective heat transfer coefficient ratio

ratio

None

area_ratio

secondary to refrigerant side heat transfer area ratio

ratio

None

td_pinch

equation for minimum pinch

temperature_difference

td_pinch_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

UA_cecchinato

equation for UA modification in offdesign

re_exp_r, re_exp_sf, alpha_ratio, area_ratio

UA_cecchinato_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

MovingBoundaryHeatExchanger

Class documentation and example: MovingBoundaryHeatExchanger

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

ttd_min

minimum terminal temperature difference

temperature_difference

ttd_min_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eff_cold

heat exchanger effectiveness for cold side

efficiency

eff_cold_func

eff_hot

heat exchanger effectiveness for hot side

efficiency

eff_hot_func

eff_max

maximum heat exchanger effectiveness

efficiency

eff_max_func

UA

sum of UA values of all sections of heat exchanger

heat_transfer_coefficient

UA_func

refrigerant_index

side on which the refrigerant is flowing (0: hot, 1:cold)

None

None

re_exp_r

Reynolds exponent for UA modification based on refrigerant side mass flow

None

None

re_exp_sf

Reynolds exponent for UA modification based on secondary fluid side mass flow

None

None

alpha_ratio

secondary to refrigerant side convective heat transfer coefficient ratio

ratio

None

area_ratio

secondary to refrigerant side heat transfer area ratio

ratio

None

td_pinch

equation for minimum pinch

temperature_difference

td_pinch_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

UA_cecchinato

equation for UA modification in offdesign

re_exp_r, re_exp_sf, alpha_ratio, area_ratio

UA_cecchinato_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

SimpleHeatExchanger

Class documentation and example: SimpleHeatExchanger

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

power_connector_location

None

None

None

Q

heat transfer

heat

energy_balance_func

pr

outlet ot inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

D [1]

diameter of channel

length

None

L [1]

length of channel

length

None

ks [1]

roughness of wall material

length

None

ks_HW [1]

Hazen-Williams roughness

None

None

kA [1]

heat transfer coefficient considering ambient temperature

heat_transfer_coefficient

None

Tamb

ambient temperature

temperature

None

dissipative

None

None

None

Table of parameter groups

Parameter

Description

Required parameters

Method

darcy_group

Darcy-Weißbach equation for pressure loss

L, ks, D

darcy_func

hw_group

Hazen-Williams equation for pressure loss

L, ks_HW, D

hazen_williams_func

kA_group

equation for heat transfer based on ambient temperature and heat transfer coefficient

kA, Tamb

kA_group_func

kA_char_group

heat transfer from design heat transfer coefficient, modifier lookup table and ambient temperature

kA_char, Tamb

kA_char_group_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char

heat transfer coefficient lookup table for offdesign

None

ParabolicTrough

Class documentation and example: ParabolicTrough

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

power_connector_location

None

None

None

Q

heat transfer

heat

energy_balance_func

pr

outlet ot inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

D [1]

diameter of channel

length

None

L [1]

length of channel

length

None

ks [1]

roughness of wall material

length

None

ks_HW [1]

Hazen-Williams roughness

None

None

Tamb

ambient temperature

temperature

None

dissipative

None

None

None

E [1]

solar irradiation to the parabolic trough

heat

None

A [1]

area of the parabolic trough

area

None

eta_opt

optical efficiency

efficiency

None

c_1

thermal loss coefficient 1

None

None

c_2

thermal loss coefficient 2

None

None

iam_1

incidence angle modifier 1

None

None

iam_2

incidence angle modifier 2

None

None

aoi

angle of incidence

angle

None

doc

degree of cleanliness

ratio

None

Q_loss

heat dissipation

heat

None

Table of parameter groups

Parameter

Description

Required parameters

Method

darcy_group

Darcy-Weißbach equation for pressure loss

L, ks, D

darcy_func

hw_group

Hazen-Williams equation for pressure loss

L, ks_HW, D

hazen_williams_func

energy_group

energy balance equation of the parabolic trough

E, eta_opt, aoi, doc, c_1, c_2, iam_1, iam_2, A, Tamb

energy_group_func

ParallelFlowHeatExchanger

Class documentation and example: ParallelFlowHeatExchanger

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

energy_balance_constraints

hot side to cold side heat transfer equation

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

Q

heat transfer from hot side

heat

energy_balance_hot_func

kA

heat transfer coefficient considering terminal temperature differences

heat_transfer_coefficient

kA_func

td_log

logarithmic temperature difference

temperature_difference

None

ttd_u

terminal temperature difference at hot side inlet to cold side outlet

temperature_difference

ttd_u_func

ttd_l

terminal temperature difference at hot side outlet to cold side inlet

temperature_difference

ttd_l_func

pr1

hot side outlet to inlet pressure ratio

ratio

pr_structure_matrix

pr2

cold side outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp1

hot side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

dp2

cold side inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta1

hot side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

zeta2

cold side non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

Table of parameter groups

Parameter

Description

Required parameters

Method

kA_char

equation for heat transfer based on kA and modification factor

kA_char1, kA_char2

kA_char_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char1

hot side kA modification lookup table for offdesign

None

kA_char2

cold side kA modification lookup table for offdesign

None

SolarCollector

Class documentation and example: SolarCollector

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

power_connector_location

None

None

None

Q

heat transfer

heat

energy_balance_func

pr

outlet ot inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

D [1]

diameter of channel

length

None

L [1]

length of channel

length

None

ks [1]

roughness of wall material

length

None

ks_HW [1]

Hazen-Williams roughness

None

None

Tamb

ambient air temperature

temperature

None

dissipative

None

None

None

E [1]

solar irradiation to the solar collector

heat

None

A [1]

area of the solar collector

area

None

eta_opt

optical efficiency

efficiency

None

lkf_lin

linear heat loss factor

None

None

lkf_quad

quadratic heat loss factor

None

None

Q_loss

heat dissipation

heat

None

Table of parameter groups

Parameter

Description

Required parameters

Method

darcy_group

Darcy-Weißbach equation for pressure loss

L, ks, D

darcy_func

hw_group

Hazen-Williams equation for pressure loss

L, ks_HW, D

hazen_williams_func

energy_group

energy balance equation of the solar collector

E, eta_opt, lkf_lin, lkf_quad, A, Tamb

energy_group_func

NodeBase

Class documentation and example: NodeBase

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

DropletSeparator

Class documentation and example: DropletSeparator

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

energy_balance_constraints

energy balance constraint

energy_balance_func

pressure_constraints

pressure equality constraints

pressure_structure_matrix

outlet_constraint_liquid

outlet 0 is saturated liquid constraint

saturated_outlet_func

outlet_constraint_gas

outlet 1 is saturated liquid constraint

saturated_outlet_func

fluid_constraints

fluid equality constraints

fluid_structure_matrix

Drum

Class documentation and example: Drum

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

energy_balance_constraints

energy balance constraint

energy_balance_func

pressure_constraints

pressure equality constraints

pressure_structure_matrix

outlet_constraint_liquid

outlet 0 is saturated liquid constraint

saturated_outlet_func

outlet_constraint_gas

outlet 1 is saturated liquid constraint

saturated_outlet_func

fluid_constraints

fluid equality constraints

fluid_structure_matrix

Merge

Class documentation and example: Merge

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

fluid_constraints

fluid mass fraction balance constraints

fluid_func

energy_balance_constraints

energy balance constraint

energy_balance_func

pressure_constraints

pressure equality constraints

pressure_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

num_in

number of inlets

None

None

Splitter

Class documentation and example: Splitter

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

energy_balance_constraints

equal enthalpy at all outlets constraint

enthalpy_structure_matrix

pressure_constraints

pressure equality constraints

pressure_structure_matrix

fluid_constraints

fluid equality constraints

fluid_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

num_out

number of outlets

None

None

Node

Class documentation and example: Node

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

pressure_constraints

pressure equality constraints

pressure_structure_matrix

outlet_enthalpy_constraints

equal enthalpy at all outlets constraint(s)

enthalpy_structure_matrix

outlet_fluid_constraints

equal fluid at all outlets constraint(s)

fluid_structure_matrix

fluid_constraints

fluid mass fraction constraints

fluid_func

energy_balance_constraints

energy balance constraint

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

num_out

number of outlets

None

None

num_in

number of inlets

None

None

Separator

Class documentation and example: Separator

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass balance constraint

mass_flow_func

fluid_constraints

fluid mass fraction balance constraints

fluid_func

energy_balance_constraints

equal temperature at all outlets constraints

energy_balance_func

pressure_constraints

pressure equality constraints

pressure_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

num_out

number of outlets

None

None

Pipe

Class documentation and example: Pipe

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

power_connector_location

None

None

None

Q

heat transfer

heat

energy_balance_func

pr

outlet ot inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

D [1]

diameter of channel

length

None

L [1]

length of channel

length

None

ks [1]

roughness of wall material

length

None

ks_HW [1]

Hazen-Williams roughness

None

None

kA [1]

heat transfer coefficient considering ambient temperature

heat_transfer_coefficient

None

Tamb

ambient temperature

temperature

None

dissipative

None

None

None

insulation_thickness

thickness of pipe insulation

length

None

insulation_tc

thermal conductivity of insulation

thermal_conductivity

None

material

None

None

None

pipe_thickness

wall thickness of pipe

length

None

environment_media

None

None

None

wind_velocity

velocity of wind at insulation surface

speed

None

pipe_depth

depth of buried pipe

length

None

Table of parameter groups

Parameter

Description

Required parameters

Method

darcy_group

Darcy-Weißbach equation for pressure loss

L, ks, D

darcy_func

hw_group

Hazen-Williams equation for pressure loss

L, ks_HW, D

hazen_williams_func

kA_group

equation for heat transfer based on ambient temperature and heat transfer coefficient

kA, Tamb

kA_group_func

kA_char_group

heat transfer from design heat transfer coefficient, modifier lookup table and ambient temperature

kA_char, Tamb

kA_char_group_func

Q_ohc_group_surface

equation for heat loss of surface pipes

insulation_thickness, insulation_tc, Tamb, material, pipe_thickness, environment_media, wind_velocity

ohc_surface_group_func

Q_ohc_group_subsurface

equation for heat loss of buried pipes

insulation_thickness, insulation_tc, Tamb, material, pipe_thickness, environment_media, pipe_depth

ohc_subsurface_group_func

Table of characteristic lines and maps

Parameter

Description

Method

kA_char

heat transfer coefficient lookup table for offdesign

None

Valve

Class documentation and example: Valve

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

enthalpy_constraints

equation for enthalpy equality

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

pr

None

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

None

None

zeta_func

Table of characteristic lines and maps

Parameter

Description

Method

dp_char

inlet to outlet absolute pressure change as function of mass flow lookup table

dp_char_func

PowerBus

Class documentation and example: PowerBus

Table of constraints

Parameter

Description

Method

energy_balance_constraint

energy balance over all inflows and outflows

energy_balance_func

Table of parameters

Parameter

Description

Quantity

Method

num_in

number of inlets

None

None

num_out

number of outlets

None

None

Generator

Class documentation and example: Generator

Table of parameters

Parameter

Description

Quantity

Method

eta

efficiency

efficiency

eta_func

delta_power

inlet to outlet power difference

power

delta_power_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_char

efficiency lookup table for offdesign

eta_char_func

Motor

Class documentation and example: Motor

Table of parameters

Parameter

Description

Quantity

Method

eta

efficiency

efficiency

eta_func

delta_power

inlet to outlet power difference

power

delta_power_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_char

efficiency lookup table for offdesign

eta_char_func

PowerSink

Class documentation and example: PowerSink

PowerSource

Class documentation and example: PowerSource

FuelCell

Class documentation and example: FuelCell

Table of constraints

Parameter

Description

Method

mass_flow_constraints

equations for oxygen and hydrogen mass flow relation

reactor_mass_flow_func

cooling_mass_flow_constraints

cooling fluid mass flow equality equation

cooling_mass_flow_structure_matrix

cooling_fluid_constraints

cooling fluid composition equality equation

cooling_fluid_structure_matrix

energy_balance_constraints

energy balance equation of the reactor

energy_balance_func

reactor_pressure_constraints

reactor pressure equality equations

reactor_pressure_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P [1]

power output of the fuel cell

power

None

Q

heat output of the cooling port

heat

heat_func

pr

cooling port outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

cooling inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

cooling port non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eta

efficiency of the fuel cell

efficiency

eta_func

e [1]

equation for specified specific energy consumption of the fuel cell

specific_energy

specific_energy_func

WaterElectrolyzer

Class documentation and example: WaterElectrolyzer

Table of constraints

Parameter

Description

Method

mass_flow_constraints

equations for oxygen and hydrogen mass flow relation

reactor_mass_flow_func

cooling_mass_flow_constraints

cooling fluid mass flow equality equation

cooling_mass_flow_structure_matrix

cooling_fluid_constraints

cooling fluid composition equality equation

cooling_fluid_structure_matrix

energy_balance_constraints

energy balance equation of the reactor

energy_balance_func

reactor_pressure_constraints

reactor pressure equality equations

reactor_pressure_structure_matrix

gas_temperature_constraints

equation for same temperature of product gases

gas_temperature_func

Table of parameters

Parameter

Description

Quantity

Method

P [1]

power consumption of the electrolyzer

power

None

Q

heat output of the cooling port

heat

heat_func

pr

cooling port outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

cooling inlet to outlet absolute pressure change

pressure

dp_structure_matrix

zeta

cooling port non-dimensional friction coefficient for pressure loss calculation

None

zeta_func

eta

efficiency of the fuel cell

efficiency

eta_func

e [1]

equation for specified specific energy consumption of the electrolyzer

specific_energy

specific_energy_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_char

efficiency lookup table for offdesign

eta_char_func

Turbomachine

Class documentation and example: Turbomachine

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

Compressor

Class documentation and example: Compressor

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

eta_s

isentropic efficiency

efficiency

eta_s_func

igva [1]

inlet guide vane angle

angle

None

Table of parameter groups

Parameter

Description

Required parameters

Method

char_map_eta_s_group

map for isentropic efficiency over speedlines and non-dimensional mass flow

char_map_eta_s, igva

char_map_eta_s_func

char_map_pr_group

map for pressure ratio over speedlines and non-dimensional mass flow

char_map_pr, igva

char_map_pr_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_s_char

isentropic efficiency lookup table for offdesign

eta_s_char_func

char_map_eta_s

2D lookup table for efficiency over non-dimensional mass flow and speed line

None

char_map_pr

2D lookup table for pressure ratio over non-dimensional mass flow and speed line

None

Pump

Class documentation and example: Pump

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

eta_s

isentropic efficiency

efficiency

eta_s_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_s_char

isentropic efficiency lookup table for offdesign

eta_s_char_func

flow_char

pressure rise over volumetric flow lookup table

flow_char_func

Turbine

Class documentation and example: Turbine

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

eta_s

isentropic efficiency

efficiency

eta_s_func

cone

cone law equation for offdesign

None

cone_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_s_char

isentropic efficiency lookup table for offdesign

eta_s_char_func

SteamTurbine

Class documentation and example: SteamTurbine

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

eta_s

isentropic efficiency

efficiency

eta_s_func

cone

cone law equation for offdesign

None

cone_func

alpha

influence factor for wetness efficiency modifier

ratio

None

eta_s_dry

isentropic efficiency of dry expansion

efficiency

None

Table of parameter groups

Parameter

Description

Required parameters

Method

eta_s_dry_group

method to apply Baumann rule

alpha, eta_s_dry

eta_s_wet_func

Table of characteristic lines and maps

Parameter

Description

Method

eta_s_char

isentropic efficiency lookup table for offdesign

eta_s_char_func

TurboCompressor

Class documentation and example: TurboCompressor

Table of constraints

Parameter

Description

Method

mass_flow_constraints

mass flow equality constraint(s)

variable_equality_structure_matrix

fluid_constraints

fluid composition equality constraint(s)

variable_equality_structure_matrix

Table of parameters

Parameter

Description

Quantity

Method

P

power input/output of the component

power

energy_balance_func

pr

outlet to inlet pressure ratio

ratio

pr_structure_matrix

dp

inlet to outlet absolute pressure change

pressure

dp_structure_matrix

eta_s

isentropic efficiency

efficiency

eta_s_func

igva [1]

inlet guide vane angle

angle

None

Table of parameter groups

Parameter

Description

Required parameters

Method

char_map_eta_s_group

map for isentropic efficiency over speedlines and non-dimensional mass flow

char_map_eta_s, igva

char_map_eta_s_func

char_map_pr_group

map for pressure ratio over speedlines and non-dimensional mass flow

char_map_pr, igva

char_map_pr_func

Table of characteristic lines and maps

Parameter

Description

Method

char_map_eta_s

2D lookup table for efficiency over non-dimensional mass flow and speed line

None

char_map_pr

2D lookup table for pressure ratio over non-dimensional mass flow and speed line

None

Component parametrisation

All parameters of components can be set and unset through the set_attr method. As seen in the tables above, there are different types of parameters:

  • Simple component parameters: If an equation/method is associated with the parameter, setting a value for the parameter will activate that equation.

  • Grouped component parameters: Multiple simple parameters can be part of a parameter group. To activate the equation associated with the parameter group, values for all elements of the group have to be set by the user.

  • Component parameters that serve as variable in the model: Specifically in the context of grouped parameters it is possible to set one of the parameters as a variable. If values for all other parameters of the group are specified as well, then the group equation is activated and the solver will include the one parameter marked as variable in the variables.

  • Component characteristics and characteristic groups: Lookup-tables are implemented here to interpolate over a variable or an expression and modify the outcome of an equation.

Component parameters

The example shows how to specify a component parameter and how to unset again at the example of the heat transfer coefficient of an evaporator.

>>> from tespy.components import HeatExchanger
>>> from tespy.tools import ComponentProperties as dc_cp
>>> import numpy as np

>>> he = HeatExchanger('evaporator')

>>> # specify the value
>>> he.set_attr(kA=1e5)
>>> he.kA.val
100000.0
>>> he.kA.is_set
True

>>> # possibilities to unset a value
>>> he.set_attr(kA=None)
>>> he.kA.is_set
False

Grouped parameters

Grouped parameters are used whenever a component property depends on multiple parameters. For instance, the pressure loss calculation via Darcy-Weissbach requires information about the length, diameter and roughness of the pipe. The solver will prompt a warning, if you do not specify all parameters required by a parameter group. If parameters of the group are missing, the equation will not be implemented by the solver.

>>> from tespy.components import Pipe, Source, Sink
>>> from tespy.networks import Network
>>> from tespy.connections import Connection

>>> nw = Network()
>>> nw.units.set_defaults(temperature="degC", pressure="bar")

>>> so = Source('source')
>>> si = Sink('sink')
>>> my_pipe = Pipe('pipe')

>>> c1 = Connection(so, 'out1', my_pipe, 'in1')
>>> c2 = Connection(my_pipe, 'out1', si, 'in1')
>>> nw.add_conns(c1, c2)
>>> c1.set_attr(fluid={"CH4": 1}, m=1, p=10, T=25)
>>> c2.set_attr(p0=10, T=25)

>>> # specify grouped parameters
>>> my_pipe.set_attr(D=0.1, L=20, ks=0.00005)
>>> nw.solve('design', init_only=True)
>>> my_pipe.darcy_group.is_set
True

>>> # the solver will not apply an equation, since the information of the
>>> # pipe's length is now missing (by removing it as follows).
>>> c2.set_attr(p=10)
>>> my_pipe.set_attr(L=None)
>>> nw.solve('design', init_only=True)
>>> my_pipe.darcy_group.is_set
False

Component variables

It is possible to use component parameters as variables of your system of equations. In the component parameter list, if a parameter can be a string, it is possible to specify this parameter as custom variable. For example, given the pressure ratio pr, length L and roughness ks of a pipe you may want to calculate the pipe’s diameter D required to achieve the specified pressure ratio. In this case you need to specify the diameter the following way.

>>> # make diameter variable of system
>>> my_pipe.set_attr(pr=0.98, L=100, ks=0.00002, D='var')
>>> c2.set_attr(p=None)
>>> nw.solve("design", init_only=True)
>>> my_pipe.darcy_group.is_set
True

It is also possible to set value boundaries for you custom variable. You can do this, if you expect the result to be within a specific range. But beware: This might result in a non converging simulation, if the actual value is out of your specified range.

>>> my_pipe.D.max_val = 0.3
>>> round(my_pipe.D.max_val, 1)
0.3

Component characteristics

Several components integrate parameters using a characteristic function. These parameters come with default characteristics. The default characteristics available can be found in the this section. Of course, it is possible to specify your own data for these characteristic functions.

Note

There are two different characteristics specifications

The characteristic function can be an auxiliary parameter of a different component property. This is the case for kA_char1 and kA_char2 of heat exchangers as well as the characteristics of a combustion engine: tiP_char, Q1_char, Q2_char and Qloss_char.

For all other components, the characteristic function is an individual parameter of the component.

What does this mean?

For the auxiliary functionality the main parameter, e.g. kA_char of a heat exchanger must be set .kA_char.is_set=True.

For the other functionality the characteristics parameter must be set e.g. .eta_s_char.is_set=True.

For example, kA_char specification for heat exchangers:

>>> from tespy.components import HeatExchanger
>>> from tespy.tools.characteristics import load_default_char as ldc
>>> from tespy.tools.characteristics import CharLine

>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(temperature="degC", pressure="bar")

>>> he = HeatExchanger('evaporator')
>>> cond = Source('condensate')
>>> steam = Sink('steam')
>>> gas_hot = Source('air inlet')
>>> gas_cold = Sink('air outlet')

>>> c1 = Connection(cond, "out1", he, "in2")
>>> c2 = Connection(he, "out2", steam, "in1")
>>> c3 = Connection(gas_hot, "out1", he, "in1")
>>> c4 = Connection(he, "out1", gas_cold, "in1")

>>> nw.add_conns(c1, c2, c3, c4)

>>> c1.set_attr(fluid={'water': 1}, m=10, p=10, x=0)
>>> c2.set_attr(p=10, x=1)
>>> c3.set_attr(fluid={'air': 1}, T=250, p=1)
>>> c4.set_attr(T=200, p=1)

>>> nw.solve("design")
>>> nw.save("design_case.json")
>>> round(he.kA.val)
503013

>>> # the characteristic function is made for offdesign calculation.
>>> he.set_attr(offdesign=["kA_char"])
>>> c4.set_attr(design=["T"])
>>> nw.solve("offdesign", design_path="design_case.json")
>>> # since we did not change any property, the offdesign case yields the
>>> # same value as the design kA value
>>> round(he.kA.val)
503013

>>> c1.set_attr(m=9)
>>> # use a characteristic line from the defaults: specify the component, the
>>> # parameter and the name of the characteristic function. Also, specify,
>>> # what type of characteristic function you want to use.
>>> kA_char1 = ldc('HeatExchanger', 'kA_char1', 'DEFAULT', CharLine)
>>> kA_char2 = ldc('HeatExchanger', 'kA_char2', 'EVAPORATING FLUID', CharLine)
>>> he.set_attr(kA_char2=kA_char2)
>>> nw.solve("offdesign", design_path="design_case.json")
>>> round(he.kA.val)
481745

>>> # specification of a data container yields the same result. It is
>>> # additionally possible to specify the characteristics parameter, e.g.
>>> # mass flow for kA_char1 (identical to default case) and volumetric
>>> # flow for kA_char2
>>> he.set_attr(
...     kA_char1={'char_func': kA_char1, 'param': 'm'},
...     kA_char2={'char_func': kA_char2, 'param': 'v'}
... )
>>> nw.solve("offdesign", design_path="design_case.json")
>>> round(he.kA.val)
481745

>>> # or use custom values for the characteristic line e.g. kA vs volumetric
>>> # flow
>>> x = np.array([0, 0.5, 1, 2])
>>> y = np.array([0, 0.8, 1, 1.2])
>>> kA_char2 = CharLine(x, y)
>>> he.set_attr(kA_char2={'char_func': kA_char2, 'param': 'v'})
>>> nw.solve("offdesign", design_path="design_case.json")
>>> round(he.kA.val)
475107

Full working example for eta_s_char specification of a turbine.

>>> from tespy.components import Sink, Source, Turbine
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> from tespy.tools.characteristics import CharLine
>>> import numpy as np

>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(
...     temperature="degC", pressure="bar", enthalpy="kJ/kg"
... )
>>> si = Sink('sink')
>>> so = Source('source')
>>> t = Turbine('turbine')
>>> inc = Connection(so, 'out1', t, 'in1')
>>> outg = Connection(t, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

>>> # design value specification, cone law and eta_s characteristic as
>>> # offdesign parameters
>>> eta_s_design = 0.855
>>> t.set_attr(
...     eta_s=eta_s_design,
...     design=['eta_s'], offdesign=['eta_s_char','cone']
... )

>>> # Characteristics x as m/m_design and y as eta_s(m)/eta_s_design
>>> # make sure to cross the 1/1 point (design point) to yield the same
>>> # output in the design state of the system
>>> line = CharLine(
...     x=[0.1, 0.3, 0.5, 0.7, 0.9, 1, 1.1],
...     y=np.array([0.6, 0.65, 0.75, 0.82, 0.85, 0.855, 0.79]) / eta_s_design
... )

>>> # default parameter for x is m / m_design
>>> t.set_attr(eta_s_char={'char_func': line})
>>> inc.set_attr(fluid={'water': 1}, m=10, T=550, p=110, design=['p'])
>>> outg.set_attr(p=0.5)
>>> nw.solve('design')
>>> nw.save('tmp.json')
>>> # change mass flow value, e.g. 3 kg/s and run offdesign calculation
>>> inc.set_attr(m=3)
>>> nw.solve('offdesign', design_path='tmp.json')
>>> # isentropic efficiency should be at 0.65
>>> round(t.eta_s.val, 2)
0.65

>>> # alternatively, we can specify the volumetric flow v / v_design for
>>> # the x lookup
>>> t.set_attr(eta_s_char={'param': 'v'})
>>> nw.solve('offdesign', design_path='tmp.json')
>>> round(t.eta_s.val, 2)
0.84

Finally, it is possible to allow value extrapolation at the lower and upper limit of the value range at the creation of characteristic lines. Set the extrapolation parameter to True.

# use custom specification parameters
>>> x = np.array([0, 0.5, 1, 2])
>>> y = np.array([0, 0.8, 1, 1.2])
>>> kA_char1 = CharLine(x, y, extrapolate=True)
>>> kA_char1.extrapolate
True

>>> # set extrapolation to True for existing lines, e.g.
>>> he.kA_char1.char_func.extrapolate = True
>>> he.kA_char1.char_func.extrapolate
True

For more information on how the characteristic functions work click here.

Component customization

Please check the advanced features on how to

  • extend existing components with additional parameters and equations or

  • create your own components from scratch