diff --git a/docs/advanced_tutorials/develop_components.rst b/docs/advanced_tutorials/develop_components.rst
index 69a2467b6..51cdcbb8a 100644
--- a/docs/advanced_tutorials/develop_components.rst
+++ b/docs/advanced_tutorials/develop_components.rst
@@ -245,7 +245,7 @@ like this:
:start-after: [sec_6]
:end-before: [sec_7]
-Once a again, it is recommended to test the code.
+Once again, it is recommended to test the code.
.. dropdown:: Display source code for testing the model
diff --git a/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT.svg b/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT.svg
new file mode 100644
index 000000000..7dd064945
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT.svg
@@ -0,0 +1,1243 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..00dcc1e2c
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1243 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT.svg b/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT.svg
new file mode 100644
index 000000000..bad1c226d
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT.svg
@@ -0,0 +1,1268 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..0d2aee3e5
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1268 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT.svg b/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT.svg
new file mode 100644
index 000000000..7bda1ad3f
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT.svg
@@ -0,0 +1,1195 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..e362fe4a6
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1195 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT.svg b/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT.svg
new file mode 100644
index 000000000..9edf55795
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT.svg
@@ -0,0 +1,1175 @@
+
+
+
diff --git a/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..52e7210ed
--- /dev/null
+++ b/docs/api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1175 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT.svg b/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT.svg
new file mode 100644
index 000000000..e5ef339bb
--- /dev/null
+++ b/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT.svg
@@ -0,0 +1,1179 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..4aa6d924d
--- /dev/null
+++ b/docs/api/_images/characteristics/Compressor_eta_s_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1179 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT.svg b/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT.svg
new file mode 100644
index 000000000..8e76d6817
--- /dev/null
+++ b/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT.svg
@@ -0,0 +1,1220 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..eade1514e
--- /dev/null
+++ b/docs/api/_images/characteristics/Condenser_kA_char1_DEFAULT_darkmode.svg
@@ -0,0 +1,1220 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT.svg b/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT.svg
new file mode 100644
index 000000000..2f0a4ffc5
--- /dev/null
+++ b/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..215e9a0d3
--- /dev/null
+++ b/docs/api/_images/characteristics/Condenser_kA_char2_DEFAULT_darkmode.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT.svg b/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT.svg
new file mode 100644
index 000000000..36c9776cb
--- /dev/null
+++ b/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT.svg
@@ -0,0 +1,1266 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..3820a74e5
--- /dev/null
+++ b/docs/api/_images/characteristics/Desuperheater_kA_char1_DEFAULT_darkmode.svg
@@ -0,0 +1,1266 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT.svg b/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT.svg
new file mode 100644
index 000000000..9f51fe376
--- /dev/null
+++ b/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..81106b30f
--- /dev/null
+++ b/docs/api/_images/characteristics/Desuperheater_kA_char2_DEFAULT_darkmode.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID.svg
new file mode 100644
index 000000000..83e7cae09
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID.svg
@@ -0,0 +1,1315 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID_darkmode.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID_darkmode.svg
new file mode 100644
index 000000000..2c716b5df
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID_darkmode.svg
@@ -0,0 +1,1315 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT.svg
new file mode 100644
index 000000000..0eee2da1c
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT.svg
@@ -0,0 +1,1266 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..9a7206088
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT_darkmode.svg
@@ -0,0 +1,1266 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT.svg
new file mode 100644
index 000000000..467ffaebb
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..1c2444870
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT_darkmode.svg
@@ -0,0 +1,1256 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID.svg
new file mode 100644
index 000000000..6ec25ca19
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID.svg
@@ -0,0 +1,1348 @@
+
+
+
diff --git a/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID_darkmode.svg b/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID_darkmode.svg
new file mode 100644
index 000000000..692a3123c
--- /dev/null
+++ b/docs/api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID_darkmode.svg
@@ -0,0 +1,1348 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT.svg b/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT.svg
new file mode 100644
index 000000000..29497a595
--- /dev/null
+++ b/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT.svg
@@ -0,0 +1,1265 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..2dc4d002e
--- /dev/null
+++ b/docs/api/_images/characteristics/Pipe_kA_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1265 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT.svg b/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT.svg
new file mode 100644
index 000000000..6366b4ce7
--- /dev/null
+++ b/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT.svg
@@ -0,0 +1,1246 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..455141bfc
--- /dev/null
+++ b/docs/api/_images/characteristics/Pump_eta_s_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1246 @@
+
+
+
diff --git a/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT.svg b/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT.svg
new file mode 100644
index 000000000..850db8f1d
--- /dev/null
+++ b/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT.svg
@@ -0,0 +1,1265 @@
+
+
+
diff --git a/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..5a194b889
--- /dev/null
+++ b/docs/api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1265 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT.svg b/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT.svg
new file mode 100644
index 000000000..97d8e9813
--- /dev/null
+++ b/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT.svg
@@ -0,0 +1,1216 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..5588a06fa
--- /dev/null
+++ b/docs/api/_images/characteristics/Turbine_eta_s_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1216 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL.svg b/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL.svg
new file mode 100644
index 000000000..08724ce85
--- /dev/null
+++ b/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL.svg
@@ -0,0 +1,1224 @@
+
+
+
diff --git a/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL_darkmode.svg b/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL_darkmode.svg
new file mode 100644
index 000000000..33e4954c3
--- /dev/null
+++ b/docs/api/_images/characteristics/Turbine_eta_s_char_TRAUPEL_darkmode.svg
@@ -0,0 +1,1224 @@
+
+
+
diff --git a/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT.svg b/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT.svg
new file mode 100644
index 000000000..55d68656c
--- /dev/null
+++ b/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT.svg
@@ -0,0 +1,1369 @@
+
+
+
diff --git a/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..3a78359d9
--- /dev/null
+++ b/docs/api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT_darkmode.svg
@@ -0,0 +1,1369 @@
+
+
+
diff --git a/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT.svg b/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT.svg
new file mode 100644
index 000000000..9d8e7d879
--- /dev/null
+++ b/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT.svg
@@ -0,0 +1,1318 @@
+
+
+
diff --git a/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..c9dbce80e
--- /dev/null
+++ b/docs/api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT_darkmode.svg
@@ -0,0 +1,1318 @@
+
+
+
diff --git a/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT.svg b/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT.svg
new file mode 100644
index 000000000..4e493c8fd
--- /dev/null
+++ b/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT.svg
@@ -0,0 +1,1120 @@
+
+
+
diff --git a/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT_darkmode.svg b/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT_darkmode.svg
new file mode 100644
index 000000000..ed6e61e3f
--- /dev/null
+++ b/docs/api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT_darkmode.svg
@@ -0,0 +1,1120 @@
+
+
+
diff --git a/docs/api/_images/combustion_engine_Q1_char_DEFAULT.svg b/docs/api/_images/combustion_engine_Q1_char_DEFAULT.svg
deleted file mode 100644
index be6cddf44..000000000
--- a/docs/api/_images/combustion_engine_Q1_char_DEFAULT.svg
+++ /dev/null
@@ -1,1217 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/combustion_engine_Q2_char_DEFAULT.svg b/docs/api/_images/combustion_engine_Q2_char_DEFAULT.svg
deleted file mode 100644
index edcde8b56..000000000
--- a/docs/api/_images/combustion_engine_Q2_char_DEFAULT.svg
+++ /dev/null
@@ -1,1240 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/combustion_engine_Qloss_char_DEFAULT.svg b/docs/api/_images/combustion_engine_Qloss_char_DEFAULT.svg
deleted file mode 100644
index 8881833ca..000000000
--- a/docs/api/_images/combustion_engine_Qloss_char_DEFAULT.svg
+++ /dev/null
@@ -1,1169 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/combustion_engine_tiP_char_DEFAULT.svg b/docs/api/_images/combustion_engine_tiP_char_DEFAULT.svg
deleted file mode 100644
index 36c7cbc9c..000000000
--- a/docs/api/_images/combustion_engine_tiP_char_DEFAULT.svg
+++ /dev/null
@@ -1,1147 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/CombustionChamber.svg b/docs/api/_images/components/CombustionChamber.svg
similarity index 100%
rename from docs/api/_images/CombustionChamber.svg
rename to docs/api/_images/components/CombustionChamber.svg
diff --git a/docs/api/_images/CombustionChamber_darkmode.svg b/docs/api/_images/components/CombustionChamber_darkmode.svg
similarity index 100%
rename from docs/api/_images/CombustionChamber_darkmode.svg
rename to docs/api/_images/components/CombustionChamber_darkmode.svg
diff --git a/docs/api/_images/CombustionEngine.svg b/docs/api/_images/components/CombustionEngine.svg
similarity index 100%
rename from docs/api/_images/CombustionEngine.svg
rename to docs/api/_images/components/CombustionEngine.svg
diff --git a/docs/api/_images/CombustionEngine_darkmode.svg b/docs/api/_images/components/CombustionEngine_darkmode.svg
similarity index 100%
rename from docs/api/_images/CombustionEngine_darkmode.svg
rename to docs/api/_images/components/CombustionEngine_darkmode.svg
diff --git a/docs/api/_images/Compressor.svg b/docs/api/_images/components/Compressor.svg
similarity index 100%
rename from docs/api/_images/Compressor.svg
rename to docs/api/_images/components/Compressor.svg
diff --git a/docs/api/_images/Compressor_darkmode.svg b/docs/api/_images/components/Compressor_darkmode.svg
similarity index 100%
rename from docs/api/_images/Compressor_darkmode.svg
rename to docs/api/_images/components/Compressor_darkmode.svg
diff --git a/docs/api/_images/Condenser.svg b/docs/api/_images/components/Condenser.svg
similarity index 100%
rename from docs/api/_images/Condenser.svg
rename to docs/api/_images/components/Condenser.svg
diff --git a/docs/api/_images/Condenser_darkmode.svg b/docs/api/_images/components/Condenser_darkmode.svg
similarity index 100%
rename from docs/api/_images/Condenser_darkmode.svg
rename to docs/api/_images/components/Condenser_darkmode.svg
diff --git a/docs/api/_images/DropletSeparator.svg b/docs/api/_images/components/DropletSeparator.svg
similarity index 100%
rename from docs/api/_images/DropletSeparator.svg
rename to docs/api/_images/components/DropletSeparator.svg
diff --git a/docs/api/_images/DropletSeparator_darkmode.svg b/docs/api/_images/components/DropletSeparator_darkmode.svg
similarity index 100%
rename from docs/api/_images/DropletSeparator_darkmode.svg
rename to docs/api/_images/components/DropletSeparator_darkmode.svg
diff --git a/docs/api/_images/Drum.svg b/docs/api/_images/components/Drum.svg
similarity index 100%
rename from docs/api/_images/Drum.svg
rename to docs/api/_images/components/Drum.svg
diff --git a/docs/api/_images/Drum_darkmode.svg b/docs/api/_images/components/Drum_darkmode.svg
similarity index 100%
rename from docs/api/_images/Drum_darkmode.svg
rename to docs/api/_images/components/Drum_darkmode.svg
diff --git a/docs/api/_images/FuelCell.svg b/docs/api/_images/components/FuelCell.svg
similarity index 100%
rename from docs/api/_images/FuelCell.svg
rename to docs/api/_images/components/FuelCell.svg
diff --git a/docs/api/_images/FuelCell_darkmode.svg b/docs/api/_images/components/FuelCell_darkmode.svg
similarity index 100%
rename from docs/api/_images/FuelCell_darkmode.svg
rename to docs/api/_images/components/FuelCell_darkmode.svg
diff --git a/docs/api/_images/Generator.svg b/docs/api/_images/components/Generator.svg
similarity index 100%
rename from docs/api/_images/Generator.svg
rename to docs/api/_images/components/Generator.svg
diff --git a/docs/api/_images/Generator_darkmode.svg b/docs/api/_images/components/Generator_darkmode.svg
similarity index 100%
rename from docs/api/_images/Generator_darkmode.svg
rename to docs/api/_images/components/Generator_darkmode.svg
diff --git a/docs/api/_images/HeatExchanger.svg b/docs/api/_images/components/HeatExchanger.svg
similarity index 100%
rename from docs/api/_images/HeatExchanger.svg
rename to docs/api/_images/components/HeatExchanger.svg
diff --git a/docs/api/_images/HeatExchanger_darkmode.svg b/docs/api/_images/components/HeatExchanger_darkmode.svg
similarity index 100%
rename from docs/api/_images/HeatExchanger_darkmode.svg
rename to docs/api/_images/components/HeatExchanger_darkmode.svg
diff --git a/docs/api/_images/Merge.svg b/docs/api/_images/components/Merge.svg
similarity index 100%
rename from docs/api/_images/Merge.svg
rename to docs/api/_images/components/Merge.svg
diff --git a/docs/api/_images/Merge_darkmode.svg b/docs/api/_images/components/Merge_darkmode.svg
similarity index 100%
rename from docs/api/_images/Merge_darkmode.svg
rename to docs/api/_images/components/Merge_darkmode.svg
diff --git a/docs/api/_images/Motor.svg b/docs/api/_images/components/Motor.svg
similarity index 100%
rename from docs/api/_images/Motor.svg
rename to docs/api/_images/components/Motor.svg
diff --git a/docs/api/_images/Motor_darkmode.svg b/docs/api/_images/components/Motor_darkmode.svg
similarity index 100%
rename from docs/api/_images/Motor_darkmode.svg
rename to docs/api/_images/components/Motor_darkmode.svg
diff --git a/docs/api/_images/Node.svg b/docs/api/_images/components/Node.svg
similarity index 100%
rename from docs/api/_images/Node.svg
rename to docs/api/_images/components/Node.svg
diff --git a/docs/api/_images/Node_darkmode.svg b/docs/api/_images/components/Node_darkmode.svg
similarity index 100%
rename from docs/api/_images/Node_darkmode.svg
rename to docs/api/_images/components/Node_darkmode.svg
diff --git a/docs/api/_images/ParabolicTrough.svg b/docs/api/_images/components/ParabolicTrough.svg
similarity index 100%
rename from docs/api/_images/ParabolicTrough.svg
rename to docs/api/_images/components/ParabolicTrough.svg
diff --git a/docs/api/_images/ParabolicTrough_darkmode.svg b/docs/api/_images/components/ParabolicTrough_darkmode.svg
similarity index 100%
rename from docs/api/_images/ParabolicTrough_darkmode.svg
rename to docs/api/_images/components/ParabolicTrough_darkmode.svg
diff --git a/docs/api/_images/Pipe.svg b/docs/api/_images/components/Pipe.svg
similarity index 100%
rename from docs/api/_images/Pipe.svg
rename to docs/api/_images/components/Pipe.svg
diff --git a/docs/api/_images/Pipe_darkmode.svg b/docs/api/_images/components/Pipe_darkmode.svg
similarity index 100%
rename from docs/api/_images/Pipe_darkmode.svg
rename to docs/api/_images/components/Pipe_darkmode.svg
diff --git a/docs/api/_images/components/PolynomialCompressor.svg b/docs/api/_images/components/PolynomialCompressor.svg
new file mode 100644
index 000000000..328c86ad2
--- /dev/null
+++ b/docs/api/_images/components/PolynomialCompressor.svg
@@ -0,0 +1,189 @@
+
+
diff --git a/docs/api/_images/PolynomialCompressorWithCooling.svg b/docs/api/_images/components/PolynomialCompressorWithCooling.svg
similarity index 100%
rename from docs/api/_images/PolynomialCompressorWithCooling.svg
rename to docs/api/_images/components/PolynomialCompressorWithCooling.svg
diff --git a/docs/api/_images/PolynomialCompressorWithCooling_darkmode.svg b/docs/api/_images/components/PolynomialCompressorWithCooling_darkmode.svg
similarity index 100%
rename from docs/api/_images/PolynomialCompressorWithCooling_darkmode.svg
rename to docs/api/_images/components/PolynomialCompressorWithCooling_darkmode.svg
diff --git a/docs/api/_images/components/PolynomialCompressor_darkmode.svg b/docs/api/_images/components/PolynomialCompressor_darkmode.svg
new file mode 100644
index 000000000..6a52860bc
--- /dev/null
+++ b/docs/api/_images/components/PolynomialCompressor_darkmode.svg
@@ -0,0 +1,189 @@
+
+
diff --git a/docs/api/_images/PowerBus.svg b/docs/api/_images/components/PowerBus.svg
similarity index 100%
rename from docs/api/_images/PowerBus.svg
rename to docs/api/_images/components/PowerBus.svg
diff --git a/docs/api/_images/PowerBus_darkmode.svg b/docs/api/_images/components/PowerBus_darkmode.svg
similarity index 100%
rename from docs/api/_images/PowerBus_darkmode.svg
rename to docs/api/_images/components/PowerBus_darkmode.svg
diff --git a/docs/api/_images/Pump.svg b/docs/api/_images/components/Pump.svg
similarity index 100%
rename from docs/api/_images/Pump.svg
rename to docs/api/_images/components/Pump.svg
diff --git a/docs/api/_images/Pump_darkmode.svg b/docs/api/_images/components/Pump_darkmode.svg
similarity index 100%
rename from docs/api/_images/Pump_darkmode.svg
rename to docs/api/_images/components/Pump_darkmode.svg
diff --git a/docs/api/_images/SolarCollector.svg b/docs/api/_images/components/SolarCollector.svg
similarity index 100%
rename from docs/api/_images/SolarCollector.svg
rename to docs/api/_images/components/SolarCollector.svg
diff --git a/docs/api/_images/SolarCollector_darkmode.svg b/docs/api/_images/components/SolarCollector_darkmode.svg
similarity index 100%
rename from docs/api/_images/SolarCollector_darkmode.svg
rename to docs/api/_images/components/SolarCollector_darkmode.svg
diff --git a/docs/api/_images/Splitter.svg b/docs/api/_images/components/Splitter.svg
similarity index 100%
rename from docs/api/_images/Splitter.svg
rename to docs/api/_images/components/Splitter.svg
diff --git a/docs/api/_images/Splitter_darkmode.svg b/docs/api/_images/components/Splitter_darkmode.svg
similarity index 100%
rename from docs/api/_images/Splitter_darkmode.svg
rename to docs/api/_images/components/Splitter_darkmode.svg
diff --git a/docs/api/_images/SubsystemInterface.svg b/docs/api/_images/components/SubsystemInterface.svg
similarity index 100%
rename from docs/api/_images/SubsystemInterface.svg
rename to docs/api/_images/components/SubsystemInterface.svg
diff --git a/docs/api/_images/SubsystemInterface_darkmode.svg b/docs/api/_images/components/SubsystemInterface_darkmode.svg
similarity index 100%
rename from docs/api/_images/SubsystemInterface_darkmode.svg
rename to docs/api/_images/components/SubsystemInterface_darkmode.svg
diff --git a/docs/api/_images/Turbine.svg b/docs/api/_images/components/Turbine.svg
similarity index 100%
rename from docs/api/_images/Turbine.svg
rename to docs/api/_images/components/Turbine.svg
diff --git a/docs/api/_images/Turbine_darkmode.svg b/docs/api/_images/components/Turbine_darkmode.svg
similarity index 100%
rename from docs/api/_images/Turbine_darkmode.svg
rename to docs/api/_images/components/Turbine_darkmode.svg
diff --git a/docs/api/_images/Valve.svg b/docs/api/_images/components/Valve.svg
similarity index 100%
rename from docs/api/_images/Valve.svg
rename to docs/api/_images/components/Valve.svg
diff --git a/docs/api/_images/Valve_darkmode.svg b/docs/api/_images/components/Valve_darkmode.svg
similarity index 100%
rename from docs/api/_images/Valve_darkmode.svg
rename to docs/api/_images/components/Valve_darkmode.svg
diff --git a/docs/api/_images/WaterElectrolyzer.svg b/docs/api/_images/components/WaterElectrolyzer.svg
similarity index 100%
rename from docs/api/_images/WaterElectrolyzer.svg
rename to docs/api/_images/components/WaterElectrolyzer.svg
diff --git a/docs/api/_images/WaterElectrolyzer_darkmode.svg b/docs/api/_images/components/WaterElectrolyzer_darkmode.svg
similarity index 100%
rename from docs/api/_images/WaterElectrolyzer_darkmode.svg
rename to docs/api/_images/components/WaterElectrolyzer_darkmode.svg
diff --git a/docs/api/_images/compressor_char_map_eta_s_DEFAULT.svg b/docs/api/_images/compressor_char_map_eta_s_DEFAULT.svg
deleted file mode 100644
index db74cedd4..000000000
--- a/docs/api/_images/compressor_char_map_eta_s_DEFAULT.svg
+++ /dev/null
@@ -1,1339 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/compressor_char_map_pr_DEFAULT.svg b/docs/api/_images/compressor_char_map_pr_DEFAULT.svg
deleted file mode 100644
index 1c4eb2737..000000000
--- a/docs/api/_images/compressor_char_map_pr_DEFAULT.svg
+++ /dev/null
@@ -1,1288 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/compressor_eta_s_char_DEFAULT.svg b/docs/api/_images/compressor_eta_s_char_DEFAULT.svg
deleted file mode 100644
index 92410167f..000000000
--- a/docs/api/_images/compressor_eta_s_char_DEFAULT.svg
+++ /dev/null
@@ -1,1153 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/condenser_kA_char1_DEFAULT.svg b/docs/api/_images/condenser_kA_char1_DEFAULT.svg
deleted file mode 100644
index 093d82a7e..000000000
--- a/docs/api/_images/condenser_kA_char1_DEFAULT.svg
+++ /dev/null
@@ -1,1192 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/condenser_kA_char2_DEFAULT.svg b/docs/api/_images/condenser_kA_char2_DEFAULT.svg
deleted file mode 100644
index 45cbc0715..000000000
--- a/docs/api/_images/condenser_kA_char2_DEFAULT.svg
+++ /dev/null
@@ -1,1228 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/desuperheater_kA_char1_DEFAULT.svg b/docs/api/_images/desuperheater_kA_char1_DEFAULT.svg
deleted file mode 100644
index 807e45ff0..000000000
--- a/docs/api/_images/desuperheater_kA_char1_DEFAULT.svg
+++ /dev/null
@@ -1,1238 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/desuperheater_kA_char2_DEFAULT.svg b/docs/api/_images/desuperheater_kA_char2_DEFAULT.svg
deleted file mode 100644
index d2044cfcc..000000000
--- a/docs/api/_images/desuperheater_kA_char2_DEFAULT.svg
+++ /dev/null
@@ -1,1228 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/heat_exchanger_kA_char1_CONDENSING_FLUID.svg b/docs/api/_images/heat_exchanger_kA_char1_CONDENSING_FLUID.svg
deleted file mode 100644
index e5060033f..000000000
--- a/docs/api/_images/heat_exchanger_kA_char1_CONDENSING_FLUID.svg
+++ /dev/null
@@ -1,1286 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/heat_exchanger_kA_char1_DEFAULT.svg b/docs/api/_images/heat_exchanger_kA_char1_DEFAULT.svg
deleted file mode 100644
index 4263bbabc..000000000
--- a/docs/api/_images/heat_exchanger_kA_char1_DEFAULT.svg
+++ /dev/null
@@ -1,1238 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/heat_exchanger_kA_char2_DEFAULT.svg b/docs/api/_images/heat_exchanger_kA_char2_DEFAULT.svg
deleted file mode 100644
index e8f6dac81..000000000
--- a/docs/api/_images/heat_exchanger_kA_char2_DEFAULT.svg
+++ /dev/null
@@ -1,1228 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/heat_exchanger_kA_char2_EVAPORATING_FLUID.svg b/docs/api/_images/heat_exchanger_kA_char2_EVAPORATING_FLUID.svg
deleted file mode 100644
index 71c5d30a1..000000000
--- a/docs/api/_images/heat_exchanger_kA_char2_EVAPORATING_FLUID.svg
+++ /dev/null
@@ -1,1314 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/heat_exchanger_simple_kA_char_DEFAULT.svg b/docs/api/_images/heat_exchanger_simple_kA_char_DEFAULT.svg
deleted file mode 100644
index 37dc99757..000000000
--- a/docs/api/_images/heat_exchanger_simple_kA_char_DEFAULT.svg
+++ /dev/null
@@ -1,1237 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/pipe_kA_char_DEFAULT.svg b/docs/api/_images/pipe_kA_char_DEFAULT.svg
deleted file mode 100644
index dbe561891..000000000
--- a/docs/api/_images/pipe_kA_char_DEFAULT.svg
+++ /dev/null
@@ -1,1237 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/pump_eta_s_char_DEFAULT.svg b/docs/api/_images/pump_eta_s_char_DEFAULT.svg
deleted file mode 100644
index f8296ca6c..000000000
--- a/docs/api/_images/pump_eta_s_char_DEFAULT.svg
+++ /dev/null
@@ -1,1218 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/turbine_eta_s_char_DEFAULT.svg b/docs/api/_images/turbine_eta_s_char_DEFAULT.svg
deleted file mode 100644
index a91c1e02c..000000000
--- a/docs/api/_images/turbine_eta_s_char_DEFAULT.svg
+++ /dev/null
@@ -1,1188 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/turbine_eta_s_char_TRAUPEL.svg b/docs/api/_images/turbine_eta_s_char_TRAUPEL.svg
deleted file mode 100644
index cbe77ec21..000000000
--- a/docs/api/_images/turbine_eta_s_char_TRAUPEL.svg
+++ /dev/null
@@ -1,1196 +0,0 @@
-
-
-
-
diff --git a/docs/api/_images/water_electrolyzer_eta_char_DEFAULT.svg b/docs/api/_images/water_electrolyzer_eta_char_DEFAULT.svg
deleted file mode 100644
index 75e85daeb..000000000
--- a/docs/api/_images/water_electrolyzer_eta_char_DEFAULT.svg
+++ /dev/null
@@ -1,1094 +0,0 @@
-
-
-
-
diff --git a/docs/api/data.rst b/docs/api/data.rst
index 5271748f1..79d500352 100644
--- a/docs/api/data.rst
+++ b/docs/api/data.rst
@@ -1,160 +1,337 @@
-.. _data_label:
-
-tespy.data module
-=================
-
-Default characteristics
------------------------
-
-Characteristic lines
-^^^^^^^^^^^^^^^^^^^^
-**turbine**
-
-.. figure:: _images/turbine_eta_s_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/turbine_eta_s_char_TRAUPEL.svg
- :alt: Characteristic line "TRAUPEL" for parameter "eta_s_char".
- :align: center
-
- Reference: :cite:`Traupel2001`.
-
-**compressor**
-
-.. figure:: _images/compressor_eta_s_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
- :align: center
-
- Reference: Generic data.
-
-**pump**
-
-.. figure:: _images/pump_eta_s_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
- :align: center
-
- Reference: Generic data.
-
-**combustion engine**
-
-.. figure:: _images/combustion_engine_tiP_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "tiP_char".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/combustion_engine_Q1_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "Q1_char".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/combustion_engine_Q2_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "Q2_char".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/combustion_engine_Qloss_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "Qloss_char".
- :align: center
-
- Reference: Generic data.
-
-**heat exchanger**
-
-.. figure:: _images/heat_exchanger_kA_char1_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/heat_exchanger_kA_char1_CONDENSING_FLUID.svg
- :alt: Characteristic line "CONDENSING FLUID" for parameter "kA_char1".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/heat_exchanger_kA_char2_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/heat_exchanger_kA_char2_EVAPORATING_FLUID.svg
- :alt: Characteristic line "EVAPORATING FLUID" for parameter "kA_char2".
- :align: center
-
- Reference: Generic data.
-
-**condenser**
-
-.. figure:: _images/condenser_kA_char1_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/condenser_kA_char2_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
- :align: center
-
- Reference: Generic data.
-
-**desuperheater**
-
-.. figure:: _images/desuperheater_kA_char1_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
- :align: center
-
- Reference: Generic data.
-
-.. figure:: _images/desuperheater_kA_char2_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
- :align: center
-
- Reference: Generic data.
-
-**heat exchanger simple**
-
-.. figure:: _images/heat_exchanger_simple_kA_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char".
- :align: center
-
- Reference: Generic data.
-
-**pipe**
-
-.. figure:: _images/pipe_kA_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "kA_char".
- :align: center
-
- Reference: Generic data.
-
-**water electrolyzer**
-
-.. figure:: _images/water_electrolyzer_eta_char_DEFAULT.svg
- :alt: Characteristic line "DEFAULT" for parameter "eta_char".
- :align: center
-
- Reference: Generic data.
-
-Characteristic maps
-^^^^^^^^^^^^^^^^^^^
-
-**compressor**
-
-.. figure:: _images/compressor_char_map_pr_DEFAULT.svg
- :alt: Characteristic map "DEFAULT" for parameter "char_map_pr".
- :align: center
-
- Reference: :cite:`Plis2016`.
-
-.. figure:: _images/compressor_char_map_eta_s_DEFAULT.svg
- :alt: Characteristic map "DEFAULT" for parameter "char_map_eta_s".
- :align: center
-
- Reference: :cite:`Plis2016`.
+.. _data_label:
+
+tespy.data module
+=================
+
+Module contents
+---------------
+
+.. automodule:: tespy.data
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+Default characteristics
+-----------------------
+
+Characteristic lines
+^^^^^^^^^^^^^^^^^^^^
+**Turbine**
+
+.. figure:: /api/_images/characteristics/Turbine_eta_s_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Turbine_eta_s_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Turbine_eta_s_char_TRAUPEL.svg
+ :alt: Characteristic line "TRAUPEL" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: :cite:`Traupel2001`.
+
+.. figure:: /api/_images/characteristics/Turbine_eta_s_char_TRAUPEL_darkmode.svg
+ :alt: Characteristic line "TRAUPEL" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: :cite:`Traupel2001`.
+
+**Compressor**
+
+.. figure:: /api/_images/characteristics/Compressor_eta_s_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Compressor_eta_s_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**Pump**
+
+.. figure:: /api/_images/characteristics/Pump_eta_s_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Pump_eta_s_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_s_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**CombustionEngine**
+
+.. figure:: /api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "tiP_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_tiP_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "tiP_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Q1_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Q1_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Q1_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Q2_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Q2_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Q2_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Qloss_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/CombustionEngine_Qloss_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "Qloss_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**HeatExchanger**
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char1_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID.svg
+ :alt: Characteristic line "CONDENSING FLUID" for parameter "kA_char1".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char1_CONDENSING_FLUID_darkmode.svg
+ :alt: Characteristic line "CONDENSING FLUID" for parameter "kA_char1".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char2_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID.svg
+ :alt: Characteristic line "EVAPORATING FLUID" for parameter "kA_char2".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/HeatExchanger_kA_char2_EVAPORATING_FLUID_darkmode.svg
+ :alt: Characteristic line "EVAPORATING FLUID" for parameter "kA_char2".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**Condenser**
+
+.. figure:: /api/_images/characteristics/Condenser_kA_char1_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Condenser_kA_char1_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Condenser_kA_char2_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Condenser_kA_char2_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**Desuperheater**
+
+.. figure:: /api/_images/characteristics/Desuperheater_kA_char1_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Desuperheater_kA_char1_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char1".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Desuperheater_kA_char2_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Desuperheater_kA_char2_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char2".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**SimpleHeatExchanger**
+
+.. figure:: /api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/SimpleHeatExchanger_kA_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**Pipe**
+
+.. figure:: /api/_images/characteristics/Pipe_kA_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/Pipe_kA_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "kA_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+**WaterElectrolyzer**
+
+.. figure:: /api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_char".
+ :align: center
+ :figclass: only-light
+
+ Reference: Generic data.
+
+.. figure:: /api/_images/characteristics/WaterElectrolyzer_eta_char_DEFAULT_darkmode.svg
+ :alt: Characteristic line "DEFAULT" for parameter "eta_char".
+ :align: center
+ :figclass: only-dark
+
+ Reference: Generic data.
+
+Characteristic maps
+^^^^^^^^^^^^^^^^^^^
+
+**TurboCompressor**
+
+.. figure:: /api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT.svg
+ :alt: Characteristic map "DEFAULT" for parameter "char_map_pr".
+ :align: center
+ :figclass: only-light
+
+ Reference: :cite:`Plis2016`.
+
+.. figure:: /api/_images/characteristics/TurboCompressor_char_map_pr_DEFAULT_darkmode.svg
+ :alt: Characteristic map "DEFAULT" for parameter "char_map_pr".
+ :align: center
+ :figclass: only-dark
+
+ Reference: :cite:`Plis2016`.
+
+.. figure:: /api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT.svg
+ :alt: Characteristic map "DEFAULT" for parameter "char_map_eta_s".
+ :align: center
+ :figclass: only-light
+
+ Reference: :cite:`Plis2016`.
+
+.. figure:: /api/_images/characteristics/TurboCompressor_char_map_eta_s_DEFAULT_darkmode.svg
+ :alt: Characteristic map "DEFAULT" for parameter "char_map_eta_s".
+ :align: center
+ :figclass: only-dark
+
+ Reference: :cite:`Plis2016`.
+
diff --git a/docs/building_blocks/networks.rst b/docs/building_blocks/networks.rst
index cdf2c77dc..10c50982b 100644
--- a/docs/building_blocks/networks.rst
+++ b/docs/building_blocks/networks.rst
@@ -643,7 +643,7 @@ added a convergence check.
applied:
* Cut off fluid mass fractions smaller than 0 and larger than 1. This way a
- mass fraction of a single fluid component never exceeds oxygenthese boundaries.
+ mass fraction of a single fluid component never exceeds these boundaries.
* Check, whether the fluid properties of pure fluids are within the available
ranges of CoolProp and readjust the values if not.
@@ -748,14 +748,14 @@ connections to the network.
**Presolving**
-In the first part of the presovling phase, the variable space reduction is
+In the first part of the presolving phase, the variable space reduction is
performed. TESPy will prompt errors, in case the parameter specifications in
context of the topology lead to an infeasibility in any of the variables. This
can be, for example
- a circular linear dependency between a set of variables. Typically, the mass
flow can be over-determined by not including a :code:`CycleCloser` component
- in a circular network. For example, ff you are modeling a cycle, e.g. the
+ in a circular network. For example, if you are modeling a cycle, e.g. the
Clausius Rankine cycle, you need to make a cut in the cycle using the
:code:`CycleCloser` or a :code:`Sink` and a :code:`Source` not to
over-determine the system. Have a look in the
diff --git a/docs/conf.py b/docs/conf.py
index e3a27ae27..fc609febb 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -19,20 +19,13 @@
from tespy.tools.data_containers import GroupedComponentCharacteristics as dc_gcc
from tespy.tools.data_containers import GroupedComponentProperties as dc_gcp
from tespy.tools.data_containers import SimpleDataContainer as dc_simple
+from tespy.tools.schema import _instantiate_component
DOCS_ROOT_PATH = os.path.join(os.path.dirname(__file__))
API_PATH = os.path.join(DOCS_ROOT_PATH, "api")
TESPY_PATH = os.path.join(DOCS_ROOT_PATH, "..", "src", "tespy")
-def _create_component_instances() -> dict:
- instances = {}
- for cls_name, cls_ref in component_registry.items.items():
- instances[cls_name] = cls_ref(cls_name)
-
- return instances
-
-
def _create_connection_instances() -> dict:
instances = {}
for cls_name, cls_ref in connection_registry.items.items():
@@ -64,24 +57,58 @@ def _get_eq_reference(datacontainer):
return ":py:meth:`" + basename.split(".")[-1] + " <" + eq_reference + ">`"
+def _collect_constraints(instance):
+ """Return (unconditional, conditional) constraint dicts.
+
+ Conditional constraints are those that only appear when an energy connector
+ (power or heat) is attached.
+ """
+ instance.power_outl = []
+ instance.power_inl = []
+ instance.heat_outl = []
+ instance.heat_inl = []
+ base = instance.get_mandatory_constraints()
+
+ # A single sentinel object is enough — get_mandatory_constraints() only
+ # checks len(self.power_outl/inl) > 0, it never accesses list elements.
+ _sentinel = [object()]
+ instance.power_outl = _sentinel
+ instance.power_inl = _sentinel
+ instance.heat_outl = _sentinel
+ instance.heat_inl = _sentinel
+ with_power = instance.get_mandatory_constraints()
+
+ # Restore to empty so the instance is left in a neutral state.
+ instance.power_outl = []
+ instance.power_inl = []
+ instance.heat_outl = []
+ instance.heat_inl = []
+
+ unconditional = {}
+ conditional = {}
+ for key, value in with_power.items():
+ eq_reference = _get_eq_reference(value)
+ entry = {"eq_reference": eq_reference, "description": value.description}
+ if key in base:
+ unconditional[key] = entry
+ else:
+ conditional[key] = entry
+
+ return unconditional, conditional
+
+
def collect_component_parameters(instance):
grouped_parameters = {}
parameters_with_equation = {}
characteristic_lines_and_maps = {}
- constraints = {}
- for key, value in instance.get_mandatory_constraints().items():
- eq_reference = _get_eq_reference(value)
- constraints[key] = {
- "eq_reference": eq_reference,
- "description": value.description
- }
+ unconditional_constraints, conditional_constraints = _collect_constraints(instance)
for key, value in instance.parameters.items():
eq_reference = _get_eq_reference(value)
if isinstance(value, dc_cp):
- if value._potential_var:
+ if value._allows_var:
key = key + " [1]_"
parameters_with_equation[key] = {
"eq_reference": eq_reference,
@@ -107,7 +134,7 @@ def collect_component_parameters(instance):
"elements": ", ".join([f":code:`{element}`" for element in value.elements])
}
- return constraints, parameters_with_equation, grouped_parameters, characteristic_lines_and_maps
+ return unconditional_constraints, conditional_constraints, parameters_with_equation, grouped_parameters, characteristic_lines_and_maps
def collect_connection_parameters(instance):
@@ -154,37 +181,37 @@ def _indent_block(s: str, spaces: int) -> str:
def create_tabular_component_views():
- instances = _create_component_instances()
+ from tespy.components.component import Component
+
path = os.path.join(DOCS_ROOT_PATH, "building_blocks", "_components_overview.rst")
modules = {}
- for cls_name, instance in instances.items():
- # this is required to collect the mandatory constraints
- # it will keep the power balance equation between the component and the
- # (optionally) attached PowerConnection out of the list of equations
- # TODO: Find a better solution
- instance.power_outl = []
- instance.power_inl = []
- instance.heat_outl = []
- instance.heat_inl = []
+ for cls_name, cls_ref in component_registry.items.items():
+ # _instantiate_component returns None for classes with a static
+ # get_parameters(); in that case we still need a probe instance for
+ # get_mandatory_constraints(), so we create one the same way.
+ instance = _instantiate_component(cls_ref)
+ if instance is None:
+ instance = cls_ref.__new__(cls_ref)
+ Component.__init__(instance, "_docs_probe_")
- cls_ref = instance.__class__
cls_module = cls_ref.__module__
parent_module = ".".join(cls_ref.__module__.split(".")[:-1])
if parent_module not in modules:
modules[parent_module] = {}
- constraints, parameters, parameter_groups, characteristic_lines = collect_component_parameters(instance)
+ constraints, conditional_constraints, parameters, parameter_groups, characteristic_lines = collect_component_parameters(instance)
modules[parent_module][cls_name] = _indent_block("\n", 4)
modules[parent_module][cls_name] += _indent_block(f".. dropdown:: {cls_name}" + "\n" * 2, 8)
modules[parent_module][cls_name] += _indent_block(
- f"Class documentation and example: :py:class:`{cls_name} <{cls_module}.{cls_name}>`", 8
+ f"**Class documentation and example:** :py:class:`{cls_name} <{cls_module}.{cls_name}>`", 8
)
outputs = {
"Table of constraints": constraints,
+ "Table of constraints (active when energy connector is attached)": conditional_constraints,
"Table of parameters": parameters,
"Table of parameter groups": parameter_groups,
"Table of characteristic lines and maps": characteristic_lines,
@@ -246,7 +273,7 @@ def create_tabular_connection_views():
parameters = collect_connection_parameters(instance)
classes[cls_name] = "\n"
- classes[cls_name] += (f"Class documentation and example: :py:class:`{cls_name} <{cls_module}.{cls_name}>`")
+ classes[cls_name] += (f"**Class documentation and example:** :py:class:`{cls_name} <{cls_module}.{cls_name}>`")
outputs = {
"Table of parameters": parameters
diff --git a/docs/scripts/docstring_updater.py b/docs/scripts/docstring_updater.py
new file mode 100644
index 000000000..11dadf2ab
--- /dev/null
+++ b/docs/scripts/docstring_updater.py
@@ -0,0 +1,626 @@
+# -*- coding: utf-8
+
+"""On-demand updater for component and connection class docstrings.
+
+Rewrites the middle sections (image block, Ports, Mandatory Equations,
+Parameters) of every registered component docstring from live introspection
+of :py:meth:`port_schema`, :py:meth:`get_mandatory_constraints`, and
+:py:meth:`get_parameters`. For connection classes only the Parameters section
+is regenerated. The first paragraph(s) and the :code:`Example` section are
+preserved verbatim.
+
+Usage
+-----
+ # Update all registered components and connections in-place
+ python docs/scripts/docstring_updater.py
+
+ # Preview without writing files
+ python docs/scripts/docstring_updater.py --dry-run
+
+ # Update specific classes only
+ python docs/scripts/docstring_updater.py Turbine Compressor --dry-run
+
+ # Update connections only
+ python docs/scripts/docstring_updater.py --connections-only
+
+ # Update components only
+ python docs/scripts/docstring_updater.py --components-only
+"""
+
+import ast
+import inspect
+import re
+import subprocess
+import textwrap
+
+from tespy.tools.data_containers import ComponentCharacteristicMaps as dc_cm
+from tespy.tools.data_containers import ComponentCharacteristics as dc_cc
+from tespy.tools.data_containers import ComponentProperties as dc_cp
+from tespy.tools.data_containers import FluidComposition as dc_flu
+from tespy.tools.data_containers import FluidProperties as dc_prop
+from tespy.tools.data_containers import GroupedComponentCharacteristics as dc_gcc
+from tespy.tools.data_containers import GroupedComponentProperties as dc_gcp
+from tespy.tools.data_containers import ReferencedFluidProperties as dc_ref
+from tespy.tools.data_containers import SimpleDataContainer as dc_simple
+
+# ---------------------------------------------------------------------------
+# Base parameters shared by every component
+# ---------------------------------------------------------------------------
+
+_BASE_PARAMETERS = [
+ ("label", "str", "The label of the component."),
+ ("design", "list", "List containing design parameters (stated as String)."),
+ ("offdesign", "list", "List containing offdesign parameters (stated as String)."),
+ ("design_path", "str", "Path to the components design case."),
+ ("local_offdesign", "bool",
+ "Treat this component in offdesign mode in a design calculation."),
+ ("local_design", "bool",
+ "Treat this component in design mode in an offdesign calculation."),
+ ("char_warnings", "bool",
+ "Ignore warnings on default characteristics usage for this component."),
+ ("printout", "bool", "Include this component in the network's results printout."),
+]
+
+# ---------------------------------------------------------------------------
+# Base parameters shared by every connection
+# ---------------------------------------------------------------------------
+
+_CONNECTION_BASE_PARAMETERS = [
+ ("label", "str", "The label of the connection."),
+ ("design", "list", "List containing design parameters (stated as String)."),
+ ("offdesign", "list", "List containing offdesign parameters (stated as String)."),
+ ("design_path", "str", "Path to the individual design case for this connection."),
+ ("local_offdesign", "bool",
+ "Treat this connection in offdesign mode in a design calculation."),
+ ("local_design", "bool",
+ "Treat this connection in design mode in an offdesign calculation."),
+ ("printout", "bool", "Include this connection in the network's results printout."),
+]
+
+
+# ---------------------------------------------------------------------------
+# Helpers
+# ---------------------------------------------------------------------------
+
+def _eq_reference(dc):
+ """Return a :code:`:py:meth:` cross-reference string for the equation, or :code:`None`."""
+ func = getattr(dc, "func", None)
+ mat = getattr(dc, "structure_matrix", None)
+ target = func if func is not None else mat
+ if target is None:
+ return None
+ qualname = target.__qualname__
+ module = target.__module__
+ short = qualname.split(".")[-1]
+ return f":py:meth:`{short} <{module}.{qualname}>`"
+
+
+def _collect_constraints(instance):
+ """Return :code:`(unconditional, conditional)` mandatory-constraint dicts.
+
+ Conditional constraints are those that only activate when a power or heat
+ connector is attached to the component.
+ """
+ for attr in ("power_outl", "power_inl", "heat_outl", "heat_inl"):
+ setattr(instance, attr, [])
+
+ base = instance.get_mandatory_constraints()
+
+ sentinel = [object()]
+ for attr in ("power_outl", "power_inl", "heat_outl", "heat_inl"):
+ setattr(instance, attr, sentinel)
+
+ with_connectors = instance.get_mandatory_constraints()
+
+ for attr in ("power_outl", "power_inl", "heat_outl", "heat_inl"):
+ setattr(instance, attr, [])
+
+ unconditional = {}
+ conditional = {}
+ for key, value in with_connectors.items():
+ entry = {
+ "ref": _eq_reference(value),
+ "description": getattr(value, "description", None) or key,
+ }
+ (unconditional if key in base else conditional)[key] = entry
+
+ return unconditional, conditional
+
+
+def _dc_type(dc):
+ """Return the NumPy-style type annotation string for a data container."""
+ import math
+ if isinstance(dc, dc_cp):
+ base = "float, dict"
+ return base + ', :code:`"var"`' if getattr(dc, "_allows_var", False) else base
+ if isinstance(dc, dc_cc):
+ return "tespy.tools.characteristics.CharLine, dict"
+ if isinstance(dc, dc_cm):
+ return "tespy.tools.characteristics.CharMap, dict"
+ if isinstance(dc, (dc_gcp, dc_gcc)):
+ return type(dc).__name__
+ if isinstance(dc, dc_ref):
+ return "Ref"
+ if isinstance(dc, dc_prop):
+ return "float, Ref"
+ if isinstance(dc, dc_flu):
+ return "dict"
+ if isinstance(dc, dc_simple):
+ dtype = getattr(dc, "dtype", None)
+ if dtype:
+ return dtype
+ val = getattr(dc, "val", None)
+ if isinstance(val, bool):
+ return "bool"
+ if isinstance(val, int):
+ return "int"
+ if isinstance(val, float) and not math.isnan(val):
+ return "int, float"
+ if isinstance(val, str):
+ return "str"
+ return "any"
+ return "any"
+
+
+# ---------------------------------------------------------------------------
+# Section formatters
+# ---------------------------------------------------------------------------
+
+_PORT_LABELS = [
+ ("inlets", "Fluid inlets"),
+ ("outlets", "Fluid outlets"),
+ ("powerinlets", "Power inlets"),
+ ("poweroutlets", "Power outlets"),
+ ("heatinlets", "Heat inlets"),
+ ("heatoutlets", "Heat outlets"),
+]
+
+
+def _ports_section(cls):
+ schema = cls.port_schema()
+ lines = []
+ for key, label in _PORT_LABELS:
+ entry = schema.get(key, {})
+ kind = entry.get("type")
+ if kind == "fixed":
+ ports = entry.get("ports", [])
+ if ports:
+ lines.append(f"{label}: {', '.join(ports)}")
+ elif kind == "variable":
+ param = entry["parameter"]
+ pattern = entry["pattern"]
+ lines.append(
+ f"{label}: {pattern.replace('{n}', '1')}, "
+ f"{pattern.replace('{n}', '2')}, ... "
+ f"(variable, count set by :code:`{param}`)"
+ )
+ if not lines:
+ return ""
+ return "Ports\n-----\n\n" + "\n\n".join(lines)
+
+
+def _mandatory_section(instance):
+ try:
+ unconditional, conditional = _collect_constraints(instance)
+ except Exception:
+ return ""
+
+ if not unconditional and not conditional:
+ return "Mandatory Equations\n-------------------\n\nNone"
+
+ def _bullet(entry):
+ ref = entry["ref"]
+ desc = entry["description"].rstrip(".")
+ return "- " + desc + (f": {ref}" if ref else "")
+
+ parts = ["Mandatory Equations\n-------------------\n"]
+ parts.extend(_bullet(e) for e in unconditional.values())
+
+ if conditional:
+ parts.append("\nWhen a power or heat connector is attached:\n")
+ parts.extend(_bullet(e) for e in conditional.values())
+
+ return "\n".join(parts)
+
+
+def _parameters_section(instance, base_params=None, param_filter=None):
+ if base_params is None:
+ base_params = _BASE_PARAMETERS
+ entries = []
+
+ for name, ptype, desc in base_params:
+ entries.append((name, f"\n{name} : {ptype}\n {desc}"))
+
+ try:
+ params = instance.get_parameters()
+ except Exception:
+ params = {}
+
+ for name, dc in params.items():
+ if param_filter is not None and not param_filter(name, dc):
+ continue
+ ptype = _dc_type(dc)
+
+ raw_desc = getattr(dc, "description", None) or ""
+ desc = (raw_desc[0].upper() + raw_desc[1:]).rstrip(".") if raw_desc else ""
+
+ meta_parts = []
+ if isinstance(dc, dc_cp):
+ q = getattr(dc, "quantity", None)
+ if q:
+ meta_parts.append(f"Quantity: :code:`{q}`.")
+ if getattr(dc, "_allows_var", False):
+ meta_parts.append(
+ 'Can be set as a system variable by passing :code:`"var"` as its value.'
+ )
+ if isinstance(dc, (dc_gcp, dc_gcc)):
+ elements = getattr(dc, "elements", None) or []
+ if elements:
+ meta_parts.append(
+ "Elements: " + ", ".join(f":code:`{e}`" for e in elements) + "."
+ )
+
+ ref = _eq_reference(dc)
+
+ desc_body = (desc + "." if desc else "") + (
+ " " + " ".join(meta_parts) if meta_parts else ""
+ )
+ body_line = textwrap.fill(
+ desc_body.strip(), width=76, initial_indent=" ",
+ subsequent_indent=" "
+ )
+ if ref:
+ eq_line = f" Equation: {ref}."
+ entries.append((name, f"\n{name} : {ptype}\n{body_line}\n{eq_line}"))
+ else:
+ entries.append((name, f"\n{name} : {ptype}\n{body_line}"))
+
+ entries.sort(key=lambda x: x[0].lower())
+
+ return "\n".join(["Parameters\n----------"] + [e for _, e in entries])
+
+
+def _image_block(cls):
+ import os
+ _images_dir = os.path.join(os.path.dirname(__file__), "..", "api", "_images", "components")
+ available = {
+ os.path.splitext(f)[0]
+ for f in os.listdir(_images_dir)
+ if f.endswith(".svg") and not f.endswith("_darkmode.svg")
+ }
+
+ image_name = next(
+ (c.__name__ for c in cls.__mro__ if c.__name__ in available),
+ None,
+ )
+ if not image_name:
+ return ""
+
+ low = cls.__name__.lower()
+ return (
+ f".. image:: /api/_images/components/{image_name}.svg\n"
+ f" :alt: flowsheet of the {low}\n"
+ f" :align: center\n"
+ f" :class: only-light\n\n"
+ f".. image:: /api/_images/components/{image_name}_darkmode.svg\n"
+ f" :alt: flowsheet of the {low}\n"
+ f" :align: center\n"
+ f" :class: only-dark"
+ )
+
+
+# ---------------------------------------------------------------------------
+# Existing-docstring splitting
+# ---------------------------------------------------------------------------
+
+# Section markers that signal the start of auto-generated content
+_SECTION_START = re.compile(
+ r"(?:^|\n)(?=\*\*(?:Mandatory|Optional)"
+ r"|Ports\n[-]"
+ r"|Mandatory\s+Equations"
+ r"|Optional\s+Equations"
+ r"|Inlets/Outlets"
+ r"|Image\n"
+ r"|\.\.\ image::"
+ r"|Parameters\n[-])",
+ re.MULTILINE,
+)
+_EXAMPLE_START = re.compile(r"(?:^|\n\n)Examples?\n[-]+", re.MULTILINE)
+_PRESERVE_SECTION_START = re.compile(
+ r"(?:^|\n\n)(?:"
+ r"(?:Note|Notes|Warning|Warnings|References|See Also)\n[-]+"
+ r"|\.\.\ (?:note|tip|warning|attention|important|caution)::"
+ r")",
+ re.MULTILINE,
+)
+
+
+def _split_docstring(cls):
+ """Return :code:`(intro, suffix, example)` from the current class docstring.
+
+ *suffix* contains any Note / Warning / References sections that follow
+ the auto-generated block; they are preserved verbatim after Parameters.
+ """
+ doc = inspect.getdoc(cls) or ""
+
+ sm = _SECTION_START.search(doc)
+ em = _EXAMPLE_START.search(doc)
+
+ # intro ends at the first auto-generated section or the Example section
+ intro_end = len(doc)
+ if sm:
+ intro_end = sm.start() + (1 if doc[sm.start()] == "\n" else 0)
+ if em:
+ ex_pos = em.start() + (1 if doc[em.start()] == "\n" else 0)
+ intro_end = min(intro_end, ex_pos)
+
+ intro = doc[:intro_end].strip()
+ example = doc[em.start():].strip() if em else ""
+ if example.startswith("\n"):
+ example = example[1:]
+
+ auto_end = em.start() if em else len(doc)
+ auto_block = doc[intro_end:auto_end]
+ pm = _PRESERVE_SECTION_START.search(auto_block)
+ suffix = auto_block[pm.start():].lstrip("\n").strip() if pm else ""
+
+ return intro, suffix, example
+
+
+# ---------------------------------------------------------------------------
+# Docstring assembly
+# ---------------------------------------------------------------------------
+
+def generate_docstring(cls):
+ """Return the complete new docstring body (without surrounding quotes)."""
+ from tespy.components.component import Component
+ from tespy.tools.schema import _instantiate_component
+
+ intro, suffix, example = _split_docstring(cls)
+
+ instance = _instantiate_component(cls)
+ if instance is None:
+ instance = cls.__new__(cls)
+ Component.__init__(instance, "_docprobe_")
+
+ parts = []
+ if intro:
+ parts.append(intro)
+ image_block = _image_block(cls)
+ if image_block:
+ parts.append(image_block)
+ ports = _ports_section(cls)
+ if ports:
+ parts.append(ports)
+ mandatory = _mandatory_section(instance)
+ if mandatory:
+ parts.append(mandatory)
+ parts.append(_parameters_section(instance))
+ if suffix:
+ if re.match(r"^\.\.", suffix):
+ parts.append("Notes\n-----\n\n" + suffix)
+ else:
+ parts.append(suffix)
+ if example:
+ parts.append(example)
+
+ return "\n\n".join(parts)
+
+
+# ---------------------------------------------------------------------------
+# Source-file patching
+# ---------------------------------------------------------------------------
+
+def _char_pos(source, line_1based, col):
+ """Convert 1-based line + 0-based col to a character offset in *source*."""
+ pos = 0
+ for _ in range(line_1based - 1):
+ pos = source.index("\n", pos) + 1
+ return pos + col
+
+
+def _patch_file(source, cls_name, new_body):
+ """Return *source* with the docstring of *cls_name* replaced by *new_body*."""
+ tree = ast.parse(source)
+
+ for node in ast.walk(tree):
+ if not (isinstance(node, ast.ClassDef) and node.name == cls_name):
+ continue
+ if not node.body:
+ break
+ first = node.body[0]
+ if not (
+ isinstance(first, ast.Expr)
+ and isinstance(first.value, ast.Constant)
+ and isinstance(first.value.value, str)
+ ):
+ break
+
+ dv = first.value
+ start = _char_pos(source, dv.lineno, dv.col_offset)
+ end = _char_pos(source, dv.end_lineno, dv.end_col_offset)
+
+ indent = " " * dv.col_offset
+ raw_prefix = "r" if source[start] == "r" else ""
+
+ # Indent every line of the body to match the class indentation
+ indented_lines = []
+ for line in new_body.split("\n"):
+ indented_lines.append(indent + line if line.strip() else "")
+ body = "\n".join(indented_lines)
+
+ new_doc = f'{raw_prefix}"""\n{body}\n{indent}"""'
+ return source[:start] + new_doc + source[end:]
+
+ return source
+
+
+# ---------------------------------------------------------------------------
+# Git helpers
+# ---------------------------------------------------------------------------
+
+def _has_uncommitted_changes(filepath):
+ """Return True if *filepath* has uncommitted changes according to git."""
+ try:
+ result = subprocess.run(
+ ["git", "status", "--porcelain", filepath],
+ capture_output=True, text=True, check=True,
+ )
+ return bool(result.stdout.strip())
+ except (subprocess.CalledProcessError, FileNotFoundError):
+ return False
+
+
+# ---------------------------------------------------------------------------
+# Connection docstring generation
+# ---------------------------------------------------------------------------
+
+def generate_connection_docstring(cls):
+ """Return the complete new docstring body for a connection class."""
+ intro, suffix, example = _split_docstring(cls)
+
+ instance = cls.__new__(cls)
+
+ parts = []
+ if intro:
+ parts.append(intro)
+ parts.append(_parameters_section(
+ instance,
+ base_params=_CONNECTION_BASE_PARAMETERS,
+ param_filter=lambda name, _: not name.endswith("_ref"),
+ ))
+ if suffix:
+ if re.match(r"^\.\.", suffix):
+ parts.append("Notes\n-----\n\n" + suffix)
+ else:
+ parts.append(suffix)
+ if example:
+ parts.append(example)
+
+ return "\n\n".join(parts)
+
+
+def update_connection_docstrings(classes=None, dry_run=False, force=False):
+ """Update docstrings for *classes* (defaults to all registered connections).
+
+ Parameters
+ ----------
+ classes : list of str, optional
+ Class names to process. Defaults to every entry in the connection
+ registry.
+ dry_run : bool
+ When :code:`True`, print the generated docstrings to stdout instead of
+ writing files.
+ force : bool
+ When :code:`True`, write files even if they have uncommitted changes.
+ """
+ from tespy.connections.connection import connection_registry
+
+ registry = {
+ k: v for k, v in connection_registry.items.items()
+ if classes is None or k in classes
+ }
+
+ pending = {}
+
+ for cls_name, cls in registry.items():
+ try:
+ new_body = generate_connection_docstring(cls)
+ except Exception as exc:
+ print(f"[SKIP] {cls_name}: {exc}")
+ continue
+
+ if dry_run:
+ sep = "=" * 72
+ print(f"\n{sep}\n=== {cls_name}\n{sep}")
+ print(new_body)
+ continue
+
+ filepath = inspect.getfile(cls)
+ if filepath not in pending:
+ with open(filepath, encoding="utf-8") as fh:
+ pending[filepath] = fh.read()
+
+ pending[filepath] = _patch_file(pending[filepath], cls_name, new_body)
+ print(f"[OK] {cls_name}")
+
+ for filepath, content in pending.items():
+ if not force and _has_uncommitted_changes(filepath):
+ print(f"[SKIP] {filepath}: has uncommitted changes (pass --force to override)")
+ continue
+ with open(filepath, "w", encoding="utf-8") as fh:
+ fh.write(content)
+ print(f"[WRITE] {filepath}")
+
+
+# ---------------------------------------------------------------------------
+# Public entry point
+# ---------------------------------------------------------------------------
+
+def update_component_docstrings(classes=None, dry_run=False, force=False):
+ """Update docstrings for *classes* (defaults to all registered components).
+
+ Parameters
+ ----------
+ classes : list of str, optional
+ Class names to process. Defaults to every entry in the component
+ registry except the base :code:`Component` class.
+ dry_run : bool
+ When :code:`True`, print the generated docstrings to stdout instead of
+ writing files.
+ force : bool
+ When :code:`True`, write files even if they have uncommitted changes.
+ """
+ from tespy.components.component import component_registry
+
+ registry = {
+ k: v for k, v in component_registry.items.items()
+ if k != "Component" and (classes is None or k in classes)
+ }
+
+ pending = {} # filepath → current source text
+
+ for cls_name, cls in registry.items():
+ try:
+ new_body = generate_docstring(cls)
+ except Exception as exc:
+ print(f"[SKIP] {cls_name}: {exc}")
+ continue
+
+ if dry_run:
+ sep = "=" * 72
+ print(f"\n{sep}\n=== {cls_name}\n{sep}")
+ print(new_body)
+ continue
+
+ filepath = inspect.getfile(cls)
+ if filepath not in pending:
+ with open(filepath, encoding="utf-8") as fh:
+ pending[filepath] = fh.read()
+
+ pending[filepath] = _patch_file(pending[filepath], cls_name, new_body)
+ print(f"[OK] {cls_name}")
+
+ for filepath, content in pending.items():
+ if not force and _has_uncommitted_changes(filepath):
+ print(f"[SKIP] {filepath}: has uncommitted changes (pass --force to override)")
+ continue
+ with open(filepath, "w", encoding="utf-8") as fh:
+ fh.write(content)
+ print(f"[WRITE] {filepath}")
+
+
+if __name__ == "__main__":
+ import sys
+
+ argv = sys.argv[1:]
+ dry_run = "--dry-run" in argv
+ force = "--force" in argv
+ components_only = "--components-only" in argv
+ connections_only = "--connections-only" in argv
+ names = [a for a in argv if not a.startswith("--")] or None
+
+ if not connections_only:
+ update_component_docstrings(classes=names, dry_run=dry_run, force=force)
+ if not components_only:
+ update_connection_docstrings(classes=names, dry_run=dry_run, force=force)
diff --git a/docs/scripts/generate_tespy_data_module.py b/docs/scripts/generate_tespy_data_module.py
index 62c0aa251..e94daffa7 100644
--- a/docs/scripts/generate_tespy_data_module.py
+++ b/docs/scripts/generate_tespy_data_module.py
@@ -1,15 +1,21 @@
# -*- coding: utf-8 -*-
import json
+import os
from matplotlib import pyplot as plt
-from pkg_resources import resource_filename
import tespy
+DOCS_DIR = os.path.join(os.path.dirname(__file__), "..")
+IMAGES_DIR = os.path.join(DOCS_DIR, "api", "_images", "characteristics")
+API_DIR = os.path.join(DOCS_DIR, "api")
+
+os.makedirs(IMAGES_DIR, exist_ok=True)
+
def get_char_data(filename):
- path = resource_filename('tespy.data', filename + '.json')
+ path = os.path.join(tespy.__datapath__, f'{filename}.json')
with open(path) as f:
data = json.load(f)
@@ -17,50 +23,68 @@ def get_char_data(filename):
return data
-def plot_line(component, parameter, name, data):
+def plot_line(component, parameter, name, data, suffix=""):
char = tespy.tools.characteristics.CharLine(x=data['x'], y=data['y'])
- title = ('Characteristic line "' + name + '" for parameter "' +
- parameter + '".')
+ title = f'Characteristic line "{name}" for parameter "{parameter}".'
xlabel = '$X$'
ylabel = r'$f\left(X\right)$'
- path = component + '_' + parameter + '_' + name + '.svg'
- char.plot(path.replace(' ', '_'), title, xlabel, ylabel)
+ filename = f'{component}_{parameter}_{name}{suffix}.svg'.replace(' ', '_')
+ char.plot(os.path.join(IMAGES_DIR, filename), title, xlabel, ylabel)
-def plot_map(component, parameter, name, data):
+def plot_map(component, parameter, name, data, suffix=""):
char = tespy.tools.characteristics.CharMap(
x=data['x'], y=data['y'], z=data['z'])
- title = ('Characteristic line "' + name + '" for parameter "' +
- parameter + '".')
+ title = f'Characteristic line "{name}" for parameter "{parameter}".'
xlabel = '$Y$'
ylabel = r'$f\left(X,Y\right)$'
- path = component + '_' + parameter + '_' + name + '.svg'
- char.plot(path.replace(' ', '_'), title, xlabel, ylabel)
+ filename = f'{component}_{parameter}_{name}{suffix}.svg'.replace(' ', '_')
+ char.plot(os.path.join(IMAGES_DIR, filename), title, xlabel, ylabel)
def generate_api_doc(component, parameter, name, char_type, ref):
- path = '_images/' + component + '_' + parameter + '_' + name + '.svg'
- rst = (
- '.. figure:: ' + path.replace(' ', '_') + '\n'
- ' :alt: Characteristic ' + char_type + ' "' + name +
- '" for parameter "' + parameter + '".\n'
- ' :align: center\n\n'
- )
- if ref:
- rst += ' Reference: :cite:`' + ref + '`.\n\n'
- else:
- rst += ' Reference: Generic data.\n\n'
+ base = f'{component}_{parameter}_{name}'.replace(' ', '_')
+ alt = f'Characteristic {char_type} "{name}" for parameter "{parameter}".'
+ caption = f' Reference: :cite:`{ref}`.\n\n' if ref else ' Reference: Generic data.\n\n'
+
+ def figure(filename, extra_class):
+ return (
+ f'.. figure:: /api/_images/characteristics/{filename}.svg\n'
+ f' :alt: {alt}\n'
+ f' :align: center\n'
+ f' :figclass: {extra_class}\n\n'
+ + caption
+ )
+
+ return figure(base, 'only-light') + figure(f'{base}_darkmode', 'only-dark')
+
+
+def generate_plots(suffix=""):
+ for component, params in get_char_data('char_lines').items():
+ for param, lines in params.items():
+ for line, data in lines.items():
+ plot_line(component, param, line, data, suffix)
+
+ for component, params in get_char_data('char_maps').items():
+ for param, chars in params.items():
+ for char, data in chars.items():
+ plot_map(component, param, char, data, suffix)
+
+
+generate_plots()
- return rst
+with plt.style.context("dark_background"):
+ generate_plots(suffix="_darkmode")
rst = (
+ '.. _data_label:\n\n'
'tespy.data module\n'
'=================\n\n'
)
@@ -82,12 +106,10 @@ def generate_api_doc(component, parameter, name, char_type, ref):
)
for component, params in get_char_data('char_lines').items():
- rst += '**' + component + '**\n\n'
+ rst += f'**{component}**\n\n'
for param, lines in params.items():
for line, data in lines.items():
- plot_line(component, param, line, data)
- rst += generate_api_doc(
- component, param, line, 'line', data['ref'])
+ rst += generate_api_doc(component, param, line, 'line', data['ref'])
rst += (
'Characteristic maps\n'
@@ -95,12 +117,10 @@ def generate_api_doc(component, parameter, name, char_type, ref):
)
for component, params in get_char_data('char_maps').items():
- rst += '**' + component + '**\n\n'
+ rst += f'**{component}**\n\n'
for param, chars in params.items():
for char, data in chars.items():
- plot_map(component, param, char, data)
rst += generate_api_doc(component, param, char, 'map', data['ref'])
-with open('tespy.data.rst', 'w') as f:
+with open(os.path.join(API_DIR, 'data.rst'), 'w') as f:
f.write(rst)
- f.close()
diff --git a/docs/whats_new/v0-10-0.rst b/docs/whats_new/v0-10-0.rst
index 450d62fa2..f57e3a17c 100644
--- a/docs/whats_new/v0-10-0.rst
+++ b/docs/whats_new/v0-10-0.rst
@@ -44,6 +44,12 @@ API Changes
for that parameter, and setting a numerical value automatically unsets any
previously set :code:`Ref`. Both could be set simultaneously before, which
raised a :code:`FutureWarning`.
+- The :code:`char_map_pr` and :code:`char_map_eta_s` parameters of
+ :py:class:`~tespy.components.turbomachinery.compressor.Compressor` are
+ deprecated. Use
+ :py:class:`~tespy.components.turbomachinery.turbocompressor.TurboCompressor`
+ instead, which is the dedicated class providing characteristic map offdesign
+ capability.
- The pygmo compatibility interface of
:py:class:`~tespy.tools.optimization.OptimizationProblem` has been removed.
The :code:`fitness`, :code:`get_nobj`, :code:`get_nic`, :code:`get_bounds`,
@@ -152,6 +158,19 @@ Other Changes
the parameter (`PR #980 `__).
- Fix logging message in connection preprocessing
(`PR #988 `__).
+- :py:func:`~tespy.tools.schema.generate_component_schema` and
+ :py:func:`~tespy.tools.schema.generate_connection_schema` export a JSON
+ description of all registered component and connection parameters - including
+ container type, physical quantity and description - for use in external
+ tooling (`PR #938 `__).
+- A docstring updater script has been added at
+ :code:`docs/scripts/docstring_updater.py`. It regenerates the Ports,
+ Mandatory Equations, and Parameters sections of all registered component and
+ connection class docstrings from live introspection of
+ :py:meth:`port_schema`, :py:meth:`get_mandatory_constraints`, and
+ :py:meth:`get_parameters`, while preserving the introductory paragraph,
+ :code:`Notes` sections, and :code:`Example` blocks verbatim
+ (`PR #938 `__).
Bug Fixes
#########
diff --git a/src/tespy/components/basics/cycle_closer.py b/src/tespy/components/basics/cycle_closer.py
index b6985432d..76591ec4d 100644
--- a/src/tespy/components/basics/cycle_closer.py
+++ b/src/tespy/components/basics/cycle_closer.py
@@ -23,46 +23,64 @@ class CycleCloser(Component):
r"""
Component for closing cycles.
- **Mandatory Equations**
+ Ports
+ -----
- - pressure: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - enthalpy: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ Fluid inlets: in1
- Image not available
+ Fluid outlets: out1
+
+ Mandatory Equations
+ -------------------
+
+ - pressure equality constraint: :py:meth:`variable_equality_structure_matrix `
+ - enthalpy equality constraint: :py:meth:`variable_equality_structure_matrix `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ fluid_deviation : float, dict
+ Norm of absolute deviation of fluid composition between inlet and
+ outlet.
- local_design : boolean
+ label : str
+ The label of the component.
+
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ mass_deviation : float, dict
+ Absolute deviation of mass flow between inlet and outlet. Quantity:
+ :code:`mass_flow`.
- printout : boolean
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
Include this component in the network's results printout.
- Note
- ----
- This component can be used to close a cycle process. The system of
- equations describing your plant will overdetermined, if you close a cycle
- without this component or a cut the cycle with a sink and a source at
- some point of the cycle. This component can be used instead of cutting
- the cycle.
+ Notes
+ -----
+
+ .. note::
+
+ This component can be used to close a cycle process. The system of
+ equations describing your plant will overdetermined, if you close a cycle
+ without this component or a cut the cycle with a sink and a source at
+ some point of the cycle. This component can be used instead of cutting
+ the cycle.
Example
-------
diff --git a/src/tespy/components/basics/sink.py b/src/tespy/components/basics/sink.py
index a93e12d58..2f450160e 100644
--- a/src/tespy/components/basics/sink.py
+++ b/src/tespy/components/basics/sink.py
@@ -21,30 +21,41 @@ class Sink(Component):
r"""
A flow drains in a Sink.
+ Ports
+ -----
+
+ Fluid inlets: in1
+
+ Mandatory Equations
+ -------------------
+
+ None
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
Example
diff --git a/src/tespy/components/basics/source.py b/src/tespy/components/basics/source.py
index f05dc50e9..70ada47bc 100644
--- a/src/tespy/components/basics/source.py
+++ b/src/tespy/components/basics/source.py
@@ -22,30 +22,41 @@ class Source(Component):
r"""
A flow originates from a Source.
+ Ports
+ -----
+
+ Fluid outlets: out1
+
+ Mandatory Equations
+ -------------------
+
+ None
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
Example
diff --git a/src/tespy/components/basics/subsystem_interface.py b/src/tespy/components/basics/subsystem_interface.py
index 27f37d2a2..1f0079352 100644
--- a/src/tespy/components/basics/subsystem_interface.py
+++ b/src/tespy/components/basics/subsystem_interface.py
@@ -22,63 +22,68 @@ class SubsystemInterface(Component):
r"""
The subsystem interface does not change fluid properties.
- **Mandatory Equations**
+ .. image:: /api/_images/components/SubsystemInterface.svg
+ :alt: flowsheet of the subsysteminterface
+ :align: center
+ :class: only-light
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - pressure: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - enthalpy: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ .. image:: /api/_images/components/SubsystemInterface_darkmode.svg
+ :alt: flowsheet of the subsysteminterface
+ :align: center
+ :class: only-dark
- Inlets/Outlets
+ Ports
+ -----
- - Specify number of inlets and outlets with :code:`num_inter`,
- default value: 1.
+ Fluid inlets: in1, in2, ... (variable, count set by :code:`num_inter`)
- Image
+ Fluid outlets: out1, out2, ... (variable, count set by :code:`num_inter`)
- .. image:: /api/_images/SubsystemInterface.svg
- :alt: flowsheet of the subsystem interface
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/SubsystemInterface_darkmode.svg
- :alt: flowsheet of the subsystem interface
- :align: center
- :class: only-dark
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - pressure equality constraint: :py:meth:`variable_equality_structure_matrix `
+ - enthalpy equality constraint: :py:meth:`variable_equality_structure_matrix `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ num_inter : int
+ Number of interfacing connections.
- printout : boolean
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
Include this component in the network's results printout.
- num_inter : float, dict
- Number of interfaces for subsystem.
+ Notes
+ -----
+
+ .. note::
- Note
- ----
- This component passes all fluid properties and mass flow from its inlet to
- the outlet.
+ This component passes all fluid properties and mass flow from its inlet to
+ the outlet.
Example
-------
@@ -149,10 +154,21 @@ def get_mandatory_constraints(self):
def get_parameters():
return {
"num_inter": dc_simple(
- description="number of interfacing connections"
+ dtype="int", description="number of interfacing connections"
)
}
+ @classmethod
+ def port_schema(cls):
+ return {
+ "inlets": {"type": "variable", "parameter": "num_inter", "pattern": "in{n}", "min": 1},
+ "outlets": {"type": "variable", "parameter": "num_inter", "pattern": "out{n}", "min": 1},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": []},
+ }
+
def inlets(self):
if self.num_inter.is_set:
return ['in' + str(i + 1) for i in range(self.num_inter.val)]
diff --git a/src/tespy/components/combustion/base.py b/src/tespy/components/combustion/base.py
index 04b7f069b..9a2ad7273 100644
--- a/src/tespy/components/combustion/base.py
+++ b/src/tespy/components/combustion/base.py
@@ -32,87 +32,92 @@ class CombustionChamber(Component):
r"""
The class CombustionChamber is parent class of all combustion components.
- **Mandatory Equations**
+ .. image:: /api/_images/components/CombustionChamber.svg
+ :alt: flowsheet of the combustionchamber
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.mass_flow_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.combustion_pressure_structure_matrix`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.stoichiometry`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.energy_balance_func`
+ .. image:: /api/_images/components/CombustionChamber_darkmode.svg
+ :alt: flowsheet of the combustionchamber
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.lambda_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.ti_func`
+ Fluid inlets: in1, in2
- Available fuels
+ Fluid outlets: out1
- - methane, ethane, propane, butane, hydrogen, carbon monoxide, nDodecane
+ Mandatory Equations
+ -------------------
- .. tip::
+ - mass flow balance over all inflows and outflows: :py:meth:`mass_flow_func `
+ - pressure equality constraints: :py:meth:`combustion_pressure_structure_matrix `
+ - constraints for stoichiometry of the reaction: :py:meth:`stoichiometry_func `
+ - constraint for energy balance: :py:meth:`energy_balance_func `
- You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
- the :code:`tespy.tools` module and passing the respective information.
- See in the example below, how to do that.
-
- Inlets/Outlets
-
- - in1, in2
- - out1
-
- Image
+ Parameters
+ ----------
- .. image:: /api/_images/CombustionChamber.svg
- :alt: flowsheet of the combustion chamber
- :align: center
- :class: only-light
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
- .. image:: /api/_images/CombustionChamber_darkmode.svg
- :alt: flowsheet of the combustion chamber
- :align: center
- :class: only-dark
+ design : list
+ List containing design parameters (stated as String).
- .. note::
+ design_path : str
+ Path to the components design case.
- The fuel and the air components can be connected to either of the
- inlets.
+ f_nox : float, dict
+ Mass-based nitric oxide (NO) generation rate in flue gas in mass of
+ created NO per mass of fuel and air input. Only active if value is
+ explicitly set. Quantity: :code:`ratio`.
- Parameters
- ----------
label : str
The label of the component.
- design : list
- List containing design parameters (stated as String).
+ lamb : float, dict
+ Available oxygen to stoichiometric oxygen ratio. Quantity:
+ :code:`ratio`.
+ Equation: :py:meth:`lambda_func `.
+
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
+
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
offdesign : list
List containing offdesign parameters (stated as String).
- design_path : str
- Path to the components design case.
+ printout : bool
+ Include this component in the network's results printout.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ ti : float, dict
+ Thermal input of fuel: lower heating value multiplied with mass flow.
+ Quantity: :code:`heat`.
+ Equation: :py:meth:`ti_func `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ Notes
+ -----
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ .. tip::
- printout : boolean
- Include this component in the network's results printout.
+ You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
+ the :code:`tespy.tools` module and passing the respective information.
+ See in the example below, how to do that. To retrieve the fluids
+ available by default run:
- lamb : float, dict
- Actual oxygen to stoichiometric oxygen ratio, :math:`\lambda/1`.
+ .. code-block:: python
- ti : float, dict
- Thermal input, (:math:`{LHV \cdot \dot{m}_f}`), :math:`ti/\text{W}`.
+ from tespy.tools.global_vars import COMBUSTION_FLUIDS
+ COMBUSTION_FLUIDS.fluids.keys()
+
+ .. note::
- Note
- ----
- For more information on the usage of the combustion chamber see the
- examples section on github or look for the combustion chamber tutorials
- at tespy.readthedocs.io.
+ The fuel and the air components can be connected to either of the
+ inlets.
Example
-------
@@ -198,7 +203,7 @@ def get_parameters(self):
dependents=self.ti_dependents,
num_eq_sets=1,
quantity="heat",
- description="thermal input of fuel: lower heating value multipled with mass flow",
+ description="thermal input of fuel: lower heating value multiplied with mass flow",
calc=self._calc_ti
),
"f_nox": dc_cp(
@@ -584,7 +589,7 @@ def stoichiometry(self, fluid):
0 = res + \left( \dot{m}_{H_m} - \dot{m}_{H_{exc,m}} \right)
\cdot 0.5 \cdot M_{H_2O}
- Equation for carbondioxide
+ Equation for carbon dioxide
.. math::
@@ -683,7 +688,7 @@ def stoichiometry(self, fluid):
)
###################################################################
- # equation for carbondioxide
+ # equation for carbon dioxide
if fluid == self.co2:
dm = (n_c - n_c_exc) * inl[0].fluid.wrapper[self.co2]._molar_mass
@@ -911,12 +916,12 @@ def lambda_dependents(self):
def _calc_lambda(self):
r"""
- Calculate oxygen to stoichimetric oxygen ration
+ Calculate oxygen to stoichiometric oxygen ratio
Returns
-------
lambda : float
- Oxygent to stoichiometric oxygen ratio.
+ Oxygen to stoichiometric oxygen ratio.
.. math::
@@ -1203,7 +1208,7 @@ def entropy_balance(self):
reaction, we need to define the same reference state for the entropy
balance of the combustion. The temperature for the reference state is
set to 25 °C and reference pressure is 1 bar. As the water in the flue
- gas may be liquid but the thermodynmic temperature of heat of
+ gas may be liquid but the thermodynamic temperature of heat of
combustion refers to the lower heating value, the water is forced to
gas at the reference point by considering evaporation.
diff --git a/src/tespy/components/combustion/diabatic.py b/src/tespy/components/combustion/diabatic.py
index 513911b17..095b7e562 100644
--- a/src/tespy/components/combustion/diabatic.py
+++ b/src/tespy/components/combustion/diabatic.py
@@ -23,108 +23,119 @@
@component_registry
class DiabaticCombustionChamber(CombustionChamber):
r"""
- The class CombustionChamber is parent class of all combustion components.
+ An extension of the adiabatic combustion chamber with pressure drop and heat loss.
- **Mandatory Equations**
+ .. image:: /api/_images/components/CombustionChamber.svg
+ :alt: flowsheet of the diabaticcombustionchamber
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.mass_flow_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.combustion_pressure_structure_matrix`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.stoichiometry`
+ .. image:: /api/_images/components/CombustionChamber_darkmode.svg
+ :alt: flowsheet of the diabaticcombustionchamber
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.lambda_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.ti_func`
- - :py:meth:`tespy.components.combustion.diabatic.DiabaticCombustionChamber.energy_balance_func`
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
+ Fluid inlets: in1, in2
- Available fuels
+ Fluid outlets: out1
- - methane, ethane, propane, butane, hydrogen, carbon monoxide, nDodecane
+ Mandatory Equations
+ -------------------
- .. tip::
+ - mass flow balance over all inflows and outflows: :py:meth:`mass_flow_func `
+ - constraints for stoichiometry of the reaction: :py:meth:`stoichiometry_func `
- You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
- the :code:`tespy.tools` module and passing the respective information.
- See in the example of
- :py:class:`tespy.components.combustion.base.CombustionChamber`, how to
- do that.
-
- Inlets/Outlets
+ Parameters
+ ----------
- - in1, in2
- - out1
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
- Image
+ design : list
+ List containing design parameters (stated as String).
- .. image:: /api/_images/CombustionChamber.svg
- :alt: flowsheet of the combustion chamber
- :align: center
- :class: only-light
+ design_path : str
+ Path to the components design case.
- .. image:: /api/_images/CombustionChamber_darkmode.svg
- :alt: flowsheet of the combustion chamber
- :align: center
- :class: only-dark
+ dp : float, dict
+ Inlet 0 to outlet 0 absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- .. note::
+ eta : float, dict
+ Heat dissipation ratio relative to thermal input. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`energy_balance_func `.
- The fuel and the air components can be connected to either of the
- inlets. The pressure of inlet 2 is disconnected from the pressure of
- inlet 1. A warning is prompted, if the pressure at inlet 2 is lower than
- the pressure at inlet 1.
+ f_nox : float, dict
+ Mass-based nitric oxide (NO) generation rate in flue gas in mass of
+ created NO per mass of fuel and air input. Only active if value is
+ explicitly set. Quantity: :code:`ratio`.
- Parameters
- ----------
label : str
The label of the component.
- design : list
- List containing design parameters (stated as String).
-
- offdesign : list
- List containing offdesign parameters (stated as String).
+ lamb : float, dict
+ Available oxygen to stoichiometric oxygen ratio. Quantity:
+ :code:`ratio`.
+ Equation: :py:meth:`lambda_func `.
- design_path : str
- Path to the components design case.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- local_offdesign : boolean
+ local_offdesign : bool
Treat this component in offdesign mode in a design calculation.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ pr : float, dict
+ Outlet 0 to inlet 0 pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
- lamb : float, dict
- Actual oxygen to stoichiometric oxygen ratio, :math:`\lambda/1`.
+ Qloss : float, dict
+ Heat dissipation. Quantity: :code:`heat`.
ti : float, dict
- Thermal input, (:math:`{LHV \cdot \dot{m}_f}`), :math:`ti/\text{W}`.
+ Thermal input of fuel: lower heating value multiplied with mass flow.
+ Quantity: :code:`heat`.
+ Equation: :py:meth:`ti_func `.
- eta : float, dict
- Combustion thermal efficiency, :math:`\eta`. Heat loss calculation based
- on share of thermal input.
+ Notes
+ -----
- pr : float, dict
- Pressure ratio of outlet 1 to inlet 1, :math:`pr`.
+ .. tip::
+
+ You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
+ the :code:`tespy.tools` module and passing the respective information.
+ See in the example of
+ :py:class:`tespy.components.combustion.base.CombustionChamber`, how to
+ do that. To retrieve the fluids available by default run:
+
+ .. code-block:: python
- Note
- ----
- For more information on the usage of the combustion chamber see the
- examples section on github or look for the combustion chamber tutorials
- at tespy.readthedocs.io.
+ from tespy.tools.global_vars import COMBUSTION_FLUIDS
+ COMBUSTION_FLUIDS.fluids.keys()
+
+ .. note::
+
+ The fuel and the air components can be connected to either of the
+ inlets. The pressure of inlet 2 is disconnected from the pressure of
+ inlet 1. A warning is prompted, if the pressure at inlet 2 is lower than
+ the pressure at inlet 1.
Example
-------
The combustion chamber calculates energy input due to combustion as well as
the flue gas composition based on the type of fuel and the amount of
oxygen supplied. In this example a mixture of methane, hydrogen and
- carbondioxide is used as fuel.
+ carbon dioxide is used as fuel.
>>> from tespy.components import Sink, Source, DiabaticCombustionChamber
>>> from tespy.connections import Connection
@@ -170,8 +181,8 @@ class DiabaticCombustionChamber(CombustionChamber):
>>> round(comb_fg.p.val, 2)
1.14
- Instead of the pressure ration, we can also specify the outlet pressure.
- The pressure ratio is the ratio or pressure at the outlet to the pressure
+ Instead of the pressure ratio, we can also specify the outlet pressure.
+ The pressure ratio is the ratio of pressure at the outlet to the pressure
at the inlet 1 (ambient air inlet in this example).
>>> comb.set_attr(pr=None)
@@ -272,7 +283,7 @@ def energy_balance_func(self):
The temperature for the reference state is set to 25 °C, thus
the water may be liquid. In order to make sure, the state is
referring to the lower heating value, the state of the water in the
- flue gas is fored to gaseous.
+ flue gas is forced to gaseous.
- Reference temperature: 298.15 K.
- Reference pressure: 1 bar.
diff --git a/src/tespy/components/combustion/engine.py b/src/tespy/components/combustion/engine.py
index 8298e569d..b5038269b 100644
--- a/src/tespy/components/combustion/engine.py
+++ b/src/tespy/components/combustion/engine.py
@@ -36,162 +36,174 @@ class CombustionEngine(CombustionChamber):
chamber. Thermal input and power output, heat output and heat losses are
linked with an individual characteristic line for each property.
- **Mandatory Equations**
+ .. image:: /api/_images/components/CombustionEngine.svg
+ :alt: flowsheet of the combustionengine
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.mass_flow_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.combustion_pressure_structure_matrix`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.stoichiometry`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.energy_balance_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.tiP_char_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.Q1_char_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.Q2_char_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.Qloss_char_func`
+ .. image:: /api/_images/components/CombustionEngine_darkmode.svg
+ :alt: flowsheet of the combustionengine
+ :align: center
+ :class: only-dark
- - for each cooling loop:
+ Ports
+ -----
- - mass flow: :py:meth:`tespy.components.combustion.engine.CombustionEngine.variable_equality_structure_matrix`
- - fluid: :py:meth:`tespy.components.combustion.engine.CombustionEngine.variable_equality_structure_matrix`
+ Fluid inlets: in1, in2, in3, in4
- **Optional Equations**
+ Fluid outlets: out1, out2, out3
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.lambda_func`
- - :py:meth:`tespy.components.combustion.base.CombustionChamber.ti_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.Q1_func`
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.Q2_func`
+ Power outlets: power
- - for each cooling loop:
+ Mandatory Equations
+ -------------------
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
+ - mass flow balance over all inflows and outflows: :py:meth:`mass_flow_func `
+ - pressure equality constraints: :py:meth:`combustion_pressure_structure_matrix `
+ - constraints for stoichiometry of the reaction: :py:meth:`stoichiometry_func `
+ - constraint for energy balance: :py:meth:`energy_balance_func `
+ - equation for thermal input to power generation relation: :py:meth:`tiP_char_func `
+ - equation for thermal input to heating port 1 heat generation relation: :py:meth:`Q1_char_func `
+ - equation for thermal input to heating port 2 heat generation relation: :py:meth:`Q2_char_func `
+ - equation for thermal input to heat dissipation relation: :py:meth:`Qloss_char_func `
+ - equation for mass flow equality at heating ports: :py:meth:`variable_equality_structure_matrix `
+ - equation for fluid composition equality at heating ports: :py:meth:`variable_equality_structure_matrix `
- Available fuels
+ When a power or heat connector is attached:
- - methane, ethane, propane, butane, hydrogen, carbon monoxide, nDodecane
+ - energy_connector_balance: :py:meth:`energy_connector_balance_func `
- .. tip::
-
- You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
- the :code:`tespy.tools` module and passing the respective information.
- See in the example of
- :py:class:`tespy.components.combustion.base.CombustionChamber`, how to
- do that.
+ Parameters
+ ----------
- Inlets/Outlets
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
- - in1, in2 (cooling water), in3, in4 (air and fuel)
- - out1, out2 (cooling water), out3 (flue gas)
+ design : list
+ List containing design parameters (stated as String).
- Power outlets
+ design_path : str
+ Path to the components design case.
- - power
+ dp1 : float, dict
+ Heating port 1 inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- Image
+ dp2 : float, dict
+ Heating port 2 inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- .. image:: /api/_images/CombustionEngine.svg
- :alt: flowsheet of the combustion engine
- :align: center
- :class: only-light
+ eta_mech : float
- .. image:: /api/_images/CombustionEngine_darkmode.svg
- :alt: flowsheet of the combustion engine
- :align: center
- :class: only-dark
- .. note::
+ f_nox : float, dict
+ Mass-based nitric oxide (NO) generation rate in flue gas in mass of
+ created NO per mass of fuel and air input. Only active if value is
+ explicitly set. Quantity: :code:`ratio`.
- The fuel and the air components can be connected to either of the
- inlets.
-
- Parameters
- ----------
label : str
The label of the component.
- design : list
- List containing design parameters (stated as String).
-
- offdesign : list
- List containing offdesign parameters (stated as String).
+ lamb : float, dict
+ Available oxygen to stoichiometric oxygen ratio. Quantity:
+ :code:`ratio`.
+ Equation: :py:meth:`lambda_func `.
- design_path : str
- Path to the components design case.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- local_offdesign : boolean
+ local_offdesign : bool
Treat this component in offdesign mode in a design calculation.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ P : float, dict, :code:`"var"`
+ Mechanical power generated by the engine. Quantity: :code:`power`. Can
+ be set as a system variable by passing :code:`"var"` as its value.
- printout : boolean
- Include this component in the network's results printout.
+ pr1 : float, dict
+ Heating port 1 outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- lamb : float, dict
- Air to stoichiometric air ratio, :math:`\lambda/1`.
+ pr2 : float, dict
+ Heating port 2 outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- ti : float, dict
- Thermal input, (:math:`{LHV \cdot \dot{m}_f}`), :math:`ti/\text{W}`.
-
- P : float, dict, :code:`"var"`
- Power output, :math:`P/\text{W}`.
+ printout : bool
+ Include this component in the network's results printout.
Q1 : float, dict
- Heat output 1, :math:`\dot Q/\text{W}`.
+ Heating port 1 heat production. Quantity: :code:`heat`.
+ Equation: :py:meth:`Q1_func `.
+
+ Q1_char : tespy.tools.characteristics.CharLine, dict
+ Thermal input to heat production of port 1 lookup table.
Q2 : float, dict
- Heat output 2, :math:`\dot Q/\text{W}`.
+ Heating port 2 heat production. Quantity: :code:`heat`.
+ Equation: :py:meth:`Q2_func `.
+
+ Q2_char : tespy.tools.characteristics.CharLine, dict
+ Thermal input to heat production of port 2 lookup table.
Qloss : float, dict, :code:`"var"`
- Heat loss, :math:`\dot Q_{loss}/\text{W}`.
+ Heat dissipation. Quantity: :code:`heat`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
- pr1 : float, dict, :code:`"var"`
- Pressure ratio heat outlet 1, :math:`pr/1`.
+ Qloss_char : tespy.tools.characteristics.CharLine, dict
+ Thermal input to heat dissipation lookup table.
- pr2 : float, dict, :code:`"var"`
- Pressure ratio heat outlet 2, :math:`pr/1`.
+ T_v_inner : float
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient heating loop 1,
- :math:`\zeta_1/\frac{1}{\text{m}^4}`.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient heating loop 2,
- :math:`\zeta_2/\frac{1}{\text{m}^4}`.
+ ti : float, dict
+ Thermal input of fuel: lower heating value multiplied with mass flow.
+ Quantity: :code:`heat`.
+ Equation: :py:meth:`ti_func `.
tiP_char : tespy.tools.characteristics.CharLine, dict
- Characteristic line linking fuel input to power output.
+ Thermal input to power lookup table.
- Q1_char : tespy.tools.characteristics.CharLine, dict
- Characteristic line linking heat output 1 to power output.
+ zeta1 : float, dict
+ Heating port 1 non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- Q2_char : tespy.tools.characteristics.CharLine, dict
- Characteristic line linking heat output 2 to power output.
+ zeta2 : float, dict
+ Heating port 2 non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- Qloss_char : tespy.tools.characteristics.CharLine, dict
- Characteristic line linking heat loss to power output.
+ Notes
+ -----
- eta_mech : float
- Value of internal efficiency of the combustion engine. This value is
- required to determine the (virtual) thermodynamic temperature of heat
- inside the combustion engine for the entropy balance calculation.
- Default value is 0.85.
+ .. tip::
- Note
- ----
- Parameters available through entropy balance are listed in the respective
- method:
+ You can add more fluids by importing :code:`COMBUSTION_FLUIDS` from
+ the :code:`tespy.tools` module and passing the respective information.
+ See in the example of
+ :py:class:`tespy.components.combustion.base.CombustionChamber`, how to
+ do that. To retrieve the fluids available by default run:
+
+ .. code-block:: python
+
+ from tespy.tools.global_vars import COMBUSTION_FLUIDS
+ COMBUSTION_FLUIDS.fluids.keys()
- - :py:meth:`tespy.components.combustion.engine.CombustionEngine.entropy_balance`
+ .. note::
+
+ The fuel and the air components can be connected to either of the
+ inlets.
Example
-------
The combustion chamber calculates energy input due to combustion as well as
the flue gas composition based on the type of fuel and the amount of
oxygen supplied. In this example a mixture of methane, hydrogen and
- carbondioxide is used as fuel. There are two cooling ports, the cooling
+ carbon dioxide is used as fuel. There are two cooling ports, the cooling
water will flow through them in parallel.
>>> from tespy.components import (Sink, Source, CombustionEngine, Merge,
@@ -263,7 +275,7 @@ def get_parameters(self):
params = super().get_parameters()
params.update({
'P': dc_cp(
- _val=-1e6, max_val=-1, quantity="power", _potential_var=True,
+ _val=-1e6, max_val=-1, quantity="power", _allows_var=True,
description="mechanical power generated by the engine",
calc=self._calc_P
),
@@ -286,7 +298,7 @@ def get_parameters(self):
calc=self._calc_Q2
),
'Qloss': dc_cp(
- _val=-1e5, max_val=-1, quantity="heat", _potential_var=True,
+ _val=-1e5, max_val=-1, quantity="heat", _allows_var=True,
description="heat dissipation",
calc=self._calc_Qloss
),
@@ -350,8 +362,8 @@ def get_parameters(self):
'Qloss_char': dc_cc(
description="thermal input to heat dissipation lookup table"
),
- 'eta_mech': dc_simple(_val=0.85),
- 'T_v_inner': dc_simple()
+ 'eta_mech': dc_simple(_val=0.85, dtype="float"),
+ 'T_v_inner': dc_simple(dtype="float")
})
return params
@@ -959,7 +971,7 @@ def entropy_balance(self):
reaction, we need to define the same reference state for the entropy
balance of the combustion. The temperature for the reference state is
set to 25 °C and reference pressure is 1 bar. As the water in the flue
- gas may be liquid but the thermodynmic temperature of heat of
+ gas may be liquid but the thermodynamic temperature of heat of
combustion refers to the lower heating value, the water is forced to
gas at the reference point by considering evaporation.
diff --git a/src/tespy/components/component.py b/src/tespy/components/component.py
index c883ce185..d818ec6cf 100644
--- a/src/tespy/components/component.py
+++ b/src/tespy/components/component.py
@@ -209,13 +209,13 @@ def set_attr(self, **kwargs):
def _set_parameter(self, key, value):
try:
self.parameters[key].accept(value)
- except TypeError as e:
+ except (TypeError, ValueError) as e:
msg = (
- f"Bad datatype for keyword argument '{key}' on "
+ f"Bad value for keyword argument '{key}' on "
f"component {self.label}: {e}"
)
logger.error(msg)
- raise TypeError(msg) from e
+ raise type(e)(msg) from e
def _set_design_list(self, key, value):
if not isinstance(value, list):
@@ -573,6 +573,50 @@ def get_bypass_constraints(self):
logger.exception(msg)
raise NotImplementedError(msg)
+ @classmethod
+ def port_schema(cls):
+ """
+ Return a description of the component's port topology for UI tooling.
+
+ The default implementation derives fixed-port descriptions from the
+ ``@staticmethod`` ``inlets``/``outlets``/``powerinlets``/
+ ``poweroutlets`` methods. Subclasses with variable or conditional
+ port counts must override this method.
+
+ Returns
+ -------
+ dict
+ Keys are ``"inlets"``, ``"outlets"``, ``"powerinlets"``,
+ ``"poweroutlets"``, ``"heatinlets"``, ``"heatoutlets"``.
+ Each value is a dict with at least a ``"type"`` key:
+
+ ``{"type": "fixed", "ports": [...]}``
+ The port list is static.
+
+ ``{"type": "variable", "parameter": str, "pattern": str, "min": int}``
+ Port count is controlled by *parameter*. *pattern* is a
+ Python format string where ``{n}`` is replaced by the
+ 1-based port index (e.g. ``"in{n}"``).
+ """
+ import inspect
+ result = {}
+ for port_type in (
+ "inlets", "outlets",
+ "powerinlets", "poweroutlets",
+ "heatinlets", "heatoutlets",
+ ):
+ attr = inspect.getattr_static(cls, port_type, None)
+ if isinstance(attr, staticmethod):
+ result[port_type] = {
+ "type": "fixed",
+ "ports": getattr(cls, port_type)(),
+ }
+ else:
+ # Instance method — subclass should override port_schema()
+ # but provide a safe fallback so schema generation never crashes.
+ result[port_type] = {"type": "unknown"}
+ return result
+
@staticmethod
def inlets():
return []
diff --git a/src/tespy/components/displacementmachinery/base.py b/src/tespy/components/displacementmachinery/base.py
index 7ac38299b..7e33e158e 100644
--- a/src/tespy/components/displacementmachinery/base.py
+++ b/src/tespy/components/displacementmachinery/base.py
@@ -23,57 +23,58 @@ class DisplacementMachine(Component):
r"""
Parent class for displacement machines
- **Mandatory Equations**
+ Ports
+ -----
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ Fluid inlets: in1
- **Optional Equations**
+ Fluid outlets: out1
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.displacementmachinery.base.DisplacementMachine.energy_balance_func`
+ Mandatory Equations
+ -------------------
- Inlets/Outlets
-
- - in1
- - out1
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
+ label : str
+ The label of the component.
+
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- printout : boolean
- Include this component in the network's results printout.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
P : float, dict
- Power, :math:`P/\text{W}`
+ Power input of the component. Quantity: :code:`power`.
+ Equation: :py:meth:`energy_balance_func `.
pr : float, dict
- Outlet to inlet pressure ratio, :math:`pr/1`
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- dp : float, dict
- Inlet to outlet pressure difference, :math:`dp/\text{p}_\text{unit}`
- Is specified in the Network's pressure unit
+ printout : bool
+ Include this component in the network's results printout.
Example
-------
diff --git a/src/tespy/components/displacementmachinery/polynomial_compressor.py b/src/tespy/components/displacementmachinery/polynomial_compressor.py
index 078c08f8f..5eb8ccc26 100644
--- a/src/tespy/components/displacementmachinery/polynomial_compressor.py
+++ b/src/tespy/components/displacementmachinery/polynomial_compressor.py
@@ -34,93 +34,140 @@ class PolynomialCompressor(DisplacementMachine):
See the example for the intended use of the component.
- **Mandatory Equations**
+ .. image:: /api/_images/components/PolynomialCompressor.svg
+ :alt: flowsheet of the polynomialcompressor
+ :align: center
+ :class: only-light
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ .. image:: /api/_images/components/PolynomialCompressor_darkmode.svg
+ :alt: flowsheet of the polynomialcompressor
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.energy_balance_group_func`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.eta_s_group_func`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.eta_vol_group_func`
+ Fluid inlets: in1
- Inlets/Outlets
+ Fluid outlets: out1
- - in1
- - out1
+ Power inlets: power
- Optional inlets
+ Mandatory Equations
+ -------------------
- - power
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
- Image
+ When a power or heat connector is attached:
- .. image:: /api/_images/Compressor.svg
- :alt: flowsheet of the compressor
- :align: center
- :class: only-light
-
- .. image:: /api/_images/Compressor_darkmode.svg
- :alt: flowsheet of the compressor
- :align: center
- :class: only-dark
+ - energy balance between for power connector and the power consumption of the compressor: :py:meth:`energy_connector_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
-
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dissipation_ratio : float, dict
+ Heat dissipation ratio relative to power consumption. Quantity:
+ :code:`ratio`.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- printout : boolean
- Include this component in the network's results printout.
+ energy_balance_group : GroupedComponentProperties
+ Energy balance equation for fixed power and dissipation ratio. Elements:
+ :code:`P`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`energy_balance_group_func `.
- P : float, dict
- Compressor power, :math:`P/\text{W}`
+ eta_s : float, dict
+ Isentropic efficiency. Quantity: :code:`efficiency`.
- dissipation_ratio : float, dict
- Relative heat loss of compressor, :math:`Q_\text{diss,rel}/1`
+ eta_s_group : GroupedComponentProperties
+ Isentropic efficiency equation with fixed efficiency. Elements:
+ :code:`eta_s`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`eta_s_group_func `.
- eta_s : float, dict
- Isentropic efficiency, :math:`\eta_\text{s}/1`
+ eta_s_poly : list
+ Polynomial coefficients for isentropic efficiency.
- eta_s_poly : array, dict
- Polynomial coefficients for isentropic efficiency
+ eta_s_poly_group : GroupedComponentProperties
+ Isentropic efficiency equation based on polynomial coefficients.
+ Elements: :code:`eta_s_poly`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`eta_s_poly_group_func `.
eta_vol : float, dict
- Volumetric efficiency, :math:`\eta_\text{vol}/1`
+ Volumetric efficiency. Quantity: :code:`efficiency`.
+
+ eta_vol_group : GroupedComponentProperties
+ Elements: :code:`reference_state`, :code:`eta_vol`, :code:`frequency`.
+ Equation: :py:meth:`eta_vol_frequency_group_func `.
+
+ eta_vol_group_rpm : GroupedComponentProperties
+ Displacement equation based on fixed volumetric efficiency. Elements:
+ :code:`reference_state`, :code:`eta_vol`, :code:`rpm`.
+ Equation: :py:meth:`eta_vol_group_func `.
+
+ eta_vol_poly : list
+ Polynomial coefficients for volumetric efficiency.
- eta_vol_poly : array, dict
- Polynomial coefficients for volumetric efficiency
+ eta_vol_poly_group : GroupedComponentProperties
+ Displacement equation based on polynomial coefficients for volumetric
+ efficiency. Elements: :code:`reference_state`, :code:`eta_vol_poly`,
+ :code:`frequency`.
+ Equation: :py:meth:`eta_vol_poly_frequency_group_func `.
- reference_state: dict
- Reference state for the polynomial and displacement.
+ eta_vol_poly_group_rpm : GroupedComponentProperties
+ Displacement equation based on polynomial coefficients for volumetric
+ efficiency. Elements: :code:`reference_state`, :code:`eta_vol_poly`,
+ :code:`rpm`.
+ Equation: :py:meth:`eta_vol_poly_group_func `.
+
+ frequency : float, dict, :code:`"var"`
+ Compressor frequency. Quantity: :code:`frequency`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ label : str
+ The label of the component.
+
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
+
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ P : float, dict
+ Power consumption. Quantity: :code:`power`.
pr : float, dict
- Outlet to inlet pressure ratio, :math:`pr/1`
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- dp : float, dict
- Inlet to outlet pressure difference, :math:`dp/\text{p}_\text{unit}`
- Is specified in the Network's pressure unit
+ printout : bool
+ Include this component in the network's results printout.
+
+ Q_diss : float, dict
+ Heat dissipation. Quantity: :code:`heat`.
+
+ reference_state : dict
+ Reference state definition for the scaling of displacement with
+ compressor rpm.
+
+ rpm : float, dict, :code:`"var"`
+ Compressor frequency. Can be set as a system variable by passing
+ :code:`"var"` as its value.
Example
-------
@@ -365,6 +412,7 @@ def get_mandatory_constraints(self):
constraints["energy_connector_balance"] = dc_cmc(**{
"func": self.energy_connector_balance_func,
"dependents": self.energy_connector_dependents,
+ "description": "energy balance between for power connector and the power consumption of the compressor.",
"num_eq_sets": 1
})
@@ -398,21 +446,24 @@ def get_parameters(self):
description="heat dissipation ratio relative to power consumption"
),
"frequency": dc_cp(
- min_val=0, max_val=10000, is_result=True, _potential_var=True,
+ min_val=0, max_val=10000, is_result=True, _allows_var=True,
quantity="frequency",
description="compressor frequency"
),
"rpm": dc_cp(
- min_val=0, is_result=True, _potential_var=True,
+ min_val=0, is_result=True, _allows_var=True,
description="compressor frequency"
),
"reference_state": dc_simple(
+ dtype="dict",
description="reference state definition for the scaling of displacement with compressor rpm"
),
"eta_s_poly": dc_simple(
+ dtype="list",
description="polynomial coefficients for isentropic efficiency"
),
"eta_vol_poly": dc_simple(
+ dtype="list",
description="polynomial coefficients for volumetric efficiency"
),
"eta_vol_poly_group_rpm": dc_gcp(
@@ -506,6 +557,20 @@ def _calc_eta_vol(self):
# this is a bit different that in other cases, because the power cannot
# directly be deduced from the change in enthalpy
def energy_connector_balance_func(self):
+ r"""Equation for equality of power connector power with component drawn
+ power.
+
+ .. math::
+
+ 0 = \dot m \cdot
+ \frac{ h_\text{out} - h_\text{in}}{1 - \dot Q_\text{diss,rel}}
+ - \dot E
+
+ Returns
+ -------
+ float
+ residual
+ """
return self._calc_P() - self.power_inl[0].E.val_SI
def energy_connector_dependents(self):
diff --git a/src/tespy/components/displacementmachinery/polynomial_compressor_with_cooling.py b/src/tespy/components/displacementmachinery/polynomial_compressor_with_cooling.py
index 6ea8ae514..3f15161ce 100644
--- a/src/tespy/components/displacementmachinery/polynomial_compressor_with_cooling.py
+++ b/src/tespy/components/displacementmachinery/polynomial_compressor_with_cooling.py
@@ -27,108 +27,158 @@ class PolynomialCompressorWithCooling(PolynomialCompressor):
See the example for the intended use of the component.
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - cooling energy balance: :py:meth:`tespy.components.displacementmachinery.polynomial_compressor_with_cooling.PolynomialCompressorWithCooling.cooling_energy_balance_func`
+ .. image:: /api/_images/components/PolynomialCompressorWithCooling.svg
+ :alt: flowsheet of the polynomialcompressorwithcooling
+ :align: center
+ :class: only-light
- **Optional Equations**
+ .. image:: /api/_images/components/PolynomialCompressorWithCooling_darkmode.svg
+ :alt: flowsheet of the polynomialcompressorwithcooling
+ :align: center
+ :class: only-dark
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.energy_balance_group_func`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.eta_s_group_func`
- - :py:meth:`tespy.components.displacementmachinery.polynomial_compressor.PolynomialCompressor.eta_vol_group_func`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix` for cooling
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix` for cooling
+ Ports
+ -----
- Inlets/Outlets
+ Fluid inlets: in1, in2
- - in1, in2 (cooling)
- - out1, out2 (cooling)
+ Fluid outlets: out1, out2
- Optional inlets
+ Power inlets: power
- - power
+ Mandatory Equations
+ -------------------
- Image
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - energy balance for the cooling ports: :py:meth:`cooling_energy_balance_func `
- .. image:: /api/_images/PolynomialCompressorWithCooling.svg
- :alt: flowsheet of the compressor
- :align: center
- :class: only-light
+ When a power or heat connector is attached:
- .. image:: /api/_images/PolynomialCompressorWithCooling_darkmode.svg
- :alt: flowsheet of the compressor
- :align: center
- :class: only-dark
+ - energy balance between for power connector and the power consumption of the compressor: :py:meth:`energy_connector_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
-
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
-
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ dissipation_ratio : float, dict
+ Heat dissipation ratio relative to power consumption. Quantity:
+ :code:`ratio`.
- printout : boolean
- Include this component in the network's results printout.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- P : float, dict
- Compressor power, :math:`P/\text{W}`
+ dp_cooling : float, dict
+ Cooling port inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- dissipation_ratio : float, dict
- Relative heat loss of compressor, :math:`Q_\text{diss,rel}/1`
+ energy_balance_group : GroupedComponentProperties
+ Energy balance equation for fixed power and dissipation ratio. Elements:
+ :code:`P`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`energy_balance_group_func `.
eta_recovery : float, dict
- Share of heat recovered in the cooling fluid of the heat loss of
- compressor, :math:`Q_\text{diss,rel}/1`
+ Share of dissipated heat usable in cooling port. Quantity:
+ :code:`efficiency`.
eta_s : float, dict
- Isentropic efficiency, :math:`\eta_\text{s}/1`
+ Isentropic efficiency. Quantity: :code:`efficiency`.
- eta_s_poly : array, dict
- Polynomial coefficients for isentropic efficiency
+ eta_s_group : GroupedComponentProperties
+ Isentropic efficiency equation with fixed efficiency. Elements:
+ :code:`eta_s`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`eta_s_group_func `.
+
+ eta_s_poly : list
+ Polynomial coefficients for isentropic efficiency.
+
+ eta_s_poly_group : GroupedComponentProperties
+ Isentropic efficiency equation based on polynomial coefficients.
+ Elements: :code:`eta_s_poly`, :code:`dissipation_ratio`.
+ Equation: :py:meth:`eta_s_poly_group_func `.
eta_vol : float, dict
- Volumetric efficiency, :math:`\eta_\text{vol}/1`
+ Volumetric efficiency. Quantity: :code:`efficiency`.
- eta_vol_poly : array, dict
- Polynomial coefficients for volumetric efficiency
+ eta_vol_group : GroupedComponentProperties
+ Elements: :code:`reference_state`, :code:`eta_vol`, :code:`frequency`.
+ Equation: :py:meth:`eta_vol_frequency_group_func `.
- reference_state: dict
- Reference state for the polynomial and displacement.
+ eta_vol_group_rpm : GroupedComponentProperties
+ Displacement equation based on fixed volumetric efficiency. Elements:
+ :code:`reference_state`, :code:`eta_vol`, :code:`rpm`.
+ Equation: :py:meth:`eta_vol_group_func `.
- pr : float, dict
- Outlet to inlet pressure ratio, :math:`pr/1`
+ eta_vol_poly : list
+ Polynomial coefficients for volumetric efficiency.
- dp : float, dict
- Inlet to outlet pressure difference, :math:`dp/\text{p}_\text{unit}`
- Is specified in the Network's pressure unit
+ eta_vol_poly_group : GroupedComponentProperties
+ Displacement equation based on polynomial coefficients for volumetric
+ efficiency. Elements: :code:`reference_state`, :code:`eta_vol_poly`,
+ :code:`frequency`.
+ Equation: :py:meth:`eta_vol_poly_frequency_group_func `.
+
+ eta_vol_poly_group_rpm : GroupedComponentProperties
+ Displacement equation based on polynomial coefficients for volumetric
+ efficiency. Elements: :code:`reference_state`, :code:`eta_vol_poly`,
+ :code:`rpm`.
+ Equation: :py:meth:`eta_vol_poly_group_func `.
+
+ frequency : float, dict, :code:`"var"`
+ Compressor frequency. Quantity: :code:`frequency`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ label : str
+ The label of the component.
+
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
+
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ P : float, dict
+ Power consumption. Quantity: :code:`power`.
+
+ pr : float, dict
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
pr_cooling : float, dict
- Outlet to inlet pressure ratio for cooling, :math:`pr/1`
+ Cooling port outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- dp_cooling : float, dict
- Inlet to outlet pressure difference for cooling,
- :math:`dp/\text{p}_\text{unit}`
- Is specified in the Network's pressure unit
+ printout : bool
+ Include this component in the network's results printout.
+
+ Q_diss : float, dict
+ Heat dissipation. Quantity: :code:`heat`.
+
+ reference_state : dict
+ Reference state definition for the scaling of displacement with
+ compressor rpm.
+
+ rpm : float, dict, :code:`"var"`
+ Compressor frequency. Can be set as a system variable by passing
+ :code:`"var"` as its value.
+
+ td_minimal : float, dict
+ Theoretical minimal temperature difference between working and cooling
+ fluid. Quantity: :code:`temperature_difference`.
Example
-------
diff --git a/src/tespy/components/energy/_bus.py b/src/tespy/components/energy/_bus.py
index 30779b658..ddbbdd30f 100644
--- a/src/tespy/components/energy/_bus.py
+++ b/src/tespy/components/energy/_bus.py
@@ -25,6 +25,18 @@ class _EnergyBus(Component):
_energy_port: str = None
+ @classmethod
+ def port_schema(cls):
+ is_power = cls._energy_port == "power"
+ return {
+ "inlets": {"type": "fixed", "ports": []},
+ "outlets": {"type": "fixed", "ports": []},
+ "powerinlets": {"type": "variable", "parameter": "num_in", "pattern": "power_in{n}", "min": 1} if is_power else {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "variable", "parameter": "num_out", "pattern": "power_out{n}", "min": 1} if is_power else {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []} if is_power else {"type": "variable", "parameter": "num_in", "pattern": "heat_in{n}", "min": 1},
+ "heatoutlets": {"type": "fixed", "ports": []} if is_power else {"type": "variable", "parameter": "num_out", "pattern": "heat_out{n}", "min": 1},
+ }
+
def powerinlets(self):
if self._energy_port == "power":
return [f"power_in{i + 1}" for i in range(self.num_in.val)]
@@ -55,8 +67,8 @@ def _energy_outl(self):
def get_parameters(self):
return {
- "num_in": dc_simple(val=0, description="number of inlets"),
- "num_out": dc_simple(val=0, description="number of outlets"),
+ "num_in": dc_simple(val=0, dtype="int", description="number of inlets"),
+ "num_out": dc_simple(val=0, dtype="int", description="number of outlets"),
}
def get_mandatory_constraints(self):
diff --git a/src/tespy/components/energy/_sink.py b/src/tespy/components/energy/_sink.py
index a44aa29b7..bf7f5a08a 100644
--- a/src/tespy/components/energy/_sink.py
+++ b/src/tespy/components/energy/_sink.py
@@ -21,6 +21,18 @@ class _EnergySink(Component):
_energy_port: str = None
+ @classmethod
+ def port_schema(cls):
+ is_power = cls._energy_port == "power"
+ return {
+ "inlets": {"type": "fixed", "ports": []},
+ "outlets": {"type": "fixed", "ports": []},
+ "powerinlets": {"type": "fixed", "ports": ["power"] if is_power else []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": [] if is_power else ["heat"]},
+ "heatoutlets": {"type": "fixed", "ports": []},
+ }
+
def powerinlets(self):
return ["power"] if self._energy_port == "power" else []
diff --git a/src/tespy/components/energy/_source.py b/src/tespy/components/energy/_source.py
index 5fe2e2d04..bf8dc5265 100644
--- a/src/tespy/components/energy/_source.py
+++ b/src/tespy/components/energy/_source.py
@@ -21,6 +21,18 @@ class _EnergySource(Component):
_energy_port: str = None
+ @classmethod
+ def port_schema(cls):
+ is_power = cls._energy_port == "power"
+ return {
+ "inlets": {"type": "fixed", "ports": []},
+ "outlets": {"type": "fixed", "ports": []},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": ["power"] if is_power else []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": [] if is_power else ["heat"]},
+ }
+
def poweroutlets(self):
return ["power"] if self._energy_port == "power" else []
diff --git a/src/tespy/components/heat/bus.py b/src/tespy/components/heat/bus.py
index b35ee4324..72d26bf72 100644
--- a/src/tespy/components/heat/bus.py
+++ b/src/tespy/components/heat/bus.py
@@ -25,47 +25,51 @@ class HeatBus(_EnergyBus):
:class:`~tespy.components.PowerSource` / :class:`~tespy.components.PowerSink`
with :class:`~tespy.components.HeatSource` / :class:`~tespy.components.HeatSink`.
- **Mandatory Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.energy._bus._EnergyBus.energy_balance_func`
+ Heat inlets: heat_in1, heat_in2, ... (variable, count set by :code:`num_in`)
- HeatConnection inlets/outlets
+ Heat outlets: heat_out1, heat_out2, ... (variable, count set by :code:`num_out`)
- - specify number of inlets with :code:`num_in`: 'heat_in1', ...
- - specify number of outlets with :code:`num_out`: 'heat_out1', ...
+ Mandatory Equations
+ -------------------
+
+ - energy balance over all inflows and outflows: :py:meth:`energy_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
-
- printout : boolean
- Include this component in the network's results printout.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- num_in : float
+ num_in : int
Number of inlets.
- num_out : float
+ num_out : int
Number of outlets.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
+ Include this component in the network's results printout.
+
Example
-------
A HeatBus collects heat from two sources and distributes it to one sink.
diff --git a/src/tespy/components/heat/sink.py b/src/tespy/components/heat/sink.py
index c17d3c3b8..8cc0e8b20 100644
--- a/src/tespy/components/heat/sink.py
+++ b/src/tespy/components/heat/sink.py
@@ -19,30 +19,41 @@ class HeatSink(_EnergySink):
r"""
A heat flow drains in a HeatSink.
+ Ports
+ -----
+
+ Heat inlets: heat
+
+ Mandatory Equations
+ -------------------
+
+ None
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
Example
diff --git a/src/tespy/components/heat/source.py b/src/tespy/components/heat/source.py
index cc293bcc6..98eb6a120 100644
--- a/src/tespy/components/heat/source.py
+++ b/src/tespy/components/heat/source.py
@@ -19,30 +19,41 @@ class HeatSource(_EnergySource):
r"""
A heat flow emerges from a HeatSource.
+ Ports
+ -----
+
+ Heat outlets: heat
+
+ Mandatory Equations
+ -------------------
+
+ None
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
Example
diff --git a/src/tespy/components/heat_exchangers/base.py b/src/tespy/components/heat_exchangers/base.py
index 8d925912f..f6a7e96f3 100644
--- a/src/tespy/components/heat_exchangers/base.py
+++ b/src/tespy/components/heat_exchangers/base.py
@@ -40,138 +40,148 @@ class HeatExchanger(Component):
- :py:class:`tespy.components.heat_exchangers.desuperheater.Desuperheater`
- :py:class:`tespy.components.heat_exchangers.movingboundary.MovingBoundaryHeatExchanger`
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
-
- **Optional Equations**
-
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_char_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_min_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_cold_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_max_func`
-
- For hot and cold side individually:
+ .. image:: /api/_images/components/HeatExchanger.svg
+ :alt: flowsheet of the heatexchanger
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
+ .. image:: /api/_images/components/HeatExchanger_darkmode.svg
+ :alt: flowsheet of the heatexchanger
+ :align: center
+ :class: only-dark
- Inlets/Outlets
+ Ports
+ -----
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
+ Fluid inlets: in1, in2
- Image
+ Fluid outlets: out1, out2
- .. image:: /api/_images/HeatExchanger.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/HeatExchanger_darkmode.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-dark
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ eff_cold : float, dict
+ Heat exchanger effectiveness for cold side. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`eff_cold_func `.
- printout : boolean
- Include this component in the network's results printout.
+ eff_hot : float, dict
+ Heat exchanger effectiveness for hot side. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_hot_func `.
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ eff_max : float, dict
+ Maximum heat exchanger effectiveness. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_max_func `.
- pr1 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
- pr2 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
- dp1 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at hot side, unit is the network's
- pressure unit!.
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
- dp2 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at cold side, unit is the network's
- pressure unit!.
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ label : str
+ The label of the component.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- ttd_l : float, dict
- Lower terminal temperature difference :math:`ttd_\text{l}/\text{K}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- ttd_u : float, dict
- Upper terminal temperature difference :math:`ttd_\text{u}/\text{K}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- ttd_min : float, dict
- Minimum terminal temperature difference :math:`ttd_\text{min}/\text{K}`.
+ pr1 : float, dict
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_cold : float, dict
- Cold side heat exchanger effectiveness :math:`eff_\text{cold}/\text{1}`.
+ pr2 : float, dict
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_hot : float, dict
- Hot side heat exchanger effectiveness :math:`eff_\text{hot}/\text{1}`.
+ printout : bool
+ Include this component in the network's results printout.
- eff_max : float, dict
- Max value of hot and cold side heat exchanger effectiveness values
- :math:`eff_\text{max}/\text{1}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- kA : float, dict
- Area independent heat transfer coefficient,
- :math:`kA/\frac{\text{W}}{\text{K}}`.
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
- kA_char : dict
- Area independent heat transfer coefficient characteristic.
+ ttd_l : float, dict
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
- kA_char1 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for hot side heat transfer coefficient.
+ ttd_min : float, dict
+ Minimum terminal temperature difference. Quantity:
+ :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_min_func `.
- kA_char2 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for cold side heat transfer coefficient.
-
- Note
- ----
- The HeatExchanger and subclasses (
- :py:class:`tespy.components.heat_exchangers.condenser.Condenser`,
- :py:class:`tespy.components.heat_exchangers.desuperheater.Desuperheater`)
- are countercurrent heat exchangers. Equations (:code:`kA`, :code:`ttd_u`,
- :code:`ttd_l`) do not work for directcurrent and crosscurrent or
- combinations of different types.
+ ttd_u : float, dict
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
+
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
+
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
+
+ Notes
+ -----
+
+ .. note::
+
+ The HeatExchanger and subclasses (
+ :py:class:`tespy.components.heat_exchangers.condenser.Condenser`,
+ :py:class:`tespy.components.heat_exchangers.desuperheater.Desuperheater`)
+ are countercurrent heat exchangers. Equations (:code:`kA`, :code:`ttd_u`,
+ :code:`ttd_l`) do not work for directcurrent and crosscurrent or
+ combinations of different types.
Example
-------
diff --git a/src/tespy/components/heat_exchangers/condenser.py b/src/tespy/components/heat_exchangers/condenser.py
index 7b9084456..1ecd8eaf6 100644
--- a/src/tespy/components/heat_exchangers/condenser.py
+++ b/src/tespy/components/heat_exchangers/condenser.py
@@ -28,151 +28,155 @@ class Condenser(HeatExchanger):
The condensing fluid is cooled by the cold side fluid. The fluid on the hot
side of the condenser must be pure. Subcooling is available.
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
- - condensate outlet state, function can be disabled by specifying
- :code:`set_attr(subcooling=True)`
- :py:meth:`tespy.components.heat_exchangers.condenser.Condenser.subcooling_func`
-
- **Optional Equations**
-
- The :code:`Condenser` class uses an individual definition for the
- calculation of the logarithmic temperature difference
-
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_char_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_min_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_cold_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_max_func`
-
- For hot and cold side individually:
-
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
-
- Inlets/Outlets
-
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
-
- Image
-
- .. image:: /api/_images/Condenser.svg
+ .. image:: /api/_images/components/Condenser.svg
:alt: flowsheet of the condenser
:align: center
:class: only-light
- .. image:: /api/_images/Condenser_darkmode.svg
+ .. image:: /api/_images/components/Condenser_darkmode.svg
:alt: flowsheet of the condenser
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1, in2
+
+ Fluid outlets: out1, out2
+
+ Mandatory Equations
+ -------------------
+
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ eff_cold : float, dict
+ Heat exchanger effectiveness for cold side. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`eff_cold_func `.
- printout : boolean
- Include this component in the network's results printout.
+ eff_hot : float, dict
+ Heat exchanger effectiveness for hot side. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_hot_func `.
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ eff_max : float, dict
+ Maximum heat exchanger effectiveness. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_max_func `.
- pr1 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
- pr2 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
- dp1 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at hot side, unit is the network's
- pressure unit!.
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
- dp2 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at cold side, unit is the network's
- pressure unit!.
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ label : str
+ The label of the component.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- ttd_l : float, dict
- Lower terminal temperature difference :math:`ttd_\text{l}/\text{K}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- ttd_u : float, dict
- Upper terminal temperature difference (referring to saturation
- temperature of condensing fluid) :math:`ttd_\text{u}/\text{K}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- ttd_min : float, dict
- Minimum terminal temperature difference :math:`ttd_\text{min}/\text{K}`.
+ pr1 : float, dict
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_cold : float, dict
- Cold side heat exchanger effectiveness :math:`eff_\text{cold}/\text{1}`.
+ pr2 : float, dict
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_hot : float, dict
- Hot side heat exchanger effectiveness :math:`eff_\text{hot}/\text{1}`.
+ printout : bool
+ Include this component in the network's results printout.
- eff_max : float, dict
- Max value of hot and cold side heat exchanger effectiveness values
- :math:`eff_\text{max}/\text{1}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- kA : float, dict
- Area independent heat transfer coefficient,
- :math:`kA/\frac{\text{W}}{\text{K}}`.
+ subcooling : bool
+ Allow subcooling in the condenser.
+ Equation: :py:meth:`subcooling_func `.
- kA_char : tespy.tools.data_containers.SimpleDataContainer
- Area independent heat transfer coefficient characteristic.
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
- kA_char1 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for hot side heat transfer coefficient.
+ ttd_l : float, dict
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
- kA_char2 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for cold side heat transfer coefficient.
+ ttd_min : float, dict
+ Minimum terminal temperature difference. Quantity:
+ :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_min_func `.
+
+ ttd_u : float, dict
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
+
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
+
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
+
+ Notes
+ -----
- subcooling : boolean
- Enable/disable subcooling, default value: disabled.
+ .. note::
- Note
- ----
- The condenser has an additional equation for enthalpy at hot side outlet:
- The fluid leaves the component in saturated liquid state. If subcooling
- is activated, it possible to specify the enthalpy at the outgoing
- connection manually.
+ The condenser has an additional equation for enthalpy at hot side outlet:
+ The fluid leaves the component in saturated liquid state. If subcooling
+ is activated, it is possible to specify the enthalpy at the outgoing
+ connection manually.
- It has different calculation method for given heat transfer coefficient and
- upper terminal temperature dierence: These parameters refer to the
- **condensing** temperature, even if the fluid on the hot side enters the
- component in superheated state.
+ It has a different calculation method for given heat transfer coefficient and
+ upper terminal temperature difference: These parameters refer to the
+ **condensing** temperature, even if the fluid on the hot side enters the
+ component in superheated state.
Example
-------
@@ -240,7 +244,7 @@ def get_parameters(self):
params = super().get_parameters()
params.update({
'subcooling': dc_simple(
- _val=False, num_eq_sets=1,
+ _val=False, dtype="bool", num_eq_sets=1,
func=self.subcooling_func,
dependents=self.subcooling_dependents,
description="allow subcooling in the condenser"
diff --git a/src/tespy/components/heat_exchangers/desuperheater.py b/src/tespy/components/heat_exchangers/desuperheater.py
index de2dc7ba4..b37798393 100644
--- a/src/tespy/components/heat_exchangers/desuperheater.py
+++ b/src/tespy/components/heat_exchangers/desuperheater.py
@@ -24,115 +24,149 @@ class Desuperheater(HeatExchanger):
r"""
The Desuperheater cools a fluid to the saturated gas state.
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
- - :py:meth:`tespy.components.heat_exchangers.desuperheater.Desuperheater.saturated_gas_func`
-
- **Optional Equations**
-
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_char_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_min_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_cold_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_max_func`
-
- For hot and cold side individually:
-
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
-
- Inlets/Outlets
-
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
-
- Image
-
- .. image:: /api/_images/HeatExchanger.svg
+ .. image:: /api/_images/components/HeatExchanger.svg
:alt: flowsheet of the desuperheater
:align: center
:class: only-light
- .. image:: /api/_images/HeatExchanger_darkmode.svg
+ .. image:: /api/_images/components/HeatExchanger_darkmode.svg
:alt: flowsheet of the desuperheater
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1, in2
+
+ Fluid outlets: out1, out2
+
+ Mandatory Equations
+ -------------------
+
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
+ - equation for saturated gas at hot side outlet: :py:meth:`saturated_gas_func `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
+
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
+
+ eff_cold : float, dict
+ Heat exchanger effectiveness for cold side. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`eff_cold_func `.
+
+ eff_hot : float, dict
+ Heat exchanger effectiveness for hot side. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_hot_func `.
- local_design : boolean
+ eff_max : float, dict
+ Maximum heat exchanger effectiveness. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_max_func `.
+
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
+
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
+
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
+
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
+
+ label : str
+ The label of the component.
+
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- printout : boolean
- Include this component in the network's results printout.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ pr1 : float, dict
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- pr1 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ pr2 : float, dict
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- pr2 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ printout : bool
+ Include this component in the network's results printout.
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
ttd_l : float, dict
- Lower terminal temperature difference :math:`ttd_\text{l}/\text{K}`.
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
+
+ ttd_min : float, dict
+ Minimum terminal temperature difference. Quantity:
+ :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_min_func `.
ttd_u : float, dict
- Upper terminal temperature difference :math:`ttd_\text{u}/\text{K}`.
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
- kA : float, dict
- Area independent heat transfer coefficient,
- :math:`kA/\frac{\text{W}}{\text{K}}`.
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- kA_char1 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for hot side heat transfer coefficient.
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- kA_char2 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for cold side heat transfer coefficient.
+ Notes
+ -----
+
+ .. note::
- Note
- ----
- The desuperheater has an additional equation for enthalpy at hot side
- outlet: The fluid leaves the component in saturated gas state.
+ The desuperheater has an additional equation for enthalpy at hot side
+ outlet: The fluid leaves the component in saturated gas state.
Example
-------
- Overheated enthanol is cooled with water in a heat exchanger until it
+ Overheated ethanol is cooled with water in a heat exchanger until it
reaches the state of saturated gas.
>>> from tespy.components import Sink, Source, Desuperheater
diff --git a/src/tespy/components/heat_exchangers/movingboundary.py b/src/tespy/components/heat_exchangers/movingboundary.py
index 93bd3508e..01828e5d3 100644
--- a/src/tespy/components/heat_exchangers/movingboundary.py
+++ b/src/tespy/components/heat_exchangers/movingboundary.py
@@ -27,150 +27,181 @@ class MovingBoundaryHeatExchanger(SectionedHeatExchanger):
identification is done iteratively. In principle the implementations
follows :cite:`bell2015`.
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
+ .. image:: /api/_images/components/HeatExchanger.svg
+ :alt: flowsheet of the movingboundaryheatexchanger
+ :align: center
+ :class: only-light
- **Optional Equations**
+ .. image:: /api/_images/components/HeatExchanger_darkmode.svg
+ :alt: flowsheet of the movingboundaryheatexchanger
+ :align: center
+ :class: only-dark
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.UA_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.td_pinch_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.UA_cecchinato_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_min_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_cold_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_max_func`
+ Ports
+ -----
- For hot and cold side individually:
+ Fluid inlets: in1, in2
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
+ Fluid outlets: out1, out2
- Inlets/Outlets
+ Mandatory Equations
+ -------------------
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
- Image
+ Parameters
+ ----------
- .. image:: /api/_images/HeatExchanger.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-light
+ alpha_ratio : float, dict
+ Secondary to refrigerant side convective heat transfer coefficient
+ ratio. Quantity: :code:`ratio`.
- .. image:: /api/_images/HeatExchanger_darkmode.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-dark
+ area_ratio : float, dict
+ Secondary to refrigerant side heat transfer area ratio. Quantity:
+ :code:`ratio`.
- Parameters
- ----------
- label : str
- The label of the component.
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ eff_cold : float, dict
+ Heat exchanger effectiveness for cold side. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`eff_cold_func `.
- printout : boolean
- Include this component in the network's results printout.
+ eff_hot : float, dict
+ Heat exchanger effectiveness for hot side. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_hot_func `.
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ eff_max : float, dict
+ Maximum heat exchanger effectiveness. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_max_func `.
- pr1 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
- pr2 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
- dp1 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at hot side, unit is the network's
- pressure unit!.
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
- dp2 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at cold side, unit is the network's
- pressure unit!.
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ label : str
+ The label of the component.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- ttd_l : float, dict
- Lower terminal temperature difference :math:`ttd_\text{l}/\text{K}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- ttd_u : float, dict
- Upper terminal temperature difference :math:`ttd_\text{u}/\text{K}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- ttd_min : float, dict
- Minimum terminal temperature difference :math:`ttd_\text{min}/\text{K}`.
+ pr1 : float, dict
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_cold : float, dict
- Cold side heat exchanger effectiveness :math:`eff_\text{cold}/\text{1}`.
+ pr2 : float, dict
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_hot : float, dict
- Hot side heat exchanger effectiveness :math:`eff_\text{hot}/\text{1}`.
+ printout : bool
+ Include this component in the network's results printout.
- eff_max : float, dict
- Max value of hot and cold side heat exchanger effectiveness values
- :math:`eff_\text{max}/\text{1}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- UA : float, dict
- Sum of UA in all sections of the heat exchanger.
+ re_exp_r : float, dict
+ Reynolds exponent for UA modification based on refrigerant side mass
+ flow.
+
+ re_exp_sf : float, dict
+ Reynolds exponent for UA modification based on secondary fluid side mass
+ flow.
+
+ refrigerant_index : int
+ Side on which the refrigerant is flowing (0: hot, 1:cold).
+
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
td_pinch : float, dict
- Value of the lowest delta T between hot side and cold side at the
- different sections.
+ Equation for minimum pinch. Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`td_pinch_func `.
+
+ ttd_l : float, dict
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
+
+ ttd_min : float, dict
+ Minimum terminal temperature difference. Quantity:
+ :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_min_func `.
+
+ ttd_u : float, dict
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
+
+ UA : float, dict
+ Sum of UA values of all sections of heat exchanger. Quantity:
+ :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`UA_func `.
- UA_cecchinato : dict
- Group specification for partload UA modification according to
- :cite:`cecchinato2010`, for usage see details in the
- :py:meth:`tespy.components.heat_exchangers.movingboundary.MovingBoundaryHeatExchanger.UA_cecchinato_func`.
- This method can only be used in offdesign simulations!
+ UA_cecchinato : GroupedComponentProperties
+ Equation for UA modification in offdesign. Elements: :code:`re_exp_r`,
+ :code:`re_exp_sf`, :code:`alpha_ratio`, :code:`area_ratio`.
+ Equation: :py:meth:`UA_cecchinato_func `.
- alpha_ration: float
- Secondary fluid to refrigerant heat transfer coefficient ratio.
+ UA_char : GroupedComponentCharacteristics
+ Equation for sectioned UA modification based on characteristic lines.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`UA_char_func `.
- area_ration: float
- Secondary fluid to refrigerant heat transfer area ratio.
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- re_exp_r: float
- Reynolds exponent for refrigerant side.
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- re_exp_sf: float
- Reynolds exponent for secondary fluid side.
+ Notes
+ -----
- refrigerant_index: int
- Connection index for the refrigerant side, 0 if refrigerant is on hot
- side, 1 if refrigerant is on cold side.
+ .. note::
- Note
- ----
- The equations only apply to counter-current heat exchangers.
+ The equations only apply to counter-current heat exchangers.
Example
-------
diff --git a/src/tespy/components/heat_exchangers/parabolic_trough.py b/src/tespy/components/heat_exchangers/parabolic_trough.py
index faf29f8c7..b6122352a 100644
--- a/src/tespy/components/heat_exchangers/parabolic_trough.py
+++ b/src/tespy/components/heat_exchangers/parabolic_trough.py
@@ -22,133 +22,157 @@ class ParabolicTrough(SimpleHeatExchanger):
r"""
The ParabolicTrough calculates heat output from irradiance.
- **Mandatory Equations**
+ .. image:: /api/_images/components/ParabolicTrough.svg
+ :alt: flowsheet of the parabolictrough
+ :align: center
+ :class: only-light
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ .. image:: /api/_images/components/ParabolicTrough_darkmode.svg
+ :alt: flowsheet of the parabolictrough
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.energy_balance_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.darcy_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.hazen_williams_func`
- - :py:meth:`tespy.components.heat_exchangers.parabolic_trough.ParabolicTrough.energy_group_func`
+ Fluid inlets: in1
- Inlets/Outlets
+ Fluid outlets: out1
- - in1
- - out1
+ Power inlets: heat
- Image
+ Power outlets: heat
- .. image:: /api/_images/ParabolicTrough.svg
- :alt: flowsheet of the parabolic trough
- :align: center
- :class: only-light
+ Heat inlets: heat
- .. image:: /api/_images/ParabolicTrough_darkmode.svg
- :alt: flowsheet of the parabolic trough
- :align: center
- :class: only-dark
+ Heat outlets: heat
+
+ Mandatory Equations
+ -------------------
+
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+
+ When a power or heat connector is attached:
+
+ - energy_connector_balance: :py:meth:`energy_connector_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ A : float, dict, :code:`"var"`
+ Area of the parabolic trough. Quantity: :code:`area`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ aoi : float, dict
+ Angle of incidence. Quantity: :code:`angle`.
+
+ c_1 : float, dict
+ Thermal loss coefficient 1.
+
+ c_2 : float, dict
+ Thermal loss coefficient 2.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
+
+ D : float, dict, :code:`"var"`
+ Diameter of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
+
+ darcy_group : GroupedComponentProperties
+ Darcy-Weißbach equation for pressure loss. Elements: :code:`L`,
+ :code:`ks`, :code:`D`.
+ Equation: :py:meth:`darcy_func `.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dissipative : bool
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ doc : float, dict
+ Degree of cleanliness. Quantity: :code:`ratio`.
- printout : boolean
- Include this component in the network's results printout.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- Q : float, dict, :code:`"var"`
- Heat transfer, :math:`Q/\text{W}`.
+ E : float, dict, :code:`"var"`
+ Solar irradiation to the parabolic trough. Quantity: :code:`heat`. Can
+ be set as a system variable by passing :code:`"var"` as its value.
- pr : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio, :math:`pr/1`.
+ energy_group : GroupedComponentProperties
+ Energy balance equation of the parabolic trough. Elements: :code:`E`,
+ :code:`eta_opt`, :code:`aoi`, :code:`doc`, :code:`c_1`, :code:`c_2`,
+ :code:`iam_1`, :code:`iam_2`, :code:`A`, :code:`Tamb`.
+ Equation: :py:meth:`energy_group_func `.
- zeta : float, dict, :code:`"var"`
- Geometry independent friction coefficient,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ eta_opt : float, dict
+ Optical efficiency. Quantity: :code:`efficiency`.
- D : float, dict, :code:`"var"`
- Diameter of the absorber tube, :math:`D/\text{m}`.
+ hw_group : GroupedComponentProperties
+ Hazen-Williams equation for pressure loss. Elements: :code:`L`,
+ :code:`ks_HW`, :code:`D`.
+ Equation: :py:meth:`hazen_williams_func `.
- L : float, dict, :code:`"var"`
- Length of the absorber tube, :math:`L/\text{m}`.
+ iam_1 : float, dict
+ Incidence angle modifier 1.
- ks : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{m}`.
+ iam_2 : float, dict
+ Incidence angle modifier 2.
- darcy_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using darcy weissbach equation.
+ ks : float, dict, :code:`"var"`
+ Roughness of wall material. Quantity: :code:`length`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
ks_HW : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{1}`.
+ Hazen-Williams roughness. Can be set as a system variable by passing
+ :code:`"var"` as its value.
- hw_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using hazen williams equation.
+ L : float, dict, :code:`"var"`
+ Length of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
- E : float, dict, :code:`"var"`
- Direct irradiance to tilted collector,
- :math:`E/\frac{\text{W}}{\text{m}^2}`.
+ label : str
+ The label of the component.
- aoi : float, dict, :code:`"var"`
- Angle of incidience, :math:`aoi/^\circ`.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- doc : float, dict, :code:`"var"`
- Degree of cleanliness (1: full absorption, 0: no absorption),
- :math:`X`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- eta_opt : float, dict, :code:`"var"`
- (constant) optical losses due to surface reflection,
- :math:`\eta_{opt}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- c_1 : float, dict, :code:`"var"`
- Linear thermal loss key figure,
- :math:`c_1/\frac{\text{W}}{\text{K} \cdot \text{m}^2}`.
+ power_connector_location : str
- c_2 : float, dict, :code:`"var"`
- Quadratic thermal loss key figure,
- :math:`c_2/\frac{\text{W}}{\text{K}^2 \cdot \text{m}^2}`.
- iam_1 : float, dict, :code:`"var"`
- Linear incidence angle modifier,
- :math:`iam_1/\frac{1}{^\circ}`.
+ pr : float, dict
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- iam_2 : float, dict, :code:`"var"`
- Quadratic incidence angle modifier,
- :math:`iam_2/\left(\frac{1}{^\circ}\right)^2`.
+ printout : bool
+ Include this component in the network's results printout.
- A : float, dict, :code:`"var"`
- Collector aperture surface area :math:`A/\text{m}^2`.
+ Q : float, dict
+ Heat transfer. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_func `.
+
+ Q_loss : float, dict
+ Heat dissipation. Quantity: :code:`heat`.
Tamb : float, dict
- Ambient temperature, provide parameter in network's temperature unit.
+ Ambient temperature. Quantity: :code:`temperature`.
- energy_group : str, dict
- Parametergroup for energy balance of solarthermal collector.
+ zeta : float, dict
+ Non-dimensional friction coefficient for pressure loss calculation.
+ Equation: :py:meth:`zeta_func `.
Example
-------
@@ -228,11 +252,11 @@ def get_parameters(self):
data.update({
'E': dc_cp(
- min_val=0, quantity="heat", _potential_var=True,
+ min_val=0, quantity="heat", _allows_var=True,
description="solar irradiation to the parabolic trough"
),
'A': dc_cp(
- min_val=0, quantity="area", _potential_var=True,
+ min_val=0, quantity="area", _allows_var=True,
description="area of the parabolic trough"
),
'eta_opt': dc_cp(
diff --git a/src/tespy/components/heat_exchangers/parallel.py b/src/tespy/components/heat_exchangers/parallel.py
index 4d886a51c..194a0664f 100644
--- a/src/tespy/components/heat_exchangers/parallel.py
+++ b/src/tespy/components/heat_exchangers/parallel.py
@@ -20,122 +20,129 @@ class ParallelFlowHeatExchanger(HeatExchanger):
r"""
Class for parallel flow heat exchanger.
- **Mandatory Equations**
-
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
-
- **Optional Equations**
-
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.kA_char_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
-
- For hot and cold side individually:
+ .. image:: /api/_images/components/HeatExchanger.svg
+ :alt: flowsheet of the parallelflowheatexchanger
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
+ .. image:: /api/_images/components/HeatExchanger_darkmode.svg
+ :alt: flowsheet of the parallelflowheatexchanger
+ :align: center
+ :class: only-dark
- Inlets/Outlets
+ Ports
+ -----
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
+ Fluid inlets: in1, in2
- Image
+ Fluid outlets: out1, out2
- .. image:: /api/_images/HeatExchanger.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/HeatExchanger_darkmode.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-dark
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
- printout : boolean
- Include this component in the network's results printout.
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
+
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
+
+ label : str
+ The label of the component.
+
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
+
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
pr1 : float, dict
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
pr2 : float, dict
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- dp1 : float, dict,
- Inlet to outlet pressure delta at hot side, :math:`dp/\text{Pa}`
-
- dp2 : float, dict
- Inlet to outlet pressure delta at cold side, :math:`dp\text{Pa}`.
+ printout : bool
+ Include this component in the network's results printout.
- zeta1 : float, dict
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- zeta2 : float, dict
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
ttd_l : float, dict
- Initial terminal temperature difference, referring to the temperature
- difference between the two inlets of the heat exchanger,
- :math:`ttd_\text{l}/\text{K}`.
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
ttd_u : float, dict
- Final terminal temperature difference, referring to the temperature
- difference between the two outlets of the heat exchanger,
- :math:`ttd_\text{u}/\text{K}`.
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
- kA : float, dict
- Area independent heat transfer coefficient,
- :math:`kA/\frac{\text{W}}{\text{K}}`.
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- kA_char : dict
- Area independent heat transfer coefficient characteristic.
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- kA_char1 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for hot side heat transfer coefficient.
+ Notes
+ -----
- kA_char2 : tespy.tools.characteristics.CharLine, dict
- Characteristic line for cold side heat transfer coefficient.
-
- Note
- ----
- The :code:`ParallelFlowHeatExchanger` implements parallel flow of both
- streams, meaning the streams enter with a high temperature difference and
- then gradually reduce their temperature difference to each other. The
- initial temperature difference is the maximum temperature difference, the
- final temperature difference is the minimum temperature difference.
+ .. note::
+
+ The :code:`ParallelFlowHeatExchanger` implements parallel flow of both
+ streams, meaning the streams enter with a high temperature difference and
+ then gradually reduce their temperature difference to each other. The
+ initial temperature difference is the maximum temperature difference, the
+ final temperature difference is the minimum temperature difference.
Example
-------
diff --git a/src/tespy/components/heat_exchangers/sectioned.py b/src/tespy/components/heat_exchangers/sectioned.py
index 1a56f826a..2251dc65a 100644
--- a/src/tespy/components/heat_exchangers/sectioned.py
+++ b/src/tespy/components/heat_exchangers/sectioned.py
@@ -36,158 +36,189 @@ class SectionedHeatExchanger(HeatExchanger):
transfer. The number of section can be adjusted by the user. It is based on
the model implemented by :cite:`Quoilin2020`.
- **Mandatory Equations**
+ .. image:: /api/_images/components/HeatExchanger.svg
+ :alt: flowsheet of the sectionedheatexchanger
+ :align: center
+ :class: only-light
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_func`
+ .. image:: /api/_images/components/HeatExchanger_darkmode.svg
+ :alt: flowsheet of the sectionedheatexchanger
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.energy_balance_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.UA_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.td_pinch_func`
- - :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.UA_cecchinato_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_u_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_l_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.ttd_min_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_cold_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_hot_func`
- - :py:meth:`tespy.components.heat_exchangers.base.HeatExchanger.eff_max_func`
+ Fluid inlets: in1, in2
- For hot and cold side individually:
+ Fluid outlets: out1, out2
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
+ Mandatory Equations
+ -------------------
- Inlets/Outlets
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - hot side to cold side heat transfer equation: :py:meth:`energy_balance_func `
- - in1, in2 (index 1: hot side, index 2: cold side)
- - out1, out2 (index 1: hot side, index 2: cold side)
+ Parameters
+ ----------
- Image
+ alpha_ratio : float, dict
+ Secondary to refrigerant side convective heat transfer coefficient
+ ratio. Quantity: :code:`ratio`.
- .. image:: /api/_images/HeatExchanger.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-light
+ area_ratio : float, dict
+ Secondary to refrigerant side heat transfer area ratio. Quantity:
+ :code:`ratio`.
- .. image:: /api/_images/HeatExchanger_darkmode.svg
- :alt: flowsheet of the heat exchanger
- :align: center
- :class: only-dark
-
- Parameters
- ----------
- label : str
- The label of the component.
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dp1 : float, dict
+ Hot side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
+ dp2 : float, dict
+ Cold side inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ eff_cold : float, dict
+ Heat exchanger effectiveness for cold side. Quantity:
+ :code:`efficiency`.
+ Equation: :py:meth:`eff_cold_func `.
- printout : boolean
- Include this component in the network's results printout.
+ eff_hot : float, dict
+ Heat exchanger effectiveness for hot side. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_hot_func `.
- Q : float, dict
- Heat transfer, :math:`Q/\text{W}`.
+ eff_max : float, dict
+ Maximum heat exchanger effectiveness. Quantity: :code:`efficiency`.
+ Equation: :py:meth:`eff_max_func `.
+
+ kA : float, dict
+ Heat transfer coefficient considering terminal temperature differences.
+ Quantity: :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`kA_func `.
+
+ kA_char : GroupedComponentCharacteristics
+ Equation for heat transfer based on kA and modification factor.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`kA_char_func `.
- pr1 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at hot side, :math:`pr/1`.
+ kA_char1 : tespy.tools.characteristics.CharLine, dict
+ Hot side kA modification lookup table for offdesign.
- pr2 : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio at cold side, :math:`pr/1`.
+ kA_char2 : tespy.tools.characteristics.CharLine, dict
+ Cold side kA modification lookup table for offdesign.
- dp1 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at hot side, unit is the network's
- pressure unit!.
+ label : str
+ The label of the component.
- dp2 : float, dict, :code:`"var"`
- Inlet to outlet pressure delta at cold side, unit is the network's
- pressure unit!.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- zeta1 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at hot side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- zeta2 : float, dict, :code:`"var"`
- Geometry independent friction coefficient at cold side,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ num_sections : int
+ Number of sections of the heat exchanger.
- ttd_l : float, dict
- Lower terminal temperature difference :math:`ttd_\text{l}/\text{K}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- ttd_u : float, dict
- Upper terminal temperature difference :math:`ttd_\text{u}/\text{K}`.
+ pr1 : float, dict
+ Hot side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- ttd_min : float, dict
- Minimum terminal temperature difference :math:`ttd_\text{min}/\text{K}`.
+ pr2 : float, dict
+ Cold side outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
- eff_cold : float, dict
- Cold side heat exchanger effectiveness :math:`eff_\text{cold}/\text{1}`.
+ printout : bool
+ Include this component in the network's results printout.
- eff_hot : float, dict
- Hot side heat exchanger effectiveness :math:`eff_\text{hot}/\text{1}`.
+ Q : float, dict
+ Heat transfer from hot side. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_hot_func `.
- eff_max : float, dict
- Max value of hot and cold side heat exchanger effectiveness values
- :math:`eff_\text{max}/\text{1}`.
+ re_exp_r : float, dict
+ Reynolds exponent for UA modification based on refrigerant side mass
+ flow.
- UA : float, dict
- Sum of UA in all sections of the heat exchanger.
+ re_exp_sf : float, dict
+ Reynolds exponent for UA modification based on secondary fluid side mass
+ flow.
+
+ refrigerant_index : int
+ Side on which the refrigerant is flowing (0: hot, 1:cold).
+
+ td_log : float, dict
+ Logarithmic temperature difference. Quantity:
+ :code:`temperature_difference`.
td_pinch : float, dict
- Value of the lowest delta T between hot side and cold side at the
- different sections.
+ Equation for minimum pinch. Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`td_pinch_func `.
- num_sections : int
- Number of sections.
+ ttd_l : float, dict
+ Terminal temperature difference at hot side outlet to cold side inlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_l_func `.
+
+ ttd_min : float, dict
+ Minimum terminal temperature difference. Quantity:
+ :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_min_func `.
- UA_cecchinato : dict
- Group specification for partload UA modification according to
- :cite:`cecchinato2010`, for usage see details in the
- :py:meth:`tespy.components.heat_exchangers.sectioned.SectionedHeatExchanger.UA_cecchinato_func`.
- This method can only be used in offdesign simulations!
+ ttd_u : float, dict
+ Terminal temperature difference at hot side inlet to cold side outlet.
+ Quantity: :code:`temperature_difference`.
+ Equation: :py:meth:`ttd_u_func `.
+
+ UA : float, dict
+ Sum of UA values of all sections of heat exchanger. Quantity:
+ :code:`heat_transfer_coefficient`.
+ Equation: :py:meth:`UA_func `.
+
+ UA_cecchinato : GroupedComponentProperties
+ Equation for UA modification in offdesign. Elements: :code:`re_exp_r`,
+ :code:`re_exp_sf`, :code:`alpha_ratio`, :code:`area_ratio`.
+ Equation: :py:meth:`UA_cecchinato_func `.
- alpha_ration: float
- Secondary fluid to refrigerant heat transfer coefficient ratio.
+ UA_char : GroupedComponentCharacteristics
+ Equation for sectioned UA modification based on characteristic lines.
+ Elements: :code:`kA_char1`, :code:`kA_char2`.
+ Equation: :py:meth:`UA_char_func `.
- area_ration: float
- Secondary fluid to refrigerant heat transfer area ratio.
+ zeta1 : float, dict
+ Hot side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- re_exp_r: float
- Reynolds exponent for refrigerant side.
+ zeta2 : float, dict
+ Cold side non-dimensional friction coefficient for pressure loss
+ calculation.
+ Equation: :py:meth:`zeta_func `.
- re_exp_sf: float
- Reynolds exponent for secondary fluid side.
+ Notes
+ -----
- refrigerant_index: int
- Connection index for the refrigerant side, 0 if refrigerant is on hot
- side, 1 if refrigerant is on cold side.
+ .. note::
- Note
- ----
- The equations only apply to counter-current heat exchangers.
+ The equations only apply to counter-current heat exchangers.
Example
-------
Water vapor should be cooled down, condensed and then further subcooled.
- For his air is heated up from 15 °C to 25 °C.
+ For this, air is heated up from 15 °C to 25 °C.
>>> from tespy.components import Source, Sink, SectionedHeatExchanger
>>> from tespy.connections import Connection
@@ -318,12 +349,12 @@ class SectionedHeatExchanger(HeatExchanger):
>>> round(cd.td_pinch.val, 2)
4.3
- Example
- -------
- A transcritical gas cooler designed to cool CO2 from 160°C to approximately 50°C
- while water is heated from 10°C to 60°C. The heat exchanger uses characteristic
- lines (`kA_char1` and `kA_char2`) to scale the heat transfer coefficient in
- offdesign operation as mass flow varies.
+ **Second Example**
+
+ A transcritical gas cooler designed to cool CO2 from 160°C to approximately
+ 50°C while water is heated from 10°C to 60°C. The heat exchanger uses
+ characteristic lines (`kA_char1` and `kA_char2`) to scale the heat transfer
+ coefficient in offdesign operation as mass flow varies.
This two-stage approach improves convergence:
@@ -474,7 +505,7 @@ def get_parameters(self):
params = super().get_parameters()
params.update({
'num_sections': dc_simple(
- val=50,
+ val=50, dtype="int",
description="number of sections of the heat exchanger"
),
'UA': dc_cp(
@@ -492,7 +523,7 @@ def get_parameters(self):
description="equation for sectioned UA modification based on characteristic lines"
),
'refrigerant_index': dc_simple(
- val=0,
+ val=0, dtype="int",
description="side on which the refrigerant is flowing (0: hot, 1:cold)"
),
're_exp_r': dc_cp(
diff --git a/src/tespy/components/heat_exchangers/simple.py b/src/tespy/components/heat_exchangers/simple.py
index 928bdd42d..4c30a58ef 100644
--- a/src/tespy/components/heat_exchangers/simple.py
+++ b/src/tespy/components/heat_exchangers/simple.py
@@ -42,108 +42,127 @@ class SimpleHeatExchanger(Component):
- :py:class:`tespy.components.heat_exchangers.parabolic_trough.ParabolicTrough`
- :py:class:`tespy.components.piping.pipe.Pipe`
- **Mandatory Equations**
+ Ports
+ -----
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ Fluid inlets: in1
- **Optional Equations**
+ Fluid outlets: out1
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.energy_balance_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.darcy_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.hazen_williams_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_group_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_char_group_func`
+ Power inlets: heat
- Inlets/Outlets
+ Power outlets: heat
- - in1
- - out1
+ Heat inlets: heat
- Image
+ Heat outlets: heat
- .. image:: /api/_images/Pipe.svg
- :alt: flowsheet of the simple heat exchanger
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/Pipe_darkmode.svg
- :alt: flowsheet of the simple heat exchanger
- :align: center
- :class: only-dark
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+
+ When a power or heat connector is attached:
+
+ - energy_connector_balance: :py:meth:`energy_connector_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
+
+ D : float, dict, :code:`"var"`
+ Diameter of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
+
+ darcy_group : GroupedComponentProperties
+ Darcy-Weißbach equation for pressure loss. Elements: :code:`L`,
+ :code:`ks`, :code:`D`.
+ Equation: :py:meth:`darcy_func `.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dissipative : bool
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- printout : boolean
- Include this component in the network's results printout.
+ hw_group : GroupedComponentProperties
+ Hazen-Williams equation for pressure loss. Elements: :code:`L`,
+ :code:`ks_HW`, :code:`D`.
+ Equation: :py:meth:`hazen_williams_func `.
- Q : float, dict, :code:`"var"`
- Heat transfer, :math:`Q/\text{W}`.
+ kA : float, dict, :code:`"var"`
+ Heat transfer coefficient considering ambient temperature. Quantity:
+ :code:`heat_transfer_coefficient`. Can be set as a system variable by
+ passing :code:`"var"` as its value.
- pr : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio, :math:`pr/1`.
+ kA_char : tespy.tools.characteristics.CharLine, dict
+ Heat transfer coefficient lookup table for offdesign.
- zeta : float, dict, :code:`"var"`
- Geometry independent friction coefficient,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ kA_char_group : GroupedComponentProperties
+ Heat transfer from design heat transfer coefficient, modifier lookup
+ table and ambient temperature. Elements: :code:`kA_char`, :code:`Tamb`.
+ Equation: :py:meth:`kA_char_group_func `.
- D : float, dict, :code:`"var"`
- Diameter of the pipes, :math:`D/\text{m}`.
+ kA_group : GroupedComponentProperties
+ Equation for heat transfer based on ambient temperature and heat
+ transfer coefficient. Elements: :code:`kA`, :code:`Tamb`.
+ Equation: :py:meth:`kA_group_func `.
+
+ ks : float, dict, :code:`"var"`
+ Roughness of wall material. Quantity: :code:`length`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ ks_HW : float, dict, :code:`"var"`
+ Hazen-Williams roughness. Can be set as a system variable by passing
+ :code:`"var"` as its value.
L : float, dict, :code:`"var"`
- Length of the pipes, :math:`L/\text{m}`.
+ Length of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
- ks : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{m}`.
+ label : str
+ The label of the component.
- darcy_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using darcy weissbach equation.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- ks_HW : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{1}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- hw_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using hazen williams equation.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- kA : float, dict, :code:`"var"`
- Area independent heat transfer coefficient,
- :math:`kA/\frac{\text{W}}{\text{K}}`.
+ power_connector_location : str
- kA_char : tespy.tools.characteristics.CharLine, dict
- Characteristic line for heat transfer coefficient.
+
+ pr : float, dict
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
+
+ printout : bool
+ Include this component in the network's results printout.
+
+ Q : float, dict
+ Heat transfer. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_func `.
Tamb : float, dict
- Ambient temperature, provide parameter in network's temperature unit.
+ Ambient temperature. Quantity: :code:`temperature`.
- kA_group : str, dict
- Parametergroup for heat transfer calculation from ambient temperature
- and area independent heat transfer coefficient kA.
+ zeta : float, dict
+ Non-dimensional friction coefficient for pressure loss calculation.
+ Equation: :py:meth:`zeta_func `.
Example
-------
@@ -258,7 +277,7 @@ def _calc_kA(self):
def get_parameters(self):
return {
- 'power_connector_location': dc_simple(),
+ 'power_connector_location': dc_simple(dtype="str"),
'Q': dc_cp(
num_eq_sets=1,
func=self.energy_balance_func,
@@ -294,27 +313,27 @@ def get_parameters(self):
'D': dc_cp(
min_val=1e-2, max_val=2, d=1e-5, quantity="length",
description="diameter of channel",
- _potential_var=True
+ _allows_var=True
),
'L': dc_cp(
min_val=1e-1, quantity="length",
description="length of channel",
- _potential_var=True
+ _allows_var=True
),
'ks': dc_cp(
_val=1e-4, min_val=1e-7, max_val=1e-3,
quantity="length", description="roughness of wall material",
- _potential_var=True
+ _allows_var=True
),
'ks_HW': dc_cp(
_val=10, min_val=1e-1, max_val=1e3,
description="Hazen-Williams roughness",
- _potential_var=True
+ _allows_var=True
),
'kA': dc_cp(
min_val=0, quantity="heat_transfer_coefficient",
description="heat transfer coefficient considering ambient temperature",
- _potential_var=True,
+ _allows_var=True,
calc=self._calc_kA, calc_deps=['Q']
),
'kA_char': dc_cc(
@@ -325,7 +344,7 @@ def get_parameters(self):
quantity="temperature",
description="ambient temperature"
),
- 'dissipative': dc_simple(_val=None),
+ 'dissipative': dc_simple(_val=None, dtype="bool"),
'darcy_group': dc_gcp(
elements=['L', 'ks', 'D'], num_eq_sets=1,
func=self.darcy_func,
diff --git a/src/tespy/components/heat_exchangers/solar_collector.py b/src/tespy/components/heat_exchangers/solar_collector.py
index ebeedfa03..57f4b46a9 100644
--- a/src/tespy/components/heat_exchangers/solar_collector.py
+++ b/src/tespy/components/heat_exchangers/solar_collector.py
@@ -22,118 +22,145 @@ class SolarCollector(SimpleHeatExchanger):
r"""
The solar collector calculates heat output from irradiance.
- **Mandatory Equations**
+ .. image:: /api/_images/components/SolarCollector.svg
+ :alt: flowsheet of the solarcollector
+ :align: center
+ :class: only-light
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ .. image:: /api/_images/components/SolarCollector_darkmode.svg
+ :alt: flowsheet of the solarcollector
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.energy_balance_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.darcy_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.hazen_williams_func`
- - :py:meth:`tespy.components.heat_exchangers.solar_collector.SolarCollector.energy_group_func`
+ Fluid inlets: in1
- Inlets/Outlets
+ Fluid outlets: out1
- - in1
- - out1
+ Power inlets: heat
- Image
+ Power outlets: heat
- .. image:: /api/_images/SolarCollector.svg
- :alt: flowsheet of the solar collector
- :align: center
- :class: only-light
+ Heat inlets: heat
- .. image:: /api/_images/SolarCollector_darkmode.svg
- :alt: flowsheet of the solar collector
- :align: center
- :class: only-dark
+ Heat outlets: heat
+
+ Mandatory Equations
+ -------------------
+
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+
+ When a power or heat connector is attached:
+
+ - energy_connector_balance: :py:meth:`energy_connector_balance_func `
Parameters
----------
- label : str
- The label of the component.
+
+ A : float, dict, :code:`"var"`
+ Area of the solar collector. Quantity: :code:`area`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
+
+ D : float, dict, :code:`"var"`
+ Diameter of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
+
+ darcy_group : GroupedComponentProperties
+ Darcy-Weißbach equation for pressure loss. Elements: :code:`L`,
+ :code:`ks`, :code:`D`.
+ Equation: :py:meth:`darcy_func `.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ dissipative : bool
- local_design : boolean
- Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ dp : float, dict
+ Inlet to outlet absolute pressure change. Quantity:
+ :code:`pressure_difference`.
+ Equation: :py:meth:`dp_structure_matrix `.
- printout : boolean
- Include this component in the network's results printout.
+ E : float, dict, :code:`"var"`
+ Solar irradiation to the solar collector. Quantity: :code:`heat`. Can be
+ set as a system variable by passing :code:`"var"` as its value.
- Q : float, dict, :code:`"var"`
- Heat transfer, :math:`Q/\text{W}`.
+ energy_group : GroupedComponentProperties
+ Energy balance equation of the solar collector. Elements: :code:`E`,
+ :code:`eta_opt`, :code:`lkf_lin`, :code:`lkf_quad`, :code:`A`,
+ :code:`Tamb`.
+ Equation: :py:meth:`energy_group_func `.
- pr : float, dict, :code:`"var"`
- Outlet to inlet pressure ratio, :math:`pr/1`.
+ eta_opt : float, dict
+ Optical efficiency. Quantity: :code:`efficiency`.
- zeta : float, dict, :code:`"var"`
- Geometry independent friction coefficient,
- :math:`\frac{\zeta}{D^4}/\frac{1}{\text{m}^4}`.
+ hw_group : GroupedComponentProperties
+ Hazen-Williams equation for pressure loss. Elements: :code:`L`,
+ :code:`ks_HW`, :code:`D`.
+ Equation: :py:meth:`hazen_williams_func `.
- D : float, dict, :code:`"var"`
- Diameter of the pipes, :math:`D/\text{m}`.
+ ks : float, dict, :code:`"var"`
+ Roughness of wall material. Quantity: :code:`length`. Can be set as a
+ system variable by passing :code:`"var"` as its value.
+
+ ks_HW : float, dict, :code:`"var"`
+ Hazen-Williams roughness. Can be set as a system variable by passing
+ :code:`"var"` as its value.
L : float, dict, :code:`"var"`
- Length of the pipes, :math:`L/\text{m}`.
+ Length of channel. Quantity: :code:`length`. Can be set as a system
+ variable by passing :code:`"var"` as its value.
- ks : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{m}`.
+ label : str
+ The label of the component.
- darcy_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using darcy weissbach equation.
+ lkf_lin : float, dict
+ Linear heat loss factor.
- ks_HW : float, dict, :code:`"var"`
- Pipe's roughness, :math:`ks/\text{1}`.
+ lkf_quad : float, dict
+ Quadratic heat loss factor.
- hw_group : str, dict
- Parametergroup for pressure drop calculation based on pipes dimensions
- using hazen williams equation.
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
- E : float, dict, :code:`"var"`
- irradiance at tilted collector surface area,
- :math:`E/\frac{\text{W}}{\text{m}^2}`.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- eta_opt : float, dict, :code:`"var"`
- optical loss at surface cover,
- :math:`\eta_{opt}`.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- lkf_lin : float, dict, :code:`"var"`
- Linear thermal loss key figure,
- :math:`\alpha_1/\frac{\text{W}}{\text{K} \cdot \text{m}^2}`.
+ power_connector_location : str
- lkf_quad : float, dict, :code:`"var"`
- Quadratic thermal loss key figure,
- :math:`\alpha_2/\frac{\text{W}}{\text{K}^2 \cdot \text{m}^2}`.
- A : float, dict, :code:`"var"`
- Collector surface area :math:`A/\text{m}^2`.
+ pr : float, dict
+ Outlet to inlet pressure ratio. Quantity: :code:`ratio`.
+ Equation: :py:meth:`pr_structure_matrix `.
+
+ printout : bool
+ Include this component in the network's results printout.
+
+ Q : float, dict
+ Heat transfer. Quantity: :code:`heat`.
+ Equation: :py:meth:`energy_balance_func `.
+
+ Q_loss : float, dict
+ Heat dissipation. Quantity: :code:`heat`.
Tamb : float, dict
- Ambient temperature, provide parameter in network's temperature unit.
+ Ambient air temperature. Quantity: :code:`temperature`.
- energy_group : str, dict
- Parametergroup for energy balance of solarthermal collector.
+ zeta : float, dict
+ Non-dimensional friction coefficient for pressure loss calculation.
+ Equation: :py:meth:`zeta_func `.
Example
-------
@@ -188,11 +215,11 @@ def get_parameters(self):
data.update({
'E': dc_cp(
- min_val=0, quantity="heat", _potential_var=True,
+ min_val=0, quantity="heat", _allows_var=True,
description="solar irradiation to the solar collector"
),
'A': dc_cp(
- min_val=0, quantity="area", _potential_var=True,
+ min_val=0, quantity="area", _allows_var=True,
description="area of the solar collector"
),
'eta_opt': dc_cp(
diff --git a/src/tespy/components/nodes/base.py b/src/tespy/components/nodes/base.py
index 264cfcb8c..0d8430f2b 100644
--- a/src/tespy/components/nodes/base.py
+++ b/src/tespy/components/nodes/base.py
@@ -16,7 +16,42 @@
@component_registry
class NodeBase(Component):
- """Class NodeBase is parent class for all components of submodule nodes."""
+ """
+ Class NodeBase is parent class for all components of submodule nodes.
+
+ Mandatory Equations
+ -------------------
+
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+ - fluid composition equality constraint(s): :py:meth:`variable_equality_structure_matrix `
+
+ Parameters
+ ----------
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
+
+ design : list
+ List containing design parameters (stated as String).
+
+ design_path : str
+ Path to the components design case.
+
+ label : str
+ The label of the component.
+
+ local_design : bool
+ Treat this component in design mode in an offdesign calculation.
+
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
+ Include this component in the network's results printout.
+ """
@staticmethod
def get_bypass_constraints():
diff --git a/src/tespy/components/nodes/droplet_separator.py b/src/tespy/components/nodes/droplet_separator.py
index 9aed82804..3efec237e 100644
--- a/src/tespy/components/nodes/droplet_separator.py
+++ b/src/tespy/components/nodes/droplet_separator.py
@@ -26,56 +26,58 @@ class DropletSeparator(NodeBase):
This component is the parent component of the Drum.
- **Mandatory Equations**
+ .. image:: /api/_images/components/DropletSeparator.svg
+ :alt: flowsheet of the dropletseparator
+ :align: center
+ :class: only-light
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.fluid_structure_matrix`
- - :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.energy_balance_func`
- - saturated liquid: :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.saturated_outlet_func`
- - saturated gas: :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.saturated_outlet_func`
+ .. image:: /api/_images/components/DropletSeparator_darkmode.svg
+ :alt: flowsheet of the dropletseparator
+ :align: center
+ :class: only-dark
- Inlets/Outlets
+ Ports
+ -----
- - in1
- - out1, out2 (index 1: saturated liquid, index 2: saturated gas)
+ Fluid inlets: in1
- Image
+ Fluid outlets: out1, out2
- .. image:: /api/_images/DropletSeparator.svg
- :alt: flowsheet of the droplet separator
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/DropletSeparator_darkmode.svg
- :alt: flowsheet of the droplet separator
- :align: center
- :class: only-dark
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - energy balance constraint: :py:meth:`energy_balance_func `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
+ - outlet 0 is saturated liquid constraint: :py:meth:`saturated_outlet_func `
+ - outlet 1 is saturated gas constraint: :py:meth:`saturated_outlet_func `
+ - fluid equality constraints: :py:meth:`fluid_structure_matrix `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
Example
diff --git a/src/tespy/components/nodes/drum.py b/src/tespy/components/nodes/drum.py
index ba8305320..cc44dd57c 100644
--- a/src/tespy/components/nodes/drum.py
+++ b/src/tespy/components/nodes/drum.py
@@ -23,67 +23,72 @@ class Drum(DropletSeparator):
r"""
A drum separates saturated gas from saturated liquid.
- **Mandatory Equations**
-
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.fluid_structure_matrix`
- - :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.energy_balance_func`
- - saturated liquid: :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.saturated_outlet_func`
- - saturated gas: :py:meth:`tespy.components.nodes.droplet_separator.DropletSeparator.saturated_outlet_func`
-
- Inlets/Outlets
-
- - in1, in2 (index 1: from economiser, index 2: from evaporator)
- - out1, out2 (index 1: saturated liquid, index 2: saturated gas)
-
- Image
-
- .. image:: /api/_images/Drum.svg
+ .. image:: /api/_images/components/Drum.svg
:alt: flowsheet of the drum
:align: center
:class: only-light
- .. image:: /api/_images/Drum_darkmode.svg
+ .. image:: /api/_images/components/Drum_darkmode.svg
:alt: flowsheet of the drum
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1, in2
+
+ Fluid outlets: out1, out2
+
+ Mandatory Equations
+ -------------------
+
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - energy balance constraint: :py:meth:`energy_balance_func `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
+ - outlet 0 is saturated liquid constraint: :py:meth:`saturated_outlet_func `
+ - outlet 1 is saturated gas constraint: :py:meth:`saturated_outlet_func `
+ - fluid equality constraints: :py:meth:`fluid_structure_matrix `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
- Note
- ----
- If you are using a drum in a network with multiple fluids, it is likely
- the fluid propagation causes trouble. If this is the case, try to
- specify the fluid composition at another connection of your network.
+ Notes
+ -----
+
+ .. note::
+
+ If you are using a drum in a network with multiple fluids, it is likely
+ the fluid propagation causes trouble. If this is the case, try to
+ specify the fluid composition at another connection of your network.
- This component assumes, that the fluid composition between outlet 1 and
- inlet 2 does not change, thus there is no equation for the fluid mass
- fraction at the inlet 2!
+ This component assumes, that the fluid composition between outlet 1 and
+ inlet 2 does not change, thus there is no equation for the fluid mass
+ fraction at the inlet 2!
Example
-------
@@ -111,7 +116,7 @@ class Drum(DropletSeparator):
>>> s = Sink('steam')
>>> dr = Drum('drum')
>>> ev = HeatExchanger('evaporator')
- >>> erp = Pump('evaporator reciculation pump')
+ >>> erp = Pump('evaporator recirculation pump')
>>> f_dr = Connection(fa, 'out1', dr, 'in1')
>>> dr_erp = Connection(dr, 'out1', erp, 'in1')
>>> erp_ev = Connection(erp, 'out1', ev, 'in2')
diff --git a/src/tespy/components/nodes/merge.py b/src/tespy/components/nodes/merge.py
index e82a7ac92..ebb35e18d 100644
--- a/src/tespy/components/nodes/merge.py
+++ b/src/tespy/components/nodes/merge.py
@@ -24,58 +24,60 @@ class Merge(NodeBase):
r"""
Class for merge points with multiple inflows and one outflow.
- **Mandatory Equations**
-
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.merge.Merge.fluid_func`
- - :py:meth:`tespy.components.nodes.merge.Merge.energy_balance_func`
-
- Inlets/Outlets
-
- - specify number of inlets with :code:`num_in` (default value: 2)
- - out1
-
- Image
-
- .. image:: /api/_images/Merge.svg
+ .. image:: /api/_images/components/Merge.svg
:alt: flowsheet of the merge
:align: center
:class: only-light
- .. image:: /api/_images/Merge_darkmode.svg
+ .. image:: /api/_images/components/Merge_darkmode.svg
:alt: flowsheet of the merge
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1, in2, ... (variable, count set by :code:`num_in`)
+
+ Fluid outlets: out1
+
+ Mandatory Equations
+ -------------------
+
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - fluid mass fraction balance constraints: :py:meth:`fluid_func `
+ - energy balance constraint: :py:meth:`energy_balance_func `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- printout : boolean
- Include this component in the network's results printout.
+ num_in : int
+ Number of inlets.
- num_in : float, dict
- Number of inlets for this component, default value: 2.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
+ Include this component in the network's results printout.
Example
-------
@@ -166,7 +168,18 @@ class Merge(NodeBase):
@staticmethod
def get_parameters():
- return {'num_in': dc_simple(description="number of inlets")}
+ return {'num_in': dc_simple(dtype="int", description="number of inlets")}
+
+ @classmethod
+ def port_schema(cls):
+ return {
+ "inlets": {"type": "variable", "parameter": "num_in", "pattern": "in{n}", "min": 2},
+ "outlets": {"type": "fixed", "ports": ["out1"]},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": []},
+ }
def _update_num_eq(self):
self.variable_fluids = set(
diff --git a/src/tespy/components/nodes/node.py b/src/tespy/components/nodes/node.py
index b39044cfa..c34ba0e1c 100644
--- a/src/tespy/components/nodes/node.py
+++ b/src/tespy/components/nodes/node.py
@@ -23,63 +23,65 @@ class Node(Splitter, Merge):
Class for combined merge and splitting points with multiple inflows and
outflows.
- **Mandatory Equations**
-
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.node.Node.enthalpy_structure_matrix`
- - :py:meth:`tespy.components.nodes.node.Node.fluid_structure_matrix`
- - :py:meth:`tespy.components.nodes.merge.Merge.fluid_func`
- - :py:meth:`tespy.components.nodes.merge.Merge.energy_balance_func`
-
- Inlets/Outlets
-
- - specify number of inlets with :code:`num_in` (default value: 2)
- - specify number of outlets with :code:`num_in` (default value: 2)
-
- Image
-
- .. image:: /api/_images/Node.svg
+ .. image:: /api/_images/components/Node.svg
:alt: flowsheet of the node
:align: center
:class: only-light
- .. image:: /api/_images/Node_darkmode.svg
+ .. image:: /api/_images/components/Node_darkmode.svg
:alt: flowsheet of the node
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1, in2, ... (variable, count set by :code:`num_in`)
+
+ Fluid outlets: out1, out2, ... (variable, count set by :code:`num_out`)
+
+ Mandatory Equations
+ -------------------
+
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
+ - equal enthalpy at all outlets constraint(s): :py:meth:`enthalpy_structure_matrix `
+ - equal fluid at all outlets constraint(s): :py:meth:`fluid_structure_matrix `
+ - fluid mass fraction constraints: :py:meth:`fluid_func `
+ - energy balance constraint: :py:meth:`energy_balance_func `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- printout : boolean
- Include this component in the network's results printout.
+ num_in : int
+ Number of inlets.
- num_in : float
- Number of inlets for this component, default value: 2.
+ num_out : int
+ Number of outlets.
- num_out : float
- Number of outlets for this component, default value: 2.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
+ Include this component in the network's results printout.
Example
-------
@@ -131,8 +133,19 @@ class Node(Splitter, Merge):
@staticmethod
def get_parameters():
return {
- 'num_out': dc_simple(description="number of outlets"),
- 'num_in': dc_simple(description="number of inlets")
+ 'num_out': dc_simple(dtype="int", description="number of outlets"),
+ 'num_in': dc_simple(dtype="int", description="number of inlets")
+ }
+
+ @classmethod
+ def port_schema(cls):
+ return {
+ "inlets": {"type": "variable", "parameter": "num_in", "pattern": "in{n}", "min": 2},
+ "outlets": {"type": "variable", "parameter": "num_out", "pattern": "out{n}", "min": 2},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": []},
}
def get_mandatory_constraints(self):
diff --git a/src/tespy/components/nodes/separator.py b/src/tespy/components/nodes/separator.py
index 6a91873dd..04082d8fe 100644
--- a/src/tespy/components/nodes/separator.py
+++ b/src/tespy/components/nodes/separator.py
@@ -23,63 +23,58 @@ class Separator(NodeBase):
r"""
A separator separates fluid components from a mass flow.
- **Mandatory Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.separator.Separator.fluid_func`
- - :py:meth:`tespy.components.nodes.separator.Separator.energy_balance_func`
+ Fluid inlets: in1
- Inlets/Outlets
+ Fluid outlets: out1, out2, ... (variable, count set by :code:`num_out`)
- - in1
- - specify number of outlets with :code:`num_out` (default value: 2)
+ Mandatory Equations
+ -------------------
- Image
-
- .. image:: /api/_images/Splitter.svg
- :alt: flowsheet of the splitter
- :align: center
- :class: only-light
-
- .. image:: /api/_images/Splitter_darkmode.svg
- :alt: flowsheet of the splitter
- :align: center
- :class: only-dark
-
- Note
- ----
- Fluid separation requires power and cooling, equations have not been
- implemented, yet!
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - fluid mass fraction balance constraints: :py:meth:`fluid_func `
+ - equal temperature at all outlets constraints: :py:meth:`energy_balance_func `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
+
+ num_out : int
+ Number of outlets.
+
+ offdesign : list
+ List containing offdesign parameters (stated as String).
- printout : boolean
+ printout : bool
Include this component in the network's results printout.
- num_out : float, dict
- Number of outlets for this component, default value: 2.
+ Notes
+ -----
+
+ .. note::
+
+ Fluid separation requires power and cooling, equations have not been
+ implemented, yet!
Example
-------
@@ -134,7 +129,18 @@ class Separator(NodeBase):
@staticmethod
def get_parameters():
- return {'num_out': dc_simple(description="number of outlets")}
+ return {'num_out': dc_simple(dtype="int", description="number of outlets")}
+
+ @classmethod
+ def port_schema(cls):
+ return {
+ "inlets": {"type": "fixed", "ports": ["in1"]},
+ "outlets": {"type": "variable", "parameter": "num_out", "pattern": "out{n}", "min": 2},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": []},
+ }
def _update_num_eq(self):
self.variable_fluids = set(
diff --git a/src/tespy/components/nodes/splitter.py b/src/tespy/components/nodes/splitter.py
index b1d5e7dfd..07c8a2e24 100644
--- a/src/tespy/components/nodes/splitter.py
+++ b/src/tespy/components/nodes/splitter.py
@@ -21,58 +21,60 @@ class Splitter(NodeBase):
r"""
Split up a mass flow in parts of identical enthalpy and fluid composition.
- **Mandatory Equations**
-
- - :py:meth:`tespy.components.nodes.base.NodeBase.mass_flow_func`
- - :py:meth:`tespy.components.nodes.base.NodeBase.pressure_structure_matrix`
- - :py:meth:`tespy.components.nodes.splitter.Splitter.enthalpy_structure_matrix`
- - :py:meth:`tespy.components.nodes.splitter.Splitter.fluid_structure_matrix`
-
- Inlets/Outlets
-
- - in1
- - specify number of outlets with :code:`num_out` (default value: 2)
-
- Image
-
- .. image:: /api/_images/Splitter.svg
+ .. image:: /api/_images/components/Splitter.svg
:alt: flowsheet of the splitter
:align: center
:class: only-light
- .. image:: /api/_images/Splitter_darkmode.svg
+ .. image:: /api/_images/components/Splitter_darkmode.svg
:alt: flowsheet of the splitter
:align: center
:class: only-dark
+ Ports
+ -----
+
+ Fluid inlets: in1
+
+ Fluid outlets: out1, out2, ... (variable, count set by :code:`num_out`)
+
+ Mandatory Equations
+ -------------------
+
+ - mass balance constraint: :py:meth:`mass_flow_func `
+ - equal enthalpy at all outlets constraint: :py:meth:`enthalpy_structure_matrix `
+ - pressure equality constraints: :py:meth:`pressure_structure_matrix `
+ - fluid equality constraints: :py:meth:`fluid_structure_matrix `
+
Parameters
----------
- label : str
- The label of the component.
+
+ char_warnings : bool
+ Ignore warnings on default characteristics usage for this component.
design : list
List containing design parameters (stated as String).
- offdesign : list
- List containing offdesign parameters (stated as String).
-
design_path : str
Path to the components design case.
- local_offdesign : boolean
- Treat this component in offdesign mode in a design calculation.
+ label : str
+ The label of the component.
- local_design : boolean
+ local_design : bool
Treat this component in design mode in an offdesign calculation.
- char_warnings : boolean
- Ignore warnings on default characteristics usage for this component.
+ local_offdesign : bool
+ Treat this component in offdesign mode in a design calculation.
- printout : boolean
- Include this component in the network's results printout.
+ num_out : int
+ Number of outlets.
- num_out : float, dict
- Number of outlets for this component, default value: 2.
+ offdesign : list
+ List containing offdesign parameters (stated as String).
+
+ printout : bool
+ Include this component in the network's results printout.
Example
-------
@@ -118,7 +120,18 @@ class Splitter(NodeBase):
@staticmethod
def get_parameters():
- return {'num_out': dc_simple(description="number of outlets")}
+ return {'num_out': dc_simple(dtype="int", description="number of outlets")}
+
+ @classmethod
+ def port_schema(cls):
+ return {
+ "inlets": {"type": "fixed", "ports": ["in1"]},
+ "outlets": {"type": "variable", "parameter": "num_out", "pattern": "out{n}", "min": 2},
+ "powerinlets": {"type": "fixed", "ports": []},
+ "poweroutlets": {"type": "fixed", "ports": []},
+ "heatinlets": {"type": "fixed", "ports": []},
+ "heatoutlets": {"type": "fixed", "ports": []},
+ }
def get_mandatory_constraints(self):
return {
diff --git a/src/tespy/components/piping/pipe.py b/src/tespy/components/piping/pipe.py
index 7cf5d6c33..f5f2bf74a 100644
--- a/src/tespy/components/piping/pipe.py
+++ b/src/tespy/components/piping/pipe.py
@@ -30,144 +30,181 @@ class Pipe(SimpleHeatExchanger):
a subsurface buried pipe. The implementation is based on
:cite:`gnielinski1975` (surface) and :cite:`wallenten1991` (subsurface).
- **Mandatory Equations**
+ .. image:: /api/_images/components/Pipe.svg
+ :alt: flowsheet of the pipe
+ :align: center
+ :class: only-light
- - fluid: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
- - mass flow: :py:meth:`tespy.components.component.Component.variable_equality_structure_matrix`
+ .. image:: /api/_images/components/Pipe_darkmode.svg
+ :alt: flowsheet of the pipe
+ :align: center
+ :class: only-dark
- **Optional Equations**
+ Ports
+ -----
- - :py:meth:`tespy.components.component.Component.dp_structure_matrix`
- - :py:meth:`tespy.components.component.Component.pr_structure_matrix`
- - :py:meth:`tespy.components.component.Component.zeta_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.energy_balance_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.darcy_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.hazen_williams_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_group_func`
- - :py:meth:`tespy.components.heat_exchangers.simple.SimpleHeatExchanger.kA_char_group_func`
- - :py:meth:`tespy.components.piping.pipe.Pipe.ohc_surface_group_func`
- - :py:meth:`tespy.components.piping.pipe.Pipe.ohc_subsurface_group_func`
+ Fluid inlets: in1
- Inlets/Outlets
+ Fluid outlets: out1
- - in1
- - out1
+ Power inlets: heat
- Optional inlets/outlets
+ Power outlets: heat
- - heat
+ Heat inlets: heat
- Image
+ Heat outlets: heat
- .. image:: /api/_images/Pipe.svg
- :alt: flowsheet of the pipe
- :align: center
- :class: only-light
+ Mandatory Equations
+ -------------------
- .. image:: /api/_images/Pipe_darkmode.svg
- :alt: flowsheet of the pipe
- :align: center
- :class: only-dark
+ - mass flow equality constraint(s): :py:meth:`variable_equality_structure_matrix