modbusintellastar.com/.../user-guides/inferstack/modbus.pdf · 2019-07-28 · modbus- 3/3/2016 –...

14
Modbus- 3/3/2016 Page 1 of 14 Modbus Contents Overview ....................................................................................................................................................... 2 Supported Protocols ...................................................................................................................................... 2 TCP/IP ....................................................................................................................................................... 2 RTU over TCP/IP ....................................................................................................................................... 2 RTU over Serial ......................................................................................................................................... 2 Enable the Modbus Extension ...................................................................................................................... 2 Add Register Maps ........................................................................................................................................ 3 Add Modbus Connectors............................................................................................................................... 3 TCP/IP ........................................................................................................................................................... 5 Check Connector .......................................................................................................................................... 6 Create Points ................................................................................................................................................ 7 From Connector ......................................................................................................................................... 7 Has Current Value ..................................................................................................................................... 9 Has History ................................................................................................................................................ 9 Scale the Points ............................................................................................................................................ 9 Register Map Conversions ........................................................................................................................ 9 Point Conversions ..................................................................................................................................... 9 Debugging Your Connector......................................................................................................................... 10 Connectors App ....................................................................................................................................... 10 Debug App ............................................................................................................................................... 10 Developing Register Maps .......................................................................................................................... 11 Collect Documentation ............................................................................................................................ 11 Addressing ........................................................................................................................................... 11 Ping ...................................................................................................................................................... 11 Data Type ............................................................................................................................................ 12 Read/Write ........................................................................................................................................... 12 Scale Factor ......................................................................................................................................... 12 Dis, Unit, Tags ..................................................................................................................................... 13 Successfully Ping Device ........................................................................................................................ 13 Add Remaining Registers ........................................................................................................................ 13 Reference .................................................................................................................................................... 14

Upload: others

Post on 06-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 1 of 14

Modbus Contents Overview ....................................................................................................................................................... 2

Supported Protocols ...................................................................................................................................... 2

TCP/IP ....................................................................................................................................................... 2

RTU over TCP/IP ....................................................................................................................................... 2

RTU over Serial ......................................................................................................................................... 2

Enable the Modbus Extension ...................................................................................................................... 2

Add Register Maps ........................................................................................................................................ 3

Add Modbus Connectors ............................................................................................................................... 3

TCP/IP ........................................................................................................................................................... 5

Check Connector .......................................................................................................................................... 6

Create Points ................................................................................................................................................ 7

From Connector ......................................................................................................................................... 7

Has Current Value ..................................................................................................................................... 9

Has History ................................................................................................................................................ 9

Scale the Points ............................................................................................................................................ 9

Register Map Conversions ........................................................................................................................ 9

Point Conversions ..................................................................................................................................... 9

Debugging Your Connector......................................................................................................................... 10

Connectors App ....................................................................................................................................... 10

Debug App ............................................................................................................................................... 10

Developing Register Maps .......................................................................................................................... 11

Collect Documentation ............................................................................................................................ 11

Addressing ........................................................................................................................................... 11

Ping ...................................................................................................................................................... 11

Data Type ............................................................................................................................................ 12

Read/Write ........................................................................................................................................... 12

Scale Factor ......................................................................................................................................... 12

Dis, Unit, Tags ..................................................................................................................................... 13

Successfully Ping Device ........................................................................................................................ 13

Add Remaining Registers ........................................................................................................................ 13

Reference .................................................................................................................................................... 14

Page 2: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 2 of 14

Overview This document provides an overview for using the Modbus extension in InferStack. There is a more detailed document on usage of 240-245 Modbus Serial.

Supported Protocols ModbusExt supports three protocols for accessing Modbus slave devices:

TCP/IP To setup a connector to access a Modbus slave over TCP/IP, we use the modbus-tcp URI scheme:

modbusConn

uri: `modbus-tcp://host/`

modbusSlave: 1

modbusRegMapUri: `data/modbus/xxx.csv`

RTU over TCP/IP

To access the slave using serial RTU over a TCP connection, use the modbus-rtutcp scheme:

modbusConn

uri: `modbus-rtutcp://host/`

modbusSlave: 1

modbusRegMapUri: `data/modbus/xxx.csv`

RTU over Serial

Set setup Modbus RTU connector, use modbus-rtu URI scheme. The serial port must be configured

properly in your project.

modbusConn

uri: `modbus-rtu://s1`

modbusSlave: 1

modbusRegMapUri: `data/modbus/xxx.csv`

Enable the Modbus Extension Go to Settings and press Extensions. Enable the Modbus extension by pressing the darkened Enabled if it is not Green as shown below:

Page 3: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 3 of 14

Add Register Maps The Connectors app is also used to add Register Maps for Modbus. You must set up a map for each type of Modbus device.

See http://licensing.intellastar.com/doc/ext-modbus/doc#regMap for more information.

Note: Some Register Maps have been prototyped for some devices in the portal Files directory at http://licensing.intellastar.com/doc/files/index .

Note: If you change a Register Map after the Connector has been pinged, it is cached and you will need to Disable and Enable your connector to force a reload. If you make changes to the actual tag names, you will need to delete your points and re-add them.

Add Modbus Connectors Set up a connector for each Modbus device. Use Builder to add Connectors for each Modbus device.

Page 4: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 4 of 14

Press Connectors in the top menu to see the connectors in the right column.

The Plus (+) sign in the upper right lets you add Connectors.

Select Modbus for Connector type.

Page 5: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 5 of 14

Enter the fields for your device and press create:

Display Name – This is the name used to reference your device.

Modbus Register Map URI – This is a reference to the Register Map you created for this type of device. Don’t forget to enter “data/modbus/” before and “.csv” after the name you used when entering the Register Map like “data/modbus/VerisH8035.csv”.

Modbus Slave – This is the Modbus address of the device like 3.

URI – This selects which type of Modbus connectivity. Use “modbus-rtu://s1” for serial Modbus.

TCP/IP ADAM-6017.csv Modbus Register Map is on the portal Files directory at http://licensing.intellastar.com/doc/files/index and used in this example. Set up your ADAM-6017 over either Ethernet port (This example is on WAN at 192.168.1.17). We used the Advantech utility to set the IP address.

ADAM-6017

data/modbus/ADAM-6017.csv

0

modbus-tcp://192.168.1.17

Page 6: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 6 of 14

Ping to verify set up properly

Check Connector Go back to Builder, select Connectors and select your connector. Next press the pencil in the upper right to Edit the connector

Press Ping to ensure your device is connected properly.

In the upper right are icons for Tools, Point Debug Info, Enabled, Status and State for the connector. Press Close and select the Record Info.

Page 7: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 7 of 14

This will show all the properties and markers.

Create Points

From Connector

Press the right arrow to see the points that it found in your device.

Page 8: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 8 of 14

Drag one or more points in the right connector tree to the left equipment tree to add them.

When the equipment changes color, you can release the mouse to create a new point(s) there.

NOTE: Be sure to leave your points as Connected Points

Page 9: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 9 of 14

Has Current Value

Typically the Has Cur Value box will be checked.

Has History

You also probably want to check the Has History box and change the drop down from Synchronized to Collected if your Modbus device does not have history to be synchronized.

Scale the Points You can scale the points using the Register Map or Point Conversions, but Register Maps are much more efficient if they can perform your scaling.

See the reference docs at http://licensing.intellastar.com/doc/ext-modbus/doc#scale for more information on scaling in the register maps.

Register Map Conversions

You can scale using the scale column of your register map as in the example below.

Point Conversions

One simple example is to scale an input with the curConvert property. Add a property of type string named curConvert with a tag value of “* 100” (without quotes). This will multiply the value by 100.

See the point extension reference at http://licensing.intellastar.com/doc/ext-point/doc#overview . And specifically the Point Conversion Reference at http://licensing.intellastar.com/doc/ext-point/doc#convert .

Page 10: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 10 of 14

Debugging Your Connector If you have problems with your connector, there are a few places to get diagnostic information.

Connectors App

In the Connectors app, you can select your connector and press Details to see more information about how your connector is performing.

Debug App

The Log tab of the Debug app provides adjustable levels of diagnostic information.

Page 11: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 11 of 14

Developing Register Maps Developing a register map can be a very simple or complex activity based on the implementation in the device and the documentation you have on the implementation in the device. We will review the Veris H8035 example on the portal.

name, addr, data, rw, scale, dis, unit, tags

ping, 40001, u2, r, , , ,

kwhlsw, 40001, u2, r, /128, kWhlsw, kWh,

kwhmsw, 40002, u2, r, *512, kWhmsw, kWh,

kw, 40003, u2, r, /250, KW, kW, power

kwhfl, 40257, f4, r, , kWh fl, kWh, energy

kwhfl2, 40259, f4, r, , kWh fl2, kWh, energy

kwfl, 40261, f4, r, , kW fl, kW, power

Collect Documentation

You will need to know how the device communicates (IP address or serial address and speed). In addition you need to know the register addresses, data types and scaling information.

Addressing

Register address are defined with addr column and specified using Modbus convention:

0xxxx Coil 00001-09999

1xxxx Discrete Input 10001-19999

3xxxx Input Register 30001-39999

4xxxx Holding Regiter 40001-49999

Ping A valid ping register is required in order to test connectivity to slave.

Page 12: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 12 of 14

Data Type The data column specifies how register data is modeled.

bit Bool

u1 Unsigned 8-bit Int

u2 Unsigned 16-bit Int

u4 Unsigned 32-bit Int

s1 Signed 8-bit Int

s2 Signed 16-bit Int

s4 Signed 32-bit Int

s8 Signed 64-bit Int

f4 32-bit Float

f8 64-bit Float

Bit Mask

The bit data type supports a position notation for cases where bits are packed into input or holding

registers:

name, addr, data, rw

do0, 40101, bit:0, rw

do1, 40101, bit:1, rw

do2, 40101, bit:2, rw

Word and Byte Order

If register data is not stored in network byte order, you can specify the order using a suffix:

u2le Unsigned 16-bit Int Little endian byte and word order

u2leb Unsigned 16-bit Int Little endian byte order only

u2lew Unsigned 16-bit Int Little endian word order only

Read/Write Read and write permissions are configured using rw column:

rw Register may be read and written

r Register is read-only

w Register is write-only

Scale Factor An optional scale factor can be applied to registers using scale column. The scale format is [op] [num

| name] where the factor may be a numeric constant, or a reference to another register name. If a

reference name is used, that register content will be used as the scale factor.

add: +1.5

minus: -0.25

mult: *10

div: /1000

ref mult: *ai0Scale

ref div: /ai1Scale

Page 13: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 13 of 14

Dis, Unit, Tags The dis, unit, and tags column allow optional pre-configuration for the point during the learn process:

name, addr, data, rw, dis, unit, tags

ai1, 40002, u2, r, AI-1, kW, power foo bar

Successfully Ping Device

You need to select a register that is always available. We often create a register map with only the header and ping line to verify that we can communicate with the device.

name, addr, data, rw, scale, dis, unit, tags

ping, 40001, u2, r, , , ,

Next, add a connector for your device and ping it to verify that it communicates properly. Go to Connectors app and press New.

Name your connector, enter uri, modbusSlave and modbusRegMapUri. Select your connector and press Ping to verify that connStatus becomes open and connStatus becomes ok.

Add Remaining Registers

Now go back and add the rest of the registers to the register map. Once complete, Disable and enable the Connector to load the new Register Map. Now you can go to Builder app and add points as described in create Points.

Page 14: Modbusintellastar.com/.../user-guides/inferstack/Modbus.pdf · 2019-07-28 · Modbus- 3/3/2016 – Page 2 of 14 Overview This document provides an overview for using the Modbus extension

Modbus- 3/3/2016 – Page 14 of 14

Reference There are a number of references available on your device or server. In the Help app, scroll down to Extensions and select from these:

conn – Connector Extension Framework

equip – Equipment Extension

his – Historian Extension

point – Point Extension

Online docs are available at http://licensing.intellastar.com/doc/ .