OpenPyTEA 1.2.0__tar.gz → 2.1.0__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.
Files changed (30) hide show
  1. {openpytea-1.2.0/src/OpenPyTEA.egg-info → openpytea-2.1.0}/PKG-INFO +87 -12
  2. {openpytea-1.2.0 → openpytea-2.1.0}/README.md +86 -11
  3. {openpytea-1.2.0 → openpytea-2.1.0}/pyproject.toml +17 -1
  4. {openpytea-1.2.0 → openpytea-2.1.0/src/OpenPyTEA.egg-info}/PKG-INFO +87 -12
  5. {openpytea-1.2.0 → openpytea-2.1.0}/src/OpenPyTEA.egg-info/SOURCES.txt +9 -1
  6. openpytea-2.1.0/src/openpytea/__init__.py +36 -0
  7. openpytea-2.1.0/src/openpytea/analysis.py +910 -0
  8. openpytea-2.1.0/src/openpytea/data/cepci_values.csv +36 -0
  9. openpytea-2.1.0/src/openpytea/equipment.py +556 -0
  10. openpytea-2.1.0/src/openpytea/helpers.py +753 -0
  11. openpytea-2.1.0/src/openpytea/io.py +620 -0
  12. {openpytea-1.2.0 → openpytea-2.1.0}/src/openpytea/plant.py +1050 -348
  13. openpytea-2.1.0/src/openpytea/plotting.py +834 -0
  14. openpytea-2.1.0/tests/test_analysis.py +113 -0
  15. openpytea-2.1.0/tests/test_equipment.py +29 -0
  16. openpytea-2.1.0/tests/test_plant.py +119 -0
  17. openpytea-2.1.0/tests/test_plotting.py +47 -0
  18. openpytea-2.1.0/tests/test_run_tea.py +148 -0
  19. openpytea-2.1.0/tests/test_smoke.py +69 -0
  20. openpytea-1.2.0/src/openpytea/__init__.py +0 -24
  21. openpytea-1.2.0/src/openpytea/analysis.py +0 -2127
  22. openpytea-1.2.0/src/openpytea/data/cepci_values.csv +0 -36
  23. openpytea-1.2.0/src/openpytea/equipment.py +0 -432
  24. openpytea-1.2.0/tests/test_import.py +0 -2
  25. {openpytea-1.2.0 → openpytea-2.1.0}/LICENSE +0 -0
  26. {openpytea-1.2.0 → openpytea-2.1.0}/setup.cfg +0 -0
  27. {openpytea-1.2.0 → openpytea-2.1.0}/src/OpenPyTEA.egg-info/dependency_links.txt +0 -0
  28. {openpytea-1.2.0 → openpytea-2.1.0}/src/OpenPyTEA.egg-info/requires.txt +0 -0
  29. {openpytea-1.2.0 → openpytea-2.1.0}/src/OpenPyTEA.egg-info/top_level.txt +0 -0
  30. {openpytea-1.2.0 → openpytea-2.1.0}/src/openpytea/data/cost_correlations.csv +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenPyTEA
3
- Version: 1.2.0
3
+ Version: 2.1.0
4
4
  Summary: OpenPyTEA: An open-source Python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation
5
5
  Maintainer-email: "Panji B. Tamarona" <P.B.Tamarona@tudelft.nl>
6
6
  License-Expression: MIT
@@ -26,7 +26,7 @@ Dynamic: license-file
26
26
 
27
27
  **OpenPyTEA** is an open-source Python toolkit for performing **techno-economic assessment (TEA)** of chemical and energy systems. It was created to address a persistent gap in the TEA workflow: while process simulators model mass and energy balances, researchers often lack an equally transparent and flexible way to evaluate the **economic feasibility** of their designs. Commercial tools remain *black-box tools*, and many academic TEA implementations are process-specific, undocumented, or difficult to reproduce.
28
28
 
29
- **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdown plots**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
29
+ **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdowns**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
30
30
 
31
31
  Beyond its functionality, **OpenPyTEA is designed as a community-driven TEA platform**. Users can contribute new equipment cost correlations, improve economic models, report issues, and expand the toolkit’s capabilities over time. This collaborative approach helps build a shared, transparent, and continually improving TEA resource—similar to the open-source progress seen in the LCA community.
32
32
 
@@ -43,8 +43,10 @@ https://github.com/pbtamarona/OpenPyTEA/tree/main/examples
43
43
  ## ✨ Key Features
44
44
  - **Modular architecture:** clean separation of cost correlations, equipment objects, plant economics, and uncertainty analysis.
45
45
  - **Transparent and reproducible:** all algorithms, equations, and assumptions are openly available for full traceability.
46
- - **Cost breakdown visualization:** built-in helpers to plot stacked bar charts of direct equipment costs, fixed capital, and operating costs.
47
- - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
46
+ - **Cost breakdown visualization:** built-in functions to plot stacked bar charts of equipment costs, fixed capital, and operating costs.
47
+ - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
48
+ - **Workflow using JSON configuration files:** standardized input/output structure via `io.py` for reproducible analyses and multi-scenario evaluation.
49
+ - **Flexible analysis and visualization:** separation of data processing (`analysis.py`) and plotting (`plotting.py`) allows users to apply custom visualization tools.
48
50
  - **Interoperable and extensible:** easy integration with process simulators, optimization frameworks, and LCA tools.
49
51
  - **Education-friendly:** ideal for teaching TEA and process design without reliance on proprietary software.
50
52
  - **Community-driven:** users can contribute new correlations, improve models, request features, and shape the evolution of the platform.
@@ -71,7 +73,6 @@ or with `uv`:
71
73
  uv add git+https://github.com/pbtamarona/OpenPyTEA
72
74
  ```
73
75
 
74
-
75
76
  **OpenPyTEA** requires **Python ≥ 3.9**.
76
77
  The main dependencies include:
77
78
 
@@ -91,12 +92,78 @@ src/openpytea/
91
92
  ├── equipment.py # Equipment-level costing and inflation correction
92
93
  ├── plant.py # Plant-level TEA: CAPEX, OPEX, cash flows, financial metrics
93
94
  ├── analysis.py # Sensitivity and uncertainty analysis (sensitivity plots, Monte Carlo)
95
+ ├── plotting.py # Visualization functions (plots and figures)
96
+ ├── io.py # JSON-based workflow: load inputs and export results
97
+ ├── helpers.py # Helper functions for data handling and common operations
94
98
  └── data/ # Cost correlations database and CEPCI data
95
99
  examples/ # Example notebooks and case studies
96
- walkthrough.ipynb # walkthrough of the package
100
+ walkthrough.ipynb # Walkthrough of the package
101
+
102
+ backend/ # FastAPI backend for the web GUI
103
+ ├── app/
104
+ │ ├── main.py # FastAPI app with CORS and router mounting
105
+ │ ├── state.py # In-memory session state
106
+ │ ├── schemas.py # Pydantic request/response models
107
+ │ ├── util.py # JSON serialization utilities
108
+ │ ├── routers/ # API endpoints (equipment, plant, analysis, I/O)
109
+ │ └── presets/ # Example preset JSON files
110
+ └── requirements.txt
111
+
112
+ frontend/ # React + TypeScript web GUI
113
+ ├── src/
114
+ │ ├── api/client.ts # Typed API client
115
+ │ ├── types/index.ts # TypeScript interfaces
116
+ │ ├── pages/ # Equipment, Plant Config, Results, Analysis, Monte Carlo, Compare
117
+ │ ├── App.tsx # Tab navigation + examples dropdown
118
+ │ └── App.css # Styling
119
+ └── package.json
120
+
97
121
  pyproject.toml
98
122
  README.md
99
123
  ```
124
+ ---
125
+
126
+ ## 🏗️ Software Architecture
127
+
128
+ ![OpenPyTEA Architecture](examples/img/architecture.png)
129
+
130
+ Software architecture and data flow of **OpenPyTEA**, illustrating the progression from user input to TEA output. Users provide economic assumptions, process simulation results, and equipment-sizing parameters. Equipment-sizing information is linked with cost correlations and CEPCI values stored in CSV databases to calculate inflation-adjusted purchased and direct costs. `Equipment` objects are aggregated into a `Plant` object, where CAPEX, OPEX, and financial performance metrics are evaluated. The `analysis.py` module subsequently operates on `Plant` objects to perform sensitivity and uncertainty analyses.
131
+
132
+ ---
133
+
134
+ ## 🖥️ Web GUI (**work in progress**)
135
+
136
+ OpenPyTEA includes an optional web-based graphical interface for users who prefer a visual workflow over Python scripting. The GUI provides the full TEA workflow through a tabbed browser interface:
137
+
138
+ - **Equipment** — add, edit, and remove equipment with cost database lookup
139
+ - **Plant Config** — configure location, financial parameters, labor, products, and variable OPEX
140
+ - **Results** — run calculations and view metric cards, cost breakdown charts, and cash flow tables
141
+ - **Analysis** — sensitivity plots and tornado diagrams. Sensitivity supports a **multi-panel grid** (different parameter and metric per panel, e.g. NPV vs. interest rate, ROI vs. electricity price, all in one figure) and **multi-plant overlay** (curves for every plant added on the Compare tab share the same axes for direct comparison)
142
+ - **Monte Carlo** — uncertainty analysis with histogram distributions, fitted normal curves, and summary statistics. **Multi-plant overlay** shows distributions for several plants on the same axes, mirroring `plot_multiple_monte_carlo` from the library
143
+ - **Compare** — side-by-side comparison of saved plants (CAPEX/OPEX breakdown bars, key metric bars). Plants imported here are also reused as the overlay set on the Analysis and Monte Carlo tabs
144
+ - **Downloadable charts** — all plots include a download button to export as standalone PNG images with full axis labels
145
+ - **Examples** — built-in presets from the case study notebooks for quick demonstration
146
+
147
+ ### Running the GUI
148
+
149
+ **Backend** (requires Python 3.10+):
150
+ ```bash
151
+ pip install -e . # install OpenPyTEA from repo root
152
+ cd backend
153
+ pip install -r requirements.txt
154
+ PYTHONPATH=../src python3 -m uvicorn app.main:app --reload --port 8000
155
+ ```
156
+
157
+ **Frontend** (requires Node.js):
158
+ ```bash
159
+ cd frontend
160
+ npm install
161
+ npm run dev
162
+ ```
163
+
164
+ Then open http://localhost:5173. Click **Examples** in the header to load a case study preset and explore.
165
+
166
+ For detailed architecture documentation, see `GUI_ARCHITECTURE.md`.
100
167
 
101
168
  ---
102
169
 
@@ -212,14 +279,24 @@ results = monte_carlo(
212
279
  Outputs include probability distributions and confidence intervals for LCOP or NPV—supporting uncertainty-informed decision-making. With `plot_multiple_monte_carlo`, **OpenPyTEA** can also visualize Monte Carlo results for multiple plants to enable uncertainty comparisons.
213
280
 
214
281
  ---
282
+ ### 5. **Workflow using JSON configuration files**
283
+
284
+ **OpenPyTEA** supports a workflow using structured JSON input files via the `io.py` module. This enables standardized, reproducible, and scalable TEA studies.
285
+
286
+ Key functionalities include:
287
+ - `run_equipment()`: evaluate equipment costs from JSON input
288
+ - `run_plant()`: construct and evaluate a plant configuration
289
+ - `run_tea()`: execute full TEA, including cost breakdowns, sensitivity, and uncertainty analysis
290
+
291
+ This workflow is demonstrated in `case_study_1_with_JSON.ipynb` in the example folder.
215
292
 
216
293
  ## 📘 Example Workflows
217
294
 
218
295
  Example notebooks are available in the `examples/` folder, including:
219
296
 
220
- - Hydrogen production
221
- - Hydrogen liquefaction
222
- - Geothermal heat and power
297
+ - Comparison of hydrogen production pathwways
298
+ - Hydrogen liquefaction precooling system
299
+ - Geothermal-based heating and power generation
223
300
 
224
301
  Run any example via:
225
302
  ```bash
@@ -231,8 +308,6 @@ Each notebook demonstrates:
231
308
  - Sensitivity and uncertainty analysis
232
309
  - Visualization of key economic indicators
233
310
 
234
- ---
235
-
236
311
  ## 🧑‍🏫 Educational Use
237
312
 
238
313
  **OpenPyTEA** is suitable for chemical and process engineering education.
@@ -279,7 +354,7 @@ Or if you prefer to cite manually, you may use:
279
354
  title = {OpenPyTEA: An open-source python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation},
280
355
  year = {2025},
281
356
  url = {\url{https://github.com/pbtamarona/OpenPyTEA}},
282
- version = {1.2.0},
357
+ version = {2.0.0},
283
358
  note = {Accessed: YYYY-MM-DD}
284
359
  }
285
360
  ```
@@ -2,7 +2,7 @@
2
2
 
3
3
  **OpenPyTEA** is an open-source Python toolkit for performing **techno-economic assessment (TEA)** of chemical and energy systems. It was created to address a persistent gap in the TEA workflow: while process simulators model mass and energy balances, researchers often lack an equally transparent and flexible way to evaluate the **economic feasibility** of their designs. Commercial tools remain *black-box tools*, and many academic TEA implementations are process-specific, undocumented, or difficult to reproduce.
4
4
 
5
- **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdown plots**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
5
+ **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdowns**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
6
6
 
7
7
  Beyond its functionality, **OpenPyTEA is designed as a community-driven TEA platform**. Users can contribute new equipment cost correlations, improve economic models, report issues, and expand the toolkit’s capabilities over time. This collaborative approach helps build a shared, transparent, and continually improving TEA resource—similar to the open-source progress seen in the LCA community.
8
8
 
@@ -19,8 +19,10 @@ https://github.com/pbtamarona/OpenPyTEA/tree/main/examples
19
19
  ## ✨ Key Features
20
20
  - **Modular architecture:** clean separation of cost correlations, equipment objects, plant economics, and uncertainty analysis.
21
21
  - **Transparent and reproducible:** all algorithms, equations, and assumptions are openly available for full traceability.
22
- - **Cost breakdown visualization:** built-in helpers to plot stacked bar charts of direct equipment costs, fixed capital, and operating costs.
23
- - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
22
+ - **Cost breakdown visualization:** built-in functions to plot stacked bar charts of equipment costs, fixed capital, and operating costs.
23
+ - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
24
+ - **Workflow using JSON configuration files:** standardized input/output structure via `io.py` for reproducible analyses and multi-scenario evaluation.
25
+ - **Flexible analysis and visualization:** separation of data processing (`analysis.py`) and plotting (`plotting.py`) allows users to apply custom visualization tools.
24
26
  - **Interoperable and extensible:** easy integration with process simulators, optimization frameworks, and LCA tools.
25
27
  - **Education-friendly:** ideal for teaching TEA and process design without reliance on proprietary software.
26
28
  - **Community-driven:** users can contribute new correlations, improve models, request features, and shape the evolution of the platform.
@@ -47,7 +49,6 @@ or with `uv`:
47
49
  uv add git+https://github.com/pbtamarona/OpenPyTEA
48
50
  ```
49
51
 
50
-
51
52
  **OpenPyTEA** requires **Python ≥ 3.9**.
52
53
  The main dependencies include:
53
54
 
@@ -67,12 +68,78 @@ src/openpytea/
67
68
  ├── equipment.py # Equipment-level costing and inflation correction
68
69
  ├── plant.py # Plant-level TEA: CAPEX, OPEX, cash flows, financial metrics
69
70
  ├── analysis.py # Sensitivity and uncertainty analysis (sensitivity plots, Monte Carlo)
71
+ ├── plotting.py # Visualization functions (plots and figures)
72
+ ├── io.py # JSON-based workflow: load inputs and export results
73
+ ├── helpers.py # Helper functions for data handling and common operations
70
74
  └── data/ # Cost correlations database and CEPCI data
71
75
  examples/ # Example notebooks and case studies
72
- walkthrough.ipynb # walkthrough of the package
76
+ walkthrough.ipynb # Walkthrough of the package
77
+
78
+ backend/ # FastAPI backend for the web GUI
79
+ ├── app/
80
+ │ ├── main.py # FastAPI app with CORS and router mounting
81
+ │ ├── state.py # In-memory session state
82
+ │ ├── schemas.py # Pydantic request/response models
83
+ │ ├── util.py # JSON serialization utilities
84
+ │ ├── routers/ # API endpoints (equipment, plant, analysis, I/O)
85
+ │ └── presets/ # Example preset JSON files
86
+ └── requirements.txt
87
+
88
+ frontend/ # React + TypeScript web GUI
89
+ ├── src/
90
+ │ ├── api/client.ts # Typed API client
91
+ │ ├── types/index.ts # TypeScript interfaces
92
+ │ ├── pages/ # Equipment, Plant Config, Results, Analysis, Monte Carlo, Compare
93
+ │ ├── App.tsx # Tab navigation + examples dropdown
94
+ │ └── App.css # Styling
95
+ └── package.json
96
+
73
97
  pyproject.toml
74
98
  README.md
75
99
  ```
100
+ ---
101
+
102
+ ## 🏗️ Software Architecture
103
+
104
+ ![OpenPyTEA Architecture](examples/img/architecture.png)
105
+
106
+ Software architecture and data flow of **OpenPyTEA**, illustrating the progression from user input to TEA output. Users provide economic assumptions, process simulation results, and equipment-sizing parameters. Equipment-sizing information is linked with cost correlations and CEPCI values stored in CSV databases to calculate inflation-adjusted purchased and direct costs. `Equipment` objects are aggregated into a `Plant` object, where CAPEX, OPEX, and financial performance metrics are evaluated. The `analysis.py` module subsequently operates on `Plant` objects to perform sensitivity and uncertainty analyses.
107
+
108
+ ---
109
+
110
+ ## 🖥️ Web GUI (**work in progress**)
111
+
112
+ OpenPyTEA includes an optional web-based graphical interface for users who prefer a visual workflow over Python scripting. The GUI provides the full TEA workflow through a tabbed browser interface:
113
+
114
+ - **Equipment** — add, edit, and remove equipment with cost database lookup
115
+ - **Plant Config** — configure location, financial parameters, labor, products, and variable OPEX
116
+ - **Results** — run calculations and view metric cards, cost breakdown charts, and cash flow tables
117
+ - **Analysis** — sensitivity plots and tornado diagrams. Sensitivity supports a **multi-panel grid** (different parameter and metric per panel, e.g. NPV vs. interest rate, ROI vs. electricity price, all in one figure) and **multi-plant overlay** (curves for every plant added on the Compare tab share the same axes for direct comparison)
118
+ - **Monte Carlo** — uncertainty analysis with histogram distributions, fitted normal curves, and summary statistics. **Multi-plant overlay** shows distributions for several plants on the same axes, mirroring `plot_multiple_monte_carlo` from the library
119
+ - **Compare** — side-by-side comparison of saved plants (CAPEX/OPEX breakdown bars, key metric bars). Plants imported here are also reused as the overlay set on the Analysis and Monte Carlo tabs
120
+ - **Downloadable charts** — all plots include a download button to export as standalone PNG images with full axis labels
121
+ - **Examples** — built-in presets from the case study notebooks for quick demonstration
122
+
123
+ ### Running the GUI
124
+
125
+ **Backend** (requires Python 3.10+):
126
+ ```bash
127
+ pip install -e . # install OpenPyTEA from repo root
128
+ cd backend
129
+ pip install -r requirements.txt
130
+ PYTHONPATH=../src python3 -m uvicorn app.main:app --reload --port 8000
131
+ ```
132
+
133
+ **Frontend** (requires Node.js):
134
+ ```bash
135
+ cd frontend
136
+ npm install
137
+ npm run dev
138
+ ```
139
+
140
+ Then open http://localhost:5173. Click **Examples** in the header to load a case study preset and explore.
141
+
142
+ For detailed architecture documentation, see `GUI_ARCHITECTURE.md`.
76
143
 
77
144
  ---
78
145
 
@@ -188,14 +255,24 @@ results = monte_carlo(
188
255
  Outputs include probability distributions and confidence intervals for LCOP or NPV—supporting uncertainty-informed decision-making. With `plot_multiple_monte_carlo`, **OpenPyTEA** can also visualize Monte Carlo results for multiple plants to enable uncertainty comparisons.
189
256
 
190
257
  ---
258
+ ### 5. **Workflow using JSON configuration files**
259
+
260
+ **OpenPyTEA** supports a workflow using structured JSON input files via the `io.py` module. This enables standardized, reproducible, and scalable TEA studies.
261
+
262
+ Key functionalities include:
263
+ - `run_equipment()`: evaluate equipment costs from JSON input
264
+ - `run_plant()`: construct and evaluate a plant configuration
265
+ - `run_tea()`: execute full TEA, including cost breakdowns, sensitivity, and uncertainty analysis
266
+
267
+ This workflow is demonstrated in `case_study_1_with_JSON.ipynb` in the example folder.
191
268
 
192
269
  ## 📘 Example Workflows
193
270
 
194
271
  Example notebooks are available in the `examples/` folder, including:
195
272
 
196
- - Hydrogen production
197
- - Hydrogen liquefaction
198
- - Geothermal heat and power
273
+ - Comparison of hydrogen production pathwways
274
+ - Hydrogen liquefaction precooling system
275
+ - Geothermal-based heating and power generation
199
276
 
200
277
  Run any example via:
201
278
  ```bash
@@ -207,8 +284,6 @@ Each notebook demonstrates:
207
284
  - Sensitivity and uncertainty analysis
208
285
  - Visualization of key economic indicators
209
286
 
210
- ---
211
-
212
287
  ## 🧑‍🏫 Educational Use
213
288
 
214
289
  **OpenPyTEA** is suitable for chemical and process engineering education.
@@ -255,7 +330,7 @@ Or if you prefer to cite manually, you may use:
255
330
  title = {OpenPyTEA: An open-source python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation},
256
331
  year = {2025},
257
332
  url = {\url{https://github.com/pbtamarona/OpenPyTEA}},
258
- version = {1.2.0},
333
+ version = {2.0.0},
259
334
  note = {Accessed: YYYY-MM-DD}
260
335
  }
261
336
  ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "OpenPyTEA"
3
- version = "1.2.0"
3
+ version = "2.1.0"
4
4
  description = "OpenPyTEA: An open-source Python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -57,3 +57,19 @@ where = ["src"]
57
57
 
58
58
  [tool.setuptools.package-data]
59
59
  openpytea = ["data/*.csv"]
60
+
61
+ [tool.ruff]
62
+ # Only check Python files (default, but explicit is cleaner)
63
+ extend-include = ["*.py"]
64
+ extend-exclude = ["*.ipynb", "notebooks/", ".ipynb_checkpoints/"]
65
+
66
+ # Optional but recommended
67
+ line-length = 88
68
+ target-version = "py310"
69
+
70
+ [tool.ruff.lint]
71
+ select = ["E", "F", "W"] # errors, flakes, warnings
72
+ ignore = []
73
+
74
+ [tool.ruff.format]
75
+ quote-style = "double"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OpenPyTEA
3
- Version: 1.2.0
3
+ Version: 2.1.0
4
4
  Summary: OpenPyTEA: An open-source Python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation
5
5
  Maintainer-email: "Panji B. Tamarona" <P.B.Tamarona@tudelft.nl>
6
6
  License-Expression: MIT
@@ -26,7 +26,7 @@ Dynamic: license-file
26
26
 
27
27
  **OpenPyTEA** is an open-source Python toolkit for performing **techno-economic assessment (TEA)** of chemical and energy systems. It was created to address a persistent gap in the TEA workflow: while process simulators model mass and energy balances, researchers often lack an equally transparent and flexible way to evaluate the **economic feasibility** of their designs. Commercial tools remain *black-box tools*, and many academic TEA implementations are process-specific, undocumented, or difficult to reproduce.
28
28
 
29
- **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdown plots**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
29
+ **OpenPyTEA** provides a fully open, modular, and traceable framework that brings TEA into the Python ecosystem. By integrating **equipment cost estimation**, **capital and operating expenditure modeling**, **cash-flow analysis**, **cost breakdowns**, **sensitivity evaluation**, and **Monte Carlo uncertainty propagation**, the toolkit enables users to perform end-to-end TEA with clarity and reproducibility.
30
30
 
31
31
  Beyond its functionality, **OpenPyTEA is designed as a community-driven TEA platform**. Users can contribute new equipment cost correlations, improve economic models, report issues, and expand the toolkit’s capabilities over time. This collaborative approach helps build a shared, transparent, and continually improving TEA resource—similar to the open-source progress seen in the LCA community.
32
32
 
@@ -43,8 +43,10 @@ https://github.com/pbtamarona/OpenPyTEA/tree/main/examples
43
43
  ## ✨ Key Features
44
44
  - **Modular architecture:** clean separation of cost correlations, equipment objects, plant economics, and uncertainty analysis.
45
45
  - **Transparent and reproducible:** all algorithms, equations, and assumptions are openly available for full traceability.
46
- - **Cost breakdown visualization:** built-in helpers to plot stacked bar charts of direct equipment costs, fixed capital, and operating costs.
47
- - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
46
+ - **Cost breakdown visualization:** built-in functions to plot stacked bar charts of equipment costs, fixed capital, and operating costs.
47
+ - **Built-in uncertainty tools:** automatic generation of sensitivity plots and Monte Carlo simulations.
48
+ - **Workflow using JSON configuration files:** standardized input/output structure via `io.py` for reproducible analyses and multi-scenario evaluation.
49
+ - **Flexible analysis and visualization:** separation of data processing (`analysis.py`) and plotting (`plotting.py`) allows users to apply custom visualization tools.
48
50
  - **Interoperable and extensible:** easy integration with process simulators, optimization frameworks, and LCA tools.
49
51
  - **Education-friendly:** ideal for teaching TEA and process design without reliance on proprietary software.
50
52
  - **Community-driven:** users can contribute new correlations, improve models, request features, and shape the evolution of the platform.
@@ -71,7 +73,6 @@ or with `uv`:
71
73
  uv add git+https://github.com/pbtamarona/OpenPyTEA
72
74
  ```
73
75
 
74
-
75
76
  **OpenPyTEA** requires **Python ≥ 3.9**.
76
77
  The main dependencies include:
77
78
 
@@ -91,12 +92,78 @@ src/openpytea/
91
92
  ├── equipment.py # Equipment-level costing and inflation correction
92
93
  ├── plant.py # Plant-level TEA: CAPEX, OPEX, cash flows, financial metrics
93
94
  ├── analysis.py # Sensitivity and uncertainty analysis (sensitivity plots, Monte Carlo)
95
+ ├── plotting.py # Visualization functions (plots and figures)
96
+ ├── io.py # JSON-based workflow: load inputs and export results
97
+ ├── helpers.py # Helper functions for data handling and common operations
94
98
  └── data/ # Cost correlations database and CEPCI data
95
99
  examples/ # Example notebooks and case studies
96
- walkthrough.ipynb # walkthrough of the package
100
+ walkthrough.ipynb # Walkthrough of the package
101
+
102
+ backend/ # FastAPI backend for the web GUI
103
+ ├── app/
104
+ │ ├── main.py # FastAPI app with CORS and router mounting
105
+ │ ├── state.py # In-memory session state
106
+ │ ├── schemas.py # Pydantic request/response models
107
+ │ ├── util.py # JSON serialization utilities
108
+ │ ├── routers/ # API endpoints (equipment, plant, analysis, I/O)
109
+ │ └── presets/ # Example preset JSON files
110
+ └── requirements.txt
111
+
112
+ frontend/ # React + TypeScript web GUI
113
+ ├── src/
114
+ │ ├── api/client.ts # Typed API client
115
+ │ ├── types/index.ts # TypeScript interfaces
116
+ │ ├── pages/ # Equipment, Plant Config, Results, Analysis, Monte Carlo, Compare
117
+ │ ├── App.tsx # Tab navigation + examples dropdown
118
+ │ └── App.css # Styling
119
+ └── package.json
120
+
97
121
  pyproject.toml
98
122
  README.md
99
123
  ```
124
+ ---
125
+
126
+ ## 🏗️ Software Architecture
127
+
128
+ ![OpenPyTEA Architecture](examples/img/architecture.png)
129
+
130
+ Software architecture and data flow of **OpenPyTEA**, illustrating the progression from user input to TEA output. Users provide economic assumptions, process simulation results, and equipment-sizing parameters. Equipment-sizing information is linked with cost correlations and CEPCI values stored in CSV databases to calculate inflation-adjusted purchased and direct costs. `Equipment` objects are aggregated into a `Plant` object, where CAPEX, OPEX, and financial performance metrics are evaluated. The `analysis.py` module subsequently operates on `Plant` objects to perform sensitivity and uncertainty analyses.
131
+
132
+ ---
133
+
134
+ ## 🖥️ Web GUI (**work in progress**)
135
+
136
+ OpenPyTEA includes an optional web-based graphical interface for users who prefer a visual workflow over Python scripting. The GUI provides the full TEA workflow through a tabbed browser interface:
137
+
138
+ - **Equipment** — add, edit, and remove equipment with cost database lookup
139
+ - **Plant Config** — configure location, financial parameters, labor, products, and variable OPEX
140
+ - **Results** — run calculations and view metric cards, cost breakdown charts, and cash flow tables
141
+ - **Analysis** — sensitivity plots and tornado diagrams. Sensitivity supports a **multi-panel grid** (different parameter and metric per panel, e.g. NPV vs. interest rate, ROI vs. electricity price, all in one figure) and **multi-plant overlay** (curves for every plant added on the Compare tab share the same axes for direct comparison)
142
+ - **Monte Carlo** — uncertainty analysis with histogram distributions, fitted normal curves, and summary statistics. **Multi-plant overlay** shows distributions for several plants on the same axes, mirroring `plot_multiple_monte_carlo` from the library
143
+ - **Compare** — side-by-side comparison of saved plants (CAPEX/OPEX breakdown bars, key metric bars). Plants imported here are also reused as the overlay set on the Analysis and Monte Carlo tabs
144
+ - **Downloadable charts** — all plots include a download button to export as standalone PNG images with full axis labels
145
+ - **Examples** — built-in presets from the case study notebooks for quick demonstration
146
+
147
+ ### Running the GUI
148
+
149
+ **Backend** (requires Python 3.10+):
150
+ ```bash
151
+ pip install -e . # install OpenPyTEA from repo root
152
+ cd backend
153
+ pip install -r requirements.txt
154
+ PYTHONPATH=../src python3 -m uvicorn app.main:app --reload --port 8000
155
+ ```
156
+
157
+ **Frontend** (requires Node.js):
158
+ ```bash
159
+ cd frontend
160
+ npm install
161
+ npm run dev
162
+ ```
163
+
164
+ Then open http://localhost:5173. Click **Examples** in the header to load a case study preset and explore.
165
+
166
+ For detailed architecture documentation, see `GUI_ARCHITECTURE.md`.
100
167
 
101
168
  ---
102
169
 
@@ -212,14 +279,24 @@ results = monte_carlo(
212
279
  Outputs include probability distributions and confidence intervals for LCOP or NPV—supporting uncertainty-informed decision-making. With `plot_multiple_monte_carlo`, **OpenPyTEA** can also visualize Monte Carlo results for multiple plants to enable uncertainty comparisons.
213
280
 
214
281
  ---
282
+ ### 5. **Workflow using JSON configuration files**
283
+
284
+ **OpenPyTEA** supports a workflow using structured JSON input files via the `io.py` module. This enables standardized, reproducible, and scalable TEA studies.
285
+
286
+ Key functionalities include:
287
+ - `run_equipment()`: evaluate equipment costs from JSON input
288
+ - `run_plant()`: construct and evaluate a plant configuration
289
+ - `run_tea()`: execute full TEA, including cost breakdowns, sensitivity, and uncertainty analysis
290
+
291
+ This workflow is demonstrated in `case_study_1_with_JSON.ipynb` in the example folder.
215
292
 
216
293
  ## 📘 Example Workflows
217
294
 
218
295
  Example notebooks are available in the `examples/` folder, including:
219
296
 
220
- - Hydrogen production
221
- - Hydrogen liquefaction
222
- - Geothermal heat and power
297
+ - Comparison of hydrogen production pathwways
298
+ - Hydrogen liquefaction precooling system
299
+ - Geothermal-based heating and power generation
223
300
 
224
301
  Run any example via:
225
302
  ```bash
@@ -231,8 +308,6 @@ Each notebook demonstrates:
231
308
  - Sensitivity and uncertainty analysis
232
309
  - Visualization of key economic indicators
233
310
 
234
- ---
235
-
236
311
  ## 🧑‍🏫 Educational Use
237
312
 
238
313
  **OpenPyTEA** is suitable for chemical and process engineering education.
@@ -279,7 +354,7 @@ Or if you prefer to cite manually, you may use:
279
354
  title = {OpenPyTEA: An open-source python toolkit for techno-economic assessment of process plants with economic sensitivity and uncertainty evaluation},
280
355
  year = {2025},
281
356
  url = {\url{https://github.com/pbtamarona/OpenPyTEA}},
282
- version = {1.2.0},
357
+ version = {2.0.0},
283
358
  note = {Accessed: YYYY-MM-DD}
284
359
  }
285
360
  ```
@@ -9,7 +9,15 @@ src/OpenPyTEA.egg-info/top_level.txt
9
9
  src/openpytea/__init__.py
10
10
  src/openpytea/analysis.py
11
11
  src/openpytea/equipment.py
12
+ src/openpytea/helpers.py
13
+ src/openpytea/io.py
12
14
  src/openpytea/plant.py
15
+ src/openpytea/plotting.py
13
16
  src/openpytea/data/cepci_values.csv
14
17
  src/openpytea/data/cost_correlations.csv
15
- tests/test_import.py
18
+ tests/test_analysis.py
19
+ tests/test_equipment.py
20
+ tests/test_plant.py
21
+ tests/test_plotting.py
22
+ tests/test_run_tea.py
23
+ tests/test_smoke.py
@@ -0,0 +1,36 @@
1
+ from .plant import Plant
2
+ from .equipment import Equipment
3
+ from .analysis import (direct_costs_data, fixed_capital_data,
4
+ fixed_opex_data, variable_opex_data,
5
+ sensitivity_data, tornado_data,
6
+ monte_carlo)
7
+ from .plotting import (plot_stacked_bar, plot_sensitivity,
8
+ plot_tornado, plot_monte_carlo,
9
+ plot_monte_carlo_inputs,
10
+ plot_multiple_monte_carlo)
11
+
12
+ from .io import (load_results, run_equipment, run_plant, run_tea)
13
+
14
+ __version__ = "2.0.0"
15
+
16
+ __all__ = [
17
+ "Plant",
18
+ "Equipment",
19
+ "direct_costs_data",
20
+ "fixed_capital_data",
21
+ "fixed_opex_data",
22
+ "variable_opex_data",
23
+ "sensitivity_data",
24
+ "tornado_data",
25
+ "monte_carlo",
26
+ "plot_stacked_bar",
27
+ "plot_sensitivity",
28
+ "plot_tornado",
29
+ "plot_monte_carlo",
30
+ "plot_monte_carlo_inputs",
31
+ "plot_multiple_monte_carlo",
32
+ "load_results",
33
+ "run_equipment",
34
+ "run_plant",
35
+ "run_tea"
36
+ ]