Skip to main content

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: makes points: only, never tables: and mapping:.

Words on this page​

WordMeaning
pointA named value in a Modbus connection.
poll planThe register ranges that the gateway reads.
dump-configThe command that prints what the gateway derived from the configuration.

Before and after​

Both configurations read the same value from the same device.

before: tables: + mapping:
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)
after: points:
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​

  1. Remove tables:. The gateway makes the poll plan from the address tokens and the polling rates.
  2. Add expose: to the connection. A point goes to <expose.parent>/own:<object>/own:<pointName>. Set object: to the name of the old parent Object. Without object:, the gateway uses the connection name.
  3. Make one point for each mapping: entry. Read the expression: modbusGetInt32BE("MB1", 3000) is at: holding:3000, type: int32, endianness: ABCD.
  4. Move the layout. BE is ABCD. A call modbusGetFloat32(..., "CDAB") gives type: float32 and endianness: CDAB. See the register layout.
  5. Move the scale. The formula $mb.value / 10.0 + 3.14 gives scale: 0.1 and offset: 3.14 on the point.
  6. Leave a calculation that a point cannot express. Move it to the value: key of the point. See The value: 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.

  1. Check tables: of the connection. Compare it with the address tokens and the polling rates that you wrote.
  2. 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 endianness is wrong. BE and LE are not the same question as the word swap.
  • expose.object is not the old node: path.

dump-config exits with an error and shows the diagnostics when the configuration is not valid. Correct them first.

  • opcua-omni-edge migrate-config config.yaml migrates the schema from version 3 to version 4. It changes nodesets: to namespaces: and imports:, and instance: to instances:. It does not change tables:. Run it first when the configuration is older than version 4.
  • opcua-omni-edge convert-mapping <file> --write config.yaml --device MB1 converts a vendor mapping file to points:. See Link or convert.