This repo simulates a edge-based architecture using Python + Docker:
- Edge (STM32/RPi simulated): 3 containers publishing sensor data to MQTT.
- Fog (Industrial PC): aggregates fleet data, computes simple z-score anomalies, publishes actuator commands.
- Cloud (AWS/Azure/GCP simulated): Streamlit dashboard subscribing to MQTT and visualizing fleet status.
- Broker: Eclipse Mosquitto (MQTT).
# 1) cd into the folder
cd EdgeSim_Anomaly
# 2) Launch the stack
sudo docker-compose up --build
# 3) Open the dashboard
# http://localhost:8501
# 4) Closing the connections
# Ctrl+C
sudo docker-compose downYou should see edge1/2/3 printing actuator commands when anomalies are detected,
and the Cloud dashboard will show real-time reports.
- Edge publishes:
edge/{edge_id}/sensors→ JSON with temperature, humidity, pressure, electrical, vibrationedge/{edge_id}/heartbeat
- Fog publishes:
fog/actuators/{edge_id}→ JSON commands (e.g.,{ "alarm": true })cloud/reports→ JSON status per edgecloud/fleet_snapshot→ fleet-level snapshot
fogservice env:WINDOW_SIZE(default 50 samples)Z_THRESH(default 2.5)
edgeservices env:ANOMALY_RATE(probability of anomaly injection per message)
This simulation uses the knowledge gained from the paper A general anomaly detection framework for fleet-based condition monitoring of machines by Kilian Hendrickx, Wannes Meert, Yves Mollet, Johan Gyselinck, Bram Cornelis, Konstantinos Gryllias, Jesse Davis https://doi.org/10.1016/j.ymssp.2019.106585
- Replace fog z-score logic with:
- DTW/W-DTW warping amount between edges (Block 1)
- Hierarchical clustering + cophenetic correlation to pick clusters (Block 2)
- Anomaly score = 1 - (cluster_size / fleet_size) (Block 3)
- Keep MQTT topics the same — only swap
fog_node.pyinternals.
docker-compose.ymlmosquitto/mosquitto.confedge/→Dockerfile,edge_node.pyfog/→Dockerfile,fog_node.pycloud/→Dockerfile,cloud_app.py