# feslima/hensad architecture

> Architecture diagram of the GitHub repository feslima/hensad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/feslima/hensad
- Repository: https://github.com/feslima/hensad

## Overview

HENSAD is a heat-exchanger network analysis and design application, with both a PyQt desktop interface and a Python calculation package. The main workflow is to enter hot/cold stream data and a minimum temperature approach, review pinch and interval results, explore diagrams, and optionally design exchangers or compare EAOC and area. The README also documents unit selection, saving/opening projects, and a programmatic package API. Edges follow shown imports and the documented workflow; some unsampled dialog wiring is omitted.

Main entry points: [`src/gui/mainwindow.py`](https://github.com/feslima/hensad/blob/master/src/gui/mainwindow.py) (Main window), [`src/gui/models/core.py`](https://github.com/feslima/hensad/blob/master/src/gui/models/core.py) (Shared setup state), [`src/gui/views/diagrams/cascade.py`](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/cascade.py) (Heat cascade), [`src/gui/views/diagrams/eaoc.py`](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/eaoc.py) (EAOC and area analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop workflow"]
  node_main["Main window<br/>[mainwindow.py]"]
  node_ui_form["Main UI form<br/>[mainwindow.py]"]
  node_icons["UI resources<br/>[icons_rc.py]"]
end

subgraph group_models["GUI state and models"]
  node_setup["Shared setup state<br/>[core.py]"]
  node_stream_model["Stream input models<br/>[input_streams.py]"]
  node_exchanger_model["Exchanger table model<br/>[exchanger_table.py]"]
  node_summary_model["Summary table model<br/>[summary_table.py]"]
end

subgraph group_visuals["Analysis and design views"]
  node_temp_view["Temperature intervals"]
  node_temp_form["Temperature diagram form<br/>[tempdiagram.py]"]
  node_cascade_view["Heat cascade<br/>[cascade.py]"]
  node_cascade_form["Cascade diagram form<br/>[cascadediagram.py]"]
  node_enthalpy_view["Temperature-enthalpy plot<br/>[enthalpy.py]"]
  node_eaoc_view["EAOC and area analysis<br/>[eaoc.py]"]
  node_design_view["Pinch network design<br/>[pinchdesign.py]"]
  node_graphics_common["Diagram graphics<br/>[__init__.py]"]
end

subgraph group_engine["Calculation package"]
  node_calc["Thermal calculations<br/>[__init__.py]"]
  node_cost[("Exchanger cost data<br/>[__init__.py]")]
end

node_engineer(("Process engineer"))
node_project_file["HSD project file"]

node_engineer -->|"enters streams"| node_main
node_main -->|"builds interface"| node_ui_form
node_main -->|"loads resources"| node_icons
node_main -->|"creates state"| node_setup
node_main -->|"binds stream tables"| node_stream_model
node_stream_model -->|"reads and updates"| node_setup
node_setup -->|"computes summaries"| node_calc
node_main -->|"opens and saves"| node_project_file
node_main -->|"opens diagram"| node_temp_view
node_main -->|"opens diagram"| node_cascade_view
node_main -->|"opens plot"| node_enthalpy_view
node_main -->|"opens analysis"| node_eaoc_view
node_main -->|"opens design tool"| node_design_view
node_temp_view -->|"reads interval data"| node_setup
node_temp_view -->|"uses dialog form"| node_temp_form
node_cascade_view -->|"reads heat flow"| node_setup
node_cascade_view -->|"uses dialog form"| node_cascade_form
node_cascade_view -->|"draws arrows"| node_graphics_common
node_enthalpy_view -->|"reads analysis state"| node_setup
node_eaoc_view -->|"reads design state"| node_setup
node_eaoc_view -->|"requests calculations"| node_calc
node_eaoc_view -->|"uses cost procedures"| node_cost
node_design_view -->|"updates exchanger designs"| node_setup
node_design_view -->|"uses exchanger model"| node_exchanger_model
node_design_view -->|"uses diagram graphics"| node_graphics_common
node_setup -->|"supplies summary data"| node_summary_model
node_setup -->|"supplies design data"| node_exchanger_model
node_calc -->|"uses cost definitions"| node_cost

click node_main "https://github.com/feslima/hensad/blob/master/src/gui/mainwindow.py"
click node_ui_form "https://github.com/feslima/hensad/blob/master/src/gui/views/py/mainwindow.py"
click node_icons "https://github.com/feslima/hensad/blob/master/src/gui/resources/icons_rc.py"
click node_setup "https://github.com/feslima/hensad/blob/master/src/gui/models/core.py"
click node_stream_model "https://github.com/feslima/hensad/blob/master/src/gui/models/input_streams.py"
click node_exchanger_model "https://github.com/feslima/hensad/blob/master/src/gui/models/exchanger_table.py"
click node_summary_model "https://github.com/feslima/hensad/blob/master/src/gui/models/summary_table.py"
click node_calc "https://github.com/feslima/hensad/blob/master/src/hensad/__init__.py"
click node_cost "https://github.com/feslima/hensad/blob/master/src/hensad/cost/__init__.py"
click node_temp_view "https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/temperatureinterval.py"
click node_temp_form "https://github.com/feslima/hensad/blob/master/src/gui/views/py/tempdiagram.py"
click node_cascade_view "https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/cascade.py"
click node_cascade_form "https://github.com/feslima/hensad/blob/master/src/gui/views/py/cascadediagram.py"
click node_enthalpy_view "https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/enthalpy.py"
click node_eaoc_view "https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/eaoc.py"
click node_design_view "https://github.com/feslima/hensad/blob/master/src/gui/views/designs/pinchdesign.py"
click node_graphics_common "https://github.com/feslima/hensad/blob/master/src/gui/views/common/__init__.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_ui_form,node_icons toneBlue
class node_setup,node_stream_model,node_exchanger_model,node_summary_model toneAmber
class node_temp_view,node_temp_form,node_cascade_view,node_cascade_form,node_enthalpy_view,node_eaoc_view,node_design_view,node_graphics_common toneMint
class node_calc,node_cost toneRose
class node_engineer,node_project_file toneIndigo
```

## Components

### Desktop workflow

- [Main window](https://github.com/feslima/hensad/blob/master/src/gui/mainwindow.py): `src/gui/mainwindow.py`
- [Main UI form](https://github.com/feslima/hensad/blob/master/src/gui/views/py/mainwindow.py): `src/gui/views/py/mainwindow.py`
- [UI resources](https://github.com/feslima/hensad/blob/master/src/gui/resources/icons_rc.py): `src/gui/resources/icons_rc.py`

### GUI state and models

- [Shared setup state](https://github.com/feslima/hensad/blob/master/src/gui/models/core.py): `src/gui/models/core.py`
- [Stream input models](https://github.com/feslima/hensad/blob/master/src/gui/models/input_streams.py): `src/gui/models/input_streams.py`
- [Exchanger table model](https://github.com/feslima/hensad/blob/master/src/gui/models/exchanger_table.py): `src/gui/models/exchanger_table.py`
- [Summary table model](https://github.com/feslima/hensad/blob/master/src/gui/models/summary_table.py): `src/gui/models/summary_table.py`

### Analysis and design views

- [Temperature intervals](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/temperatureinterval.py): `src/gui/views/diagrams/temperatureinterval.py`
- [Temperature diagram form](https://github.com/feslima/hensad/blob/master/src/gui/views/py/tempdiagram.py): `src/gui/views/py/tempdiagram.py`
- [Heat cascade](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/cascade.py): `src/gui/views/diagrams/cascade.py`
- [Cascade diagram form](https://github.com/feslima/hensad/blob/master/src/gui/views/py/cascadediagram.py): `src/gui/views/py/cascadediagram.py`
- [Temperature-enthalpy plot](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/enthalpy.py): `src/gui/views/diagrams/enthalpy.py`
- [EAOC and area analysis](https://github.com/feslima/hensad/blob/master/src/gui/views/diagrams/eaoc.py): `src/gui/views/diagrams/eaoc.py`
- [Pinch network design](https://github.com/feslima/hensad/blob/master/src/gui/views/designs/pinchdesign.py): `src/gui/views/designs/pinchdesign.py`
- [Diagram graphics](https://github.com/feslima/hensad/blob/master/src/gui/views/common/__init__.py): `src/gui/views/common/__init__.py`

### Calculation package

- [Thermal calculations](https://github.com/feslima/hensad/blob/master/src/hensad/__init__.py): `src/hensad/__init__.py`
- [Exchanger cost data](https://github.com/feslima/hensad/blob/master/src/hensad/cost/__init__.py): `src/hensad/cost/__init__.py`

### Other components

- **Process engineer**
- **HSD project file**

## Connections

- Process engineer → Main window: enters streams (evidence: `README.md`)
- Main window → Main UI form: builds interface (evidence: `src/gui/mainwindow.py`)
- Main window → UI resources: loads resources
- Main window → Shared setup state: creates state (evidence: `src/gui/mainwindow.py`)
- Main window → Stream input models: binds stream tables (evidence: `src/gui/mainwindow.py`)
- Stream input models → Shared setup state: reads and updates (evidence: `src/gui/models/input_streams.py`)
- Shared setup state → Thermal calculations: computes summaries (evidence: `src/gui/models/core.py`)
- Main window → HSD project file: opens and saves (evidence: `README.md`)
- Main window → Temperature intervals: opens diagram (evidence: `src/gui/mainwindow.py`)
- Main window → Heat cascade: opens diagram (evidence: `src/gui/mainwindow.py`)
- Main window → Temperature-enthalpy plot: opens plot (evidence: `src/gui/mainwindow.py`)
- Main window → EAOC and area analysis: opens analysis (evidence: `src/gui/mainwindow.py`)
- Main window → Pinch network design: opens design tool (evidence: `src/gui/mainwindow.py`)
- Temperature intervals → Shared setup state: reads interval data (evidence: `src/gui/views/diagrams/temperatureinterval.py`)
- Temperature intervals → Temperature diagram form: uses dialog form (evidence: `src/gui/views/diagrams/temperatureinterval.py`)
- Heat cascade → Shared setup state: reads heat flow (evidence: `src/gui/views/diagrams/cascade.py`)
- Heat cascade → Cascade diagram form: uses dialog form (evidence: `src/gui/views/diagrams/cascade.py`)
- Heat cascade → Diagram graphics: draws arrows (evidence: `src/gui/views/diagrams/cascade.py`)
- Temperature-enthalpy plot → Shared setup state: reads analysis state (evidence: `src/gui/views/diagrams/enthalpy.py`)
- EAOC and area analysis → Shared setup state: reads design state (evidence: `src/gui/views/diagrams/eaoc.py`)
- EAOC and area analysis → Thermal calculations: requests calculations (evidence: `src/gui/views/diagrams/eaoc.py`)
- EAOC and area analysis → Exchanger cost data: uses cost procedures (evidence: `src/gui/views/diagrams/eaoc.py`)
- Pinch network design → Shared setup state: updates exchanger designs (evidence: `src/gui/views/designs/pinchdesign.py`)
- Pinch network design → Exchanger table model: uses exchanger model (evidence: `src/gui/views/designs/pinchdesign.py`)
- Pinch network design → Diagram graphics: uses diagram graphics (evidence: `src/gui/views/designs/pinchdesign.py`)
- Shared setup state → Summary table model: supplies summary data (evidence: `src/gui/models/summary_table.py`)
- Shared setup state → Exchanger table model: supplies design data (evidence: `src/gui/models/exchanger_table.py`)
- Thermal calculations → Exchanger cost data: uses cost definitions (evidence: `src/hensad/__init__.py`)
