Difference between revisions of "Modbus TCP Client CSV Files"

From Control Solutions IoTServer Documentation
Jump to navigation Jump to search
Line 37: Line 37:
  
 
NOTE: A Modbus CSV file may contain both client and server sections as the respective functionality will select sections relevant to its purpose. It should also be noted that the same application, csiModbusEngine, can function as both client and server (master and slave).
 
NOTE: A Modbus CSV file may contain both client and server sections as the respective functionality will select sections relevant to its purpose. It should also be noted that the same application, csiModbusEngine, can function as both client and server (master and slave).
 +
 +
== MODBUS Client CSV Example ==
 +
 +
The following illustrates a valid Modbus TCP Client CSV configuration file. The DEVICES, READMAPS, and WRITEMAPS sections of a CSV file will be processed when the Modbus Engine is operating as a Client. Server sections (see later section) will only be processed by an instance of a Modbus Server, and the server will skip over the Client sections illustrated here.
 +
 +
A valid Modbus RTU Client (Master) CSV configuration file would look largely the same, except there is no DEVICES section in a Modbus RTU client. The other minor variation is that “Device,Unit” in the read/write maps are replaced with “Slave”.
 +
 +
Begin,Modbus,Devices<br>
 +
Number,RemoteIP,Port,PollTime,Timeout,Name<br>
 +
1,192.168.1.135,502,2,2,SPX<br>
 +
End<br>
 +
Begin,Modbus,ReadMaps<br>
 +
Device,RegType,RegAddr,RegFormat,RegSize,DestObj,PollTime<br>
 +
1,Hold,0,Int,1,1,5<br>
 +
1,Hold,1,Int,1,2,5<br>
 +
1,Hold,2,Int,1,3,5<br>
 +
End<br>
 +
Begin,Modbus,WriteMaps<br>
 +
SourceObj,Device,RegType,RegAddr,RegFormat,RegSize,PollTime<br>
 +
4,1,Hold,3,Int,1,10<br>
 +
5,1,Hold,4,Int,1,10<br>
 +
End

Revision as of 14:56, 9 April 2019

Modbus TCP Client CSV Files

A CSV file may be imported to configure various aspects of the IoTServer (or Babel Buster gateway). A single CSV file may contain multiple sections. When a file including an “Objects” section is imported by the Data Engine, local objects will be configured. When a file including one or more “Modbus” sections is imported by an instance of the Modbus Engine, Modbus gateway functionality will be configured. The same Modbus file may be imported by a Modbus Client or Modbus Server, and either RTU or TCP, and only those sections of interest to that Modbus function will be imported. The CSV file may also contain one or more SNMP sections, and so forth.

A section begins when the word “Begin” appears in the first column of a line. All lines up to and including a line that begins with the word “End” will be taken to be part of that section.

The line immediately following the “Begin” line must be a header line. A Header line is one which labels the columns of data that will follow the Header line.

All lines following the Header line are data lines that are expected to contain the same number of columns as the Header line, and whose contents are defined by the labels found in each column of the Header line.

Labels in the section Begin and End lines, and labels in the Header line are NOT case sensitive and will be interpreted equally whether upper case, lower case, or some combination of both (for readability).

Labels may NOT contain embedded spaces. A label is terminated by a comma, line-end, or space. Labels may not be encapsulated in quote characters; however, data content in data lines may be encapsulated in quote characters and may contain embedded spaces or blanks if quoted.

Some labels in the Header line may be considered optional. The minimum required columns are indicated in the definition of each data section.

Columns in the Header line do not have to follow any particular order. They may be rearranged to the user’s liking. The only restriction is that data in subsequent data lines must match up with the labels placed in the Header line. Data lines may contain fewer columns than the Header line, but may not contain more. Data columns that the user wishes to deliberately omit, but omit between included columns, should be indicated by place holder commas (which will simply appear as blank cells in a spread sheet program).

A Begin line will contain three columns:
Column 1: BEGIN
Column 2: Function as noted below
Column 3: Sub-function as noted in definition of the Function.

Functions may be any of the following (with this listed expanded from time to time):

  • LOCALDATA
  • MODBUS
  • SNMP

Sub-functions:

MODBUS

  • DEVICES
  • READMAPS
  • WRITEMAPS
  • SERVERMAPS
  • SERVERREMAPS

NOTE: A Modbus CSV file may contain both client and server sections as the respective functionality will select sections relevant to its purpose. It should also be noted that the same application, csiModbusEngine, can function as both client and server (master and slave).

MODBUS Client CSV Example

The following illustrates a valid Modbus TCP Client CSV configuration file. The DEVICES, READMAPS, and WRITEMAPS sections of a CSV file will be processed when the Modbus Engine is operating as a Client. Server sections (see later section) will only be processed by an instance of a Modbus Server, and the server will skip over the Client sections illustrated here.

A valid Modbus RTU Client (Master) CSV configuration file would look largely the same, except there is no DEVICES section in a Modbus RTU client. The other minor variation is that “Device,Unit” in the read/write maps are replaced with “Slave”.

Begin,Modbus,Devices
Number,RemoteIP,Port,PollTime,Timeout,Name
1,192.168.1.135,502,2,2,SPX
End
Begin,Modbus,ReadMaps
Device,RegType,RegAddr,RegFormat,RegSize,DestObj,PollTime
1,Hold,0,Int,1,1,5
1,Hold,1,Int,1,2,5
1,Hold,2,Int,1,3,5
End
Begin,Modbus,WriteMaps
SourceObj,Device,RegType,RegAddr,RegFormat,RegSize,PollTime
4,1,Hold,3,Int,1,10
5,1,Hold,4,Int,1,10
End