Niagara - Network Protocols - BQL Queries for Device Identification Across Multiple Network Protocols
Introduction
Identifying devices across various network protocols using Building Query Language (BQL) can be challenging due to the differences in device types. This guide provides a systematic approach to constructing BQL queries that can efficiently identify devices across different networks.
Good Practice
To construct an effective BQL query for identifying devices across multiple different network protocols, follow these detailed steps:
Identify Device Type:
Begin by determining the specific type of device component you need to query. This involves understanding the network component structure and accessing the AX Slot Sheet view or similar tools within your Niagara system.
Figure 1. Different Modbus Networks
Figure 2. Type of the component to use in the BQL query
Use Correct Device Type in Query:
Replace generic types in your query with specific device types. For example, if querying in a ModbusAsyncNetwork, use
modbusAsync:ModbusAsyncDevice
instead of a generic type likecontrol:NumericPoint
.
Find Common Device Types:
When querying devices from different network drivers (e.g., ModbusAsyncNetwork and ModbusTcpNetwork), it's crucial to identify a common parent device type. Access Bajadoc help documentation to find the base classes (e.g.,
BModbusAsyncDevice
andBModbusTcpDevice
).Figure 3. ModbusAsyncDevice and it’s parent class
Figure 4. ModbusTcpDevice and it’s parent class
Parent classes are not the same. Trace their inheritance further to discover a common parent such as
BModbusClientDevice
.Figure 5. ModbusTcpDevice and it’s grandparent class
Figure 6. Common parent class
Formulate the BQL Query:
Modify the device type string appropriately by removing prefixes and suffixes (e.g., remove "B" prefix and "-rt" suffix) and combine them with a colon separator to form something like
modbusCore:ModbusClientDevice
.Construct your BQL query using this type. For example:
station:|slot:/Drivers|bql:select * from modbusCore:ModbusClientDevice
. This query will now be able to retrieve all devices of the specified type across the queried networks.
Expand Query to Include Multiple Protocols:
If you need to include devices from additional protocols (e.g., SNMP, BACnet), repeat the process to find a common type across all required protocols. This might involve more extensive research into device inheritance and might also lead to the discovery of a universal type that encompasses multiple protocols. However common class for all of those networks can possibly also include devices from other protocols like M-Bus, NiagaraDriver etc.
Alternative Query Method - NEQL:
For a more flexible querying method that can accommodate diverse and non-standard device types, consider using Network Equipment Query Language (NEQL). This approach requires tagging each device manually with a custom tag (e.g.,
my:deviceForQuery
) and then querying based on these tags. While this method involves more setup time, it provides greater control over the query results.