# maheshks74/scada_defence architecture

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

- Interactive diagram: https://gitdiagram.com/maheshks74/scada_defence
- Repository: https://github.com/maheshks74/scada_defence

## Overview

This is a fully simulated SCADA cyber-defense application. Its main workflow advances coupled virtual PLC physics, injects optional false telemetry, publishes reported values, verifies and assesses suspicious readings, evaluates prediction impact, requests operator judgment when warranted, and applies mitigation. The dashboard exposes telemetry, attack controls, analysis, confirmations, and event history. Edges follow the README’s documented flow or shown imports/calls; unsampled controller and agent internals are represented only where documented.

Main entry points: [`simulation/simulator.py`](https://github.com/maheshks74/scada_defence/blob/main/simulation/simulator.py) (Simulation Orchestrator), [`simulation/physical_model.py`](https://github.com/maheshks74/scada_defence/blob/main/simulation/physical_model.py) (Coupled Physics), [`dashboard/app.py`](https://github.com/maheshks74/scada_defence/blob/main/dashboard/app.py) (SCADA Dashboard), [`agents/telemetry_agent.py`](https://github.com/maheshks74/scada_defence/blob/main/agents/telemetry_agent.py) (Telemetry Verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plant["Simulated Plant"]
  node_simulator["Simulation Orchestrator<br/>[simulator.py]"]
  node_physical["Coupled Physics<br/>[physical_model.py]"]
  node_baseplc["PLC Interface<br/>[base_plc.py]"]
  node_motorplc["Motor PLC<br/>[motor_plc.py]"]
  node_pumpplc["Pump PLC<br/>[pump_plc.py]"]
  node_processplc["Process PLC<br/>[process_plc.py]"]
  node_attack["FDIA Engine<br/>[fdia.py]"]
  node_config["Configuration Loader<br/>[config_loader.py]"]
end

subgraph group_transport["Telemetry Transport"]
  node_telemetry["Telemetry History"]
  node_modbusserver["Modbus Publisher<br/>[modbus_server.py]"]
  node_registermap["Register Map<br/>[register_map.py]"]
  node_modbusclient["Modbus Client<br/>[modbus_client.py]"]
end

subgraph group_analysis["Defense Analysis"]
  node_verification["Telemetry Verification<br/>[telemetry_agent.py]"]
  node_risk["Risk Analysis<br/>[risk_agent.py]"]
  node_impact["Model Impact<br/>[impact_analyzer.py]"]
  node_prediction["Trend Prediction"]
  node_schemas["Agent Data Schemas<br/>[schemas.py]"]
end

subgraph group_response["Operator Response"]
  node_mitigation["Mitigation Policy"]
  node_human["Confirmation Gate"]
  node_eventlog[("Event Log<br/>[event_logger.py]")]
end

subgraph group_interface["User Interface"]
  node_main["Application Entry<br/>[main.py]"]
  node_dashboard["SCADA Dashboard<br/>[app.py]"]
  node_controller["Dashboard Controller"]
end

node_operator(("Operator"))

node_main -->|"launches"| node_dashboard
node_dashboard -->|"uses"| node_controller
node_controller -.->|"controls"| node_simulator
node_dashboard -.->|"reads telemetry"| node_modbusclient
node_simulator -->|"advances"| node_physical
node_physical -->|"updates"| node_motorplc
node_physical -->|"updates"| node_pumpplc
node_physical -->|"updates"| node_processplc
node_motorplc -->|"implements"| node_baseplc
node_pumpplc -->|"implements"| node_baseplc
node_processplc -->|"implements"| node_baseplc
node_physical -->|"supplies pump flow"| node_processplc
node_simulator -->|"injects values"| node_attack
node_simulator -->|"records reported state"| node_telemetry
node_simulator -->|"publishes registers"| node_modbusserver
node_modbusserver -->|"uses addresses"| node_registermap
node_simulator -.->|"provides telemetry"| node_verification
node_verification -.->|"provides checks"| node_risk
node_verification -->|"analyzes suspicious readings"| node_impact
node_impact -->|"reads history"| node_telemetry
node_impact -->|"forecasts"| node_prediction
node_verification -.->|"returns result"| node_schemas
node_risk -.->|"returns assessment"| node_schemas
node_impact -->|"returns analysis"| node_schemas
node_mitigation -->|"requests confirmation"| node_human
node_operator -->|"submits decision"| node_human
node_mitigation -->|"isolates PLC"| node_physical
node_mitigation -.->|"records decisions"| node_eventlog
node_dashboard -.->|"shows events"| node_eventlog
node_main -->|"loads settings"| node_config
node_dashboard -->|"loads settings"| node_config
node_simulator -->|"starts or stops"| node_attack

click node_main "https://github.com/maheshks74/scada_defence/blob/main/main.py"
click node_dashboard "https://github.com/maheshks74/scada_defence/blob/main/dashboard/app.py"
click node_controller "https://github.com/maheshks74/scada_defence/tree/main/dashboard"
click node_simulator "https://github.com/maheshks74/scada_defence/blob/main/simulation/simulator.py"
click node_physical "https://github.com/maheshks74/scada_defence/blob/main/simulation/physical_model.py"
click node_baseplc "https://github.com/maheshks74/scada_defence/blob/main/plc/base_plc.py"
click node_motorplc "https://github.com/maheshks74/scada_defence/blob/main/plc/motor_plc.py"
click node_pumpplc "https://github.com/maheshks74/scada_defence/blob/main/plc/pump_plc.py"
click node_processplc "https://github.com/maheshks74/scada_defence/blob/main/plc/process_plc.py"
click node_attack "https://github.com/maheshks74/scada_defence/blob/main/attacks/fdia.py"
click node_telemetry "https://github.com/maheshks74/scada_defence/blob/main/simulation/telemetry_generator.py"
click node_modbusserver "https://github.com/maheshks74/scada_defence/blob/main/scada/modbus_server.py"
click node_registermap "https://github.com/maheshks74/scada_defence/blob/main/scada/register_map.py"
click node_modbusclient "https://github.com/maheshks74/scada_defence/blob/main/scada/modbus_client.py"
click node_verification "https://github.com/maheshks74/scada_defence/blob/main/agents/telemetry_agent.py"
click node_risk "https://github.com/maheshks74/scada_defence/blob/main/agents/risk_agent.py"
click node_impact "https://github.com/maheshks74/scada_defence/blob/main/agents/impact_analyzer.py"
click node_prediction "https://github.com/maheshks74/scada_defence/blob/main/models/prediction_model.py"
click node_schemas "https://github.com/maheshks74/scada_defence/blob/main/models/schemas.py"
click node_mitigation "https://github.com/maheshks74/scada_defence/blob/main/agents/mitigation_agent.py"
click node_human "https://github.com/maheshks74/scada_defence/blob/main/agents/human_confirmation.py"
click node_eventlog "https://github.com/maheshks74/scada_defence/blob/main/storage/event_logger.py"
click node_config "https://github.com/maheshks74/scada_defence/blob/main/simulation/config_loader.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_simulator,node_physical,node_baseplc,node_motorplc,node_pumpplc,node_processplc,node_attack,node_config toneBlue
class node_telemetry,node_modbusserver,node_registermap,node_modbusclient toneAmber
class node_verification,node_risk,node_impact,node_prediction,node_schemas toneMint
class node_mitigation,node_human,node_eventlog toneRose
class node_main,node_dashboard,node_controller,node_operator toneIndigo
```

## Components

### Simulated Plant

- [Simulation Orchestrator](https://github.com/maheshks74/scada_defence/blob/main/simulation/simulator.py): `simulation/simulator.py`
- [Coupled Physics](https://github.com/maheshks74/scada_defence/blob/main/simulation/physical_model.py): `simulation/physical_model.py`
- [PLC Interface](https://github.com/maheshks74/scada_defence/blob/main/plc/base_plc.py): `plc/base_plc.py`
- [Motor PLC](https://github.com/maheshks74/scada_defence/blob/main/plc/motor_plc.py): `plc/motor_plc.py`
- [Pump PLC](https://github.com/maheshks74/scada_defence/blob/main/plc/pump_plc.py): `plc/pump_plc.py`
- [Process PLC](https://github.com/maheshks74/scada_defence/blob/main/plc/process_plc.py): `plc/process_plc.py`
- [FDIA Engine](https://github.com/maheshks74/scada_defence/blob/main/attacks/fdia.py): `attacks/fdia.py`
- [Configuration Loader](https://github.com/maheshks74/scada_defence/blob/main/simulation/config_loader.py): `simulation/config_loader.py`

### Telemetry Transport

- [Telemetry History](https://github.com/maheshks74/scada_defence/blob/main/simulation/telemetry_generator.py): `simulation/telemetry_generator.py`
- [Modbus Publisher](https://github.com/maheshks74/scada_defence/blob/main/scada/modbus_server.py): `scada/modbus_server.py`
- [Register Map](https://github.com/maheshks74/scada_defence/blob/main/scada/register_map.py): `scada/register_map.py`
- [Modbus Client](https://github.com/maheshks74/scada_defence/blob/main/scada/modbus_client.py): `scada/modbus_client.py`

### Defense Analysis

- [Telemetry Verification](https://github.com/maheshks74/scada_defence/blob/main/agents/telemetry_agent.py): `agents/telemetry_agent.py`
- [Risk Analysis](https://github.com/maheshks74/scada_defence/blob/main/agents/risk_agent.py): `agents/risk_agent.py`
- [Model Impact](https://github.com/maheshks74/scada_defence/blob/main/agents/impact_analyzer.py): `agents/impact_analyzer.py`
- [Trend Prediction](https://github.com/maheshks74/scada_defence/blob/main/models/prediction_model.py): `models/prediction_model.py`
- [Agent Data Schemas](https://github.com/maheshks74/scada_defence/blob/main/models/schemas.py): `models/schemas.py`

### Operator Response

- [Mitigation Policy](https://github.com/maheshks74/scada_defence/blob/main/agents/mitigation_agent.py): `agents/mitigation_agent.py`
- [Confirmation Gate](https://github.com/maheshks74/scada_defence/blob/main/agents/human_confirmation.py): `agents/human_confirmation.py`
- [Event Log](https://github.com/maheshks74/scada_defence/blob/main/storage/event_logger.py): `storage/event_logger.py`

### User Interface

- [Application Entry](https://github.com/maheshks74/scada_defence/blob/main/main.py): `main.py`
- [SCADA Dashboard](https://github.com/maheshks74/scada_defence/blob/main/dashboard/app.py): `dashboard/app.py`
- [Dashboard Controller](https://github.com/maheshks74/scada_defence/tree/main/dashboard): `dashboard`

### Other components

- **Operator**

## Connections

- Application Entry → SCADA Dashboard: launches (evidence: `main.py`)
- SCADA Dashboard → Dashboard Controller: uses (evidence: `dashboard/app.py`)
- Dashboard Controller → Simulation Orchestrator: controls
- SCADA Dashboard → Modbus Client: reads telemetry (evidence: `README.md`)
- Simulation Orchestrator → Coupled Physics: advances (evidence: `simulation/simulator.py`)
- Coupled Physics → Motor PLC: updates (evidence: `simulation/physical_model.py`)
- Coupled Physics → Pump PLC: updates (evidence: `simulation/physical_model.py`)
- Coupled Physics → Process PLC: updates (evidence: `simulation/physical_model.py`)
- Motor PLC → PLC Interface: implements (evidence: `plc/motor_plc.py`)
- Pump PLC → PLC Interface: implements
- Process PLC → PLC Interface: implements (evidence: `plc/process_plc.py`)
- Coupled Physics → Process PLC: supplies pump flow (evidence: `simulation/physical_model.py`)
- Simulation Orchestrator → FDIA Engine: injects values (evidence: `simulation/simulator.py`)
- Simulation Orchestrator → Telemetry History: records reported state (evidence: `simulation/simulator.py`)
- Simulation Orchestrator → Modbus Publisher: publishes registers (evidence: `simulation/simulator.py`)
- Modbus Publisher → Register Map: uses addresses (evidence: `scada/modbus_server.py`)
- Simulation Orchestrator → Telemetry Verification: provides telemetry (evidence: `README.md`)
- Telemetry Verification → Risk Analysis: provides checks (evidence: `README.md`)
- Telemetry Verification → Model Impact: analyzes suspicious readings (evidence: `agents/impact_analyzer.py`)
- Model Impact → Telemetry History: reads history (evidence: `agents/impact_analyzer.py`)
- Model Impact → Trend Prediction: forecasts (evidence: `agents/impact_analyzer.py`)
- Telemetry Verification → Agent Data Schemas: returns result (evidence: `README.md`)
- Risk Analysis → Agent Data Schemas: returns assessment (evidence: `README.md`)
- Model Impact → Agent Data Schemas: returns analysis (evidence: `agents/impact_analyzer.py`)
- Mitigation Policy → Confirmation Gate: requests confirmation (evidence: `agents/mitigation_agent.py`)
- Operator → Confirmation Gate: submits decision (evidence: `agents/human_confirmation.py`)
- Mitigation Policy → Coupled Physics: isolates PLC (evidence: `agents/mitigation_agent.py`)
- Mitigation Policy → Event Log: records decisions (evidence: `README.md`)
- SCADA Dashboard → Event Log: shows events (evidence: `README.md`)
- Application Entry → Configuration Loader: loads settings (evidence: `main.py`)
- SCADA Dashboard → Configuration Loader: loads settings (evidence: `dashboard/app.py`)
- Simulation Orchestrator → FDIA Engine: starts or stops (evidence: `simulation/simulator.py`)
