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) |
|
fluid_constraints |
fluid composition equality constraint(s) |
CycleCloser
Class documentation and example: CycleCloser
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
pressure_equality_constraint |
pressure equality constraint |
|
enthalpy_equality_constraint |
enthalpy equality constraint |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
mass_deviation |
absolute deviation of mass flow between inlet and outlet |
mass_flow |
|
fluid_deviation |
norm of absolute deviation of fluid composition between inlet and outlet |
|
|
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) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
pressure_equality_constraint |
pressure equality constraint |
|
enthalpy_equality_constraint |
enthalpy equality constraint |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_inter |
number of interfacing connections |
|
|
CombustionChamber
Class documentation and example: CombustionChamber
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow balance over all inflows and outflows |
|
reactor_pressure_constraints |
pressure equality constraints |
|
stoichiometry_constraints |
constraints for stoichiometry of the reaction |
|
energy_balance_constraints |
constraint for energy balance |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
lamb |
available oxygen to stoichiometric oxygen ratio |
ratio |
|
ti |
thermal input (fuel LHV multiplied with mass flow) |
heat |
DiabaticCombustionChamber
Class documentation and example: DiabaticCombustionChamber
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow balance over all inflows and outflows |
|
stoichiometry_constraints |
constraints for stoichiometry of the reaction |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
lamb |
available oxygen to stoichiometric oxygen ratio |
ratio |
|
ti |
thermal input (fuel LHV multiplied with mass flow) |
heat |
|
pr |
outlet 0 to inlet 0 pressure ratio |
ratio |
|
dp |
inlet 0 to outlet 0 absolute pressure change |
pressure |
|
eta |
heat dissipation ratio relative to thermal input |
efficiency |
|
Qloss |
heat dissipation |
heat |
|
CombustionEngine
Class documentation and example: CombustionEngine
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow balance over all inflows and outflows |
|
reactor_pressure_constraints |
pressure equality constraints |
|
stoichiometry_constraints |
constraints for stoichiometry of the reaction |
|
energy_balance_constraints |
constraint for energy balance |
|
power_constraints |
equation for thermal input to power generation relation |
|
heat1_constraints |
equation for thermal input to heating port 1 heat generation relation |
|
heat2_constraints |
equation for thermal input to heating port 2 heat generation relation |
|
heatloss_constraints |
equation for thermal input to heat dissipation relation |
|
mass_flow_cooling_constraints |
equation for mass flow equality at heating ports |
|
fluid_cooling_constraints |
equation for fluid composition equality at heating ports |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
lamb |
available oxygen to stoichiometric oxygen ratio |
ratio |
|
ti |
thermal input (fuel LHV multiplied with mass flow) |
heat |
|
P [1] |
mechanical power generated by the engine |
power |
|
Q1 |
heating port 1 heat production |
heat |
|
Q2 |
heating port 2 heat production |
heat |
|
Qloss [1] |
heat dissipation |
heat |
|
pr1 |
heating port 1 outlet to inlet pressure ratio |
ratio |
|
pr2 |
heating port 2 outlet to inlet pressure ratio |
ratio |
|
dp1 |
heating port 1 inlet to outlet absolute pressure change |
pressure |
|
dp2 |
heating port 2 inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
heating port 1 non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
heating port 2 non-dimensional friction coefficient for pressure loss calculation |
|
|
eta_mech |
|
|
|
T_v_inner |
|
|
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
tiP_char |
thermal input to power lookup table |
|
Q1_char |
thermal input to heat production of port 1 lookup table |
|
Q2_char |
thermal input to heat production of port 2 lookup table |
|
Qloss_char |
thermal input to heat dissipation lookup table |
|
DisplacementMachine
Class documentation and example: DisplacementMachine
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
PolynomialCompressor
Class documentation and example: PolynomialCompressor
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power consumption |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
Q_diss |
heat dissipation |
heat |
|
eta_vol |
volumetric efficiency |
efficiency |
|
dissipation_ratio |
heat dissipation ratio relative to power consumption |
ratio |
|
Q_diss_rel |
heat dissipation ratio relative to power consumption(deprecated) |
ratio |
|
rpm [1] |
compressor frequency |
|
|
reference_state |
reference state definition for the scaling of displacement with compressor rpm |
|
|
eta_s_poly |
polynomial coefficients for isentropic efficiency |
|
|
eta_vol_poly |
polynomial coefficients for volumetric efficiency |
|
|
eta_s |
isentropic efficiency |
efficiency |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
eta_vol_poly_group |
displacement equation based on polynomial coefficients for volumetric efficiency |
|
|
eta_vol_group |
displacement equation based on fixed volumetric efficiency |
|
|
eta_s_poly_group |
isentropic efficiency equation based on polynomial coefficients |
|
|
eta_s_group |
isentropic efficiency equation with fixed efficiency |
|
|
energy_balance_group |
energy balance equation for fixed power and dissipation ratio |
|
PolynomialCompressorWithCooling
Class documentation and example: PolynomialCompressorWithCooling
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
cooling_energy_balance_constraints |
energy balance for the cooling ports |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power consumption |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
Q_diss |
heat dissipation |
heat |
|
eta_vol |
volumetric efficiency |
efficiency |
|
dissipation_ratio |
heat dissipation ratio relative to power consumption |
ratio |
|
Q_diss_rel |
heat dissipation ratio relative to power consumption(deprecated) |
ratio |
|
rpm [1] |
compressor frequency |
|
|
reference_state |
reference state definition for the scaling of displacement with compressor rpm |
|
|
eta_s_poly |
polynomial coefficients for isentropic efficiency |
|
|
eta_vol_poly |
polynomial coefficients for volumetric efficiency |
|
|
eta_s |
isentropic efficiency |
efficiency |
|
eta_recovery |
share of dissipated heat usable in cooling port |
efficiency |
|
td_minimal |
theoretical minimal temperature difference between working and cooling fluid |
temperature_difference |
|
dp_cooling |
cooling port inlet to outlet absolute pressure change |
pressure |
|
pr_cooling |
cooling port outlet to inlet pressure ratio |
ratio |
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
eta_vol_poly_group |
displacement equation based on polynomial coefficients for volumetric efficiency |
|
|
eta_vol_group |
displacement equation based on fixed volumetric efficiency |
|
|
eta_s_poly_group |
isentropic efficiency equation based on polynomial coefficients |
|
|
eta_s_group |
isentropic efficiency equation with fixed efficiency |
|
|
energy_balance_group |
energy balance equation for fixed power and dissipation ratio |
|
HeatExchanger
Class documentation and example: HeatExchanger
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
ttd_min |
minimum terminal temperature difference |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
|
eff_cold |
heat exchanger effectiveness for cold side |
efficiency |
|
eff_hot |
heat exchanger effectiveness for hot side |
efficiency |
|
eff_max |
maximum heat exchanger effectiveness |
efficiency |
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
Condenser
Class documentation and example: Condenser
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
ttd_min |
minimum terminal temperature difference |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
|
eff_cold |
heat exchanger effectiveness for cold side |
efficiency |
|
eff_hot |
heat exchanger effectiveness for hot side |
efficiency |
|
eff_max |
maximum heat exchanger effectiveness |
efficiency |
|
subcooling |
allow subcooling in the condenser |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
Desuperheater
Class documentation and example: Desuperheater
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
|
saturated_gas_constraints |
equation for saturated gas at hot side outlet |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
ttd_min |
minimum terminal temperature difference |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
|
eff_cold |
heat exchanger effectiveness for cold side |
efficiency |
|
eff_hot |
heat exchanger effectiveness for hot side |
efficiency |
|
eff_max |
maximum heat exchanger effectiveness |
efficiency |
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
SectionedHeatExchanger
Class documentation and example: SectionedHeatExchanger
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
ttd_min |
minimum terminal temperature difference |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
|
eff_cold |
heat exchanger effectiveness for cold side |
efficiency |
|
eff_hot |
heat exchanger effectiveness for hot side |
efficiency |
|
eff_max |
maximum heat exchanger effectiveness |
efficiency |
|
num_sections |
number of sections of the heat exchanger |
|
|
UA |
sum of UA values of all sections of heat exchanger |
heat_transfer_coefficient |
|
refrigerant_index |
side on which the refrigerant is flowing (0: hot, 1:cold) |
|
|
re_exp_r |
Reynolds exponent for UA modification based on refrigerant side mass flow |
|
|
re_exp_sf |
Reynolds exponent for UA modification based on secondary fluid side mass flow |
|
|
alpha_ratio |
secondary to refrigerant side convective heat transfer coefficient ratio |
ratio |
|
area_ratio |
secondary to refrigerant side heat transfer area ratio |
ratio |
|
td_pinch |
equation for minimum pinch |
temperature_difference |
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
|
UA_cecchinato |
equation for UA modification in offdesign |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
MovingBoundaryHeatExchanger
Class documentation and example: MovingBoundaryHeatExchanger
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
ttd_min |
minimum terminal temperature difference |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
|
eff_cold |
heat exchanger effectiveness for cold side |
efficiency |
|
eff_hot |
heat exchanger effectiveness for hot side |
efficiency |
|
eff_max |
maximum heat exchanger effectiveness |
efficiency |
|
UA |
sum of UA values of all sections of heat exchanger |
heat_transfer_coefficient |
|
refrigerant_index |
side on which the refrigerant is flowing (0: hot, 1:cold) |
|
|
re_exp_r |
Reynolds exponent for UA modification based on refrigerant side mass flow |
|
|
re_exp_sf |
Reynolds exponent for UA modification based on secondary fluid side mass flow |
|
|
alpha_ratio |
secondary to refrigerant side convective heat transfer coefficient ratio |
ratio |
|
area_ratio |
secondary to refrigerant side heat transfer area ratio |
ratio |
|
td_pinch |
equation for minimum pinch |
temperature_difference |
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
|
UA_cecchinato |
equation for UA modification in offdesign |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
SimpleHeatExchanger
Class documentation and example: SimpleHeatExchanger
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
power_connector_location |
|
|
|
Q |
heat transfer |
heat |
|
pr |
outlet ot inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
zeta |
non-dimensional friction coefficient for pressure loss calculation |
|
|
D [1] |
diameter of channel |
length |
|
L [1] |
length of channel |
length |
|
ks [1] |
roughness of wall material |
length |
|
ks_HW [1] |
Hazen-Williams roughness |
|
|
kA [1] |
heat transfer coefficient considering ambient temperature |
heat_transfer_coefficient |
|
Tamb |
ambient temperature |
temperature |
|
dissipative |
|
|
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
darcy_group |
Darcy-Weißbach equation for pressure loss |
|
|
hw_group |
Hazen-Williams equation for pressure loss |
|
|
kA_group |
equation for heat transfer based on ambient temperature and heat transfer coefficient |
|
|
kA_char_group |
heat transfer from design heat transfer coefficient, modifier lookup table and ambient temperature |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char |
heat transfer coefficient lookup table for offdesign |
|
ParabolicTrough
Class documentation and example: ParabolicTrough
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
power_connector_location |
|
|
|
Q |
heat transfer |
heat |
|
pr |
outlet ot inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
zeta |
non-dimensional friction coefficient for pressure loss calculation |
|
|
D [1] |
diameter of channel |
length |
|
L [1] |
length of channel |
length |
|
ks [1] |
roughness of wall material |
length |
|
ks_HW [1] |
Hazen-Williams roughness |
|
|
Tamb |
ambient temperature |
temperature |
|
dissipative |
|
|
|
E [1] |
solar irradiation to the parabolic trough |
heat |
|
A [1] |
area of the parabolic trough |
area |
|
eta_opt |
optical efficiency |
efficiency |
|
c_1 |
thermal loss coefficient 1 |
|
|
c_2 |
thermal loss coefficient 2 |
|
|
iam_1 |
incidence angle modifier 1 |
|
|
iam_2 |
incidence angle modifier 2 |
|
|
aoi |
angle of incidence |
angle |
|
doc |
degree of cleanliness |
ratio |
|
Q_loss |
heat dissipation |
heat |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
darcy_group |
Darcy-Weißbach equation for pressure loss |
|
|
hw_group |
Hazen-Williams equation for pressure loss |
|
|
energy_group |
energy balance equation of the parabolic trough |
|
ParallelFlowHeatExchanger
Class documentation and example: ParallelFlowHeatExchanger
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
energy_balance_constraints |
hot side to cold side heat transfer equation |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
Q |
heat transfer from hot side |
heat |
|
kA |
heat transfer coefficient considering terminal temperature differences |
heat_transfer_coefficient |
|
td_log |
logarithmic temperature difference |
temperature_difference |
|
ttd_u |
terminal temperature difference at hot side inlet to cold side outlet |
temperature_difference |
|
ttd_l |
terminal temperature difference at hot side outlet to cold side inlet |
temperature_difference |
|
pr1 |
hot side outlet to inlet pressure ratio |
ratio |
|
pr2 |
cold side outlet to inlet pressure ratio |
ratio |
|
dp1 |
hot side inlet to outlet absolute pressure change |
pressure |
|
dp2 |
cold side inlet to outlet absolute pressure change |
pressure |
|
zeta1 |
hot side non-dimensional friction coefficient for pressure loss calculation |
|
|
zeta2 |
cold side non-dimensional friction coefficient for pressure loss calculation |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
kA_char |
equation for heat transfer based on kA and modification factor |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char1 |
hot side kA modification lookup table for offdesign |
|
kA_char2 |
cold side kA modification lookup table for offdesign |
|
SolarCollector
Class documentation and example: SolarCollector
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
power_connector_location |
|
|
|
Q |
heat transfer |
heat |
|
pr |
outlet ot inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
zeta |
non-dimensional friction coefficient for pressure loss calculation |
|
|
D [1] |
diameter of channel |
length |
|
L [1] |
length of channel |
length |
|
ks [1] |
roughness of wall material |
length |
|
ks_HW [1] |
Hazen-Williams roughness |
|
|
Tamb |
ambient air temperature |
temperature |
|
dissipative |
|
|
|
E [1] |
solar irradiation to the solar collector |
heat |
|
A [1] |
area of the solar collector |
area |
|
eta_opt |
optical efficiency |
efficiency |
|
lkf_lin |
linear heat loss factor |
|
|
lkf_quad |
quadratic heat loss factor |
|
|
Q_loss |
heat dissipation |
heat |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
darcy_group |
Darcy-Weißbach equation for pressure loss |
|
|
hw_group |
Hazen-Williams equation for pressure loss |
|
|
energy_group |
energy balance equation of the solar collector |
|
NodeBase
Class documentation and example: NodeBase
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
DropletSeparator
Class documentation and example: DropletSeparator
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
energy_balance_constraints |
energy balance constraint |
|
pressure_constraints |
pressure equality constraints |
|
outlet_constraint_liquid |
outlet 0 is saturated liquid constraint |
|
outlet_constraint_gas |
outlet 1 is saturated liquid constraint |
|
fluid_constraints |
fluid equality constraints |
Drum
Class documentation and example: Drum
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
energy_balance_constraints |
energy balance constraint |
|
pressure_constraints |
pressure equality constraints |
|
outlet_constraint_liquid |
outlet 0 is saturated liquid constraint |
|
outlet_constraint_gas |
outlet 1 is saturated liquid constraint |
|
fluid_constraints |
fluid equality constraints |
Merge
Class documentation and example: Merge
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
fluid_constraints |
fluid mass fraction balance constraints |
|
energy_balance_constraints |
energy balance constraint |
|
pressure_constraints |
pressure equality constraints |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_in |
number of inlets |
|
|
Splitter
Class documentation and example: Splitter
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
energy_balance_constraints |
equal enthalpy at all outlets constraint |
|
pressure_constraints |
pressure equality constraints |
|
fluid_constraints |
fluid equality constraints |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_out |
number of outlets |
|
|
Node
Class documentation and example: Node
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
pressure_constraints |
pressure equality constraints |
|
outlet_enthalpy_constraints |
equal enthalpy at all outlets constraint(s) |
|
outlet_fluid_constraints |
equal fluid at all outlets constraint(s) |
|
fluid_constraints |
fluid mass fraction constraints |
|
energy_balance_constraints |
energy balance constraint |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_out |
number of outlets |
|
|
num_in |
number of inlets |
|
|
Separator
Class documentation and example: Separator
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass balance constraint |
|
fluid_constraints |
fluid mass fraction balance constraints |
|
energy_balance_constraints |
equal temperature at all outlets constraints |
|
pressure_constraints |
pressure equality constraints |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_out |
number of outlets |
|
|
Pipe
Class documentation and example: Pipe
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
power_connector_location |
|
|
|
Q |
heat transfer |
heat |
|
pr |
outlet ot inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
zeta |
non-dimensional friction coefficient for pressure loss calculation |
|
|
D [1] |
diameter of channel |
length |
|
L [1] |
length of channel |
length |
|
ks [1] |
roughness of wall material |
length |
|
ks_HW [1] |
Hazen-Williams roughness |
|
|
kA [1] |
heat transfer coefficient considering ambient temperature |
heat_transfer_coefficient |
|
Tamb |
ambient temperature |
temperature |
|
dissipative |
|
|
|
insulation_thickness |
thickness of pipe insulation |
length |
|
insulation_tc |
thermal conductivity of insulation |
thermal_conductivity |
|
material |
|
|
|
pipe_thickness |
wall thickness of pipe |
length |
|
environment_media |
|
|
|
wind_velocity |
velocity of wind at insulation surface |
speed |
|
pipe_depth |
depth of buried pipe |
length |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
darcy_group |
Darcy-Weißbach equation for pressure loss |
|
|
hw_group |
Hazen-Williams equation for pressure loss |
|
|
kA_group |
equation for heat transfer based on ambient temperature and heat transfer coefficient |
|
|
kA_char_group |
heat transfer from design heat transfer coefficient, modifier lookup table and ambient temperature |
|
|
Q_ohc_group_surface |
equation for heat loss of surface pipes |
|
|
Q_ohc_group_subsurface |
equation for heat loss of buried pipes |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
kA_char |
heat transfer coefficient lookup table for offdesign |
|
Valve
Class documentation and example: Valve
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
|
enthalpy_constraints |
equation for enthalpy equality |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
pr |
|
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
zeta |
|
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
dp_char |
inlet to outlet absolute pressure change as function of mass flow lookup table |
PowerBus
Class documentation and example: PowerBus
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
energy_balance_constraint |
energy balance over all inflows and outflows |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
num_in |
number of inlets |
|
|
num_out |
number of outlets |
|
|
Generator
Class documentation and example: Generator
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
eta |
efficiency |
efficiency |
|
delta_power |
inlet to outlet power difference |
power |
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_char |
efficiency lookup table for offdesign |
Motor
Class documentation and example: Motor
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
eta |
efficiency |
efficiency |
|
delta_power |
inlet to outlet power difference |
power |
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_char |
efficiency lookup table for offdesign |
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 |
|
cooling_mass_flow_constraints |
cooling fluid mass flow equality equation |
|
cooling_fluid_constraints |
cooling fluid composition equality equation |
|
energy_balance_constraints |
energy balance equation of the reactor |
|
reactor_pressure_constraints |
reactor pressure equality equations |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P [1] |
power output of the fuel cell |
power |
|
Q |
heat output of the cooling port |
heat |
|
pr |
cooling port outlet to inlet pressure ratio |
ratio |
|
dp |
cooling inlet to outlet absolute pressure change |
pressure |
|
zeta |
cooling port non-dimensional friction coefficient for pressure loss calculation |
|
|
eta |
efficiency of the fuel cell |
efficiency |
|
e [1] |
equation for specified specific energy consumption of the fuel cell |
specific_energy |
WaterElectrolyzer
Class documentation and example: WaterElectrolyzer
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
equations for oxygen and hydrogen mass flow relation |
|
cooling_mass_flow_constraints |
cooling fluid mass flow equality equation |
|
cooling_fluid_constraints |
cooling fluid composition equality equation |
|
energy_balance_constraints |
energy balance equation of the reactor |
|
reactor_pressure_constraints |
reactor pressure equality equations |
|
gas_temperature_constraints |
equation for same temperature of product gases |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P [1] |
power consumption of the electrolyzer |
power |
|
Q |
heat output of the cooling port |
heat |
|
pr |
cooling port outlet to inlet pressure ratio |
ratio |
|
dp |
cooling inlet to outlet absolute pressure change |
pressure |
|
zeta |
cooling port non-dimensional friction coefficient for pressure loss calculation |
|
|
eta |
efficiency of the fuel cell |
efficiency |
|
e [1] |
equation for specified specific energy consumption of the electrolyzer |
specific_energy |
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_char |
efficiency lookup table for offdesign |
Turbomachine
Class documentation and example: Turbomachine
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
Compressor
Class documentation and example: Compressor
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
eta_s |
isentropic efficiency |
efficiency |
|
igva [1] |
inlet guide vane angle |
angle |
|
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_pr_group |
map for pressure ratio over speedlines and non-dimensional mass flow |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_s_char |
isentropic efficiency lookup table for offdesign |
|
char_map_eta_s |
2D lookup table for efficiency over non-dimensional mass flow and speed line |
|
char_map_pr |
2D lookup table for pressure ratio over non-dimensional mass flow and speed line |
|
Pump
Class documentation and example: Pump
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
eta_s |
isentropic efficiency |
efficiency |
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_s_char |
isentropic efficiency lookup table for offdesign |
|
flow_char |
pressure rise over volumetric flow lookup table |
Turbine
Class documentation and example: Turbine
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
eta_s |
isentropic efficiency |
efficiency |
|
cone |
cone law equation for offdesign |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_s_char |
isentropic efficiency lookup table for offdesign |
SteamTurbine
Class documentation and example: SteamTurbine
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
eta_s |
isentropic efficiency |
efficiency |
|
cone |
cone law equation for offdesign |
|
|
alpha |
influence factor for wetness efficiency modifier |
ratio |
|
eta_s_dry |
isentropic efficiency of dry expansion |
efficiency |
|
Table of parameter groups
Parameter |
Description |
Required parameters |
Method |
|---|---|---|---|
eta_s_dry_group |
method to apply Baumann rule |
|
Table of characteristic lines and maps
Parameter |
Description |
Method |
|---|---|---|
eta_s_char |
isentropic efficiency lookup table for offdesign |
TurboCompressor
Class documentation and example: TurboCompressor
Table of constraints
Parameter |
Description |
Method |
|---|---|---|
mass_flow_constraints |
mass flow equality constraint(s) |
|
fluid_constraints |
fluid composition equality constraint(s) |
Table of parameters
Parameter |
Description |
Quantity |
Method |
|---|---|---|---|
P |
power input/output of the component |
power |
|
pr |
outlet to inlet pressure ratio |
ratio |
|
dp |
inlet to outlet absolute pressure change |
pressure |
|
eta_s |
isentropic efficiency |
efficiency |
|
igva [1] |
inlet guide vane angle |
angle |
|
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_pr_group |
map for pressure ratio over speedlines and non-dimensional mass flow |
|
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 |
|
char_map_pr |
2D lookup table for pressure ratio over non-dimensional mass flow and speed line |
|
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