Difference between revisions of "Modbus Service"

From ESS-WIKI
Jump to: navigation, search
Line 224: Line 224:
 
<span style="font-size:larger;">[[File:Adam-4117-01.png|600x560px|Adam-4117-01.png]]</span>
 
<span style="font-size:larger;">[[File:Adam-4117-01.png|600x560px|Adam-4117-01.png]]</span>
  
<span style="font-size:larger;"></span>
+
 
  
  
Line 230: Line 230:
 
<span style="font-size:larger;">2. Setup&nbsp;Modbus register from ADAM utility: AdamApax .NET Utility</span>
 
<span style="font-size:larger;">2. Setup&nbsp;Modbus register from ADAM utility: AdamApax .NET Utility</span>
  
<span style="font-size:larger;">* 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.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>
  
<span style="font-size:larger;">* 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>
 
  
<span style="font-size:larger;"></span>
 
  
 
[[File:Adam-4117-04.png|680x500px|Adam-4117-04.png]]
 
[[File:Adam-4117-04.png|680x500px|Adam-4117-04.png]]
Line 242: Line 242:
  
  
<span style="font-size:larger;">* After ADAM-4117 appeared, click on it to check its settings or change the default settings for your H.W. configuration.</span>
+
<span style="font-size:larger;"></span>
 +
 
 +
<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-06.png|680x500px|Adam-4117-06.png]]
Line 256: Line 258:
  
  
'''<span style="font-size:larger;">3. Gateway Modbus_Handler configuration</span>'''
 
  
'''<span style="font-size:larger;">** Modbus_Handler.ini</span>'''
+
 
 +
<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]
 
<pre>[Platform]
#Name=WISE-4012E
 
#Protocol=Modbus_TCP
 
#ClientIP=127.0.0.1
 
#ClientPort=502
 
 
 
Interval=1
 
Interval=1
 
#Interval: The time delay between two modbus access round in second.&nbsp;
 
#Interval: The time delay between two modbus access round in second.&nbsp;
Line 272: Line 271:
 
Log=0
 
Log=0
  
Name=ADAM-41XX
+
Name=ADAM-4117
 
Protocol=Modbus_RTU
 
Protocol=Modbus_RTU
 
SlavePort=COM1
 
SlavePort=COM1
Line 283: Line 282:
 
numberOfDevices=1
 
numberOfDevices=1
 
Device0=Modbus_Device0.ini
 
Device0=Modbus_Device0.ini
#Device1=Modbus_Device1.ini
 
  
 
#DeviceN: Modbus device files with detail register address mapping&nbsp;
 
#DeviceN: Modbus device files with detail register address mapping&nbsp;
 
</pre>
 
</pre>
  
 +
'''<span style="font-size:larger;"></span>'''
  
'''<span style="font-size:larger;"></span>'''
+
<span style="font-size:larger;">3.2 Edit Modbus_Device0.ini for ADAM-4117 modbus location configuration.</span>
'''<span style="font-size:larger;">** Modbus_Device0.ini</span>'''
 
 
<pre>[DeviceInfo]
 
<pre>[DeviceInfo]
 
# For Modbus_TCP
 
# For Modbus_TCP
Line 296: Line 294:
 
# For Modbus_RTU
 
# For Modbus_RTU
 
SlaveID=1
 
SlaveID=1
 
#[Discrete Inputs]
 
#numberOfIB=3
 
#IB0=0,Switch0
 
#IB1=1,Switch1
 
#IB2=2,Switch2
 
 
#[Coils]
 
#numberOfB=3
 
#B0=0,LED0
 
#B1=1,LED1
 
#B2=2,LED2
 
 
#[Input Registers]
 
#numberOfIR=3
 
#IR0=0,Data0,-1000000,1000000,1,V,0,""
 
#IR1=1,Data1,-1000000,1000000,1,V,0,""
 
#IR2=2,Data2,-1000000,1000000,1,V,0,""
 
  
 
[Holding Registers]
 
[Holding Registers]
 
numberOfR=3
 
numberOfR=3
R0=0,Data0,-1000000,1000000,1,V,0,""
+
R0=0,Vin0,-10,10,1,V,0,""
R1=1,Data1,-1000000,1000000,1,V,0,""
+
R1=1,Vin1,-10,10,1,V,0,""
R2=2,Data2,-1000000,1000000,1,V,0,""
+
R2=2,Vin2,-10,10,1,V,0,""
 
 
#[Holding Registers]
 
#numberOfR=2
 
#R0=0,Voltage0,0,5,0.001,V,0,"modbus_val*2-10"
 
#R1=1,Voltage1,0,5,0.001,V,0,"math.pow(modbus_val,1/2)+10-2.5"
 
  
 
;tag = offset, name, min, max, precision, unit, data type, lua script
 
;tag = offset, name, min, max, precision, unit, data type, lua script
Line 346: Line 321:
  
 
</pre>
 
</pre>
 +
 +
 +
 +
<span style="font-size:larger;">3.2 Restart Agent_Modbus_Handler from Task Manager, login RMM 3.3 to check the values that ADAM-4117 and Gateway uploaded.</span>

Revision as of 08:15, 10 May 2018

Release

Agent_Modbus_Handler-2.0.0-rc1

Installation

1. Double click Agent_Modbus_Handler_2.0.0.exe to start installation.

2. Click "Next" on the Welcome screen.

Agent modbus handler 02.png



3. Select Installation Folder and then click "Next" to continue.

Agent modbus handler 03.png



4. Click "Install" on the Ready to Install screen to continue.

Agent modbus handler 04.png


5. Installation completed, click "Finish" button to exit the Setup Wizard.

Agent modbus handler 06.png


Configuration

1. Open File Explorer and change target folder to the Modbus Service installation folder.

2. Open and edit the file Mobus_Handler.ini

2.1 Give a Name for the platform.

2.2 Set the Protocol.

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

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



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 of the serial port)

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

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



2.3 Set the number of modbus devices and device detail information file.

Device0 Example:

[DeviceInfo]
Name=Modbus_Device0

# For Modbus_TCP
UnitID=1

# For Modbus_RTU
#SlaveID=1

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



Device1 Example:

[DeviceInfo]
Name=Modbus_Device1

# For Modbus_TCP
UnitID=2

# For Modbus_RTU
#SlaveID=2

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



EdgeSense Linux Docker version

How to config Modbus Service and Restart Service

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




JSON Format for upload data

{
   "Modbus_Handler":{
      "Platform":{
         "bn":"Platform",
         "e":[{"n":"Version","sv":"2.0.0"},
              {"n":"Description","sv":"This service is Modbus Service"},
              {"n":"Protocol","sv":"Modbus_TCP"},
              {"n":"Name","sv":"WISE-4012E"},
              {"n":"ClientIP","sv":"127.0.0.1"},
              {"n":"ClientPort","sv":"502"},
              {"n":"Connection","bv":true}]
      },
      "Modbus_Device0":{
         "bn":"Modbus_Device0",
         "e":[{"n":"UnitID","sv":"1"}],
         "Coils":{
            "bn":"Coils",
            "e":[{"n":"LED0","bv":true},
                 {"n":"LED1","bv":true},
                 {"n":"LED2","bv":false}]
         }
      },
      "Modbus_Device1":{
         "bn":"Modbus_Device1",
         "e":[{"n":"UnitID","sv":"2"}],
         "Discrete Inputs":{
            "bn":"Discrete Inputs",
            "e":[{"n":"Switch0","bv":false},
                 {"n":"Switch1","bv":true},
                 {"n":"Switch2","bv":false}]
         }
      }
   }
}





Application Case

ADAM-4117 8-channel Analog Input Module

1. H.W. Environment & Configuration


Adam-4117-01.png



2. Setup Modbus register from ADAM utility: AdamApax .NET Utility

2.1 Download AdamApax .NET Utility from URL http://support.advantech.com/Support/DownloadSRDetail_New.aspx?SR_ID=1-2AKUDB&Doc_Source=Download and install it to your Gateway.

2.2 Launch AdamApax .NET Utility, 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.


Adam-4117-04.png



2.3 After ADAM-4117 appeared, click on it to check its settings or change the default settings for your H.W. configuration.

Adam-4117-06.png


Adam-4117-07.png


Adam-4117-08.png



3. Gateway Modbus_Handler configuration

3.1 Edit Modbus_Handler.ini for the ADAM's configuration.

[Platform]
Interval=1
#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

Name=ADAM-4117
Protocol=Modbus_RTU
SlavePort=COM1
Baud=9600
Parity=None
DataBits=8
StopBits=1

[Devices]
numberOfDevices=1
Device0=Modbus_Device0.ini

#DeviceN: Modbus device files with detail register address mapping 

3.2 Edit Modbus_Device0.ini for ADAM-4117 modbus location configuration.

[DeviceInfo]
# For Modbus_TCP
#UnitID=1
# For Modbus_RTU
SlaveID=1

[Holding Registers]
numberOfR=3
R0=0,Vin0,-10,10,1,V,0,""
R1=1,Vin1,-10,10,1,V,0,""
R2=2,Vin2,-10,10,1,V,0,""

;tag = offset, name, min, max, precision, unit, data type, lua script

;tag    Base Address
;B    00001-->Coils
;IB    10001-->Discrete Inputs
;IR    30001-->Input Registers
;R    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


3.2 Restart Agent_Modbus_Handler from Task Manager, login RMM 3.3 to check the values that ADAM-4117 and Gateway uploaded.