# forddiven/hidrogencellenergy architecture

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

- Interactive diagram: https://gitdiagram.com/forddiven/hidrogencellenergy
- Repository: https://github.com/forddiven/hidrogencellenergy

## Overview

HidrogenCellEnergy is a Flask dashboard for operating and monitoring a hydrogen-cell system. An operator signs in, views live status and alarms, and can start or manage a run; the controller executes the configured startup sequence, communicates with Modbus hardware or simulation, and persists readings and run state. The dashboard also supports history and charting, CSV export, configuration, user administration, and security logs. The excerpts show the main controller, database, and browser interactions; some routes and their implementations were not sampled.

Main entry points: [`app.py`](https://github.com/forddiven/hidrogencellenergy/blob/main/app.py) (Web routes), [`controller.py`](https://github.com/forddiven/hidrogencellenergy/blob/main/controller.py) (Controller runtime), [`database.py`](https://github.com/forddiven/hidrogencellenergy/blob/main/database.py) (SQLite database), [`static/charts.js`](https://github.com/forddiven/hidrogencellenergy/blob/main/static/charts.js) (Live dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_webapp["Web routes<br/>[app.py]"]
  node_auth["Sign-in and roles<br/>[app.py]"]
  node_liveui["Live dashboard<br/>[charts.js]"]
  node_admin["Admin and config"]
  node_history["History and export<br/>[app.py]"]
  node_alarmui["Alarm views"]
  node_chartdata["Chart rendering<br/>[charts.js]"]
end

subgraph group_operation["System operation"]
  node_controller["Controller runtime<br/>[controller.py]"]
  node_procedure["Startup sequence"]
  node_modbus["Modbus device"]
  node_config["Default settings<br/>[config.py]"]
end

subgraph group_records["Persistence and records"]
  node_store[("SQLite database<br/>[database.py]")]
end

subgraph group_simulation["HIL simulation"]
  node_hil["HIL simulator<br/>[HIL.py]"]
end

node_operator(("Operator"))

node_operator -->|"uses dashboard"| node_webapp
node_webapp -->|"handles sign-in"| node_auth
node_webapp -->|"starts and stops"| node_controller
node_webapp -->|"reads and updates"| node_store
node_webapp -.->|"serves live views"| node_liveui
node_liveui -->|"requests status"| node_webapp
node_liveui -->|"renders readings"| node_chartdata
node_webapp -->|"serves history"| node_history
node_history -->|"queries readings"| node_store
node_operator -->|"manages system"| node_admin
node_webapp -.->|"renders admin views"| node_admin
node_operator -->|"reviews alarms"| node_alarmui
node_controller -->|"uses steps"| node_procedure
node_controller -->|"persists readings and state"| node_store
node_controller -->|"reads and writes registers"| node_modbus
node_hil -->|"hosts simulated registers"| node_modbus
node_controller -.->|"connects over Modbus"| node_hil
node_store -->|"loads defaults"| node_config

click node_webapp "https://github.com/forddiven/hidrogencellenergy/blob/main/app.py"
click node_auth "https://github.com/forddiven/hidrogencellenergy/blob/main/app.py"
click node_liveui "https://github.com/forddiven/hidrogencellenergy/blob/main/static/charts.js"
click node_admin "https://github.com/forddiven/hidrogencellenergy/tree/main/templates"
click node_history "https://github.com/forddiven/hidrogencellenergy/blob/main/app.py"
click node_alarmui "https://github.com/forddiven/hidrogencellenergy/tree/main/templates"
click node_controller "https://github.com/forddiven/hidrogencellenergy/blob/main/controller.py"
click node_procedure "https://github.com/forddiven/hidrogencellenergy/blob/main/startup_procedure.py"
click node_hil "https://github.com/forddiven/hidrogencellenergy/blob/main/HIL.py"
click node_config "https://github.com/forddiven/hidrogencellenergy/blob/main/config.py"
click node_store "https://github.com/forddiven/hidrogencellenergy/blob/main/database.py"
click node_chartdata "https://github.com/forddiven/hidrogencellenergy/blob/main/static/charts.js"

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_webapp,node_auth,node_liveui,node_admin,node_history,node_alarmui,node_chartdata toneBlue
class node_controller,node_procedure,node_modbus,node_config toneAmber
class node_store toneMint
class node_hil toneRose
class node_operator toneIndigo
```

## Components

### Web dashboard

- [Web routes](https://github.com/forddiven/hidrogencellenergy/blob/main/app.py): `app.py`
- [Sign-in and roles](https://github.com/forddiven/hidrogencellenergy/blob/main/app.py): `app.py`
- [Live dashboard](https://github.com/forddiven/hidrogencellenergy/blob/main/static/charts.js): `static/charts.js`
- [Admin and config](https://github.com/forddiven/hidrogencellenergy/tree/main/templates): `templates`
- [History and export](https://github.com/forddiven/hidrogencellenergy/blob/main/app.py): `app.py`
- [Alarm views](https://github.com/forddiven/hidrogencellenergy/tree/main/templates): `templates`
- [Chart rendering](https://github.com/forddiven/hidrogencellenergy/blob/main/static/charts.js): `static/charts.js`

### System operation

- [Controller runtime](https://github.com/forddiven/hidrogencellenergy/blob/main/controller.py): `controller.py`
- [Startup sequence](https://github.com/forddiven/hidrogencellenergy/blob/main/startup_procedure.py): `startup_procedure.py`
- **Modbus device**
- [Default settings](https://github.com/forddiven/hidrogencellenergy/blob/main/config.py): `config.py`

### Persistence and records

- [SQLite database](https://github.com/forddiven/hidrogencellenergy/blob/main/database.py): `database.py`

### HIL simulation

- [HIL simulator](https://github.com/forddiven/hidrogencellenergy/blob/main/HIL.py): `HIL.py`

### Other components

- **Operator**

## Connections

- Operator → Web routes: uses dashboard (evidence: `README.md`)
- Web routes → Sign-in and roles: handles sign-in (evidence: `README.md`)
- Web routes → Controller runtime: starts and stops (evidence: `app.py`)
- Web routes → SQLite database: reads and updates (evidence: `app.py`)
- Web routes → Live dashboard: serves live views
- Live dashboard → Web routes: requests status (evidence: `static/charts.js`)
- Live dashboard → Chart rendering: renders readings (evidence: `static/charts.js`)
- Web routes → History and export: serves history (evidence: `app.py`)
- History and export → SQLite database: queries readings (evidence: `app.py`)
- Operator → Admin and config: manages system (evidence: `README.md`)
- Web routes → Admin and config: renders admin views
- Operator → Alarm views: reviews alarms (evidence: `README.md`)
- Controller runtime → Startup sequence: uses steps (evidence: `controller.py`)
- Controller runtime → SQLite database: persists readings and state (evidence: `controller.py`)
- Controller runtime → Modbus device: reads and writes registers (evidence: `controller.py`)
- HIL simulator → Modbus device: hosts simulated registers (evidence: `HIL.py`)
- Controller runtime → HIL simulator: connects over Modbus
- SQLite database → Default settings: loads defaults (evidence: `database.py`)
