Link Search Menu Expand Document

Modbus Telemetry Interface

Jan 1 2022 at 12:00 AM

  1. Modbus V-Raptor driver
  2. Versioning
  3. Driver Capabilities and Features
    1. Reading and Writing of Registers
    2. Supported Writing of Registers
  4. Security
  5. Driver Setup
    1. Configuration - Device
    2. ConnectionOptions
    3. Configuration - Properties
  6. Modbus RTU over TCP
  7. Modbus TCP

Modbus V-Raptor driver

The Modbus V-Raptor™ driver supports the use of the open Modbus protocol that has been integrated into the back-end of the driver. The primary form of communication the driver utilises is TCP that lead to two additional communication standards: Modbus TCP and Modbus RTU/TCP.

Versioning

The Modbus V-Raptor driver does not support any versioning of packages as the driver was derived from the Edge Raptor™ plugin. The Nuget Package was rewritten with permission and integrated into the driver’s backend service. The backend service makes use of a IoT.nxt® package to make use of a gold standard TCP connection. The TCP connection can support standard TCP as well as TCP TLS. TCP TLS has not yet been implemented for the driver at this time.

Driver Capabilities and Features

Reading and Writing of Registers

Supported Reading of Registers:

Holding Registers:

  • Function Code: 03

Input Registers:

  • Function Code: 04

Coils:

  • Function Code: 01

Discrete Inputs:

  • Function Code: 02

Supported Writing of Registers

Holding Registers:

  • Function Code: 06 → Force Single Register
  • Function Code: 16 → Preset Multiple Registers

Coils:

  • Function Code: 05 → Force Single Coil
  • Function Code: 15 → Force Multiple Coils

Security

The Modbus driver does not support any TCP TLS features at the moment. TCP TLS 1.2 and 1.3 should available in a future iteration of the driver.

Driver Setup

Configuration - Device

"TCPModbusDevice1": {
  "ActionDelay": 10000,
  "Enabled": true,
  "Debug": true,
  "DeviceType": "Modbus",
  "PropertiesDeviceName": "simProperties",
  "IsRTU": false, //true for Modbus RTU
  "ASCIIMode": false, //true for Modbus ASCII mode
  "ConnectionOptions": {
  "HostIp": "127.0.0.1",
  "HostPort": 502,
  "ConnectionTimeout": 10 // represents timeout value in seconds
  }
}

ActionDelay: Defines how frequent the device will pull data from specified Device. The value is measured in milliseconds, thus a value of 10 000 means that the device configuration will attempt to execute every 10 seconds.

Enabled: Defines whether the corresponding device will be executed on startup. The Driver is capable of executing multiple devices at a time, at the same time.

Debug: Defines whether Debug logging will be made for the corresponding device.

PropertiesDeviceName: Should correspond to one of the property map collections defined in the DevicesOptions.json. A single Modbus Device should have a Property map set up according to a specific register type. If there is a different register type among other registers, it simply will ignore that property.

SlaveAddress: Defines the ID for the Device. The slave address is used in the creation of the Modbus payload. SlaveAddresses for devices are usually defined within the devices’ documentation.

IsRTU: If this property is set to true, Modbus RTU over TCP will be executed for the device. It is important to note that the device should be connected to a Edge Raptor and have a serial-to-ethernet converter set up to be able to execute the RTU standard.

ASCIIMode: If this property is set to true, Modbus ASCII over TCP will be executed for the device. It is important to note that the device should be connected to a Edge Raptor and have a serial-to-ethernet converter set up to be able to execute the ASCII standard.

NOTE
ASCII standard is currently unavailable for the Modbus Driver - No testable device.

ConnectionOptions

HostIp: Defines the IP of the device the driver will be connecting to.

HostPort: Defines the Port of the device the driver will be connecting to.

ConnectionTimeout: Defines the communication timeout of the driver in seconds.

Configuration - Properties

{
       "Devices": {
       "ModbusDevice": {
       "ActionDelay": 15000,
       "Enabled": false,
       "Debug": true,
       "DeviceType": "Modbus",
       "PropertiesDeviceName": "DeviceProperties",
       "SlaveAddress": 10,
       "IsRTU": true,
       "ASCIIMode": false,
       "ConnectionOptions": {
       "HostIp": "172.16.100.80",
       "HostPort": 5013,
       "ConnectionTimeout": 10      }
                                         },
        "DeviceProperties": {
        "DeviceType": "DefaultProperties",
        "GroupName": "ModbusDevices",
        "PropertyMaps": {

"ModelNumber": {
          "DataType": "uint16",
          "ScanTag": "400770",
          "ScanTagType": "UInt16",
          "CharacterLength": 0,
          "LittleEndian": false,
          "IsWriteEnabled": false        },

"SerialNumber": {
          "DataType": "uint32",
          "ScanTag": "400771",
          "ScanTagType": "UInt32",
          "CharacterLength": 0,
          "LittleEndian": false,
          "IsWriteEnabled": false        }
  

"OilPressure": {
          "DataType": "uint16",
          "ScanTag": "401025",
          "ScanTagType": "UInt16",
          "CharacterLength": 0,
          "LittleEndian": false,
          "IsWriteEnabled": false        },

"Coolant_Temperature": {
          "DataType": "uint16",
          "ScanTag": "401026",
          "ScanTagType": "UInt16",
          "CharacterLength": 0,
          "LittleEndian": false,
          "IsWriteEnabled": false        },

"OilTemperature": {
          "DataType": "uint16",
          "ScanTag": "401027",
          "ScanTagType": "UInt16",
          "CharacterLength": 0,
          "LittleEndian": false,
          "IsWriteEnabled": false        },
      }
    }
  }
}
"BUSBAR_VOLTAGE": {
  "DataType": "uint16",
  "ScanTag": "400001",
  "ScanTagType": "UInt16",
  "CharacterLength": 0,
  "LittleEndian": false,
  "IsWriteEnabled": false,
  "TransformSetId": "D100"
},
  "BATTERY_VOLTAGE": {
  "DataType": "uint16",
  "ScanTag": "400002",
  "ScanTagType": "UInt16",
  "CharacterLength": 0,
  "LittleEndian": false,
  "IsWriteEnabled": false,
  "TransformSetId": "D100"
},

DataType: Defines the datatype of the register to be read, the datatype and ScanTagType don’t have to be the same. The DataType is an additional layer of value manipulation that will try and convert the value read for the ScanTagType into the specified DataType. For instance a UInt16 value can be converted to an Int16 value.

ScanTag: The Id of the register to be read. The first register in a series will always be referred to as a 0 index register i.e. register 400001 is referred to as the 0 index register

ScanTagType: Defines the DataType of the Scantag that will be read from the Modbus device. The ScanTagType is limited to basic data types: UInt16, UInt32, UInt64, String and Bool. Please note that any UInt data type greater than UInt16 will read more registers than specified by the config. UInt16 reads 1 Modbus Register, UInt32 reads 2 Modbus Registers and UInt64 reads 4 Modbus registers and combines them into a single value.

CharacterLength: Does not require modification most of the time. Defines the expected CharacterLength of a response. The default is 0. Only relevant for Char/String values.

LittleEndian: Defines whether data should be read from smallest byte to biggest or biggest byte to smallest. The default value is false as the standard for Modbus devices is BigEndian.

IsWriteEnabled: Defines whether the register should be interpreted as most significant bit value first or least significant bit value first.

NOTE
Only Holding Registers and Coils have write capability.

TransformSetId: Transforms a value according to rules defined in TransformSets.json file. Manipulates the response to an acceptable and desired format for Commander.

Modbus RTU over TCP

If the connection is a physical, serial connection, then you will need a phyiscal device on-site that can link to your Modbus device. This can be an Edge Raptor or any of our certified Modbus RTU over TCP supported devices, where applicable.

Modbus TCP

Setting up a Modbus TCP device for the driver should be simple as long as it is Modbus TCP compatible. The only requirement to connect the device, is the assigned IP and Port of the device. If the device requires manual setup of registers, the process would require documentation for the device as well.

Teltonika:

Setting up Custom Registers for the device:

1.Enable the router to be a Modbus TCP slave. This can be found in the Network → Modbus → Modbus TCP

2.Enable the Custom Register Block in the WebUI. This can be found in the Network → Modbus → Modbus TCP

Additional Info

Register file path refers to where the register history will be stored. The default first register number for the device is 1025, which translates to 401025 Register Count, and refers to how many Custom registers you want to add from the first register number.

NOTE
It is possible to load a custom file onto the Teltonika Router that defines a set of custom Modbus registers. This should only be done if you have sufficient knowledge on the type of file required as well as the content the file should consist of.