Migrating a Modbus device from tables to points
A Modbus connection with tables: and a jsonata expression in mapping: still works. You do not have to change it.
Migrate a connection to points: to get three things:
- The gateway checks each address token when it loads. A typo does not read a wrong register.
- The gateway makes the poll plan. You do not maintain it.
- The connection can use
import:.import:makespoints:only, nevertables:andmapping:.
Words on this page
| Word | Meaning |
|---|---|
| point | A named value in a Modbus connection. |
| poll plan | The register ranges that the gateway reads. |
dump-config | The command that prints what the gateway derived from the configuration. |
Before and after
Both configurations read the same value from the same device.
brownfieldDevices:
modbus:
- name: MB1
type: TCP
address: 127.0.0.1
port: 8502
unitId: 1
tables:
- { type: holdingRegisters, start: 3000, length: 10, pollingRate: 100 }
mapping:
- node: /ua:Objects/di:DeviceSet/own:MyObject/own:MyInt32
value: $modbusGetInt32BE("MB1", 3000)
brownfieldDevices:
modbus:
- name: MB1
type: TCP
address: 127.0.0.1
port: 8502
pollingRate: 100
expose:
parent: /ua:Objects/di:DeviceSet
object: MyObject
points:
- name: MyInt32
at: holding:3000
type: int32
endianness: ABCD # BE is the same as ABCD
How to migrate a connection
- Remove
tables:. The gateway makes the poll plan from the address tokens and the polling rates. - Add
expose:to the connection. A point goes to<expose.parent>/own:<object>/own:<pointName>. Setobject:to the name of the old parent Object. Withoutobject:, the gateway uses the connection name. - Make one point for each
mapping:entry. Read the expression:modbusGetInt32BE("MB1", 3000)isat: holding:3000,type: int32,endianness: ABCD. - Move the layout.
BEisABCD. A callmodbusGetFloat32(..., "CDAB")givestype: float32andendianness: CDAB. See the register layout. - Move the scale. The formula
$mb.value / 10.0 + 3.14givesscale: 0.1andoffset: 3.14on the point. - Leave a calculation that a point cannot express. Move it to the
value:key of the point. See Thevalue:key.
How to migrate one point at a time
points: and tables: can be in the same connection. The old mapping: entries for a migrated point become redundant.
Remove an old entry only when its point works.
How to check the result
dump-config prints what the gateway derived: the poll plan, the projected nodes and the generated expression of each point.
opcua-omni-edge dump-config -c config.yaml
The output is for debug. Do not deploy it. Do not use it as a configuration. The gateway removes secrets and certificates from it.
- Check
tables:of the connection. Compare it with the address tokens and the polling rates that you wrote. - Check the generated
mapping:entry of the point. Compare it with the expression that you replaced.
If the two do not match, check these causes:
- The
endiannessis wrong.BEandLEare not the same question as the word swap. expose.objectis not the oldnode:path.
dump-config exits with an error and shows the diagnostics when the configuration is not valid. Correct them first.
Related commands
opcua-omni-edge migrate-config config.yamlmigrates the schema from version 3 to version 4. It changesnodesets:tonamespaces:andimports:, andinstance:toinstances:. It does not changetables:. Run it first when the configuration is older than version 4.opcua-omni-edge convert-mapping <file> --write config.yaml --device MB1converts a vendor mapping file topoints:. See Link or convert.