Difference between revisions of "Modbus Handler v1.0"

From ESS-WIKI
Jump to: navigation, search
 
(16 intermediate revisions by one other user not shown)
Line 13: Line 13:
 
= <span style="font-size:x-large;">Configuration</span> =
 
= <span style="font-size:x-large;">Configuration</span> =
  
<span style="font-size:large;">1. Open File Explorer and change target folder to the Modbus Handler&nbsp;installation folder.</span>
+
<span style="font-size:large;">1. Open File Explorer and change target folder to the RMM Agent installation folder.&nbsp;</span>
  
<span style="font-size:large;">2. Open and edit the file Mobus_Handler.ini</span>
+
<span style="font-size:large;">2. Open and edit the file \module\module_config.xml to enable Modbus Handler</span>
  
<span style="font-size:large;">2.1 Give a Name for the platform.</span>
+
<span style="font-size:large;">&nbsp; &nbsp;(by default, the path is C:\Program Files (x86)\Advantech\RMM 3.3 Agent\module\module_config.xml)</span>
  
<span style="font-size:large;">2.2 Set the Protocol.</span>
 
  
  
 +
<span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size:larger;">&lt;ModuleName17&gt;Modbus_Handler&lt;/ModuleName17&gt;<br/></span></span>
 +
 +
<span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size:larger;">&lt;ModulePath17&gt;\module\Modbus_Handler.dll&lt;/ModulePath17&gt; <br/></span></span>
 +
 +
<span style="font-family:lucida sans unicode,lucida grande,sans-serif;"><span style="font-size:larger;">&lt;ModuleEnable17&gt;'''TRUE'''&lt;/ModuleEnable17&gt;</span></span>
 +
 +
 +
 +
 +
 +
<span style="font-size:large;">3. Open and edit the file Mobus_Handler.ini</span>
 +
 +
<span style="font-size:large;">&nbsp; &nbsp; (by default, the path is C:\Program Files (x86)\Advantech\RMM 3.3 Agent\Mobus_Handler.ini)</span>
 +
 +
<span style="font-size:large;">3.1 Give a name for the filed "Name" in the [Platform] session.</span>
 +
 +
<span style="font-size:large;">3.2 Set the protocol for the field "Protocol" in the [Platform] session, you can config to the type of Modbus_TCP or Modbus_RTU follow below example:</span>
  
 
<span style="font-size:larger;">'''<u>Config for the modbus TCP devices:</u>'''</span>
 
<span style="font-size:larger;">'''<u>Config for the modbus TCP devices:</u>'''</span>
Line 32: Line 48:
  
 
'''<span style="font-size:larger;">Example:</span>'''
 
'''<span style="font-size:larger;">Example:</span>'''
 +
 +
 
<pre>[Platform]
 
<pre>[Platform]
 
Name=WISE-4012E
 
Name=WISE-4012E
Line 46: Line 64:
 
Log=0
 
Log=0
 
</pre>
 
</pre>
 +
 +
  
  
Line 86: Line 106:
  
  
<span style="font-size:large;">2.3&nbsp;Set Modbus devices detail configuration.</span>
+
<span style="font-size:large;">3.3&nbsp;Set Modbus bits&nbsp;data and registers.</span>
  
 
'''<span style="font-size:larger;">Example for Coils:</span>'''
 
'''<span style="font-size:larger;">Example for Coils:</span>'''
Line 105: Line 125:
 
IB2=2,Switch2</pre>
 
IB2=2,Switch2</pre>
  
= <span style="font-size:x-large;">EdgeSense Linux Docker version</span> =
+
= <span style="font-size:x-large;">EdgeSense Linux&nbsp;</span> =
  
=== '''How to config&nbsp;Modbus Service and Restart Service''' ===
+
== How to config&nbsp;Modbus Service and Restart Service - Docker version ==
 
<pre>$cd ${Installed path}/Installer/packages/Plugins/docker-edgesense-image-x86/EdgeSense/EService-Modbus/config
 
<pre>$cd ${Installed path}/Installer/packages/Plugins/docker-edgesense-image-x86/EdgeSense/EService-Modbus/config
 
$sudo vim Modbus_Handler.ini
 
$sudo vim Modbus_Handler.ini
$sudo docker restart service-modbus
+
$sudo docker restart service-modbus</pre>
</pre>
 
  
 +
== How to install and config Modbus Service&nbsp;- Native application&nbsp; ==
  
 +
'''Install'''
 +
<pre>$tar zxvf Modbus_Handler-1.0.2-Ubuntu_16.04-x86_64.tar.gz
 +
$sudo ./Modbus_Handler-1.0.2-Ubuntu_16.04-x86_64.run</pre>
  
= Application Case =
+
'''Configuration & restart service'''
 
+
<pre>$cd /usr/local/EdgeSense/Modbus_Handler
'''<span style="font-size:large;">ADAM-4117 8-channel Analog Input Module</span>'''
+
$sudo vim Modbus_Handler.ini
 
+
$sudo systemctl restart Modbus_Handler</pre>
<span style="font-size:larger;">1. H.W. Environment & Configuration</span>
 
 
 
 
 
 
 
<span style="font-size:larger;">[[File:Adam-4117-01.png|600x560px|Adam-4117-01.png]]</span>
 
 
 
 
 
 
 
<span style="font-size:larger;">2. Setup&nbsp;Modbus register from ADAM utility: AdamApax .NET Utility</span>
 
 
 
<span style="font-size:larger;">2.1 Download&nbsp;AdamApax .NET Utility from URL [http://support.advantech.com/Support/DownloadSRDetail_New.aspx?SR_ID=1-2AKUDB&Doc_Source=Download http://support.advantech.com/Support/DownloadSRDetail_New.aspx?SR_ID=1-2AKUDB&Doc_Source=Download] and install it to your Gateway.</span>
 
 
 
<span style="font-size:larger;">2.2 Launch&nbsp;AdamApax .NET Utility,&nbsp;select COM port which ADAM module is connected, right click on the COM port you selected and click "Search Device" to detect your ADAM-4117.</span>
 
 
 
 
 
 
 
[[File:Adam-4117-04.png|680x500px|Adam-4117-04.png]]
 
 
 
 
 
 
 
<span style="font-size:larger;">2.3 After ADAM-4117 appeared, click on it to check its settings or change the default settings for your H.W. configuration.</span>
 
 
 
[[File:Adam-4117-06.png|680x500px|Adam-4117-06.png]]
 
 
 
 
 
 
 
[[File:Adam-4117-07.png|680x500px|Adam-4117-07.png]]
 
 
 
 
 
 
 
[[File:Adam-4117-08.png|680x500px|Adam-4117-08.png]]
 
 
 
 
 
 
 
<span style="font-size:larger;">2.4&nbsp;Provide a stable 12V voltage power to Vin0.</span>
 
 
 
[[File:Adam-4117-10.jpg|600x600px|Adam-4117-10.jpg]]
 
 
 
 
 
 
 
<span style="font-size:larger;">2.5&nbsp;Check the value of Channel 0 from AdamApax .NET Utility, the value of Vin0 is 12.108V.</span>
 
 
 
[[File:Adam-4117-11.png|680x500px|Adam-4117-11.png]]
 
 
 
 
 
 
 
<span style="font-size:larger;">2.6&nbsp;Check the value of Modbus Location 40001 from AdamApax .NET Utility, the value is 52900. ( 12.108 / 15 * 65536 = 52900.66 )</span>
 
 
 
[[File:Adam-4117-12.png|680x500px|Adam-4117-12.png]]
 
 
 
 
 
 
 
<span style="font-size:larger;">3. Gateway Modbus_Handler configuration</span>
 
 
 
<span style="font-size:larger;">3.1 Edit Modbus_Handler.ini for the ADAM's configuration.</span>
 
<pre>[Platform]
 
Interval=1
 
#Interval: The time delay between two modbus access round in second.&nbsp;
 
Delay=0
 
#Delay: The time delay between two modbus access in millisecond.
 
#Delay=0 means no delay.
 
Log=0
 
 
 
Name=ADAM-4117
 
Protocol=Modbus_RTU
 
SlavePort=COM1
 
Baud=9600
 
Parity=None
 
DataBits=8
 
StopBits=1
 
SlaveID=1
 
</pre>
 
 
 
<span style="font-size:larger;">3.2 Edit Modbus_Handler.ini for ADAM-4117 modbus location configuration.</span>
 
<pre>[Holding Registers]
 
numberOfR=3
 
R0=0,Vin0,0,65535,1,V,0,""
 
R1=1,Vin1,0,65535,1,V,0,""
 
R2=2,Vin2,0,65535,1,V,0,""
 
 
 
;tag = offset, name, min, max, precision, unit, data type, lua script
 
 
 
;tag&nbsp;&nbsp; &nbsp;Base Address
 
;B&nbsp;&nbsp; &nbsp;00001-->Coils
 
;IB&nbsp;&nbsp; &nbsp;10001-->Discrete Inputs
 
;IR&nbsp;&nbsp; &nbsp;30001-->Input Registers
 
;R&nbsp;&nbsp; &nbsp;40001-->Holding Registers
 
 
 
;data type
 
;0->16-bit operation
 
;1->32-bit float no swap
 
;2->32-bit float byte and word swap
 
;3->32-bit float byte swap
 
;4->32-bit float word swap
 
;5->32-bit unsigned int no swap
 
;6->32-bit unsigned int word swap
 
;7->32-bit signed int no swap
 
;8->32-bit signed int word swap
 
 
 
</pre>
 
 
 
 
 
 
 
<span style="font-size:larger;">3.2 Restart WISE Agent service from Task Manager, login RMM 3.3 to check the values that ADAM-4117 and Gateway uploaded.</span>
 
 
 
<span style="font-size:larger;">[[File:Adam-4117-13.png|800x600px|Adam-4117-13.png]]</span>
 
 
 
 
 
 
 
<span style="font-size:larger;">3.3&nbsp;Use Lua convert function to transfer modbus value to voltage value, open&nbsp;Modbus_Device0.ini and give Vin0~Vin2 Lua scripts&nbsp;as "modbus_val*15/65536".</span>
 
<pre>[Holding Registers]
 
numberOfR=3
 
R0=0,Vin0,0,15,1,V,0,"modbus_val*15/65536"
 
R1=1,Vin1,0,15,1,V,0,"modbus_val*15/65536"
 
R2=2,Vin2,0,15,1,V,0,"modbus_val*15/65536"
 
 
 
;tag = offset, name, min, max, precision, unit, data type, lua script
 
 
 
</pre>
 
 
 
 
 
  
<span style="font-size:larger;">3.4 Login RMM 3.3 again to check the values that ADAM-4117 and Gateway uploaded, the value is already converted to voltage value.</span>
+
= Real Application Case =
  
<span style="font-size:larger;">[[File:Adam-4117-14.png|800x600px|Adam-4117-14.png]]</span>
+
[[Real_Application_Case|Real Application Case: ADAM-4117]]

Latest revision as of 07:33, 11 February 2019

Introduction

Modbus enables communication among many devices connected to the same network, for example, a system that measures temperature and humidity and communicates the results to a computer. Modbus is often used to connect a supervisory computer with a remote terminal unit (RTU) in supervisory control and data acquisition (SCADA) systems.

Many of the data types are named from its use in driving relays: a single-bit physical output is called a coil, and a single-bit physical input is called a discrete input or a contact.

Modbus Service is a Windows/Linux system service for WISE Agent to read sensor data from Modbus device or write data into Modbus device. After sensor ata are acquired, WISE Agent will upload the data to the WISE-PaaS Cloud.



Configuration

1. Open File Explorer and change target folder to the RMM Agent installation folder. 

2. Open and edit the file \module\module_config.xml to enable Modbus Handler

   (by default, the path is C:\Program Files (x86)\Advantech\RMM 3.3 Agent\module\module_config.xml)


<ModuleName17>Modbus_Handler</ModuleName17>

<ModulePath17>\module\Modbus_Handler.dll</ModulePath17>

<ModuleEnable17>TRUE</ModuleEnable17>



3. Open and edit the file Mobus_Handler.ini

    (by default, the path is C:\Program Files (x86)\Advantech\RMM 3.3 Agent\Mobus_Handler.ini)

3.1 Give a name for the filed "Name" in the [Platform] session.

3.2 Set the protocol for the field "Protocol" in the [Platform] session, you can config to the type of Modbus_TCP or Modbus_RTU follow below example:

Config for the modbus TCP devices:

Protocol=Modbus_TCP

ClientIP=(IP address of Modbus TCP devices)

ClientPort=(Port of Modbus TCP devices)  

Example:


[Platform]
Name=WISE-4012E
Protocol=Modbus_TCP
ClientIP=127.0.0.1
ClientPort=502
UnitID=1

Interval=3
#Interval: The time delay between two modbus access round in second.
Delay=0
#Delay: The time delay between two modbus access in millisecond.
#Delay=0 means no delay.
Log=0



Config for the modbus RTU devices:

Protocol=Modbus_RTU

SlavePort=(The serial port's device node of the Gateway which connect to Modbus RTU devices)

Baud=(The baud rate for the serial port to communicate with Modbus RTU device)

Parity=(The parity of the serial port)

DataBits=(The data bits of the serial port)              

StopBits=(The stop bits of the serial port) 


Example:

[Platform]
Name=EKI-XXXX
Protocol=Modbus_RTU
SlavePort=COM1
Baud=19200
Parity=None
DataBits=8
StopBits=1
SlaveID=1

Interval=3
#Interval: The time delay between two modbus access round in second.
Delay=0
#Delay: The time delay between two modbus access in millisecond.
#Delay=0 means no delay.
Log=0


3.3 Set Modbus bits data and registers.

Example for Coils:

[Coils]
numberOfB=3
B0=0,LED0
B1=1,LED1
B2=2,LED2


Example for Discrete Inputs:

[Discrete Inputs]
numberOfIB=3
IB0=0,Switch0
IB1=1,Switch1
IB2=2,Switch2

EdgeSense Linux 

How to config Modbus Service and Restart Service - Docker version

$cd ${Installed path}/Installer/packages/Plugins/docker-edgesense-image-x86/EdgeSense/EService-Modbus/config
$sudo vim Modbus_Handler.ini
$sudo docker restart service-modbus

How to install and config Modbus Service - Native application 

Install

$tar zxvf Modbus_Handler-1.0.2-Ubuntu_16.04-x86_64.tar.gz
$sudo ./Modbus_Handler-1.0.2-Ubuntu_16.04-x86_64.run

Configuration & restart service

$cd /usr/local/EdgeSense/Modbus_Handler
$sudo vim Modbus_Handler.ini
$sudo systemctl restart Modbus_Handler

Real Application Case

Real Application Case: ADAM-4117