Worked Example — OCP Safi Slurry Line

Companion to Morocco UNS Standard v0.1 and Annex A — Phosphate & Mining. Demonstrates an end-to-end signal path from a Siemens S7-1500 PLC at OCP Safi to a CBAM-aware analytics consumer, fully conformant with the standard’s grammar and metadata envelope. No code is run; this is a documentation walk-through that proves the standard parses cleanly against a realistic phosphate-industry signal.


E.1 Scenario

OCP Safi operates a slurry pumping line that feeds the phosphoric-acid plant. Pump P-301 is a centrifugal slurry pump driven by a 350 kW motor, instrumented for flow, discharge pressure, motor current and bearing vibration. The PLC is a Siemens S7-1500 with the following addressing:

Tag (PLC)DescriptionTypeEngineering unit
DB10.DBD20Discharge flowReal (32-bit float)m³/h
DB10.DBD24Discharge pressureRealbar
DB10.DBD28Motor currentRealA
DB10.DBD32Bearing vibration RMSRealmm/s
DB10.DBX40.0Run stateBool
DB10.DBD44Motor energy (cumulative)RealkWh

The signal we follow end to end: discharge flow (DB10.DBD20).


E.2 Edge connector

A Go process running on an industrial PC at the pumping station connects to the S7-1500 over native S7-TCP using the maestrohub-labs/gos7 library (see IIoT Platform Build Intelligence — Open Source Stack 2026).

Configuration (conceptual):

edge_node_id: edge-safi-line3-01
plc:
  type: s7-1500
  address: 10.42.13.21
  rack: 0
  slot: 1
poll_interval_ms: 1000
mappings:
  - plc_tag: DB10.DBD20
    signal: flow-rate-m3h
    unit: m3h
    cbam_relevant: false
    cesmii_dimension: null
  - plc_tag: DB10.DBD44
    signal: energy-kwh
    unit: kwh
    cbam_relevant: true            # energy roll-up feeds CBAM
    cesmii_dimension: ProductionStateEnergyConsumption
  - plc_tag: DB10.DBX40.0
    signal: state
    unit: state
    cbam_relevant: false
    cesmii_dimension: ProductionState
  # ... other mappings

The connector publishes Sparkplug B birth (NBIRTH/DBIRTH) on connect, then DDATA messages at 1 Hz.


E.3 UNS path

Per Morocco UNS Standard v0.1 §4 and Annex A §A.7:

ma/ma-07/ocp/safi/slurry-pump/pump-p301/flow-rate-m3h

Segment-by-segment validation against §5 grammar:

SegmentValueCheck
Countryma✓ ISO 3166-1 alpha-2
Regionma-07✓ ISO 3166-2:MA — Marrakech-Safi
Enterpriseocp✓ ≤32 chars, kebab
Sitesafi
Areaslurry-pump✓ Annex A §A.3 vocabulary
(Line)omitted (no meaningful sub-line)
(Cell)omitted
Equipmentpump-p301✓ Annex A §A.4 archetype
Signalflow-rate-m3h✓ §6.1 noun-modifier-unit, unit suffix from §6.2

All segments lowercase, kebab-case, no diacritics, ≤32 chars. Conformant.


E.4 MQTT topic

Non-Sparkplug consumers (e.g. a Grafana data source via the MQTT plugin) subscribe to:

uns/ma/ma-07/ocp/safi/slurry-pump/pump-p301/flow-rate-m3h

A site-wide subscriber: uns/ma/+/ocp/safi/#

A national flow-rate subscriber: uns/ma/+/+/+/+/+/flow-rate-m3h


E.5 Sparkplug B mapping

Per §5.4 of the standard:

Sparkplug fieldValueSource
group_idma-07.ocp.safi.slurry-pumpregion.enterprise.site.area
message_typeDDATADevice data
edge_node_idedge-safi-line3-01(from connector config)
device_idpump-p301Equipment segment
Metric nameflow-rate-m3hSignal segment

Resulting topic:

spBv1.0/ma-07.ocp.safi.slurry-pump/DDATA/edge-safi-line3-01/pump-p301

The Protobuf payload contains a metric named flow-rate-m3h with a properties block carrying the §7 envelope.


E.6 Payload — JSON projection

A consumer that subscribes to the MQTT-JSON projection (some brokers offer this; otherwise a small bridge converts Sparkplug to JSON) sees:

{
  "timestamp_utc": "2026-04-27T14:32:01.123Z",
  "value": 412.6,
  "unit": "m3h",
  "source_protocol": "s7",
  "quality_code": "good",
  "iso_dimension": null,
  "cbam_relevant": false,
  "cndp_class": "none",
  "producer_id": "edge-safi-line3-01",
  "schema_version": "morocco-uns-0.1"
}

Validation against §7:

  • timestamp_utc — ISO 8601, ms precision, UTC (the connector converted UTC+1 → UTC)
  • unit matches signal suffix m3h
  • source_protocol is s7 (one of the §7 allowed values)
  • cbam_relevant is false for raw flow (the energy signal would be true)
  • schema_version is morocco-uns-0.1

Conformant.


E.7 Storage

The broker bridge writes to InfluxDB:

measurement:  flow-rate-m3h
tags:
  country=ma
  region=ma-07
  enterprise=ocp
  site=safi
  area=slurry-pump
  equipment=pump-p301
  source_protocol=s7
  quality_code=good
  cbam_relevant=false
fields:
  value=412.6
time: 2026-04-27T14:32:01.123Z

The tag set is derived mechanically from the UNS path. No mapping table required — this is the payoff of a standard.


E.8 Consumers

Three consumers run against the same broker, each with a different concern:

  1. Operations dashboard (Grafana). Subscribes uns/ma/ma-07/ocp/safi/#. Renders flow, pressure, vibration, state for pump P-301 and the rest of the line.

  2. OEE/energy analytics (CESMII profile consumer). Subscribes only to signals where iso_dimension == "ProductionStateEnergyConsumption". The pump’s energy-kwh signal qualifies; this consumer correlates energy against state to compute kWh per tonne pumped.

  3. CBAM emissions accumulator. Subscribes to uns/# and filters cbam_relevant == true. Joins energy (kWh), fuel (m³/h on dryers and calciners), and shipped mass (total-loaded-t) to produce the embedded-emissions ledger required for the May 2027 EU declaration. The slurry pump’s flow signal is not directly CBAM-relevant, but its energy signal is, and it indirectly informs the energy/throughput ratio used in apportioning emissions to specific cargoes.

All three consumers share the same broker, the same paths, the same envelope. None of them needs vendor-specific glue.


E.9 What this proves

  • The §5 grammar accepts a realistic phosphate signal without ad-hoc segments.
  • The §7 envelope carries enough metadata for operations, CESMII analytics, and CBAM reporting from a single subscription.
  • The Sparkplug B mapping (§5.4) preserves the full ISA-95 hierarchy despite Sparkplug’s flat field model.
  • Annex A vocabulary (slurry-pump, pump-p301, flow-rate-m3h) is sufficient for an actual OCP site.
  • The “ERP as a node” framing from 4.0 Solutions Channel — Intelligence & Frameworks 2026 becomes implementable: SAP S/4HANA at OCP becomes one more subscriber on uns/#, no longer a hub.

This walk-through is the editorial smoke test for the standard. Any future change to §5 or §7 must keep this example valid, or the example must be updated alongside the change.