# duytrangiale/tower_watch architecture

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

- Interactive diagram: https://gitdiagram.com/duytrangiale/tower_watch
- Repository: https://github.com/duytrangiale/tower_watch

## Overview

TowerWatch is a prototype for detecting and localising lattice-tower damage from vibration, first using synthetic data and then transferring the same analysis to real LUMO measurements. Its main workflow models the tower and damage, simulates or loads sensor signals, extracts features, trains a healthy-data autoencoder, and evaluates anomaly scores and sensor-level localisation. A separate prioritisation stage ranks evaluated instances for maintenance. The graph reflects documented stages and indexed script dependencies; some feature-extraction and evaluation wiring is documented in the README rather than shown in sampled script excerpts.

Main entry points: [`src/fem/truss.py`](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/truss.py) (Truss FEM), [`src/models/gcn_ae.py`](https://github.com/duytrangiale/tower_watch/blob/main/src/models/gcn_ae.py) (Graph autoencoder), [`src/evaluate/metrics.py`](https://github.com/duytrangiale/tower_watch/blob/main/src/evaluate/metrics.py) (Detection and localisation), [`src/fem/geometry.py`](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/geometry.py) (Lattice geometry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_physical["Structure and simulation"]
  node_geometry["Lattice geometry<br/>[geometry.py]"]
  node_truss["Truss FEM<br/>[truss.py]"]
  node_damage["Damage injection<br/>[damage.py]"]
  node_environment["Temperature model<br/>[environment.py]"]
  node_response["Vibration simulation<br/>[response.py]"]
  node_modal_energy["Modal energy analysis<br/>[modal_energy.py]"]
end

subgraph group_signals["Data and features"]
  node_lumo["LUMO adapter<br/>[lumo.py]"]
  node_windows["Time features<br/>[windows.py]"]
  node_spectral["Spectral features<br/>[spectral.py]"]
end

subgraph group_analysis["Models and evaluation"]
  node_sensorgraph["Sensor graph<br/>[build.py]"]
  node_gcn["Graph autoencoder<br/>[gcn_ae.py]"]
  node_per_sensor["Per-sensor autoencoder<br/>[per_sensor_ae.py]"]
  node_message_passing["Message-passing model"]
  node_arx["ARX model<br/>[arx.py]"]
  node_baselines["Baseline models<br/>[baselines.py]"]
  node_training["Autoencoder training<br/>[train_utils.py]"]
  node_metrics["Detection and localisation<br/>[metrics.py]"]
  node_visualization["Tower visualisation<br/>[visualize.py]"]
end

subgraph group_operations["Maintenance ranking"]
  node_priority["Priority scoring<br/>[priority.py]"]
end

node_engineer(("TowerWatch user"))

node_engineer -->|"runs synthetic workflow"| node_geometry
node_geometry -->|"builds model"| node_truss
node_damage -->|"alters stiffness"| node_truss
node_environment -->|"adjusts material"| node_truss
node_truss -->|"provides structure"| node_response
node_response -->|"yields signal windows"| node_windows
node_engineer -->|"runs real-data workflow"| node_lumo
node_lumo -->|"windows measurements"| node_windows
node_lumo -->|"computes features"| node_spectral
node_windows -->|"provides features"| node_gcn
node_spectral -->|"provides features"| node_gcn
node_geometry -->|"defines mesh"| node_sensorgraph
node_sensorgraph -->|"provides adjacency"| node_gcn
node_training -->|"trains model"| node_gcn
node_training -->|"trains model"| node_message_passing
node_gcn -->|"scores reconstruction"| node_metrics
node_per_sensor -->|"evaluated by"| node_metrics
node_baselines -->|"evaluated by"| node_metrics
node_arx -->|"evaluated by"| node_metrics
node_metrics -->|"supplies anomaly results"| node_priority
node_geometry -->|"renders structure"| node_visualization
node_truss -->|"supports modal analysis"| node_modal_energy

click node_geometry "https://github.com/duytrangiale/tower_watch/blob/main/src/fem/geometry.py"
click node_truss "https://github.com/duytrangiale/tower_watch/blob/main/src/fem/truss.py"
click node_damage "https://github.com/duytrangiale/tower_watch/blob/main/src/fem/damage.py"
click node_environment "https://github.com/duytrangiale/tower_watch/blob/main/src/simulate/environment.py"
click node_response "https://github.com/duytrangiale/tower_watch/blob/main/src/simulate/response.py"
click node_lumo "https://github.com/duytrangiale/tower_watch/blob/main/src/data/lumo.py"
click node_windows "https://github.com/duytrangiale/tower_watch/blob/main/src/features/windows.py"
click node_spectral "https://github.com/duytrangiale/tower_watch/blob/main/src/features/spectral.py"
click node_sensorgraph "https://github.com/duytrangiale/tower_watch/blob/main/src/graph/build.py"
click node_gcn "https://github.com/duytrangiale/tower_watch/blob/main/src/models/gcn_ae.py"
click node_per_sensor "https://github.com/duytrangiale/tower_watch/blob/main/src/models/per_sensor_ae.py"
click node_message_passing "https://github.com/duytrangiale/tower_watch/blob/main/src/models/message_passing_ae.py"
click node_arx "https://github.com/duytrangiale/tower_watch/blob/main/src/models/arx.py"
click node_baselines "https://github.com/duytrangiale/tower_watch/blob/main/src/models/baselines.py"
click node_training "https://github.com/duytrangiale/tower_watch/blob/main/src/models/train_utils.py"
click node_metrics "https://github.com/duytrangiale/tower_watch/blob/main/src/evaluate/metrics.py"
click node_visualization "https://github.com/duytrangiale/tower_watch/blob/main/src/fem/visualize.py"
click node_priority "https://github.com/duytrangiale/tower_watch/blob/main/src/evaluate/priority.py"
click node_modal_energy "https://github.com/duytrangiale/tower_watch/blob/main/src/fem/modal_energy.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_geometry,node_truss,node_damage,node_environment,node_response,node_modal_energy,node_engineer toneBlue
class node_lumo,node_windows,node_spectral toneAmber
class node_sensorgraph,node_gcn,node_per_sensor,node_message_passing,node_arx,node_baselines,node_training,node_metrics,node_visualization toneMint
class node_priority toneRose
```

## Components

### Structure and simulation

- [Lattice geometry](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/geometry.py): `src/fem/geometry.py`
- [Truss FEM](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/truss.py): `src/fem/truss.py`
- [Damage injection](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/damage.py): `src/fem/damage.py`
- [Temperature model](https://github.com/duytrangiale/tower_watch/blob/main/src/simulate/environment.py): `src/simulate/environment.py`
- [Vibration simulation](https://github.com/duytrangiale/tower_watch/blob/main/src/simulate/response.py): `src/simulate/response.py`
- [Modal energy analysis](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/modal_energy.py): `src/fem/modal_energy.py`

### Data and features

- [LUMO adapter](https://github.com/duytrangiale/tower_watch/blob/main/src/data/lumo.py): `src/data/lumo.py`
- [Time features](https://github.com/duytrangiale/tower_watch/blob/main/src/features/windows.py): `src/features/windows.py`
- [Spectral features](https://github.com/duytrangiale/tower_watch/blob/main/src/features/spectral.py): `src/features/spectral.py`

### Models and evaluation

- [Sensor graph](https://github.com/duytrangiale/tower_watch/blob/main/src/graph/build.py): `src/graph/build.py`
- [Graph autoencoder](https://github.com/duytrangiale/tower_watch/blob/main/src/models/gcn_ae.py): `src/models/gcn_ae.py`
- [Per-sensor autoencoder](https://github.com/duytrangiale/tower_watch/blob/main/src/models/per_sensor_ae.py): `src/models/per_sensor_ae.py`
- [Message-passing model](https://github.com/duytrangiale/tower_watch/blob/main/src/models/message_passing_ae.py): `src/models/message_passing_ae.py`
- [ARX model](https://github.com/duytrangiale/tower_watch/blob/main/src/models/arx.py): `src/models/arx.py`
- [Baseline models](https://github.com/duytrangiale/tower_watch/blob/main/src/models/baselines.py): `src/models/baselines.py`
- [Autoencoder training](https://github.com/duytrangiale/tower_watch/blob/main/src/models/train_utils.py): `src/models/train_utils.py`
- [Detection and localisation](https://github.com/duytrangiale/tower_watch/blob/main/src/evaluate/metrics.py): `src/evaluate/metrics.py`
- [Tower visualisation](https://github.com/duytrangiale/tower_watch/blob/main/src/fem/visualize.py): `src/fem/visualize.py`

### Maintenance ranking

- [Priority scoring](https://github.com/duytrangiale/tower_watch/blob/main/src/evaluate/priority.py): `src/evaluate/priority.py`

### Other components

- **TowerWatch user**

## Connections

- TowerWatch user → Lattice geometry: runs synthetic workflow
- Lattice geometry → Truss FEM: builds model (evidence: `scripts/01_generate_synthetic.py`)
- Damage injection → Truss FEM: alters stiffness (evidence: `scripts/01_generate_synthetic.py`)
- Temperature model → Truss FEM: adjusts material
- Truss FEM → Vibration simulation: provides structure (evidence: `src/simulate/response.py`)
- Vibration simulation → Time features: yields signal windows
- TowerWatch user → LUMO adapter: runs real-data workflow
- LUMO adapter → Time features: windows measurements (evidence: `src/data/lumo.py`)
- LUMO adapter → Spectral features: computes features (evidence: `src/data/lumo.py`)
- Time features → Graph autoencoder: provides features
- Spectral features → Graph autoencoder: provides features
- Lattice geometry → Sensor graph: defines mesh (evidence: `scripts/03_train.py`)
- Sensor graph → Graph autoencoder: provides adjacency (evidence: `scripts/03_train.py`)
- Autoencoder training → Graph autoencoder: trains model (evidence: `scripts/03_train.py`)
- Autoencoder training → Message-passing model: trains model (evidence: `scripts/day3_gnn_architecture_experiment.py`)
- Graph autoencoder → Detection and localisation: scores reconstruction (evidence: `scripts/04_evaluate.py`)
- Per-sensor autoencoder → Detection and localisation: evaluated by (evidence: `scripts/day4_lumo_architecture_experiment.py`)
- Baseline models → Detection and localisation: evaluated by (evidence: `scripts/05_lumo_transfer.py`)
- ARX model → Detection and localisation: evaluated by (evidence: `scripts/day3_arx_localization_experiment.py`)
- Detection and localisation → Priority scoring: supplies anomaly results (evidence: `scripts/06_priority_ranking.py`)
- Lattice geometry → Tower visualisation: renders structure (evidence: `src/fem/visualize.py`)
- Truss FEM → Modal energy analysis: supports modal analysis (evidence: `src/fem/modal_energy.py`)
