Data model
Sparkplug conventions
How Factory+ uses Sparkplug B, including the Factory+ birth marker, schema and instance UUIDs, transient metrics, rebirths and nanosecond timestamps.
Factory+ carries all live device data as Sparkplug B messages over MQTT.
Sparkplug defines the topics, the Protocol Buffers payload, the birth and death certificates and the commands. It says nothing about what a device is or what its metrics mean, and two Sparkplug devices of the same kind can publish completely different metric names. Factory+ adds a small set of conventions on top of Sparkplug, and with them any consumer can identify each device by a UUID, find the schema that describes each part of it and decide what to record without being configured for that device in advance.
A publisher, such as an Edge Agent or any service that publishes Sparkplug, follows these conventions when it builds its messages. A consumer, such as a historian, the Directory, a UNS ingester or any application, relies on them when it reads messages. The key words MUST, SHOULD and MAY follow RFC 2119, as described on the service specification page.
Sparkplug B as the base
Factory+ publishers MUST follow version 3.0 of the Sparkplug B specification. The one exception is that payload and metric timestamps SHOULD be in nanoseconds, not milliseconds, as described under Timestamps. In particular, a publisher MUST:
- publish on the
spBv1.0topic namespace, in the formspBv1.0/<group>/<type>/<node>for Node messages andspBv1.0/<group>/<type>/<node>/<device>for device messages - encode payloads as Sparkplug B Protocol Buffers
- publish NBIRTH and DBIRTH certificates that declare every metric it will later send, and set an NDEATH as its MQTT Will
- publish DDEATH when a device stops reporting
- publish data by exception, sending a metric in NDATA or DDATA only when its value changes
Sparkplug lets a publisher give each metric an alias in the birth and then send only the alias in DATA messages. A consumer MUST therefore keep the most recent birth for each Node and device and use it to map aliases back to metric names, datatypes and properties.
Sparkplug pairs an NDEATH with its NBIRTH through the bdSeq metric. Because some Edge Nodes send a constant bdSeq, Factory+ consumers SHOULD treat an NDEATH as ending the current session of the Node at that address, rather than depend on the bdSeq value.
Sparkplug addresses
A Sparkplug address is the group ID, Node ID and device ID that make up a topic. A Node’s address has no device ID. Each ID MUST be non-empty and MUST NOT contain /, + or #, as Sparkplug requires. Factory+ also expects the following.
- The address says where, the UUID says what. A device can move to a different Node or group and keep its identity, because consumers identify it by its
Instance_UUID, as described under Device identity. Consumers SHOULD store and look up data by UUID and use the address only to find the topics. - Each Edge Node has one address, held centrally. The Configuration Store records the group ID and Node ID of each Edge Node’s principal in the Sparkplug address application
8e32801b-f35a-4cbf-a5c3-2af64d3debd7. The MQTT broker uses this entry to limit each Edge Node to its own topics, and an Edge Node MUST therefore publish at the address recorded for its principal. - Group IDs group Nodes that are managed together. Factory+ does not give the group ID a fixed meaning. A group SHOULD contain the Nodes of one place or one management unit, such as the Edge Nodes of one site, because MQTT permissions can be granted for a whole group.
- Device IDs are stable and readable. Because device IDs appear in UNS topics, they SHOULD be short, human-readable names that do not change while the device is in service.
The Factory+ birth marker
A Sparkplug payload has an optional top-level uuid field. Factory+ uses it to mark payloads that follow these conventions.
11ad7b32-1d32-4c4a-b0c9-fa049208939aA Factory+ publisher MUST set the payload uuid of every NBIRTH and DBIRTH to 11ad7b32-1d32-4c4a-b0c9-fa049208939a.
A consumer MUST NOT read Factory+ meaning from a birth that does not carry this marker. Factory+ meaning covers schema and instance UUIDs, the ISA-95 hierarchy, alerts and links. The rule matters because a plain Sparkplug device may use metric names such as Schema_UUID for something else. A consumer MAY still record such a birth as an ordinary Sparkplug device.
DATA and DEATH messages do not need the marker, because a consumer interprets them through the birth that came before them.
Command Escalation also sets the marker on the CMD messages it sends and puts the identity of the principal that asked for the command in the payload body.
Metric names
A metric name is a path of segments separated by /. The segments mirror the nesting of the device’s schema. For example, the switch state of phase L1 of a three-phase circuit is Phases/L1/Switch_Closed. The part of the name before the last / is the metric’s path, here Phases/L1. Each path prefix is an object in the device, here Phases and Phases/L1.
- Metric names MUST NOT start with
/. A metric at the top level of the device has no/at all, for exampleFrequency. - Metric names MUST follow the device’s schema. A consumer that reads the schema then knows what each metric means.
- Metric names MUST NOT contain
+,#or the character U+0000, because the UNS turns each name into part of an MQTT topic. - Each segment of a name SHOULD use only letters, digits, underscores and spaces.
Schema and instance UUIDs
Each object in a Factory+ birth that follows a schema declares two UUID metrics. Both are named after the object’s path.
| Metric | Datatype | Value |
|---|---|---|
<path>/Schema_UUID | UUID | The Schema_UUID of the schema the object follows. |
<path>/Instance_UUID | UUID | A UUID that identifies this object, the same in every birth. |
The device itself is the object with an empty path. Its pair is named Schema_UUID and Instance_UUID, with no prefix.
A publisher MUST declare the top-level Schema_UUID and Instance_UUID in every Factory+ DBIRTH and NBIRTH. A publisher MUST also declare the pair for every object whose schema requires it. Both metrics SHOULD be declared only in the birth, because their values do not change while the birth is current.
Example
This DBIRTH is for a power meter that follows the Three Phase Circuit schema. Aliases, properties and most of the measurements are left out.
| Metric name | Datatype | Value |
|---|---|---|
Schema_UUID | UUID | 0d3dbae6-3195-4249-9ca1-897221db016f (Three Phase Circuit) |
Instance_UUID | UUID | 3c1f9a52-6b0e-4d8f-9a71-2e5c8b4d7f10 (the device) |
Device_Information/Schema_UUID | UUID | 2dd093e9-1450-44c5-be8c-c0d78e48219b (Device Information) |
Device_Information/Instance_UUID | UUID | 435f7c35-ca5c-511c-bb09-8f87c49388f5 |
Device_Information/Manufacturer | String | Example Meters Ltd |
Device_Information/ISA95_Hierarchy/Schema_UUID | UUID | 84ac3397-f3a2-440a-99e5-5bb9f6a75091 (Hierarchy) |
Device_Information/ISA95_Hierarchy/Instance_UUID | UUID | 35f9de69-e42b-524d-a0c1-44f2de1f69c7 |
Device_Information/ISA95_Hierarchy/Enterprise | String | Acme |
Frequency | Double | 50.02 |
Phases/L1/Schema_UUID | UUID | d6de8765-bfbe-4f6b-b5d8-822dbd7f3a49 (Single Phase Circuit) |
Phases/L1/Instance_UUID | UUID | 5184d0bf-55e0-55ad-abcf-00097c6775b6 |
Phases/L1/Switch_Closed | Boolean | true |
Device Control/Rebirth | Boolean | false (transient) |
Phases has no UUID pair of its own. In the Three Phase Circuit schema it is a folder that holds the L1, L2 and L3 objects, not an object with a schema.
How a consumer resolves the chain
A consumer works out the context of each metric from the birth in three steps.
- Collect every birth metric whose last segment is
Schema_UUID, and record its value against its path. The path is the name without the last segment. Do the same forInstance_UUID. The pair with the empty path belongs to the device. - For a given metric, the objects that contain it are the recorded paths that are a prefix of the metric’s name, compared segment by segment.
Phases/L1containsPhases/L1/Switch_Closed, but it does not containPhases/L10/Switch_Closed. - The top-level schema and instance are the device’s own pair. The bottom-level schema and instance are those of the deepest containing object. The chain is the list of containing objects from the top down.
In the example, Phases/L1/Switch_Closed has the top-level schema Three Phase Circuit and the top-level instance 3c1f9a52-…. Its bottom-level schema is Single Phase Circuit and its bottom-level instance is 5184d0bf-…. Its chain is one object, Phases/L1. Frequency has only the top level.
With these values a consumer can look up each schema in the Configuration Store. It can find all objects that follow a given schema across every device. It also has a stable key for each metric, whatever address the device publishes from. The Directory indexes the schemas each device uses, and a consumer can ask it which devices use a schema.
Device identity
The top-level Instance_UUID of a DBIRTH is the device’s UUID. It identifies the device everywhere in Factory+.
- If a device has an object in the Configuration Store, its top-level
Instance_UUIDMUST be that object’s UUID. Configuration, the Directory, the UNS and stored history then all use one identifier for the device. - A Node’s top-level
Instance_UUIDin its NBIRTH SHOULD be the UUID of the principal that publishes it. The Node’s data and its access rights then refer to the same identity. - If a birth has no top-level
Instance_UUID, the Directory allocates a UUID for the address and reuses it for later births at that address. That UUID belongs to the address, not the device. It does not follow the device if the device moves. Publishers SHOULD NOT rely on this.
Name-based (v5) instance UUIDs
Objects inside a device also need Instance_UUID values that stay the same in every birth. Storing a UUID for every object of every device is a burden. A publisher MAY instead derive each one from the device UUID and the object’s path. A publisher that derives instance UUIDs SHOULD use the scheme below, so that every publisher gives the same object the same UUID.
Instance_UUID = UUIDv5(namespace = 11ad7b32-1d32-4c4a-b0c9-fa049208939a,
name = "8a4dc2f4-2f9f-45fc-b2e9-ed7b9cda6145:" + <owner UUID> + ":" + <path>)
UUIDv5 is the name-based UUID of RFC 4122, with the name encoded as UTF-8. The owner UUID is the top-level Instance_UUID of the Node or device that carries the object. It is written in lower-case hyphenated form. The path is the object’s path with no leading or trailing /.
For the example device above, the path Phases/L1 gives the name 8a4dc2f4-2f9f-45fc-b2e9-ed7b9cda6145:3c1f9a52-6b0e-4d8f-9a71-2e5c8b4d7f10:Phases/L1. That name gives the instance UUID 5184d0bf-55e0-55ad-abcf-00097c6775b6.
8a4dc2f4-2f9f-45fc-b2e9-ed7b9cda6145A derived UUID changes if the object’s path changes. If a publisher has already published a different UUID for an object and wants the object’s history to stay under that key, it MUST keep publishing the UUID it used before. The ISA-95 placement of a device can record such UUIDs for the hierarchy object for this reason.
Common objects
Two objects appear in most Factory+ device births.
Device_Informationfollows the Device Information schema2dd093e9-1450-44c5-be8c-c0d78e48219b. It holds facts about the device such asManufacturer,ModelandSerial.Device_Information/ISA95_Hierarchyfollows the Hierarchy schema84ac3397-f3a2-440a-99e5-5bb9f6a75091. It gives the device’s place in the plant as theEnterprise,Site,Area,Work CenterandWork Unitmetrics. A device appears on the UNS only when its hierarchy is at exactly this path. ISA-95 hierarchy explains where the values come from.
Objects that follow the Alert and Link schemas report problems and relationships. The Directory indexes them.
Metric properties
Sparkplug lets a birth attach a property set to each metric. Factory+ gives meaning to the properties in the table below.
Apart from the simulation markers, a publisher SHOULD send properties only in births, because they do not change while the birth is current. The simulation markers belong to individual values.
| Property | Datatype | Meaning |
|---|---|---|
engUnit | String | The engineering unit of the metric’s value, such as V or kWh. It SHOULD resolve to a UNECE unit code through the engineering units vocabulary. A metric with a unit MUST declare it here in its birth, because consumers read the unit from this property. |
engLow, engHigh | Float | The expected lower and upper limits of the value, in the engineering unit. Optional. |
tooltip | String | A short description of the metric for display. Optional. |
documentation | String | A longer description of the metric. Optional. |
simulated | Boolean | true on values that come from a simulator, not a real device. Consumers use it to keep the two apart. MAY be sent on DATA metrics. |
run_id | String | The simulation run that produced a simulated value. MAY be sent with simulated. |
Edge Agents MAY publish other properties that describe how they read a metric from its device, such as the address or method they use. Consumers MUST ignore properties they do not recognise.
Transient metrics
Sparkplug gives each metric an is_transient flag. In Factory+ a transient metric is one whose values are live only and are not meant to be recorded, such as a control metric or a value that has no meaning once it is old.
- A publisher MUST mark a metric transient in its birth when its values should not be historised.
- Each metric in a device’s configuration has a
Record_To_Historianfield, defined under Data schemas. If that field isfalse, the publisher MUST mark the metric transient. - A historian that records Sparkplug data MUST NOT record the values of a metric that is transient in its birth or in the DATA message that carries the value.
- Transient metrics are otherwise ordinary metrics. They still appear in births and DATA messages. The UNS still publishes them, with the
Transientproperty set to"true".
Control metrics
Factory+ uses two control metrics to ask a publisher to send its birth certificates again. Every Factory+ Edge Node MUST declare and handle them.
| Metric | Declared in | Datatype | Behaviour when set to true |
|---|---|---|---|
Node Control/Rebirth | NBIRTH | Boolean | The Edge Node publishes a new NBIRTH, then a new DBIRTH for each of its devices. |
Device Control/Rebirth | each DBIRTH | Boolean | The Edge Node publishes a new DBIRTH for that device only. |
Sparkplug already requires Node Control/Rebirth. Factory+ adds Device Control/Rebirth for a consumer that has missed one device’s birth. With it, the consumer can ask for that birth without making every device on the Node publish again. Both metrics SHOULD be transient.
Metrics under a Device Control folder are commands to the device, not data about it. The UNS does not publish them.
An Edge Agent MAY declare other control metrics under Node Control or Device Control. The control metrics Factory+ defines for Edge Agents are listed under Edge Agent.
Requesting a rebirth
A consumer that needs a birth it has not seen asks for a rebirth through Command Escalation. This happens, for example, when the consumer started after the device was born. The consumer SHOULD NOT publish an NCMD or DCMD itself.
Command Escalation checks the caller’s permissions. A consumer therefore needs only the Rebirth permission for the devices it reads, not the broker permission to send any command to any device.
The request is an HTTP POST to Command Escalation. The path is /v1/address/{group}/{node} for a Node and /v1/address/{group}/{node}/{device} for a device. The body is:
{ "name": "Device Control/Rebirth", "type": "Boolean", "value": true }
For a Node, the name is Node Control/Rebirth. The caller needs the Rebirth permission fbb9c25d-386d-4966-a325-f16471d9f7be for the target.
If a consumer sees DATA from an address it has no birth for, it SHOULD rate-limit its rebirth requests for that address, because the publisher may already be sending a birth. Without a limit, a device that cannot rebirth would be asked again on every message.
A consumer that only needs one device’s birth SHOULD ask that device, not its whole Node.
Timestamps
Factory+ publishers SHOULD write payload and metric timestamps as nanoseconds since the Unix epoch, 1970-01-01T00:00:00Z. The timestamps go in the Sparkplug timestamp field, which is an unsigned 64-bit integer. A publisher MAY still write milliseconds, because consumers tell the two apart by the rule below.
Sparkplug B specifies milliseconds, and nanoseconds are a deliberate departure from the Sparkplug specification. Factory+ needs the extra precision because many devices sample faster than once a millisecond, and nanoseconds still fit in the same field until the year 2554.
A plain Sparkplug consumer that reads a Factory+ timestamp as milliseconds gets a date far in the future. Every Factory+ consumer MUST therefore convert timestamps by this rule:
- A timestamp below 1015 is in milliseconds. The consumer multiplies it by 1,000,000 to get nanoseconds.
- A timestamp of 1015 or more is already in nanoseconds.
The rule is safe in both directions because 1015 milliseconds is a date in about the year 33,658, and 1015 nanoseconds is 12 January 1970. No real timestamp can therefore be read in the wrong unit, and a consumer can read Factory+ publishers and plain Sparkplug publishers on the same broker.
For example, 12:00:00 UTC on 2 December 2026 is 1796212800000 from a plain Sparkplug publisher and 1796212800000000000 from a Factory+ publisher. Both convert to the same instant.
The rule applies to the payload timestamp and to each metric’s timestamp. It does not change how the value of a DateTime metric is encoded. If a metric has no timestamp, consumers use the payload timestamp. If that is also missing, they use the time the message arrived.
STATE messages
Sparkplug lets a Primary Host Application publish a STATE message and lets Edge Nodes wait for that host to be online before they publish. Factory+ does not use this mechanism, because consumers recover missed births by requesting a rebirth through Command Escalation instead.
Factory+ Edge Nodes SHOULD NOT be configured to wait for a Primary Host Application’s STATE before they publish. Factory+ services do not publish STATE.
The well-known MQTT permissions include permissions for the legacy Sparkplug B 2.2 STATE topics, of the form STATE/<host id>. They do not cover the Sparkplug 3.0 form, spBv1.0/STATE/<host id>.