Files
smart-city-digital-twin-mar…/data-flow-diagram.html

409 lines
16 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<h1
id="smart-city-digital-twin-martinique-diagramme-des-flux-de-données">Smart
City Digital Twin Martinique — Diagramme des Flux de Données</h1>
<p><strong>Dernière mise à jour :</strong> 06 Mai 2026<br />
<strong>Projet :</strong> Smart City Digital Twin Martinique<br />
<strong>Architecture :</strong> IoT-Agent intégré, QuantumLeap + CrateDB
pour lanalyse avancée</p>
<hr />
<h2 id="architecture-globale-mise-à-jour-06052026">Architecture Globale
(Mise à jour 06/05/2026)</h2>
<pre class="mermaid"><code>graph TB
subgraph Simulateur[&quot;🖥️ Simulateur (Host Python)&quot;]
SIM[Smart City Simulator&lt;br/&gt;10 capteurs&lt;br/&gt;Intervalle: configurable]
end
subgraph MQTT_Brokers[&quot;📡 MQTT Brokers&quot;]
EMQ[EMQX&lt;br/&gt;port 11883]
MOS[Mosquitto&lt;br/&gt;port 1883]
BUN[BunkerM&lt;br/&gt;port 1900&lt;br/&gt;MQTTS/TLS]
end
subgraph IoT_Agent[&quot;🤖 IoT Agent (NGSI-LD)&quot;]
IOTA[IoT Agent JSON&lt;br/&gt;port 4041&lt;br/&gt;Transforme MQTT → NGSI-LD]
end
subgraph CB[&quot;🔗 Context Brokers (NGSI-LD)&quot;]
ORI[Orion-LD&lt;br/&gt;NGSI-LD&lt;br/&gt;port 1026]
STE[Stellio&lt;br/&gt;NGSI-LD&lt;br/&gt;port 8080]
FRO[FROST-Server&lt;br/&gt;SensorThings&lt;br/&gt;port 8080]
end
subgraph Analytics[&quot;📈 Analytics &amp; Time-Series&quot;]
QL[QuantumLeap&lt;br/&gt;NGSI-LD → CrateDB&lt;br/&gt;port 8668]
CRATEDB[CrateDB&lt;br/&gt;PostgreSQL-compatible&lt;br/&gt;port 4200/5432]
end
subgraph Storage[&quot;💾 Stockage &amp; Métriques&quot;]
INF[InfluxDB&lt;br/&gt;Bucket: iot_data&lt;br/&gt;port 8086]
PRO[Prometheus&lt;br/&gt;Scrape: /metrics&lt;br/&gt;port 9090]
GEO[GeoServer&lt;br/&gt;WMS/WFS/WMTS&lt;br/&gt;port 8080]
end
subgraph IoT_Platform[&quot;🏢 Plateforme IoT&quot;]
ORM[OpenRemote Manager&lt;br/&gt;MQTT Agent&lt;br/&gt;port 8080]
KC[Keycloak&lt;br/&gt;port 8080]
end
subgraph VIZ[&quot;📊 Visualisation&quot;]
GRA[Grafana&lt;br/&gt;Dashboards&lt;br/&gt;port 3001]
MAP[MapStore&lt;br/&gt;WMS/WFS&lt;br/&gt;port 8080]
end
%% ── Flux Simulateur ──────────────────────────────────────────
SIM --&gt;|&quot;1⃣ MQTT publish&lt;br/&gt;city/sensors/{type}/{id}&quot;| EMQ
SIM --&gt;|&quot;1⃣ MQTT publish&quot;| MOS
SIM --&gt;|&quot;1⃣ MQTT publish&quot;| BUN
SIM --&gt;|&quot;5⃣ InfluxDB v2 API&lt;br/&gt;async non-bloquant&quot;| INF
%% ── Flux MQTT → IoT Agent ──────────────────────────────────
EMQ --&gt;|&quot;MQTT subscribe&lt;br/&gt;city/sensors/#&quot;| IOTA
MOS --&gt;|&quot;MQTT subscribe&quot;| IOTA
BUN --&gt;|&quot;MQTT subscribe&quot;| IOTA
%% ── Flux IoT Agent → Context Brokers ───────────────────────
IOTA --&gt;|&quot;2⃣ NGSI-LD POST&lt;br/&gt;/ngsi-ld/v1/entities&quot;| ORI
IOTA --&gt;|&quot;2⃣ NGSI-LD POST&quot;| STE
%% ── Flux Context Brokers → QuantumLeap ───────────────────
ORI --&gt;|&quot;NGSI-LD Subscription&lt;br/&gt;→ QuantumLeap&quot;| QL
STE --&gt;|&quot;NGSI-LD Subscription&lt;br/&gt;→ QuantumLeap&quot;| QL
%% ── Flux QuantumLeap → CrateDB ────────────────────────────
QL --&gt;|&quot;Insert&lt;br/&gt;PostgreSQL wire&quot;| CRATEDB
%% ── Visualisation ───────────────────────────────────────────
CRATEDB --&gt;|&quot;PostgreSQL Datasource&quot;| GRA
INF --&gt;|&quot;Datasource Flux IoT&quot;| GRA
ORI --&gt;|&quot;NGSI-LD Datasource&quot;| GRA
STE --&gt;|&quot;NGSI-LD Datasource&quot;| GRA
GEO --&gt;|&quot;WMS/WMTS&quot;| MAP
ORM --&gt;|MapSettings&lt;br/&gt;Martinique| MAP
ORM --&gt;|&quot;Live assets&lt;br/&gt;REST&quot;| GRA
%% ── OpenRemote MQTT Agent ───────────────────────────────────
EMQ --&gt;|&quot;6⃣ Subscribe&lt;br/&gt;city/sensors/#&quot;| ORM
MOS --&gt;|&quot;6⃣ Subscribe&quot;| ORM
BUN --&gt;|&quot;6⃣ Subscribe&quot;| ORM
%% ── Métriques Prometheus ────────────────────────────────────
SIM --&gt;|&quot;7⃣ /metrics&lt;br/&gt;port 8001&quot;| PRO
EMQ --&gt;|&quot;/api/v5/metrics&quot;| PRO
STE --&gt;|&quot;/actuator/prometheus&quot;| PRO
INF --&gt;|&quot;/metrics&quot;| PRO
ORM --&gt;|&quot;/actuator/prometheus&quot;| PRO
GRA --&gt;|&quot;/metrics&quot;| PRO
IOTA --&gt;|&quot;/metrics&quot;| PRO
QL --&gt;|&quot;/metrics&quot;| PRO</code></pre>
<hr />
<h2 id="flux-détaillés-mise-à-jour-06052026">Flux Détaillés (Mise à jour
06/05/2026)</h2>
<h3 id="flux-mqtt-brokers">1⃣ Flux MQTT — Brokers</h3>
<table>
<thead>
<tr>
<th>Broker</th>
<th>Port</th>
<th>Protocol</th>
<th>Topics</th>
</tr>
</thead>
<tbody>
<tr>
<td>EMQX</td>
<td>11883</td>
<td>MQTT</td>
<td><code>city/sensors/{type}/{id}</code></td>
</tr>
<tr>
<td>Mosquitto</td>
<td>1883</td>
<td>MQTT</td>
<td><code>city/sensors/{type}/{id}</code></td>
</tr>
<tr>
<td>BunkerM</td>
<td>1900</td>
<td>MQTTS (TLS)</td>
<td><code>city/sensors/{type}/{id}</code></td>
</tr>
</tbody>
</table>
<p>Le simulateur publie simultanément sur les 3 brokers vers <strong>IoT
Agent</strong>.</p>
<h3 id="flux-iot-agent-ngsi-ld">2⃣ Flux IoT Agent — NGSI-LD</h3>
<ul>
<li><p><strong>IoT Agent JSON</strong> : Réception MQTT → Transformation
en entités NGSI-LD</p></li>
<li><p><strong>Port</strong> : <code>4041</code></p></li>
<li><p><strong>Configuration</strong> :</p>
<div class="sourceCode" id="cb2"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Enregistrement service</span></span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a><span class="ex">curl</span> <span class="at">-X</span> POST http://localhost:4041/iot/services <span class="dt">\</span></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="at">-H</span> <span class="st">&#39;Content-Type: application/json&#39;</span> <span class="dt">\</span></span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="at">-H</span> <span class="st">&#39;fiware-service: smartcity&#39;</span> <span class="dt">\</span></span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="at">-d</span> <span class="st">&#39;{&quot;services&quot;: [{&quot;apikey&quot;: &quot;smartcity-api-key&quot;, &quot;cbroker&quot;: &quot;http://orion-ld:1026&quot;, &quot;entity_type&quot;: &quot;Device&quot;, &quot;ngsi_version&quot;: &quot;ld&quot;}]}&#39;</span></span></code></pre></div></li>
<li><p><strong>Entités créées dans</strong> : Orion-LD (port 1026) et
Stellio (port 8080)</p></li>
</ul>
<h3 id="flux-context-brokers-quantumleap-cratedb">3⃣ Flux Context
Brokers → QuantumLeap → CrateDB</h3>
<ol type="1">
<li><strong>Orion-LD</strong> / <strong>Stellio</strong> : Reçoivent les
entités NGSI-LD de IoT Agent</li>
<li><strong>QuantumLeap</strong> (port 8668) : Souscrit aux mises à jour
NGSI-LD via Subscription</li>
<li><strong>CrateDB</strong> (port 5432/4200) : Stockage temporel
PostgreSQL-compatible</li>
<li><strong>Grafana</strong> : Dashboards connectés à CrateDB
(PostgreSQL datasource)</li>
</ol>
<h3 id="flux-influxdb-temps-réel">4⃣ Flux InfluxDB — Temps Réel</h3>
<ul>
<li><strong>API</strong> :
<code>http://localhost:8086/api/v2/write</code></li>
<li><strong>Bucket</strong> : <code>iot_data</code></li>
<li><strong>Org</strong> : <code>digitribe</code></li>
<li><strong>Mode</strong> : Asynchrone (thread daemon) pour ne pas
bloquer le publish MQTT</li>
</ul>
<h3 id="openremote-mqtt-agent">5⃣ OpenRemote — MQTT Agent</h3>
<p>Lagent MQTT dOpenRemote souscrit aux topics
<code>city/sensors/#</code> sur les brokers MQTT. Les payloads sont
automatiquement parsés et les attributs des assets sont mis à jour.</p>
<h3 id="flux-prometheus-métriques">6⃣ Flux Prometheus — Métriques</h3>
<table>
<thead>
<tr>
<th>Service</th>
<th>Endpoint <code>/metrics</code></th>
<th>Statut</th>
</tr>
</thead>
<tbody>
<tr>
<td>Simulator</td>
<td><code>localhost:8001</code></td>
<td></td>
</tr>
<tr>
<td>EMQX</td>
<td><code>emqx_emqx_1:8081/api/v5/metrics</code></td>
<td></td>
</tr>
<tr>
<td>Stellio</td>
<td><code>stellio-api-gateway:8080/actuator/prometheus</code></td>
<td></td>
</tr>
<tr>
<td>InfluxDB</td>
<td><code>smart-city-influxdb:8086/metrics</code></td>
<td></td>
</tr>
<tr>
<td>OpenRemote</td>
<td><code>openremote-manager-1:8080/actuator/prometheus</code></td>
<td></td>
</tr>
<tr>
<td>Grafana</td>
<td><code>smart-city-grafana:3000/metrics</code></td>
<td></td>
</tr>
<tr>
<td>IoT Agent</td>
<td><code>iot-agent:4041/metrics</code></td>
<td>⚠️ À vérifier</td>
</tr>
<tr>
<td>QuantumLeap</td>
<td><code>quantum-leap:8668/metrics</code></td>
<td>⚠️ À vérifier</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="nouveaux-composants-06052026">Nouveaux Composants
(06/05/2026)</h2>
<h3 id="iot-agent-json">🤖 IoT Agent JSON</h3>
<ul>
<li><strong>Rôle</strong> : Pont entre MQTT et NGSI-LD (Orion-LD /
Stellio)</li>
<li><strong>Port</strong> : 4041</li>
<li><strong>Statut</strong> : ❌ En cours de réparation (erreur
MongoDB)</li>
<li><strong>Correction</strong> : Fournir
<code>IOTA_MONGO_URL=mongodb://mongodb:27017/iotagent</code></li>
</ul>
<h3 id="quantumleap">📈 QuantumLeap</h3>
<ul>
<li><strong>Rôle</strong> : Analytics NGSI-LD → CrateDB</li>
<li><strong>Port</strong> : 8668</li>
<li><strong>Statut</strong> : ✅ Fonctionnel (interne), port non exposé
sur lhôte</li>
<li><strong>Action</strong> : Exposer le port dans docker-compose</li>
</ul>
<h3 id="cratedb">🗄️ CrateDB</h3>
<ul>
<li><strong>Rôle</strong> : Base de données temporelle
PostgreSQL-compatible</li>
<li><strong>Port</strong> : 4200 (UI), 5432 (PostgreSQL)</li>
<li><strong>Statut</strong> : ✅ Opérationnel</li>
<li><strong>Usage</strong> : Stockage des séries temporelles depuis
QuantumLeap</li>
</ul>
<hr />
<h2 id="tableau-récapitulatif-mise-à-jour">Tableau Récapitulatif (Mise à
jour)</h2>
<table>
<colgroup>
<col style="width: 28%" />
<col style="width: 34%" />
<col style="width: 15%" />
<col style="width: 21%" />
</colgroup>
<thead>
<tr>
<th>Composant</th>
<th>Technologie</th>
<th>Port</th>
<th>Statut</th>
</tr>
</thead>
<tbody>
<tr>
<td>Simulator</td>
<td>Python + paho-mqtt</td>
<td>Host:8001 (metrics)</td>
<td>✅ Actif</td>
</tr>
<tr>
<td>EMQX</td>
<td>MQTT Broker</td>
<td>11883</td>
<td>✅ Connecté</td>
</tr>
<tr>
<td>Mosquitto</td>
<td>MQTT Broker</td>
<td>1883</td>
<td>✅ Connecté</td>
</tr>
<tr>
<td>BunkerM</td>
<td>MQTTS Broker</td>
<td>1900</td>
<td>✅ Connecté</td>
</tr>
<tr>
<td><strong>IoT Agent</strong></td>
<td><strong>NGSI-LD Bridge</strong></td>
<td><strong>4041</strong></td>
<td><strong>❌ Erreur MongoDB</strong></td>
</tr>
<tr>
<td>Orion-LD</td>
<td>NGSI-LD Broker</td>
<td>1026</td>
<td>⚠️ À vérifier</td>
</tr>
<tr>
<td>Stellio</td>
<td>NGSI-LD Broker</td>
<td>8080</td>
<td>⚠️ Ports occupés par OpenRemote</td>
</tr>
<tr>
<td>FROST-Server</td>
<td>SensorThings API</td>
<td>8080</td>
<td>⚠️ À vérifier</td>
</tr>
<tr>
<td><strong>QuantumLeap</strong></td>
<td><strong>NGSI-LD → CrateDB</strong></td>
<td><strong>8668</strong></td>
<td><strong>✅ Interne</strong></td>
</tr>
<tr>
<td><strong>CrateDB</strong></td>
<td><strong>PostgreSQL Time-Series</strong></td>
<td><strong>4200/5432</strong></td>
<td><strong>✅ Opérationnel</strong></td>
</tr>
<tr>
<td>OpenRemote</td>
<td>IoT Platform</td>
<td>8080</td>
<td>⚠️ 403 (Service Account)</td>
</tr>
<tr>
<td>InfluxDB</td>
<td>Time Series DB</td>
<td>8086</td>
<td>✅ Bucket iot_data</td>
</tr>
<tr>
<td>Grafana</td>
<td>Visualisation</td>
<td>3001</td>
<td>✅ Dashboards + CrateDB</td>
</tr>
<tr>
<td>GeoServer</td>
<td>Geo Data</td>
<td>8080</td>
<td>✅ REST OK</td>
</tr>
<tr>
<td>MapStore</td>
<td>Cartographie</td>
<td>8080</td>
<td>✅ WMS/WMTS</td>
</tr>
</tbody>
</table>
<hr />
<h2 id="actions-prioritaires">Actions Prioritaires</h2>
<ol type="1">
<li><strong>Corriger IoT Agent</strong> : Ajouter MongoDB et configurer
<code>IOTA_MONGO_URL</code></li>
<li><strong>Exposer QuantumLeap</strong> : Mapper le port 8668 dans
docker-compose</li>
<li><strong>Déployer Orion-LD</strong> : Créer le service sil nexiste
pas</li>
<li><strong>Libérer les ports</strong> : Résoudre le conflit
Stellio/OpenRemote sur le port 8080</li>
<li><strong>Configurer CrateDB</strong> : Créer les tables pour
QuantumLeap</li>
<li><strong>Mettre à jour le simulateur</strong> :
<code>ENABLE_PULSAR=false</code> (recommandé)</li>
</ol>
<hr />
<h2 id="commandes-utiles">Commandes Utiles</h2>
<div class="sourceCode" id="cb3"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Vérifier IoT Agent</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="ex">curl</span> <span class="at">-s</span> http://localhost:4041/iot/services <span class="at">-H</span> <span class="st">&#39;fiware-service: smartcity&#39;</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Vérifier QuantumLeap</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="ex">curl</span> <span class="at">-s</span> http://localhost:8668/version</span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a><span class="co"># Vérifier CrateDB</span></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a><span class="ex">psql</span> <span class="at">-h</span> localhost <span class="at">-p</span> 5432 <span class="at">-U</span> crate <span class="at">-c</span> <span class="st">&quot;SELECT * FROM ql_entities LIMIT 5;&quot;</span></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a><span class="co"># Vérifier Orion-LD</span></span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a><span class="ex">curl</span> <span class="at">-s</span> http://localhost:1026/version</span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true" tabindex="-1"></a><span class="co"># Voir les logs IoT Agent</span></span>
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true" tabindex="-1"></a><span class="ex">docker</span> logs smart-city-iot-agent <span class="at">--tail</span> 30</span></code></pre></div>
<hr />
<p><strong>Fichiers associés :</strong> - Simulateur :
<code>~/smart-city-digital-twin-martinique/simulator.py</code> -
Dashboard Grafana :
<code>~/smart-city-digital-twin-martinique/grafana_dashboard_smartcity.json</code>
- Ce diagramme :
<code>~/smart-city-digital-twin-martinique/data-flow-diagram.md</code> -
Session Resume :
<code>~/smart-city-digital-twin-martinique/session_resume_2026-05-07.md</code></p>