A lightweight pinch analysis package
Project description
pina
Installation
To install this package, run
python -m pip install pina
Basic example
This is a basic example using the four stream problem from Pinch Analysis and Process Integration: A User Guide On Process Integration for the Efficient Use of Energy, Second edition, Ian C. Kemp, p. 4. Its data looks as follows:
| Stream number and type | Heat flow [kW] | Supply Temperature [°C] | Target Temperature [°C] |
|---|---|---|---|
| 1. Cold | -230 | 20 | 135 |
| 2. Hot | 330 | 170 | 60 |
| 3. Cold | -240 | 80 | 140 |
| 4. Hot | 180 | 150 | 30 |
ΔTmin = 10 K
We can input the data with the following code:
from pina import PinchAnalyzer, make_stream
# Arguments: heat flow, supply temperature, target temperature
cold_1 = make_stream(-230, 20, 135)
hot_1 = make_stream(330, 170, 60)
cold_2 = make_stream(-240, 80, 140)
hot_2 = make_stream(180, 150, 30)
min_temp_diff = 10
temp_shift = min_temp_diff / 2
analyzer = PinchAnalyzer(temp_shift)
analyzer.add_streams(cold_1, hot_1, cold_2, hot_2)
The PinchAnalyzer class calculates the energy targets, the pinch
temperature(s) and the coordinates of the composite curves. The following
properties can be requested from it:
heating_demandcooling_demandhot_utility_targetcold_utility_targetheat_recovery_targetpinch_tempscold_composite_curvehot_composite_curveshifted_cold_composite_curveshifted_hot_composite_curvegrand_composite_curve
For example:
print(
"Heating demand: {}\n"
"Cooling demand: {}\n"
"Hot utility target: {}\n"
"Cold utility target: {}\n"
"Heat recovery target: {}\n"
"Pinch temperature(s): {}".format(
analyzer.heating_demand,
analyzer.cooling_demand,
analyzer.hot_utility_target,
analyzer.cold_utility_target,
analyzer.heat_recovery_target,
analyzer.pinch_temps,
)
)
Output:
Heating demand: 470.0
Cooling demand: 510.0
Hot utility target: 20.0
Cold utility target: 60.0
Heat recovery target: 450.0
Pinch temperature(s): [85.0]
Plotting
This package deliberately does not include any plotting functions, but using it
together with plotting libraries is simple. Here is an example that uses
matplotlib to create a figure with two subplots: the hot and cold composite
curves on the left and the grand composite curve on the right:
from matplotlib import pyplot as plt
fig, ax = plt.subplots(1, 2, figsize=(16, 7))
ax[0].plot(*analyzer.hot_composite_curve, color="tab:red", linestyle="--", label="HCC")
ax[0].plot(*analyzer.cold_composite_curve, color="tab:blue", linestyle="-", label="CCC")
ax[0].legend()
ax[0].set_title("Hot and cold composite curves")
ax[0].set_xlabel("Heat flow [kW]")
ax[0].set_ylabel("Actual temperature [\u2103]")
ax[1].plot(*analyzer.grand_composite_curve, color="k", linestyle="-", label="GCC")
ax[1].legend()
ax[1].set_title("Grand composite curve")
ax[1].set_xlabel("Net heat flow [kW]")
ax[1].set_ylabel("Shifted temperature [\u2103]")
# Make the y-axis equal in both plots
ylims = (*ax[0].get_ylim(), *ax[1].get_ylim())
minmax_ylims = (min(ylims), max(ylims))
ax[0].set_ylim(minmax_ylims)
ax[1].set_ylim(minmax_ylims)
plt.show()
Output:
More examples
More examples can be found in the examples folder. They show some additional features:
- Streams carrying latent heat (e.g. evaporation and condensation)
- Streams consisting of multiple segments
- Streams with individual temperature shifts
Anything else?
Nope, that's all. Enjoy :-)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pina-0.1.1.tar.gz.
File metadata
- Download URL: pina-0.1.1.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b2e864a42d5ef8d8c01d93db5aaec2cb39e55006ce0a3fc67f79e037d66518e
|
|
| MD5 |
db31d5c5d245eba7ecc207b8c6931dd4
|
|
| BLAKE2b-256 |
3958457a7d653f94647a65d891972b2167f3d819659a8da788ce031fcbcd345a
|
File details
Details for the file pina-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pina-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9f94b8995e8f08e35a8ab18e72f0f9fbba146ad9515b49e8fd682e66ab52979
|
|
| MD5 |
93d51a6b48ec575b159177804b16fa68
|
|
| BLAKE2b-256 |
136d1eb2b6623224dff8a7f2ce457d5d4b9b7225a3dfd682c3052775da3e51c1
|