Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Connecting Modbus devices

Related articles are:

Connecting Modbus devices

Connecting "VT85 / Modbus extension board"

Connecting Modbus sensors using "RS485 to USB adapter"

Description

A virtual "Modbus RTU" sensor is used to read and write data from external equipment via Modbus RTU protocol (RS-485 line).

Some Vutlan devices have a Modbus RTU port. Some require an additional extension to be bought separately.

Some older Vutlan units use an external converter to the USB bus is used to provide RS-485 communication.

https://vutlan.atlassian.net/wiki/spaces/DEN/pages/678887425/Creating+virtual+Modbus+RTU+element

Activating Modbus

After connecting the RS485 bus, according to the "Slave" hardware documentation, you can now activate the Modbus.

The Modbus operates in "Master" mode. To enable the Modbus, go inside the web interface of the Vutlan monitoring unit and go to Preferences menu >> Modbus RTU. Set up the bus according to the documentation for the "Slave" equipment. Please note that the "VT85 / Modbus extension board"  only supports 1 stop bit.


Adding the Modbus reading virtual element

To create a "Modbus RTU (reading)" element, press add button "  " inside the "Group tree" or "System tree" menu. Then choose "Modbus RTU (reading)". A modal window will appear:

Click on the "Modbus RTU (reading)". Modbus element form will be opened:

Fields in the form available for change:

#NameDescription
1NameCreated element name
2User-defined typeDefines the icon to be displayed in the "System tree"
3Units of measurementThe unit of measure in which the value is displayed in the "System tree"
4Minimum valueDetermines the minimum measurement range, when the value is out of range, the sensor goes into "Not connected" state
5Maximum valueDetermines the maximum measurement range, when the value is out of range, the sensor goes into a "Not connected" state
6Alarm and warning levelsDefines the alarm and warning thresholds, as for other sensors, see Sensor configuration
7HysteresisOption of setting the hysteresis state, see Sensor configuration
8Expression

Function of the form f (x). The default value for the sensor is equal to the measured value: "x", ie corresponds to the expression "x". To calculate the indirect value of the sensor is possible to use an arbitrary expression, which are permissible "(", ")", as well as:

    • operators: "+", "-", "*", "/", "%" (remainder of the division), "^" (exponentiation);
    • functions: "abs","sqrt","exp","ln","log","sin","cos","tan","asin","acos","atan";
    • constants: "pi" (3.1415926...), "e" (2.7182818...);
    • point is used as decimal separator (3.14).

        For example: "0.1*x+0.5"


The Modbus RTU bus configuration is available in the "Additional" tab:

Fields in the form available for change:

#NameDescription
1Slave addressModbus RTU slave address of external equipment
2Register index

Modbus protocol register start address in hexadecimal view, like 0F4A

3Function codeThe following functions are supported:
  • 0x01 - Read Coil Status
  • 0x02 - Read Input Status
  • 0x03 - Read Holding Register
  • 0x04 - Read Input Register
4Data type

Determines how to present the data:

  • 16 bits signed int
  • 16 bits unsigned int
  • 32 bits signed int
  • 32 bits unsigned int
  • 32 bits IEEE floating point
5Data ordering

Determines byte order in Modbus protocol response message:

  • low byte first, low word first
  • low byte first, high word first
  • high byte first, low word first
  • high byte first, high word first
6Polling periodDefines the time of polling the sensor value. From 10 seconds to 5 minutes. 

The Test button allows you to make a test connection with a Modbus device. In additional fields, the bytes sequence of connection, data is displayed, in hexadecimal form. Modbus request - data of the sent request, without a checksum. Modbus raw answer - data of the received answer, without a checksum. Modbus value - contains the data value interpreted under the selected Data type.

Adding the Modbus writing virtual element

To create a "Modbus RTU (writing)" element, press add button "  " inside the "Group tree" or "System tree" menu. Then choose "Modbus RTU (writing)". Modbus element form will be opened:

Fields in the form available for change:

#NameDescription
1NameCreated element name
2Slave addressModbus RTU slave address of external equipment
3Register index

Modbus protocol register start address in hexadecimal view, like 0F4A

4Function codeThe following functions are supported:
  • 0x05 - Write Single Coil
  • 0x06 - Write Single Register
5Writing valueDecimal integer value that will be written in the specified register

The Test button allows you to make a value entry immediately into the Modbus register. Now the Modbus RTU writing can be inserted as a THEN task in logic schemes:

Example, adding input register "Active power" for Eastron SDM220 Modbus slave

For this example, we will be using "Eastron SDM220-Modbus Single Phase Two Module DIN-rail Meter" as a slave Modbus device.

SDM220ModbusEN.pdf

SDM220Modbus_protocol_V1.1.pdf

Let's create a "Modbus RTU" element for input register "Active power", which is measured by SDM220.

Press add button "  " inside "Group tree" or "System tree" menu. Then choose "Modbus RTU". A Modbus element form will be opened:

Let's change values in the Setting tab:

#NameNew value
1Name

We are adding the input register "Active power",

so we write: Active power

2User-defined typeLet's choose "power" for a nice icon of a meter.
3Units of measurement

"Active power" is measured in Watts.

so we write: Watts

4Minimum value, Maximum value, Alarm, and warning levelsDefine it according to Your needs
7HysteresisDefine it according to Your needs
8Expressionx


Now let's change the values in the Additional settings tab:


#NameDescription
1Slave address

on page 2 of SDM220ModbusEN.pdf it is stated in the table in row 16 that:

"How to find Modbus address. By default, it is 001"

But in our case it is different, a slave address has been manually altered. And, after following the procedure and navigating to slave address onscreen instruction, we find out that the Salve address for this device is currently set to 31 in our example. It is advised to have a slave address according to position in a Modbus chain. So if the sensor is currently 1st in a Modbus chain, set it to 1.


So we write 31.

2Register index

on page 2 of SDM220Modbus_protocol_V1.1.pdf it is stated in the table that:

"Hi Byte = 00

+

Lo Byte = 0C"


So we write 000C
3Function code

on page 2 of SDM220Modbus_protocol_V1.1.pdf it is stated that:

"Modbus Protocol function code 04 is used to access all parameters."

So we write:

0x04 - Read Input Registers

4Data type

on page 1 of SDM220Modbus_protocol_V1.1.pdf it is stated that:

"The format for each byte in RTU mode is:

Coding System: 8-bit per byte

Data Format: 4 bytes (2 registers) per parameter.

Floating point format ( to IEEE 754)"


or


on page 2 it is stated that:

"the data used by the Eastron Digital meter is in 32-bit IEEE 754 floating-point format."


So we write:

32 bits IEEE 754 floating point

5Data ordering

on page 1 of SDM220Modbus_protocol_V1.1.pdf it is stated that:

"Most significant register first (Default). The default may be changed if

required -See Holding Register "Register Order" parameter."


So we write:

low byte first, low word first

Save the virtual Modbus element.

Now You can add the next virtual Modbus element using register index for the same Eastron SDM220 Modbus slave. For example, Current, Apparent power, Reactive power, and so on.

If You decide to add the next Modbus slave device, make sure that it has a different slave address, different from other slave devices in the chain.








Developer notes:

  • No labels