# Smart City Digital Twin — Diagramme des Flux de Données ## Vue d'ensemble Ce diagramme illustre le flux complet des données IoT du simulateur vers les différentes couches de traitement, de stockage et de visualisation. --- ## Diagramme Mermaid ```mermaid graph TB SIM[Smart City Simulator] SENS[Capteurs IoT Reels] EMQ[EMQX] MOS[Mosquitto] BUN[BunkerM] FRO[FROST-Server] ORI[Orion-LD] STE[Stellio] UI[OpenRemote UI] ORM[OpenRemote Manager] KC[Keycloak] INF[InfluxDB] PRO[Prometheus] GEO[GeoServer] GRA[Grafana] MAP[MapStore] CH[ClickHouse] RW[RisingWave] PUL[Pulsar] RED[Redpanda] SIM --> EMQ SIM --> MOS SIM --> BUN SIM --> FRO SENS --> EMQ SENS --> MOS SENS --> BUN SENS --> FRO SENS -.-> ORM EMQ -->|via EMQX| ORI EMQ -->|via EMQX| STE MOS -->|via Mosquitto| ORI MOS -->|via Mosquitto| STE BUN -->|via BunkerM| ORI BUN -->|via BunkerM| STE UI --> ORM ORM -.-> KC SIM --> INF SIM -->|real-time 1s| CH SIM -->|streaming| RW SIM -->|HTTP REST| PUL SIM -->|HTTP REST| RED ORI --> GRA STE --> GRA FRO --> GRA ORI -.-> GEO STE -.-> GEO FRO -.-> GEO GEO --> MAP ORM --> GRA EMQ -.-> PRO ORI -.-> PRO STE -.-> PRO ORM -.-> PRO ``` --- ## Description des flux ### 1. **Génération des données (Simulator)** - **Smart City Simulator** (Python) génère des données pour 10 capteurs (Traffic, Air Quality, Parking, Noise, Weather, Light) - Intervalle de publication : 1 seconde (temps réel) - Protocoles : MQTT (vers brokers uniquement) - **⚠️ Projet** : Le simulateur n'envoie PAS directement à OpenRemote (pas de REST API) ### 2. **Ingestion MQTT (Brokers)** - **EMQX** (port 11883) : Broker public, reçoit tous les capteurs - **Mosquitto** (port 1883) : Via Traefik, accès externe - **BunkerM** (port 1900) : MQTTS (TLS), accès sécurisé ### 3. **Context Brokers (NGSI-LD & SensorThings)** - **Orion-LD** : Reçoit les données au format NGSI-LD - 10 entités (TrafficFlowObserved, AirQualityObserved, etc.) - Smart Data Models utilisés - **Provenance** : Données via EMQX, Mosquitto et BunkerM (voir étiquettes dans le diagramme) - **Stellio** : Alternative NGSI-LD - 14 payloads entités - Contexte : `https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld` - **Provenance** : Données via EMQX, Mosquitto et BunkerM - **FROST-Server** : SensorThings API - 21 256+ observations - PostgreSQL + TimescaleDB - **Provenance** : Données via EMQX, Mosquitto et BunkerM ### 4. **Plateforme IoT (OpenRemote)** - **OpenRemote Manager** (realm `smartcity`) - 33 assets IoT configurés - Carte Martinique (mapsettings.json) - Réception via **MQTT Agent** depuis les brokers (EMQX, Mosquitto, BunkerM) - Peut aussi recevoir directement des capteurs IoT (via MQTT) - **Keycloak** : Authentification OpenID Connect - Client `openremote` avec Service Account - Token endpoint : `/auth/realms/smartcity/protocol/openid-connect/token` ### 5. **Stockage & Métriques** - **InfluxDB** : Stockage temporel pour Grafana - Bucket : `iot_data` - Datasource dans Grafana - **Prometheus** : Collecte des métriques - MQTT brokers, Context brokers, OpenRemote - **GeoServer** : Données géospatiales - PostGIS pour centralisation - WMS/WFS pour MapStore ### 5. **Visualisation & Analyse** - **Grafana** (port 3001) - Dashboard : `smartcity-martinique-2026` - Datasources : InfluxDB, FROST, Orion-LD, ClickHouse, RisingWave - **MapStore** : Cartographie - Sources WMS/WFS depuis GeoServer - **OpenRemote UI** : Manager Interface - Visualisation des assets realm Smart City ### 6. **Analytique & Streaming** - **ClickHouse** (port 8123/9000) : Columnar OLAP Database - Analytique rapide sur grandes volumes de données IoT - Intégration possible via HTTP interface (port 8123) - Compatible avec Grafana (plugin ClickHouse) - **RisingWave** (port 4566/4567) : Streaming Database PostgreSQL-compatible - Traitement de flux en temps réel - Interface web pour requêtes SQL streaming - Compatible Grafana via datasource PostgreSQL --- ## Technologies clés | Composant | Technologie | Port | Statut | |-----------|-------------|------|--------| | Simulator | Python + paho-mqtt | Interne | ✅ Actif (1s) | | EMQX | MQTT Broker | 11883 | ✅ Connecté | | Orion-LD | NGSI-LD Broker | 1026 | ⚠️ À vérifier | | Stellio | NGSI-LD Broker | 8080 | ⚠️ À vérifier | | FROST-Server | SensorThings API | 8080 | ⚠️ À vérifier | | OpenRemote | IoT Platform | 8080 | ⚠️ 403 (Service Account) | | InfluxDB | Time Series DB | 8086 | ✅ Configuré | | ClickHouse | Columnar OLAP DB | 8123/9000 | ✅ Ajouté | | RisingWave | Streaming DB (PG) | 4566/4567 | ✅ Ajouté | | Pulsar | Event Streaming | 8080 | ⚠️ Debugging | | Redpanda | Kafka-compatible | 19092/9644 | ⚠️ OOM | | Grafana | Visualization | 3001 | ✅ Dashboard créé | | GeoServer | GeoServer | 8080 | ⚠️ À intégrer | | Prometheus | Metrics | 9090 | ✅ En cours | --- ## Fichiers associés - **Simulator** : `~/smart-city-digital-twin-martinique/simulator.py` (intervalle 1s - temps réel) - **Docker Compose** : `~/smart-city-digital-twin-martinique/docker-compose.yml` - **ClickHouse** : `~/smart-city-digital-twin-martinique/clickhouse/docker-compose.yml` - **RisingWave** : `~/smart-city-digital-twin-martinique/risingwave/docker-compose.yml` - **Pulsar** : `~/smart-city-digital-twin-martinique/pulsar/docker-compose.yml` - **Redpanda** : `~/smart-city-digital-twin-martinique/redpanda/docker-compose.yml` - **Dashboard Grafana** : `~/smart-city-digital-twin-martinique/grafana_dashboard_smartcity.json` - **Ce diagramme** : `~/smart-city-digital-twin-martinique/data-flow-diagram.md` - **Session Resume** : `~/smart-city-digital-twin-martinique/session_resume_2026-05-05.md` --- **Dernière mise à jour :** 05 Mai 2026 **Projet :** Smart City Digital Twin Martinique **URL Grafana :** https://grafana.digitribe.fr/d/smartcity-martinique-2026/smart-city-digital-twin-martinique