UDMI supports reading Modbus points by specifying them via a modbus:// URL schema.
modbus://<host>[:port]/<unitid>/<function>/<address>[/<quantity>][?interpretation]
host: The host name or IP address of the Modbus endpoint.
host maps to a named network, as indicated in the networks field in the gateway model, then the parameters there define the effective parameters to use.port: (Optional) The TCP port.unitid: The Slave ID (Unit Identifier).function: The Function Code (see Function Codes).address: The starting register address.quantity: (Optional) The number of registers to fetch.interpretation: (Optional) Query string properties that are necessary to properly interpret data fetched from a register.1: Read Coils2: Read Discrete Inputs3: Read Holding Registers4: Read Input Registers5: Write Single Coil6: Write Single Register15: Write Multiple Coils16: Write Multiple RegistersParameters passed in the query string define how to interpret the fetched register data:
border: i.e., MSB (Big-Endian) or LSB (Little-Endian).type: i.e., INT16, UINT32, BOOLEAN, ASCII.worder: i.e., HWF (High-Word First) or LWF (Low-Word First) (for 32-bit values).scale: i.e., 1.0, 0.01, 100.0 (scale factor).The host maps to a named network in the device’s model_localnet.json (under the networks field). Each named network can define the following parameters for communication:
baud: The baud rate.protocol: i.e., RTU, TCP.parity: For serial RTU.data bits: For serial RTU.stop bits: For serial RTU.The metadata values in the examples below map to the following complete Modbus URIs:
modbus://modbus_rtu_1/1/3/40001/1?type=INT16&border=MSBfan_status: modbus://modbus_rtu_1/2/1/101?type=BOOLEANfilter_differential_pressure: modbus://modbus_rtu_1/2/4/30005?type=UINT32&worder=LWF&scale=0.01The serial-bus RTU network specification as part of a gateway metadata.json file:
{
"localnet": {
"networks": {
"modbus_rtu_1": {
"family": "modbus",
"adjunct": {
"protocol": "RTU",
"baud": 9600,
"parity": "none",
"data_bits": 8,
"stop_bits": 1,
"device": "COM1"
}
}
}
}
}
For a proxied Modbus device, the gateway block in the metadata.json specifies the target device ID (Unit ID), while the pointset block defines the individual points and their register mappings.
{
"gateway": {
"target": {
"family": "modbus",
"addr": "2",
"network_id": "modbus_rtu_1"
}
},
"pointset": {
"points": {
"fan_status": {
"ref": "1/101?type=BOOLEAN"
},
"filter_differential_pressure": {
"units": "Pascals",
"ref": "4/30005?type=UINT32&worder=LWF&scale=0.01"
}
}
}
}