# hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin architecture

> Architecture diagram of the GitHub repository hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin
- Repository: https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin

## Overview

FourierTherm simulates underground cable thermal and moisture behavior, with a user-facing dashboard as its clearest runtime workflow: users set currents and duration, the API runs the digital twin, and the dashboard visualizes the returned time series. The repository also contains a substantial EV-feeder control and surrogate-modeling subsystem. Its evaluation and model relationships are included where the sampled source or SOURCE INDEX supports them; unsampled data and security integrations are not connected speculatively.

Main entry points: [`src/dtr/twin/rc_model.py`](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/twin/rc_model.py) (Thermal digital twin), [`src/dtr/control/guarded_hybrid.py`](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/guarded_hybrid.py) (Guarded hybrid), [`src/dtr/evaluation/closed_loop.py`](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/evaluation/closed_loop.py) (Day evaluation), [`frontend/src/components/Dashboard.tsx`](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/frontend/src/components/Dashboard.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
end

subgraph group_runtime["Simulation runtime"]
  node_simulation_api["Simulation API<br/>[api.py]"]
  node_digital_twin["Thermal digital twin<br/>[rc_model.py]"]
  node_integrator["RK integrator<br/>[integrator.py]"]
end

subgraph group_control["EV control"]
  node_closed_loop["Day evaluation<br/>[closed_loop.py]"]
  node_allocator["Job allocator<br/>[allocator.py]"]
  node_safety_shield["Safety shield<br/>[shield.py]"]
  node_guarded_hybrid["Guarded hybrid<br/>[guarded_hybrid.py]"]
  node_static_cap["Static cap baseline<br/>[static_cap.py]"]
  node_synthetic_days["Synthetic demand days<br/>[synthetic.py]"]
  node_real_evaluation["Real-data runner<br/>[03_phase11_real.py]"]
  node_security_ids["FDI intrusion detection<br/>[fdi_scdr_ids.py]"]
end

subgraph group_models["Surrogate modeling"]
  node_fno["FNO model<br/>[fno_1d.py]"]
  node_training["FNO training<br/>[train.py]"]
  node_scenario_grid["Scenario generation<br/>[scenario_grid.py]"]
  node_gsno["Graph spectral model<br/>[gsno_thermal.py]"]
end

node_operator(("Operator"))

node_operator -->|"sets inputs"| node_dashboard
node_dashboard -->|"posts simulation"| node_simulation_api
node_simulation_api -->|"runs rollout"| node_digital_twin
node_digital_twin -->|"integrates state"| node_integrator
node_simulation_api -->|"returns time series"| node_dashboard
node_dashboard -->|"visualizes results"| node_operator
node_real_evaluation -->|"runs days"| node_closed_loop
node_real_evaluation -->|"computes baseline"| node_static_cap
node_real_evaluation -->|"initializes twin"| node_digital_twin
node_closed_loop -->|"dispatches jobs"| node_allocator
node_closed_loop -->|"checks safety"| node_safety_shield
node_closed_loop -->|"uses controller"| node_guarded_hybrid
node_synthetic_days -->|"uses demand function"| node_allocator
node_synthetic_days -->|"calibrates load"| node_digital_twin
node_guarded_hybrid -->|"composes dispatch"| node_allocator
node_guarded_hybrid -->|"escalates checks"| node_safety_shield
node_guarded_hybrid -->|"predicts temperatures"| node_fno
node_guarded_hybrid -->|"loads model"| node_training
node_training -->|"trains model"| node_fno
node_training -->|"builds training data"| node_digital_twin
node_scenario_grid -->|"simulates scenarios"| node_digital_twin

click node_dashboard "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/frontend/src/components/Dashboard.tsx"
click node_simulation_api "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/api.py"
click node_digital_twin "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/twin/rc_model.py"
click node_integrator "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/twin/integrator.py"
click node_closed_loop "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/evaluation/closed_loop.py"
click node_allocator "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/allocator.py"
click node_safety_shield "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/shield.py"
click node_guarded_hybrid "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/guarded_hybrid.py"
click node_static_cap "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/baselines/static_cap.py"
click node_synthetic_days "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/data/synthetic.py"
click node_real_evaluation "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/scripts/03_phase11_real.py"
click node_fno "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/fno_1d.py"
click node_training "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/train.py"
click node_scenario_grid "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/scenario_grid.py"
click node_gsno "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/gsno_thermal.py"
click node_security_ids "https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/security/fdi_scdr_ids.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_dashboard toneBlue
class node_simulation_api,node_digital_twin,node_integrator toneAmber
class node_closed_loop,node_allocator,node_safety_shield,node_guarded_hybrid,node_static_cap,node_synthetic_days,node_real_evaluation,node_security_ids toneMint
class node_fno,node_training,node_scenario_grid,node_gsno toneRose
class node_operator toneIndigo
```

## Components

### User interface

- [Dashboard](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/frontend/src/components/Dashboard.tsx): `frontend/src/components/Dashboard.tsx`

### Simulation runtime

- [Simulation API](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/api.py): `api.py`
- [Thermal digital twin](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/twin/rc_model.py): `src/dtr/twin/rc_model.py`
- [RK integrator](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/twin/integrator.py): `src/dtr/twin/integrator.py`

### EV control

- [Day evaluation](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/evaluation/closed_loop.py): `src/dtr/evaluation/closed_loop.py`
- [Job allocator](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/allocator.py): `src/dtr/control/allocator.py`
- [Safety shield](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/shield.py): `src/dtr/control/shield.py`
- [Guarded hybrid](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/control/guarded_hybrid.py): `src/dtr/control/guarded_hybrid.py`
- [Static cap baseline](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/baselines/static_cap.py): `src/dtr/baselines/static_cap.py`
- [Synthetic demand days](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/data/synthetic.py): `src/dtr/data/synthetic.py`
- [Real-data runner](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/scripts/03_phase11_real.py): `scripts/03_phase11_real.py`
- [FDI intrusion detection](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/security/fdi_scdr_ids.py): `src/dtr/security/fdi_scdr_ids.py`

### Surrogate modeling

- [FNO model](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/fno_1d.py): `src/dtr/surrogate/fno_1d.py`
- [FNO training](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/train.py): `src/dtr/surrogate/train.py`
- [Scenario generation](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/scenario_grid.py): `src/dtr/surrogate/scenario_grid.py`
- [Graph spectral model](https://github.com/hamsavartn/fouriertherm-fno-driven-cyber-physical-digital-twin/blob/master/src/dtr/surrogate/gsno_thermal.py): `src/dtr/surrogate/gsno_thermal.py`

### Other components

- **Operator**

## Connections

- Operator → Dashboard: sets inputs
- Dashboard → Simulation API: posts simulation
- Simulation API → Thermal digital twin: runs rollout (evidence: `api.py`)
- Thermal digital twin → RK integrator: integrates state (evidence: `src/dtr/twin/rc_model.py`)
- Simulation API → Dashboard: returns time series
- Dashboard → Operator: visualizes results
- Real-data runner → Day evaluation: runs days (evidence: `scripts/03_phase11_real.py`)
- Real-data runner → Static cap baseline: computes baseline (evidence: `scripts/03_phase11_real.py`)
- Real-data runner → Thermal digital twin: initializes twin (evidence: `scripts/03_phase11_real.py`)
- Day evaluation → Job allocator: dispatches jobs (evidence: `src/dtr/evaluation/closed_loop.py`)
- Day evaluation → Safety shield: checks safety (evidence: `src/dtr/evaluation/closed_loop.py`)
- Day evaluation → Guarded hybrid: uses controller (evidence: `src/dtr/evaluation/closed_loop.py`)
- Synthetic demand days → Job allocator: uses demand function (evidence: `src/dtr/data/synthetic.py`)
- Synthetic demand days → Thermal digital twin: calibrates load (evidence: `src/dtr/data/synthetic.py`)
- Guarded hybrid → Job allocator: composes dispatch (evidence: `src/dtr/control/guarded_hybrid.py`)
- Guarded hybrid → Safety shield: escalates checks (evidence: `src/dtr/control/guarded_hybrid.py`)
- Guarded hybrid → FNO model: predicts temperatures (evidence: `src/dtr/control/guarded_hybrid.py`)
- Guarded hybrid → FNO training: loads model (evidence: `src/dtr/control/guarded_hybrid.py`)
- FNO training → FNO model: trains model (evidence: `src/dtr/surrogate/train.py`)
- FNO training → Thermal digital twin: builds training data (evidence: `src/dtr/surrogate/train.py`)
- Scenario generation → Thermal digital twin: simulates scenarios (evidence: `src/dtr/surrogate/scenario_grid.py`)
