ThermoSim 2.3__tar.gz → 2.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,978 @@
1
+ Metadata-Version: 2.4
2
+ Name: ThermoSim
3
+ Version: 2.3.2
4
+ Summary: A simulation package for thermodynamic systems
5
+ Author: Md. Waheduzzaman Nouman
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: numpy
8
+ Requires-Dist: scipy
9
+ Requires-Dist: matplotlib
10
+ Requires-Dist: CoolProp
11
+ Requires-Dist: pandas
12
+ Requires-Dist: CoolProp
13
+ Requires-Dist: pymoo
14
+ Dynamic: author
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: requires-dist
18
+ Dynamic: summary
19
+
20
+
21
+ # **Chapter 1: Introduction**
22
+
23
+ ## **Overview of the Thermodynamic Model**
24
+
25
+ This Python module, **ThermoSim**, is designed to simulate and analyze various thermodynamic systems and components. It can model complex systems involving fluids such as water, air, and refrigerants like isobutane. The module supports a range of thermodynamic processes, including pumps, turbines, heat exchangers, and other essential components commonly found in energy systems, refrigeration cycles, and heat transfer applications.
26
+
27
+ ### **Key Features:**
28
+
29
+ * **State Point Management:** The module allows you to define and track state points, representing the thermodynamic properties of fluids (e.g., temperature, pressure, enthalpy) at various points in the system.
30
+
31
+ * **Component Modeling:** It models different components like pumps, turbines, heat exchangers, and expansion valves, each with specific methods for energy calculations and performance evaluation.
32
+
33
+ This model serves as a powerful tool for engineers and researchers working on thermodynamic cycle design, optimization, and analysis, including heat pumps, refrigeration systems, and other energy conversion systems.
34
+
35
+ ## **Target Audience**
36
+
37
+ This documentation is intended for:
38
+
39
+ * **Engineering Students**: Those studying thermodynamics, energy systems, and heat transfer. The module provides a practical tool to simulate real-world energy systems and understand thermodynamic concepts.
40
+
41
+ * **Researchers**: Professionals and researchers working in the field of thermodynamics and energy efficiency can use this module for modeling, optimization, and analysis of complex systems.
42
+
43
+ * **Energy System Designers**: Engineers involved in designing and optimizing thermodynamic systems such as power plants, heat exchangers, refrigeration cycles, and renewable energy systems.
44
+
45
+ ## **Real-World Applications**
46
+
47
+ 1. **Heat Exchanger Design and Optimization**: The module simulates various types of heat exchangers (e.g., double-pipe, evaporator, condenser), helping engineers optimize thermal efficiency and energy usage in industrial applications.
48
+
49
+ 2. **Pumps and Turbines**: It can model pumps and turbines used in power generation, refrigeration, and HVAC systems, providing insights into performance metrics like work output, efficiency, and energy transfer
50
+
51
+ 3. **Energy Efficiency Analysis**: By integrating components like expansion valves and PCM (Phase Change Materials), the model supports the design of energy-efficient systems in heating, cooling, and refrigeration sectors.
52
+
53
+ 4. **Simulation of Thermodynamic Cycles**: The module supports the simulation of thermodynamic cycles, including Rankine and refrigeration cycles, helping in the evaluation of system performance, energy conservation, and operational optimization.
54
+
55
+ # **Chapter 2: Installation and Setup**
56
+
57
+ ## **Installation**
58
+
59
+ To install the **ThermoSim** module, follow the steps below. This module is compatible with Python 3.6+.
60
+
61
+ ### **Installing via PyPI**
62
+
63
+ You can install the module directly from PyPI using `pip`:
64
+
65
+ `pip install ThermoSim`
66
+
67
+ ## **Quick Start**
68
+
69
+ Once installed, you can start using the module by importing it into your Python script.
70
+
71
+ ### **Example Usage**
72
+ ```pyrhon
73
+ import ThermoSim
74
+
75
+ # Initialize the thermodynamic model
76
+ model = ThermoSim.ThermodynamicModel()
77
+
78
+ # Define fluid state points
79
+ model.add_point('water', StatePointName='1', P=6.09e5, T=158+273.15, Mass_flowrate=555.9)
80
+ model.add_point('water', StatePointName='2', P=6.09e5, T=None, Mass_flowrate=555.9)
81
+
82
+ # Add components (e.g., pump, heat exchanger)
83
+ pump = model.Pump(model, 'Pump', In_state='1', Out_state='2', n_isen=0.75, Calculate=True)
84
+
85
+ print(Model)
86
+ ```
87
+ # **Chapter 3: Basic Usage**
88
+
89
+ ## **Creating and Setting Up the Model**
90
+
91
+ This chapter explains how to create the thermodynamic model, define state points, and add components like pumps, turbines, and heat exchangers to simulate thermodynamic systems.
92
+
93
+ ### **1\. The `Prop()` Function**
94
+
95
+ Before defining state points, let’s understand the **`Prop()`** function, as it is used to calculate and create the thermodynamic state for fluids. **`Prop()`** is using coolprop for calculating the thermodynamic properties. The **`Prop()`** function returns an object (called `State`) that holds the thermodynamic properties of the fluid at a specific state point.
96
+
97
+ Here’s how the **`Prop()`** function works:
98
+
99
+ `State = model.Prop(fluid, StatePointName, Mass_flowrate=None, **properties)`
100
+
101
+ ### **Arguments for the `Prop()` function:**
102
+
103
+ * **fluid**: The fluid type (e.g., 'water', 'isobutane').
104
+
105
+ * **StatePointName**: A unique identifier for the state point (e.g., '1', '2').
106
+
107
+ * **Mass\_flowrate** (optional): The mass flow rate of the fluid at the state point (in kg/s).
108
+
109
+ * **\*\*properties**: These are the thermodynamic properties to define the state point, such as:
110
+
111
+ * **P**: Pressure at the state point (in Pascals).
112
+ * **T**: Temperature at the state point (in Kelvin).
113
+ * **H**: Enthalpy at the state point (in J/kg).
114
+ * **S**: Entropy at the state point (in J/kg·K).
115
+ * **Q**: Quality of the fluid (used in two-phase fluids)
116
+ * **State.D**: Density (in kg/m³)
117
+
118
+ #### **State Object**
119
+
120
+ The **`Prop()`** function creates a **State** object that holds the thermodynamic properties of the fluid. You can access or update the properties of this object directly.
121
+
122
+ * **State.T**: Temperature (in Kelvin)
123
+
124
+ * **State.P**: Pressure (in Pascals)
125
+
126
+ * **State.H**: Enthalpy (in J/kg)
127
+
128
+ * **State.S**: Entropy (in J/kg·K)
129
+
130
+ * **State.D**: Density (in kg/m³)
131
+
132
+ * **State.Cp**: Specific heat at constant pressure (in J/kg·K)
133
+
134
+ ### **Example Usage of `Prop()` and Accessing Properties:**
135
+ ```python
136
+ # Define a state point for water
137
+ State = model.Prop('water', 'Demo', P=6.09e5, T=158 + 273.15)
138
+
139
+ # Print all properties of the State object
140
+ print(State) # This will display the State object's properties like T, P, H, etc.
141
+
142
+ # Update the pressure directly
143
+ State.P = 7e5 # New pressure in Pascals
144
+
145
+ # Print updated State object to check changes
146
+ print(State) # The updated properties will be displayed
147
+ ```
148
+ In this example:
149
+
150
+ * **State** is an object that stores all the thermodynamic properties for the fluid at state point 'Demo’'.
151
+
152
+ * We can access the temperature, pressure, enthalpy, entropy, density, and specific heat directly using `State.T`, `State.P`, `State.H`, `State.S`, `State.D`, and `State.Cp`, respectively.
153
+
154
+ * We update the pressure of the state point using **`State.P = 7e5`**.
155
+
156
+ ### **2\. Adding State Point to the Model**
157
+
158
+ State points represent the thermodynamic conditions (like pressure, temperature, and mass flow rate) at different points in the system. These points are added using the **`add_point()`** method, which internally calls the **`Prop()`** function to calculate and store the properties of the fluid.
159
+
160
+ #### **Adding State Points**
161
+
162
+ When adding a state point, you can define only the known parameters (e.g., pressure, temperature etc.) . The missing properties will be calculated by the model based on the provided values.
163
+
164
+ ```python
165
+ # Adding a state point for water with a known pressure only
166
+
167
+ model.add_point('water', StatePointName='1', P=6.09e5, T= 180+273.15, Mass_flowrate=None)
168
+
169
+ print(model.Points['1'])
170
+ ```
171
+ In this example:
172
+
173
+ * **'water'** is the fluid.
174
+
175
+ * **StatePointName='1'** is the unique identifier for the state point.
176
+
177
+ * **P=6.09e5** sets the pressure.
178
+
179
+ * **T=180+273.15** sets the themperature.
180
+
181
+ * **Mass\_flowrate=None** indicates that the mass flow rate is not specified and can be calculated.
182
+
183
+ You can also set parameters like pressure (**P**), Temperature (**T**), enthalpy (**H**), entropy (**S**), quality (**Q**), and density (**D**) to `None`:
184
+
185
+ ```python
186
+ # Adding a state point for water with a known pressure only
187
+
188
+ model.add_point('water', StatePointName='1', P=6.09e5, T= None, Mass_flowrate=None)
189
+
190
+ print(model.Points['1'])
191
+ ```
192
+ Here you can see that the state point '1' is added to the model but properties are not calculated as the sufficient numbers of parameters are not given.
193
+
194
+
195
+ #### **State Points in the Model**
196
+
197
+ All the state points you add are stored in **`model.Point`**. You can access each state point by its **StatePointName** and view or update its properties.
198
+ ```python
199
+ # Access a state point by its name (e.g., '1')
200
+ State = model.Point['1']
201
+
202
+ # Print the properties of the state point
203
+ print(State)
204
+ ```
205
+ ### **3\. Updating State Points**
206
+
207
+ You can also update the properties of any state point after it has been created. For example, to update the pressure of state point '1', you can do:
208
+ ```
209
+ # Update the pressure of state point '1'
210
+ model.Point['1'].P = 7e5 # Update pressure to 7e5 Pascals
211
+
212
+ # Print the updated state point to verify the change
213
+ print(model.Point['1'])
214
+ ```
215
+ ### 4\. Displaying All State Points
216
+
217
+ To view all state points and their properties, you can use the model.Point_print() method:
218
+ ```
219
+ # Print all state points in the model
220
+ model.Point_print()
221
+ ```
222
+ This will display all the state points and their corresponding properties (e.g., temperature, pressure, enthalpy, density, etc.) and it will return a pandas data frame which contain the proparties of the state points.
223
+
224
+ ---
225
+
226
+ # **Chapter 4: Model Components**
227
+
228
+ In this chapter, we will explore the key components of the thermodynamic model, such as pumps, turbines, heat exchangers,pipe, expansion Valve and other elements that modify the properties of fluids as they flow through the system. Each component plays a significant role in simulating the energy transfers and thermodynamic processes of the system.
229
+
230
+ ## **1. Turbine**
231
+ The **Turbine** component in the **ThermoSim** module models the process of energy extraction from a fluid as it flows through the turbine. A turbine reduces the pressure of the fluid and extracts work, which is useful in power generation, refrigeration, and other thermodynamic cycles.
232
+
233
+ ### **Functionality**
234
+
235
+ * The **Turbine** takes fluid from an **inlet state** and delivers it to an **outlet state**.
236
+
237
+ * The turbine extracts energy from the fluid and reduces its pressure.
238
+
239
+ * The **isentropic efficiency** (`n_isen`) and **mechanical efficiency** ('n_mech') are used to simulate real-world behavior of the turbine, considering energy losses.
240
+
241
+ * The turbine calculates missing state properties (like temperature, enthalpy) based on the known inlet/outlet conditions.
242
+
243
+ ---
244
+
245
+ ## **Constructor and Arguments**
246
+
247
+ The **Turbine** class is initialized using the following constructor
248
+ ```
249
+ def __init__(self, Model, ID, In_state, Out_state, n_isen=1, n_mech=1, Calculate=False):
250
+ ```
251
+ ### **Arguments:**
252
+
253
+ * **Model**: The thermodynamic model instance that holds state points and components.
254
+
255
+ * **ID**: The unique identifier for the turbine (e.g., `'Turbine1'`).
256
+
257
+ * **In\_state**: The state point ID for the fluid entering the turbine (must already exist in `Model.Point`).
258
+
259
+ * **Out\_state**: The state point ID for the fluid leaving the turbine (can be created or pre-defined).
260
+
261
+ * **n\_isen** (default \= 1): The isentropic efficiency of the turbine, which indicates how closely the turbine behaves to an ideal (isentropic) expansion. Values range from 0 (no efficiency) to 1 (perfect efficiency).
262
+
263
+ * **self.n\_mech** (default \= 1): The mechanical efficiency of the turbine, accounting for losses in converting fluid energy to mechanical work. Values range from 0 to 1\.
264
+
265
+ * **Calculate** (default \= False): A boolean flag to specify whether to immediately calculate turbine properties upon initialization (set to `True` for automatic calculation).
266
+
267
+ ## **Attributes**
268
+
269
+ * **self.Type**: A string indicating the component type (`'Turbine'`).
270
+
271
+ * **self.ID**: The unique identifier for the turbine instance.
272
+
273
+ * **self.Inlet**: The inlet state object, referring to `Model.Point[In_state]`.
274
+
275
+ * **self.Outlet**: The outlet state object, referring to `Model.Point[Out_state]`.
276
+
277
+ * **self.n\_isen**: The isentropic efficiency, representing the turbine's ideal behavior.
278
+
279
+ * **self.n\_mech**: The mechanical efficiency, representing how much work is effectively converted from fluid energy.
280
+
281
+ * **self.work**: The work extracted by the turbine (in Joules per second or Watts).
282
+
283
+ * **self.Calc()**: If `Calculate=True`, this method is invoked to perform the property update and calculation.
284
+
285
+ * **self.Solution\_Status**: A boolean indicating whether the solution has been successfully calculated (`True` or `False`).
286
+ ---
287
+
288
+ ## **The `Calc()` Method**
289
+
290
+ The **`Calc()`** method calculates the outlet or inlet properties based on the known inlet or outlet state and the turbine's efficiencies.
291
+
292
+ The work extracted by the turbine is calculated based on the **mass flow rate**, **enthalpy difference**, and the **mechanical efficiency**.
293
+
294
+ ## **Example Usage:**
295
+
296
+ ### **Scenario 1: Known Inlet, Unknown Outlet**
297
+
298
+ In this scenario, we know the inlet properties (pressure, temperature) and want to calculate the outlet properties.
299
+
300
+ ```
301
+ import ThermoSim
302
+
303
+ model = ThermoSim.ThermodynamicModel()
304
+
305
+ # Define inlet state point '1' with known properties (P, T, Mass_flowrate)
306
+ model.add_point('water', StatePointName='1', P=6.09e5, T=158 + 273.15, Mass_flowrate=500)
307
+
308
+ # Define outlet state point '2' with known propertie (P(known), T (Unknown))
309
+ model.add_point('water', StatePointName='2', P=3.5e5, T=None, Mass_flowrate=None)
310
+
311
+
312
+ # Define a turbine with known inlet (state point '1') and unknown outlet (state point '2')
313
+ turbine = model.Turbine(model, 'Turbine1', In_state='1', Out_state='2', n_isen=0.85, n_mech=0.9, Calculate=True)
314
+
315
+ # Access and print the properties of the outlet state (calculated by the turbine)
316
+ print(turbine,"\n")
317
+ print("Inlet State Properties:", model.Point['1'])
318
+ print("Outlet State Properties:", model.Point['2'])
319
+ ```
320
+
321
+ ### **Scenario 2: Known Outlet, Unknown Inlet**
322
+
323
+ In this scenario, we know the outlet properties and want to calculate the inlet properties.
324
+
325
+ ```
326
+ import ThermoSim
327
+
328
+ model = ThermoSim.ThermodynamicModel()
329
+
330
+ # Define inlet state point '1' with known properties (P(known), T(Unknown), Mass_flowrate(known))
331
+ model.add_point('water', StatePointName='1', P=6.09e5, T=None, Mass_flowrate=500)
332
+
333
+ # Define outlet state point '2' with known propertie (P(known), T (known))
334
+ model.add_point('water', StatePointName='2', P=3.5e5, T=138.86+273.15, Mass_flowrate=None)
335
+
336
+
337
+ # Define a turbine with unknown inlet (state point '1') and known outlet (state point '2')
338
+ turbine = model.Turbine(model, 'Turbine1', In_state='1', Out_state='2', n_isen=0.85, n_mech=0.9, Calculate=True)
339
+
340
+ # Access and print the properties of the outlet state (calculated by the turbine)
341
+ print(turbine,"\n")
342
+ print("Inlet State Properties:", model.Point['1'])
343
+ print("Outlet State Properties:", model.Point['2'])
344
+ ```
345
+ ---
346
+
347
+ ## **Summary of Key Attributes:**
348
+
349
+ | Attribute | Description |
350
+ | :---- | :---- |
351
+ | **Type** | Component type (`'Turbine'`) |
352
+ | **ID** | Unique identifier for the turbine |
353
+ | **Inlet** | Inlet state object (`Model.Point[In_state]`) |
354
+ | **Outlet** | Outlet state object (`Model.Point[Out_state]`) |
355
+ | **n\_isen** | Isentropic efficiency (ideal behavior) |
356
+ | **n_mech** | Mechanical efficiency (real-world performance) |
357
+ | **work** | Work extracted by the turbine (J/s or Watts) |
358
+ | **Solution\_Status** | Boolean indicating if the solution was successfully calculated |
359
+
360
+ # **2. Pump**
361
+
362
+ The **Pump** component in the **ThermoSim** module models the process of increasing the pressure of a fluid. Pumps are widely used in fluid circulation systems to ensure that fluids flow through various parts of a thermodynamic system, such as heat exchangers, turbines, or other components. The pump performs work on the fluid, increasing its pressure and potentially its temperature.
363
+
364
+ ### **Functionality**
365
+
366
+ * The **Pump** takes fluid from an **inlet state** and delivers it to an **outlet state**.
367
+
368
+ * The pump increases the pressure of the fluid and may increase its temperature depending on the energy transfer.
369
+
370
+ * The **isentropic efficiency** (`n_isen`) and **mechanical efficiency** (`n_mech`)are used to simulate real-world pump behavior, considering energy losses.
371
+
372
+ ---
373
+
374
+ ## **Constructor and Arguments**
375
+
376
+ The **Pump** class is initialized using the following constructor:
377
+ ```
378
+ def __init__(self, Model, ID, In_state, Out_state, n_isen=1, n_mech=1, Calculate=False):
379
+ ```
380
+
381
+ ### **Arguments:**
382
+
383
+ * **Model**: The thermodynamic model instance that holds state points and components.
384
+
385
+ * **ID**: The unique identifier for the pump (e.g., `'Pump1'`).
386
+
387
+ * **In\_state**: The state point ID for the fluid entering the pump (must already exist in `Model.Point`).
388
+
389
+ * **Out\_state**: The state point ID for the fluid leaving the pump (can be created or pre-defined).
390
+
391
+ * **n\_isen** (default \= 1): The isentropic efficiency of the pump, indicating how closely the pump behaves to an ideal (isentropic) compression. Values range from 0 (no efficiency) to 1 (perfect efficiency).
392
+
393
+ * **n_mech** (default \= 1): The mechanical efficiency of the pump, which accounts for losses in converting mechanical energy to fluid pressure increase. Values range from 0 to 1\.
394
+
395
+ * **Calculate** (default \= False): A boolean flag to specify whether to immediately perform calculations upon initialization (set to `True` for automatic calculation).
396
+
397
+ ## **Attributes**
398
+
399
+ * **self.Type**: A string indicating the component type (`'Pump'`).
400
+
401
+ * **self.ID**: The unique identifier for the pump instance.
402
+
403
+ * **self.Inlet**: The inlet state object, referring to `Model.Point[In_state]
404
+
405
+ * **self.Outlet**: The outlet state object, referring to `Model.Point[Out_state]`.
406
+
407
+ * **self.n\_isen**: The isentropic efficiency of the pump, representing ideal behavior.
408
+
409
+ * **self.n_mech**: The mechanical efficiency of the pump, representing real-world energy conversion efficiency.
410
+
411
+ * **self.work**: The work done by the pump (in Joules per second or Watts).
412
+
413
+ * **self.Calc()**: If `Calculate=True`, this method is invoked to perform the property update and calculation.
414
+
415
+ * **self.Solution\_Status**: A boolean indicating whether the solution has been successfully calculated (`True` or `False`).
416
+
417
+
418
+
419
+ ## **Example Usage:**
420
+
421
+ ### **Scenario 1: Known Inlet, Unknown Outlet**
422
+
423
+ In this scenario, we know the properties of the **inlet** state (e.g., pressure, temperature), and we want to calculate the properties of the **outlet** state based on the pump's performance.
424
+
425
+ #### **Code:**
426
+ ```
427
+
428
+ import ThermoSim
429
+
430
+ model = ThermoSim.ThermodynamicModel()
431
+
432
+ # Define inlet state point '1' with known properties (P, T, Mass_flowrate)
433
+ model.add_point('water', StatePointName='1', P=3e5, T=158 + 273.15, Mass_flowrate=500)
434
+
435
+ # Define outlet state point '2' with known propertie (P(known), T (Unknown))
436
+ model.add_point('water', StatePointName='2', P=6e5, T=None, Mass_flowrate=None)
437
+
438
+
439
+ # Define a pump with known inlet (state point '1') and unknown outlet (state point '2')
440
+ Pump = model.Pump(model, 'Pump1', In_state='1', Out_state='2', n_isen=0.85, n_mech=0.9, Calculate=True)
441
+
442
+ # Access and print the properties of the outlet state (calculated by the turbine)
443
+ print(Pump,"\n")
444
+ print("Inlet State Properties:", model.Point['1'])
445
+ print("Outlet State Properties:", model.Point['2'])
446
+ ```
447
+
448
+ ### **Scenario 2: Known Outlet, Unknown Inlet**
449
+
450
+ In this scenario, we know the properties of the **outlet** state (e.g., pressure, temperature), and we want to calculate the properties of the **inlet** state based on the pump's performance.
451
+
452
+ #### **Code:**
453
+
454
+ ```
455
+
456
+ import ThermoSim
457
+
458
+ model = ThermoSim.ThermodynamicModel()
459
+
460
+ # Define inlet state point '1' with known properties (P(known), T (Unknown)), Mass_flowrate)
461
+ model.add_point('water', StatePointName='1', P=3e5, T=None, Mass_flowrate=500)
462
+
463
+ # Define outlet state point '2' with known propertie (P(known), T (known))
464
+ model.add_point('water', StatePointName='2', P=6e5, T=246.61+273.15, Mass_flowrate=None)
465
+
466
+
467
+ # Define a pump with unknown inlet (state point '1') and known outlet (state point '2')
468
+ Pump = model.Pump(model, 'Pump1', In_state='1', Out_state='2', n_isen=0.85, n_mech=0.9, Calculate=True)
469
+
470
+ # Access and print the properties of the outlet state (calculated by the turbine)
471
+ print(Pump,"\n")
472
+ print("Inlet State Properties:", model.Point['1'])
473
+ print("Outlet State Properties:", model.Point['2'])
474
+ ```
475
+ ---
476
+
477
+ ## **Summary of Key Attributes:**
478
+
479
+ | Attribute | Description |
480
+ | :---- | :---- |
481
+ | **Type** | Component type (`'Pump'`) |
482
+ | **ID** | Unique identifier for the pump |
483
+ | **Inlet** | Inlet state object (`Model.Point[In_state]`) |
484
+ | **Outlet** | Outlet state object (`Model.Point[Out_state]`) |
485
+ | **n\_isen** | Isentropic efficiency (ideal behavior) |
486
+ | **n_mech** | Mechanical efficiency (real-world performance) |
487
+ | **work** | Work done by the pump (J/s or Watts) |
488
+ | **Solution\_Status** | Boolean indicating if the solution was successfully calculated |
489
+
490
+ ---
491
+ # **3. Pipe**
492
+
493
+ The **Pipe** component in the **ThermoSim** module models the flow of a fluid through a pipe. Pipes are essential elements in fluid systems, influencing the fluid’s pressure and temperature changes as it flows through. The **Pipe** component calculates the **pressure drop** and **temperature drop** across the pipe based on the fluid’s flow properties.
494
+
495
+ ### **Functionality**
496
+
497
+ * The **Pipe** models the energy losses due to friction as fluid flows through the pipe, as well as any associated pressure and temperature drops.
498
+
499
+ * It ensures that the **mass flow rate** is conserved between the inlet and outlet of the pipe.
500
+
501
+ * The **Pipe** can calculate unknown pressure and temperature values based on the known properties, and the provided **pressure drop** and **temperature drop**.
502
+
503
+ ---
504
+
505
+ ## **Constructor and Arguments**
506
+
507
+ The **Pipe** class is initialized using the following constructor:
508
+
509
+ ```
510
+ def __init__(self, Model, ID, In_state, Out_state, Pressure_drop=0, Temperature_drop=0, Calculate=False):
511
+ ```
512
+
513
+ ### **Arguments:**
514
+
515
+ * **Model**: The thermodynamic model instance that holds state points and components.
516
+
517
+ * **ID**: The unique identifier for the pipe (e.g., `'Pipe1'`).
518
+
519
+ * **In\_state**: The state point ID for the fluid entering the pipe (must already exist in `Model.Point`).
520
+
521
+ * **Out\_state**: The state point ID for the fluid leaving the pipe (can be created or pre-defined).
522
+
523
+ * **Pressure\_drop** (default \= 0): The pressure drop across the pipe (in Pascals). This is the difference between the inlet and outlet pressures.
524
+
525
+ * **Temperature\_drop** (default \= 0): The temperature drop across the pipe (in Kelvin). This is the difference between the inlet and outlet temperatures.
526
+
527
+ * **Calculate** (default \= False): A boolean flag to specify whether to immediately perform calculations upon initialization (set to `True` for automatic calculation).
528
+
529
+ ## **Attributes**
530
+
531
+ * **self.Type**: A string indicating the component type (`'Pipe'`).
532
+
533
+ * **self.ID**: The unique identifier for the pipe instance.
534
+
535
+ * **self.In\_state**: The ID of the inlet state point (e.g., `'1'`).
536
+
537
+ * **self.Out\_state**: The ID of the outlet state point (e.g., `'2'`).
538
+
539
+ * **self.Pressure\_drop**: The pressure drop across the pipe (in Pascals).
540
+
541
+ * **self.Temperature\_drop**: The temperature drop across the pipe (in Kelvin).
542
+
543
+ * **self.Solution\_Status**: A boolean indicating whether the solution has been successfully calculated (`True` or `False`).
544
+
545
+ * **self.In**: The inlet state object, referring to `Model.Point[In_state]`.
546
+
547
+ * **self.Out**: The outlet state object, referring to `Model.Point[Out_state]`.
548
+
549
+ ---
550
+
551
+ ## **The `Cal()` Method**
552
+
553
+ The **`Cal()`** method performs the necessary calculations for the **Pipe** component, including the **mass flow rate**, **pressure drop**, and **temperature drop** across the pipe.
554
+
555
+ 1. **Mass Flow Rate Check**:
556
+
557
+ * If the mass flow rate is not specified at either the inlet or outlet, it is inferred from the known state. If both are provided, they must match.
558
+
559
+ 2. **Pressure Drop**:
560
+
561
+ * If the inlet pressure is not specified, it is calculated by adding the **pressure drop** to the outlet pressure.
562
+
563
+ * If the outlet pressure is not specified, it is calculated by subtracting the **pressure drop** from the inlet pressure.
564
+
565
+ 3. **Temperature Drop**:
566
+
567
+ * Similar to the pressure drop, if the temperature at either the inlet or outlet is unknown, it is calculated based on the **temperature drop**.
568
+
569
+ 4. **Solution Status**:
570
+
571
+ * After the calculations, the solution status is updated, and the model’s state points are updated.
572
+
573
+ ## **Example Usage:**
574
+
575
+
576
+ In this scenario, we know the properties of the **inlet** state (e.g., pressure, temperature) and want to calculate the properties of the **outlet** state based on the pipe’s performance.
577
+
578
+ #### **Code:**
579
+ ```
580
+ import ThermoSim
581
+
582
+ model = ThermoSim.ThermodynamicModel()
583
+
584
+ # Define inlet state point '1' with known properties (P, T, Mass_flowrate)
585
+ model.add_point('water', StatePointName='1', P=6e5, T=158 + 273.15, Mass_flowrate=500)
586
+
587
+ # Define outlet state point '2' with known propertie (P(known), T (Unknown))
588
+ model.add_point('water', StatePointName='2', P=None, T=None, Mass_flowrate=None)
589
+
590
+
591
+ # Define a pipe with known inlet (state point '1') and unknown outlet (state point '2')
592
+ pipe = model.Pipe(model, 'Pipe1', In_state='1', Out_state='2', Pressure_drop=1e5, Temperature_drop=5, Calculate=True)
593
+
594
+ # Access and print the properties of the outlet state (calculated by the turbine)
595
+ print(pipe,"\n")
596
+ print("Inlet State Properties:", model.Point['1'])
597
+ print("Outlet State Properties:", model.Point['2'])
598
+ ```
599
+
600
+ ---
601
+
602
+ ## **Summary of Key Attributes:**
603
+
604
+ | Attribute | Description |
605
+ | :---- | :---- |
606
+ | **Type** | Component type (`'Pipe'`) |
607
+ | **ID** | Unique identifier for the pipe |
608
+ | **In\_state** | The ID of the inlet state point |
609
+ | **Out\_state** | The ID of the outlet state point |
610
+ | **Pressure\_drop** | The pressure drop across the pipe (Pa) |
611
+ | **Temperature\_drop** | The temperature drop across the pipe (K) |
612
+ | **Solution\_Status** | Boolean indicating if the solution was successfully calculated |
613
+ | **In** | Inlet state object (`Model.Point[In_state]`) |
614
+ | **Out** | Outlet state object (`Model.Point[Out_state]`) |
615
+
616
+ # **4. Heat Exchanger**
617
+
618
+
619
+ The HeatExchanger class in the **ThermoSim** module simulates the thermal exchange between two fluid streams—hot and cold—within a heat exchanger. It computes the heat transfer from the hot fluid to the cold fluid, adjusting the outlet conditions based on the type of heat exchanger (e.g., evaporator, condenser, or double-pipe). The class also calculates the overall heat transfer coefficient (UA), effectiveness, and ensures proper energy balance.
620
+
621
+ ---
622
+
623
+ ## **Constructor and Arguments**
624
+
625
+ The HeatExchanger class is initialized using the following constructor:
626
+
627
+ ```
628
+ def __init__(self, Model, ID, PPT, HEX_type, Hot_In_state, Hot_Out_state, Cold_In_state, Cold_Out_state, UA=None, effectiveness=None, Q=None, div_N=200, PPT_graph=False, Calculate=False):`
629
+ ```
630
+ ### **Arguments:**
631
+
632
+ * **Model:** The thermodynamic model instance containing all state points and components.
633
+ * **ID:** Unique identifier for the heat exchanger (e.g., `"HE1"`).
634
+ * **PPT:** Pinch point temperature (PPT), which is the minimum temperature difference between the hot and cold fluids.
635
+ * **HEX\_type:** The type of heat exchanger (e.g., `'Evaporator'`, `'Condenser'`, `'double_pipe'`, `'SimpleHEX'`).
636
+ * **Hot\_In\_state:** The state point ID for the hot fluid entering the heat exchanger.
637
+ * **Hot\_Out\_state:** The state point ID for the hot fluid exiting the heat exchanger.
638
+ * **Cold\_In\_state:** The state point ID for the cold fluid entering the heat exchanger.
639
+ * **Cold\_Out\_state:** The state point ID for the cold fluid exiting the heat exchanger.
640
+ * **UA (default \= None):** The overall heat transfer coefficient times the heat transfer area.
641
+ * **effectiveness (default \= None):** The effectiveness of the heat exchanger (used for energy balance calculations).
642
+ * **Q (default \= None):** The amount of heat transferred, calculated during the energy balance.
643
+ * **div\_N (default \= 200):** The number of discrete temperature divisions used to calculate the temperature profile.
644
+ * **PPT\_graph (default \= False):** Boolean flag to plot the temperature profiles of the hot and cold fluids.
645
+ * **Calculate (default \= False):** If set to `True`, the calculations are immediately performed upon initialization using the `Cal()` method.
646
+
647
+ ## **Attributes**
648
+
649
+ * **self.ID:** The unique identifier for the heat exchanger component.
650
+ * **self.Type:** Always set to `"HeatExchanger"`.
651
+ * **self.Hot\_In\_state, self.Hot\_Out\_state, self.Cold\_In\_state, self.Cold\_Out\_state:** State point objects for the hot and cold fluids.
652
+ * self.HEX\_type: The type of heat exchanger (e.g., `'Evaporator'`, `'Condenser'`).
653
+ * **self.PPT:** Pinch point temperature.
654
+ * **self.Q:** Heat transferred (in Watts).
655
+ * **self.Hot\_Mass\_flowrate:** Mass flow rate of the hot fluid.
656
+ * **self.Cold\_Mass\_flowrate:** Mass flow rate of the cold fluid.
657
+ * **self.effectiveness:** Effectiveness of the heat exchanger (if applicable).
658
+ * **self.Solution\_Status:** Boolean indicating whether the solution has been successfully computed (`True` or `False`).
659
+ * **self.UA:** Overall heat transfer coefficient times area (if applicable).
660
+
661
+ ---
662
+ ## **Example Usage**
663
+
664
+ ### **Scenario: Known Hot Fluid Conditions, Calculate Cold Fluid**
665
+ ```
666
+
667
+ import ThermoSim
668
+
669
+ model = ThermoSim.ThermodynamicModel()
670
+
671
+ model.add_point('water', StatePointName='1', P=6e5, T=80 + 273.15, Mass_flowrate=2) # Hot Inlet
672
+ model.add_point('water', StatePointName='2', P=6e5, T= 50+273.15) # Hot Outlet
673
+ model.add_point('water', StatePointName='3', P=6e5, T=20 + 273.15, Mass_flowrate=2) # Cold Inlet
674
+ model.add_point('water', StatePointName='4', P=6e5, T=None) # Cold Outlet
675
+
676
+ # Create heat exchanger component
677
+ hx = model.HeatExchanger(model, 'HE1', PPT=5, HEX_type='double_pipe', Hot_In_state='1', Hot_Out_state='2', Cold_In_state='3', Cold_Out_state='4',PPT_graph=True, Calculate=True)
678
+ # Access and print the heat transfer and solution status
679
+ print(hx)
680
+ ```
681
+ ---
682
+
683
+ ## **Key Notes**
684
+ * For all cases counter-flow heat exchanger is considered.
685
+ * Mass flow rates must be provided for either the hot or cold fluids. If one is missing, it will be inferred from the other sufficient parameters are given.
686
+ * The PPT (Pinch Point Temperature) is critical for determining the minimum temperature difference between the hot and cold fluids. it acts as a constrain.
687
+ * The effectiveness of the heat exchanger should be provided if the energy balance requires it (e.g., for counter-flow heat exchangers).
688
+ * Plotting can be enabled by setting `PPT_graph=True`, which will display the temperature profiles for both the hot and cold fluids.
689
+
690
+ ---
691
+
692
+ ## **Summary of Key Attributes**
693
+
694
+ | Attribute | Description |
695
+ | :---- | :---- |
696
+ | ID | Unique identifier for the heat exchanger |
697
+ | Type | Always set to `'HeatExchanger'` |
698
+ | PPT | Pinch point temperature (minimum temperature difference) |
699
+ | Q | Heat transferred (W) |
700
+ | Hot\_Mass\_flowrate | Mass flow rate of the hot fluid |
701
+ | Cold\_Mass\_flowrate | Mass flow rate of the cold fluid |
702
+ | effectiveness | Effectiveness of the heat exchanger (if provided) |
703
+ | UA | Overall heat transfer coefficient times area (if applicable) |
704
+ | Solution\_Status | Whether the calculations were successfully performed |
705
+
706
+ The `HEX_type` argument defines the type of heat exchanger being modeled. It plays a crucial role in determining the heat transfer characteristics and the method used to calculate the heat exchange between the hot and cold fluids.
707
+
708
+ ### **Available Types of Heat Exchanger**
709
+
710
+ The `HEX_type` argument can take various values, including common configurations like `'double_pipe'`, `'Evaporator'`, and `'Condenser'`. Each type represents a specific kind of heat exchanger, and the calculation methods and assumptions may vary based on the selected type.
711
+
712
+ ### **1\.** `'double_pipe'`
713
+
714
+ * Description: A double-pipe heat exchanger consists of two concentric pipes, with one fluid flowing through the inner pipe and the other fluid flowing through the outer pipe. This type is used for small heat exchange applications, especially when space is limited.
715
+ * Heat Transfer Mechanism: Heat is transferred between the two fluids through the pipe walls, relying on a temperature gradient between the fluids.
716
+ * Calculation: The model uses a simple approach for calculating the heat transfer between the two streams based on the temperature difference and flow rates.
717
+ * Here no phase change occure in any fluid.
718
+ * Example Usage:
719
+
720
+ ---
721
+
722
+ ### **2\.** `'Evaporator'`
723
+
724
+ * Description: The cold fluid changes phase from liquid to gas in the process. (e.g., Evaporator, Boiler)
725
+ * Heat Transfer Mechanism: Heat is transferred from the hot fluid to the cold fluid, causing it to evaporate.
726
+
727
+ ---
728
+
729
+ ### **3\.** `'Condenser'`
730
+
731
+ * Description: A condenser heat exchanger is used to reject heat from hot fluid (e.g., steam) to a cold fluid (e.g., water or air), causing the vapor to condense into a liquid.
732
+ * Heat Transfer Mechanism: In a condenser, the hot vapor loses its heat to the cooling fluid, which causes the vapor to condense. This type of heat exchanger is used in power plants, refrigeration systems, and air conditioning.
733
+
734
+ ---
735
+
736
+ ### **4\.** `'SimpleHEX'` **Heat Exchanger**
737
+
738
+ * Description: A simple heat exchanger can represent a variety of heat exchangers that do not fall into more specific categories. It's often used as a generic heat exchanger model for educational or testing purposes.
739
+ * Heat Transfer Mechanism: This model uses a simplified approach to calculate heat transfer based on temperature differences and flow rates.
740
+ * This heat exchanger can be used where only one fluid is considered. For example we know the feed water inlet state of a boiler and heat transfer to the boiler, then it will calculate the outlet state. here we will provide the only cold fluid inlet state no need to provide the hot fluid info.
741
+
742
+ * Example Usage:
743
+ ```
744
+ import ThermoSim
745
+
746
+ model = ThermoSim.ThermodynamicModel()
747
+
748
+ model.add_point('water', StatePointName='3', P=6e5, T=20 + 273.15, Mass_flowrate=2) # Cold Inlet
749
+ model.add_point('water', StatePointName='4', P=6e5, T=None) # Cold Outlet
750
+
751
+ # Create heat exchanger component
752
+ hx = model.HeatExchanger(model, 'HE1', PPT=5, HEX_type='SimpleHEX', Hot_In_state=None, Hot_Out_state=None, Cold_In_state='3', Cold_Out_state='4',PPT_graph=True, Calculate=True,Q=5e5)
753
+
754
+ print(hx)
755
+ ```
756
+
757
+ ## **Summary of HEX\_type Values:**
758
+
759
+ | HEX\_type | Description | Use Case |
760
+ | :---- | :---- | :---- |
761
+ | 'double\_pipe' | Two concentric pipes transferring heat between two fluids. | Small-scale applications or where space is limited. |
762
+ | 'Evaporator' | Used to absorb heat and evaporate a fluid (e.g., refrigerant). | Common in refrigeration and air conditioning systems. |
763
+ | 'Condenser' | Used to reject heat and condense a vapor into a liquid. | Found in power plants and cooling systems. |
764
+ | 'SimpleHEX' | Generic heat exchanger used for basic heat transfer calculations. | Suitable for educational purposes or simple simulations. |
765
+
766
+ # PCM (Phase Change Material)
767
+
768
+
769
+ The `PCM` component models a **phase change material energy storage system** that exchanges heat with two fluid streams — one for charging and one for discharging. It is designed to simulate how thermal energy is **stored during melting (charging)** and **released during solidification (discharging)** at a constant melting temperature.
770
+
771
+ This component is especially useful for modeling **thermal energy storage** systems used in renewable energy integration, waste heat recovery, or HVAC load balancing.
772
+
773
+ ## Constructor and Arguments
774
+
775
+ ```python
776
+ def __init__(self, Model, ID, PPT, Charge, T_melt, Hot_In_state, Hot_Out_state,
777
+ Cold_In_state, Cold_Out_state, Charging_time, Discharging_time,
778
+ per_loss, Capacity=None, Calculate=False):
779
+ ```
780
+
781
+ ### Arguments:
782
+
783
+ | Argument | Description |
784
+ |----------------------|-------------|
785
+ | **Model** | The main thermodynamic model object containing all state points and components. |
786
+ | **ID** | Unique identifier for the PCM component (e.g., `'PCM1'`). |
787
+ | **PPT** | Pinch Point Temperature (minimum temperature difference for heat exchange). |
788
+ | **Charge** | `"Charging"` or `"Discharging"` which indicating whether the PCM is currently charging or discharging. |
789
+ | **T_melt** | Melting temperature of the PCM (in Kelvin). |
790
+ | **Hot_In_state** | State ID for hot fluid inlet. |
791
+ | **Hot_Out_state** | State ID for hot fluid outlet. |
792
+ | **Cold_In_state** | State ID for cold fluid inlet. |
793
+ | **Cold_Out_state** | State ID for cold fluid outlet. |
794
+ | **Charging_time** | Charging duration (seconds). |
795
+ | **Discharging_time** | Discharging duration (seconds). |
796
+ | **per_loss** | Percentage energy loss (e.g., `0.1` for 10%). |
797
+ | **Capacity** *(optional)* | Energy capacity in Joules. |
798
+ | **Calculate** *(optional)* | Run calculations immediately if `True`. |
799
+
800
+ ## Attributes
801
+
802
+ | Attribute | Description |
803
+ |---------------------|-------------|
804
+ | **Capacity** | Energy storage capacity. |
805
+ | **Solution_Status** | Calculation success flag. |
806
+ | **Charge** | `Charging` or `Discharging` state. |
807
+ | **Hot_Mass_flowrate**, **Cold_Mass_flowrate** | Fluid flow rates. |
808
+ | **Charging_Power** | Charging Power (Watt) |
809
+ | **Discharging_Power** | Discharging_Power (Watt) |
810
+ | **Heat_loss** | Amount of heat Loss |
811
+ | **Solution\_Status** | Whether the calculations were successfully performed |
812
+
813
+ ## Charging Mode
814
+
815
+ - Hot fluid gives heat to PCM
816
+ - PCM absorbs and stores energy
817
+ - Heat loss is subtracted
818
+ - Capacity = `Q × Charging_time`
819
+
820
+ ## Discharging Mode
821
+
822
+ - PCM releases stored heat
823
+ - Cold fluid absorbs energy
824
+ - Capacity = `Q × Discharging_time`
825
+
826
+ ## Example Usage
827
+
828
+ ### Charging
829
+
830
+ ```python
831
+ import ThermoSim
832
+
833
+ model = ThermoSim.ThermodynamicModel()
834
+
835
+
836
+ model.add_point('water', StatePointName='1', P=6e5, T=80 + 273.15, Mass_flowrate=2) # Hot Inlet
837
+ model.add_point('water', StatePointName='2', P=6e5, T= None) # Hot Outlet
838
+ model.add_point('water', StatePointName='3', P=6e5, T=20 + 273.15, Mass_flowrate=2) # Cold Inlet
839
+ model.add_point('water', StatePointName='4', P=6e5, T=None) # Cold Outlet
840
+
841
+ pcm = model.PCM(model, ID='PCM1', PPT=5, Charge="Charging", T_melt=50 + 273.15,
842
+ Hot_In_state='1', Hot_Out_state='2',
843
+ Cold_In_state='3', Cold_Out_state='4',
844
+ Charging_time=600, Discharging_time=600,
845
+ per_loss=0.05, Calculate=True)
846
+
847
+ print(pcm)
848
+ ```
849
+
850
+ ### Discharging
851
+
852
+ ```python
853
+ # Now set the pcm module to discharging mode
854
+ pcm.Charge="Discharging"
855
+ # after change the Charge parameter we have to calculate the whole pcm module again.
856
+ pcm.Cal()
857
+ print(pcm)
858
+ ```
859
+
860
+ ---
861
+
862
+ # Example problem
863
+ A geothermal Organic Rankine Cycle (ORC) system uses isobutane as the working fluid and water as the heating source. Hot water enters the evaporator at 158°C and 600 kPa, with a mass flow rate of 500 kg/s, and exits at a restricted temperature of 90°C. The working fluid, isobutane, evaporates at a pressure of 3250 kPa and condenses at 410 kPa. Cooling is provided by ambient air entering the condenser at 3°C with a mass flow rate of 8500 kg/s. You are required to model the thermodynamic performance of the cycle:
864
+
865
+ * Estimate the maximum isobutane flow rate based on heat availability,
866
+ * Turbine and pump work,
867
+ * Efficiency of the cycle
868
+
869
+ ![Schematic Diagrame](diagrame.png "Schematic Diagrame of the ORC plant")
870
+
871
+ ## Solution:
872
+ First, we will set the known parameters
873
+ ```
874
+ import ThermoSim
875
+ Model = ThermoSim.ThermodynamicModel()
876
+
877
+
878
+ T1 = 158+273.15 # Hot Water Inlet temperature
879
+ T2 = 90+273.15 # Hot water outlet
880
+ T3 = None
881
+ T4 = None
882
+ T5 = None
883
+ T6 = None
884
+ T7 = 3 + 273.15 # Air temperature
885
+ T8 = None
886
+
887
+
888
+ P1 = 6e5 #Hot Water Inlet Pressure
889
+ P2 = None
890
+ P3 = 3250e3 # Turbine Inlet Pressure
891
+ P4 = 410e3 # Turbine Outlet Pressure
892
+ P5 = None
893
+ P6 = None
894
+ P7 = 1.01e5 # Atmospheric Pressure
895
+ P8 = None
896
+
897
+
898
+ m_brine = 500
899
+ water = 'water'
900
+ w_fluid = 'Isobutane'
901
+ cooling_fluid = 'Air'
902
+ m_air = 8500
903
+ ```
904
+ Now we make some assumptions and try to find other parameters.
905
+ ```
906
+ #Assumptions
907
+ # No Pressure drop in HEX so
908
+ P2 = P1 # Eveporator: Hot side pressure of inlet and outlet is same
909
+ P5 = P4 # Eveporatore: cold side pressure of inlet and outlet is same
910
+ P6 = P3 # Condenser: Hot side pressure of inlet and outlet is same
911
+ P8 = P7 # Condenser: cold side pressure of inlet and outlet is same
912
+
913
+ # Consider 10K superheat for working fluid at evaporator outlet
914
+ T3 = Model.Prop(w_fluid, StatePointName = "demo", P = P3,Q = 1).T+10
915
+ # Consider 20K subcooling of working fluid at condenser outlet
916
+ T5 = Model.Prop(w_fluid,StatePointName="xxx",P = P5,Q = 0).T - 20
917
+
918
+ # Consider Pump and Turbines Isentropic efficiency
919
+ n_expn = .75
920
+ n_pump = 0.75
921
+ PPT = 5
922
+ ```
923
+ Now we add the state points to our model.
924
+ ```
925
+
926
+ Model.add_point(water, StatePointName = '1',P = P1, T = T1,Mass_flowrate=m_brine)
927
+ Model.add_point(water, StatePointName = '2',P = P2, T = T2)
928
+ Model.add_point(w_fluid, StatePointName = '3',P = P3, T = T3)
929
+ Model.add_point(w_fluid, StatePointName = '4',P = P4, T = T4)
930
+ Model.add_point(w_fluid, StatePointName = '5',P = P5, T = T5)
931
+ Model.add_point(w_fluid, StatePointName = '6',P = P6, T = T6)
932
+ Model.add_point(cooling_fluid, StatePointName = '7',P = P7, T = T7,Mass_flowrate=m_air)
933
+ Model.add_point(cooling_fluid, StatePointName = '8',P = P8, T = T8)
934
+ Model.Point_print()
935
+ ```
936
+ Massflowrate of the working fluid is unknown so mass flowrate at state point 5 and 6 is set to 1 kg/s. It will show a warnig massage. As soon as we calculate the mass flowrate of the working fluid, we will recalculate the pump.
937
+ ```
938
+ Pump = Model.Pump(Model, 'Pump', In_state = '5', Out_state = '6',n_isen=n_pump,Calculate=True)
939
+ ```
940
+ Now solve the evaporator. Here, only missing paramtere is working fluids mass flow rate.
941
+ ```
942
+ Evaporator = Model.HeatExchanger(Model, 'Evaporator', PPT = PPT, HEX_type = 'Evaporator', Hot_In_state = '1', Hot_Out_state = '2', Cold_In_state = '6', Cold_Out_state = '3',Calculate=True,PPT_graph=True)
943
+ ```
944
+ As we know the mass flow rate of the working fluid, we recalculate the pump for accurate power of the pump.
945
+ ```
946
+ Pump.Cal()
947
+ ```
948
+ Now we solve the turbine and the condenser.
949
+ ```
950
+ Turbine = Model.Turbine(Model, 'Turbine', In_state = '3', Out_state = '4',n_isen=n_expn,Calculate=True)
951
+
952
+
953
+ Condenser = Model.HeatExchanger(Model, 'Condenser', PPT = PPT, HEX_type = 'Condenser', Hot_In_state = '4', Hot_Out_state = '5', Cold_In_state = '7', Cold_Out_state = '8',Calculate=True,PPT_graph=True)
954
+ Model.Point_print()
955
+ ```
956
+ You can print all the component and state point by using the following command.
957
+ ```
958
+ print(Model)
959
+ ```
960
+ Now we can calculate and print the required parameters
961
+ ```
962
+ working_fluid_massflowrate = Evaporator.Cold_Mass_flowrate
963
+ Turbine_work = Turbine.work
964
+ Pump_work = Pump.work
965
+ Q_in = Evaporator.Q
966
+ ORC_efficiency = (Turbine_work-Pump_work)/Q_in*100
967
+
968
+ print(f"Working Fluid's Mass Flowrate: {working_fluid_massflowrate} kg/s")
969
+ print(f"Turbine Power: {Turbine_work} W\n"
970
+ f"Pump Power: {Pump_work} W")
971
+ print(f"Cycle Efficiency: {ORC_efficiency} %")
972
+
973
+ ```
974
+ ## Tips
975
+ * You can add this `Model.Point_print()` after every component to fidn which state point is solved.
976
+ # License
977
+
978
+ MIT