A Unified Namespace (UNS) is a centralized, standardized, event-driven data architecture that facilitates easy integration and communication between diverse devices and systems in a smart city setting. It operates on the principle that all data should be disclosed and made accessible for consumption, regardless of whether there is an immediate consumer. UNS architecture provides real-time data processing and communication across various components within an urban environment, ensuring that all parts of the city’s infrastructure can interact seamlessly and efficiently. This facilitates better management of urban resources, enhances the quality of life for residents, and supports sustainable urban growth.
Table of contents
Open Table of contents
Principles of Unified Namespace architecture in smart cities and urban spaces
The Unified Namespace offers an innovative alternative to traditional urban data architecture. Conventional methods typically use hierarchical models that rely on data flowing upwards for centralized storage and subsequent analysis.
Devices, data points, and services in smart cities are organized according to the principles of Unified Namespace architecture into a logical topic structure based on characteristics such as type, function, and location. This organized approach not only facilitates the integration of various systems and protocols, enhancing interoperability and scalability, but also enables centralized data access for real-time monitoring and decision-making in urban environments. This streamlines device connectivity and data administration, making smart city management more efficient.
The core idea behind UNS architecture is that for a smart city to fully leverage decentralized real-time data sharing, each component operating within a specific functional domain must send data into a shared data infrastructure directly from its point of origin at the edge. These functional domains usually encompass traffic management, environmental monitoring, public safety, utilities, and citizen services in urban settings. Examples of data that can be shared include updates from sensors, events, alerts, status changes, commands, and configuration changes. Following the edge-driven principle, data can be transmitted using report-by-exception, ensuring only relevant changes are communicated.
Through the hierarchical topic structure it creates, the Unified Namespace in IoT streamlines device communication, data management, and system integration for smart cities. It facilitates smooth communication between various urban network protocols and systems, enhancing productivity, efficiency, and overall performance of urban infrastructure.
The Unified Namespace in IoT simplifies system integration, data management, and device communication in smart cities. Devices only need to know the topic they are publishing to or subscribing to, rather than the precise location or network of the device or data. This organized method simplifies device communication and data management across various urban systems.
Establishing a data infrastructure that supports an open architecture is essential for the efficient operation of UNS in smart cities. This involves utilizing a generally accepted, open, and standardized system for information exchange. Incorporating a “Publish-Subscribe” paradigm into the infrastructure allows for flexible and decoupled data sharing both within and between functional domains across the city’s ecosystem. This approach ensures seamless integration, improved resource management, and enhanced quality of data while supporting sustainable growth.
Unified Namespace MQTT for smart cities and urban spaces
MQTT is a client-server publish/subscribe messaging transport protocol. It is lightweight, open, simple, and designed to be easy to implement. These characteristics make it ideal for use in many situations, including constrained environments such as Machine-to-Machine (M2M) communication and Internet of Things (IoT) contexts, where a small code footprint and/or limited network bandwidth are required.
Unified namespace MQTT is a concept that involves hierarchically organizing MQTT devices to create a standardized and unified data architecture, facilitating easy integration and communication between diverse systems and devices in a smart city setting. It simplifies cooperation, information exchange, and efficiency by providing a standard and systematic method of organizing and accessing data within urban environments. In smart cities, data from various urban assets is arranged under namespaces such as city/park, city/zone/lighting, and city/Street/Sensor, with specific topics for publishing relevant data, such as city/park/irrigation and city/zone/lighting/status. This method standardizes data organization, streamlines integration, and improves data accessibility, enabling remote monitoring and control of urban infrastructure. However, challenges remain in managing data complexity, ensuring data consistency, and maintaining data transmission security protocols.
Unified namespace MQTT is a valuable tool in smart city environments as it allows MQTT topics to be organized hierarchically for effective monitoring and control of urban services, infrastructure, and environmental conditions. Data from the city is arranged into namespaces such as city/park or city/zone/lighting. Specific topics, like city/zone/lighting/status and city/park/water/consumption, are used to publish relevant data. This approach facilitates data-driven decision-making for city management, centralizes data access, and improves operational efficiency. By establishing data governance, integrating diverse systems, and ensuring seamless communication between various urban components, unified namespace MQTT supports the development of smarter, more efficient, and sustainable cities.
Example of an MQTT broker for smart cities
In the context of smart cities, a specific topic structure is used to organize data, adhering to a generic IoT standard. This structure can look like this:
smartcity/v1/city/area/park/originID
-
Topic names and rules: all parts of this structure, such as ‘city’, ‘area’, ‘park’, etc., are flexible in terms of their naming. They can include letters (a-z, A-Z), numbers (0-9), and certain symbols (- and _). However, symbols like ., +, #, or / are not used as they have special meanings in MQTT.
-
Versioning prefix: the smartcity/v1 at the beginning is mandatory. It ensures that the structure can evolve over time without causing confusion or compatibility issues.
-
Origin ID: this part identifies where the data is coming from. It could be a serial number, a MAC address, or even a software component like a Docker container. If multiple sources are involved, they are separated by underscores. Examples of originIDs: E588974, 00-80-41-ae-fd-7e, VM241_nodered_mes
Example Implementation:
- Context: in a smart city management system, handling data communication and storage.
- Challenge: establishing a robust and flexible topic structure for data handling that aligns with generic IoT standards.
- Decision: structure topics according to a specific format smartcity/v1/city/area/park/originID.
- Objective: ensure data integrity, ease of understanding for professionals, and adaptability to future changes.
Example topic structures implementation
Sensor data from a park in Madrid:
- Topic:
smartcity/v1/Madrid/central/RetiroPark/00-80-41-ae-fd-7e
- Description: data coming from a sensor in Retiro Park located in the central area of Madrid.
Environmental monitoring data from a residential area in Madrid:
- Topic:
smartcity/v1/Madrid/residential_area/GreenPark/E588974
- Description: environmental data collected from Green Park in a residential area of Madrid.
Traffic data from a park in Madrid:
- Topic:
smartcity/v1/Madrid/northern/MonteCarloPark/VM241_nodered_mes
- Description: traffic monitoring data from Monte Carlo Park located in the northern area of Madrid.
Air quality data from a park in Madrid:
- Topic:
smartcity/v1/Madrid/southern/AndaluciaPark/12-34-56-ab-cd-ef
- Description: air quality data collected from a sensor in Andalucia Park located in the southern area of Madrid.
Noise monitoring data from a park in Madrid:
- Topic:
smartcity/v1/Madrid/southern/CasaDeCampo/21-43-65-87-09
- Description: noise level data collected from Casa de Campo in the southern area of Madrid.
Guidelines for topic naming
Consistency: ensure that all parts of the topic follow a consistent naming convention to avoid confusion and facilitate data management. Readability: use clear and descriptive names that convey the necessary information at a glance. Scalability: design the topic structure to accommodate future expansions, such as adding more cities, areas, or facilities without disrupting the existing system.
MQTT Sparkplug specification
Sparkplug is an open-source software specification that provides MQTT clients with the framework to seamlessly integrate data from their applications, sensors, devices, and gateways into the MQTT infrastructure in a bidirectional and interoperable manner. With Sparkplug, all participants agree on a common data format, how to receive specific data, how to publish their data, and how the data can be interpreted. Sparkplug allows the integration of data from non-MQTT devices, as well as data from other protocols such as OPC-UA or Modbus. Additionally, the discovery of all these devices and applications is also possible by default.
The Sparkplug architecture is based on the following principles and mechanisms:
-
Pub/Sub: uses MQTT as a publish/subscribe architecture for the underlying application transport layer and decouples data producers and consumers. MQTT relies on push communication, meaning data is instantly distributed to all interested parties.
-
Report by exception: data and device status are only updated if they change. This significantly saves bandwidth and computing power for all components, as only new and fresh data is sent over the network.
-
Continuous session awareness: sparkplug and MQTT have the concept of continuous session awareness, informing all interested clients about the real-time online/offline status of the device if it changes. This concept also ensures that in-transit data continues to be sent to devices if they change from offline to online status again. With Sparkplug, you get a correct real-time view of all devices, gateways, and deployment applications.
-
Birth and death certificates: sparkplug introduces birth and death certificates used for device status management and discovery. Birth certificates encapsulate information about the device and the data it can and will send. Death certificates use the MQTT Last Will and Testament mechanism to send offline device information to all interested applications.
-
Persistent connections: all devices, gateways, and applications are always active by default and use persistent TCP connections.
-
Self-discovery: applications and devices can self-discover what data (and the corresponding topic) will be sent by all participants in the Sparkplug deployment, as well as the online/offline devices that are connected.
-
Standardized payload definition: the Sparkplug data format for all messages is standardized and can be encoded and decoded by all communication participants.
-
Standardized namespace: all Sparkplug participants use a common topic namespace. The topic namespace allows specific and detailed data subscriptions and enables the dynamic addition and removal of participants
Components of the MQTT Sparkplug topic namespace in a Smart City environment
To provide a structured way to ensure that messages are easily routed, understood, and acted upon in a Smart City environment, Sparkplug breaks down the MQTT topic namespace into specific components. Consequently, the structured nature of the Sparkplug topic namespace appears as follows:
spBv1.0/[Group ID]/[Message Type]/[EON Node ID]/[Device ID]
Here’s a detailed look at the components of the MQTT Sparkplug topic namespace:
Namespace
This always begins with “spBv1.0” to indicate that the topic is using the Sparkplug B version 1.0 specification. This serves as an identifier for the protocol version being used, as well as the encoding used for the associated payload data.
Group ID
This identifies a logical grouping of Edge of Network (EoN) nodes and devices. For example, you might use a group ID to represent a particular district or neighborhood within the city. It ensures data segregation between different groups, aiding in efficient data management and security.
Message Type
The message_type component of the topic namespace signals how the MQTT payload should be processed. The following message_type components are defined for the Sparkplug topic namespace:
- NBIRTH: Edge node BIRTH certificate. This is a startup message from an EoN to announce its presence and share its configurations.
- NDEATH: Notification of an edge node’s disconnection or failure.
- DBIRTH: Device BIRTH certificate. Like the NBIRTH but for devices, announcing their presence and configurations.
- DDEATH: Notification of a device’s disconnection or failure.
- NDATA: Data messages from an edge node. These typically include metric data.
- DDATA: Data messages from a device. Similar to NDATA but specifically for device-related metrics.
- NCMD: Command to an edge node.
- DCMD: Command to a device.
- STATE: It represents the state of the primary host application. Edge nodes subscribe to it to get the online status of the host.
Edge of Network (EON) Node ID
This uniquely identifies a specific edge node within EoNs in the same group. EON nodes are responsible for reporting data on behalf of devices they control or are connected to. The EON node ID helps in directing commands to the correct node and segregating data from various nodes.
Device ID (Optional)
If the message relates to a specific device controlled by the edge node, the device ID uniquely identifies that device.
Below is a table showing the descriptions and examples for each of the MQTT Sparkplug topic namespace components tailored for a Smart City environment.
spBv1.0/ParkDistrict1/DDATA/GreenSpaceMonitor01/IrrigationController_A
It’s essential to note that the edge node descriptor, formed by combining the group ID and edge node ID, must be distinct among all edge nodes in your MQTT Sparkplug network. This means that no two edge nodes in a Sparkplug setting can share identical group IDs and edge node IDs.
In a Smart City environment, particularly for managing parks and green spaces, this structured topic namespace allows for efficient data management and communication across various urban greenery systems. For instance, different districts or zones within the city parks can be managed under separate group IDs, ensuring that data from soil moisture sensors, irrigation systems, lighting, and other smart park components are well-organized and securely segregated. This facilitates seamless integration and scalability as the city’s green infrastructure expands.
The use of specific message types (NBIRTH, NDATA, etc.) helps in standardizing the communication protocol, ensuring that every component within the smart park network understands and processes the messages correctly. For example, when a new green space monitor (edge node) comes online, it sends an NBIRTH message to announce its presence and configuration. Similarly, NDATA messages continuously stream data about soil moisture levels, which can be used for real-time irrigation management and analysis.
Sparkplug payloads use Google Protocol Buffers to provide a compact method of data transmission. These payloads contain metrics, metadata, and status information that make it possible to provide updates on the status of devices and sensors. Each payload follows a defined structure that standardizes the reading and writing of data.
The following example shows an NDATA message that is published in the topic:
spBv1.0/ParkDistrict1/DDATA/GreenSpaceMonitor01/IrrigationController_A
This configuration causes the host application to update the value of soil moisture, water flow rate, irrigation status, ambient temperature, and humidity.
{
"timestamp": 1686144502122,
"metrics": [
{
"name": "Soil Moisture",
"timestamp": 1686144502122,
"dataType": "Float",
"value": 35.7
},
{
"name": "Water Flow Rate",
"timestamp": 1686144502122,
"dataType": "Float",
"value": 15.2
},
{
"name": "Irrigation Status",
"timestamp": 1686144502122,
"dataType": "Boolean",
"value": false
},
{
"name": "Ambient Temperature",
"timestamp": 1686144502122,
"dataType": "Float",
"value": 22.5
},
{
"name": "Humidity",
"timestamp": 1686144502122,
"dataType": "Float",
"value": 60.2
}
],
"seq": 10
}
By adhering to the Sparkplug topic namespace, city administrators can achieve a high level of interoperability between various IoT devices and systems within parks and green zones, enhancing the overall efficiency and responsiveness of the city’s green spaces to environmental conditions and public needs. This ensures that parks are well-maintained, water resources are used efficiently, and visitors can enjoy a well-managed natural environment.