Skip to main content

brownfieldDevices.modbus

Use a Modbus connection to read registers and coils of a Modbus TCP device. You declare points: each point has a name, an address and a type. A mapping entry reads a point with modbus: <connection>:<point>. With expose:, the gateway also publishes the device as an Object that has one variable for each point.

Example​

brownfieldDevices:
modbus:
- name: MB1
type: TCP
address: 192.168.1.40
port: 502
unitId: 1
pollingRate: 500
expose:
parent: /ua:Objects/di:DeviceSet
object: AHU
points:
- name: SupplyAirTemperature
at: holding:10
type: int16
scale: 0.1
unit: degC
- name: CoolingValveOpen
at: coil:3
type: bool
access: RW

The value​

brownfieldDevices.modbus: is a list. Each entry is a Modbus connection.

A Modbus connection​

One Modbus TCP device. It holds the points that the gateway reads.

KeyWhat it doesValueRequired
nameThe name of the connection. A mapping entry starts a reference with it: modbus: <name>:<point>.textyes
typeThe transport. TCP is the only transport that works today. The gateway refuses Serial.TCP, Serialyes
addressThe IP address of the device, for example 192.168.1.40.text
portThe TCP port of the device. The usual Modbus port is 502.number
unitIdThe Modbus unit identifier of the device (the slave id). The default is 1.whole number
endiannessThe register layout of the device for values larger than 16 bits. A point can set its own. The default is ABCD.ABCD, BADC, CDAB, DCBA
pollingRateHow often the gateway reads the registers of the points, in ms. The default is 1000. A point can set its own.number
maxGapThe number of unused registers that one read can contain. The gateway reads across a gap this size instead of making two reads. The default is 8.whole number
estimatedTransactionMsThe time in ms that the gateway assumes for one Modbus request when it checks the poll plan. The default is 10. Use a lower value for a fast TCP link.number
exposeWhere the gateway puts the device in the address space: an Object below parent: that has one variable for each point.Modbus expose entry
pointsThe values to read from the device. Each point has a name, an address and a type.list of Modbus point
importMapping files to import, for example a vendor export of the register map. The gateway reads the points from the files.list of Modbus import
tablesThe register ranges to poll. The gateway makes them from the points. Declare tables only to set the poll plan yourself.list of Modbus table
tagsDeprecated for Modbus. Declare points instead.list of tag

A Modbus expose entry​

Says where the gateway puts the device in the address space: an Object below a parent node.

KeyWhat it doesValueRequired
parentThe browse path of the node that holds the device Object, for example /ua:Objects/di:DeviceSet.textyes
objectThe browse name of the device Object. The default is the name of the connection.text
nodeIdPrefixThe start of the node id of each variable. The default is s=<connection>.<object>..text

A Modbus point​

A named value of a Modbus device: its address, its type and how to scale it.

KeyWhat it doesValueRequired
nameThe name of the point. A mapping entry uses it: modbus: M1:<name>. The name stays the same when a new import changes the register numbers.textyes
atWhere the value is: <table>:<address>, for example holding:10. The table is coil, discrete, holding or input. The address starts at 0. Use modicon:400011 for a 1-based Modicon number, and holding:10.3 for bit 3 of a register.textyes
typeThe data type in the register or registers: int16, float32 and so on. It gives the width and the decoding. A float32 or int32 point uses 2 registers.text (a fixed list)yes
displayNameA name for people. The default is the name of the point.text
countThe number of elements, for an array or a string. The default is 1.whole number
endiannessThe register layout of this point. The default is the endianness of the connection.ABCD, BADC, CDAB, DCBA
scaleA multiplier for the raw value: engineering = raw * scale + offset.number
offsetA number that the gateway adds after the multiplication by scale.number
sqrtRangeA square-root scale between a raw range and an engineering range. Differential-pressure flow transmitters use it. Do not combine it with scale or offset.square-root range
scaleRegisterThe address of a second register that holds a power-of-ten scale factor, for example holding:200. The gateway reads it at each poll.text
unitThe engineering unit, for example degC. The gateway publishes it on the variable.text
rangeThe low and high limit of the value. The gateway publishes it as the engineering range of the variable.engineering range
accessWhat the device permits: RO (read only), RW (read and write) or WO (write only). The default is RO. The gateway does not write to devices today.RO, RW, WO
writeFcPolicyThe Modbus function codes for a write. auto (the default) uses a single write when one register is enough. forceMultiple always uses a multiple write, for a device that supports only that. The gateway does not write to devices today.auto, forceMultiple
invalidRaw values that mean "no reading", for example [-32768]. The gateway then publishes BadDataUnavailable. Write a value above 2^53 as a text.list of whole number or text
bitmaskA mask for a bit field in a 16-bit register. The type must be int16, uint16 or bool.whole number
pollingRateHow often the gateway reads this point, in ms. The default is the pollingRate of the connection.number
samplingIntervalThe sampling interval, in ms, that the variable of this point shows to OPC UA clients.number
nodeThe browse path of a variable that already exists. The gateway then gives the value to this variable and does not make a new one.text
valueA JSONata expression that replaces the standard decoding. Use it only when the other keys cannot express the calculation.text
descriptionA text for people. The gateway puts it in the Description attribute of the variable.text

A Modbus import​

A mapping file from a vendor tool. The gateway reads the points from the file.

KeyWhat it doesValueRequired
fileThe path of the mapping file, relative to the folder of the configuration file, for example profiles/tags.csv.textyes
formatThe format of the file. auto (the default) finds the format from the file. Set it when the gateway cannot find it.text (a fixed list)
addressBaseSays if the file uses addresses that start at 0 or at 1. auto (the default) uses the convention of the format.auto, 0, 1
endiannessThe register layout that the file assumes for values larger than 16 bits. It applies to the imported points.ABCD, BADC, CDAB, DCBA
kepwareZeroBasedSet to false when a Kepware export does not use zero-based addressing.true or false
includeName patterns. The gateway imports only the points that match.list of text
excludeName patterns. The gateway does not import the points that match.list of text
overridesChanges for single points, applied after the gateway reads the file. Use them to rename, retype or bind a point without an edit of the vendor file.list of override of an imported point

A Modbus table​

A range of registers that the gateway polls. Use points for a new configuration.

KeyWhat it doesValueRequired
typeThe register table to poll: coils, discreteInputs, holdingRegisters or inputRegisters.coils, discreteInputs, holdingRegisters, inputRegistersyes
startThe first register of the table. The address starts at 0.numberyes
lengthThe number of registers in the table.numberyes
pollingRateHow often the gateway reads the table, in ms.numberyes

A tag​

A named value of a device, with its address. A tag documents the layout of the device.

KeyWhat it doesValueRequired
nameThe name of the tag. It is unique in the connection, for example BoilerTempRaw.textyes
addressThe address of the value, without the connection name. The syntax depends on the protocol: DB1,INT2 for S7.textyes
dataTypeThe data type in the protocol of the device, for example INT16 or FLOAT.text
descriptionA text for people. The gateway puts it in the Description attribute of the variable.text

A square-root range​

The raw and engineering limits for a square-root scale, as used by flow transmitters.

KeyWhat it doesValueRequired
rawLowThe raw value at the low end of the range.numberyes
rawHighThe raw value at the high end of the range.numberyes
scaledLowThe engineering value at the low end of the range.numberyes
scaledHighThe engineering value at the high end of the range.numberyes

An engineering range​

The low and high limit of the value of a point. The gateway publishes it on the variable.

KeyWhat it doesValueRequired
lowThe low end of the engineering range.numberyes
highThe high end of the engineering range.numberyes

An override of an imported point​

Changes one imported point without a change to the vendor file.

KeyWhat it doesValueRequired
pointThe name of the imported point to change. A name pattern is allowed.textyes