Difference between revisions of "Modbus Master"

From ESS-WIKI
Jump to: navigation, search
Line 51: Line 51:
  
 
<span style="font-size:medium;">1. Device Configuration: &lt;Install_folder&gt;\config\industry\device-industry.yaml</span>
 
<span style="font-size:medium;">1. Device Configuration: &lt;Install_folder&gt;\config\industry\device-industry.yaml</span>
<pre>metadata:  
+
<pre>metadata:&nbsp;
  name: "Modbus devices"
+
&nbsp; name: "Modbus devices"
  labels: ["Modbus"]  
+
&nbsp; labels: ["Modbus"]&nbsp;
  Description: "Modbus TCP/RTU devices with 3 sensors in holding register area 40001~40003"
+
&nbsp; Description: "Modbus TCP/RTU devices with 3 sensors in holding register area 40001~40003"
  UpdateData: 2020-01-08-14:25:30
+
&nbsp; UpdateData: 2020-01-08-14:25:30
  
# DeviceInfo: You can add a new device with unique name
+
# LinkInfo: You can add a new link with unique name
# <DeviceName>: Unique Device Name
+
&nbsp; # <LinkName>: Unique Link Name
  # Params:
+
&nbsp; &nbsp; # Params: Serial Port or Network parameters
 +
&nbsp; &nbsp; # Info: Time interval of polling data & check link&nbsp;
 +
&nbsp; &nbsp; # DevList: Device list which defined in DeviceInfo section
 +
 
 +
LinkInfo:&nbsp;
 +
&nbsp; TCP-IP-1:
 +
&nbsp; &nbsp; Params:&nbsp;
 +
&nbsp; &nbsp; &nbsp; Driver: Modbus-TCP
 +
&nbsp; &nbsp; &nbsp; ConnectType: Net
 +
&nbsp; &nbsp; &nbsp; IP: 127.0.0.1
 +
&nbsp; &nbsp; &nbsp; Port: 502
 +
&nbsp; &nbsp; &nbsp; Timeout: 1000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# A request timeout in milliseconds
 +
&nbsp; &nbsp;
 +
&nbsp; &nbsp; Info:&nbsp;
 +
&nbsp; &nbsp; &nbsp; PollingInterval: 3000 &nbsp;# Polling interval in milliseconds
 +
&nbsp; &nbsp; &nbsp; Retry: 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Count of retry min:0 max:3
 +
&nbsp; &nbsp; &nbsp; AliveTime: 10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
 +
&nbsp; &nbsp; &nbsp; CheckLinkInterval: 2 &nbsp; # Check link status interval (second)
  
LinkInfo:  
+
&nbsp; &nbsp; DevList:
  COM1:
+
&nbsp; &nbsp; &nbsp; - Device-1
    Params:
 
      Driver: Modbus-RTU
 
      ConnectType: Serial
 
      PortName: COM1
 
      BaudRate: 9600
 
      DataBits: 8
 
      StopBits: 1
 
      Parity: None
 
   
 
    Info:
 
      PollingInterval: 1000  # Polling interval ( milliseconds )
 
      Timeout: 100          # A request timeout ( milliseconds )
 
      Retry: 3              # Retries min:0 max:3 ( count )
 
      AliveTime: 60          # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
 
      CheckLinkInterval: 5  # Check link status interval (second)
 
  
    DevList:  
+
&nbsp; COM1:
      - Device-1
+
&nbsp; &nbsp; Params:
 +
&nbsp; &nbsp; &nbsp; Driver: Modbus-RTU
 +
&nbsp; &nbsp; &nbsp; ConnectType: Serial
 +
&nbsp; &nbsp; &nbsp; PortName: COM1
 +
&nbsp; &nbsp; &nbsp; BaudRate: 9600
 +
&nbsp; &nbsp; &nbsp; DataBits: 8
 +
&nbsp; &nbsp; &nbsp; StopBits: 1
 +
&nbsp; &nbsp; &nbsp; Parity: None
 +
&nbsp; &nbsp; &nbsp; Timeout: 1000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# A request timeout in milliseconds
 +
&nbsp; &nbsp;&nbsp;
 +
&nbsp; &nbsp; Info:&nbsp;
 +
&nbsp; &nbsp; &nbsp; PollingInterval: 3000 &nbsp;# Polling interval in milliseconds&nbsp;
 +
&nbsp; &nbsp; &nbsp; Retry: 3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Count of retry min:0 max:3
 +
&nbsp; &nbsp; &nbsp; AliveTime: 10 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
 +
&nbsp; &nbsp; &nbsp; CheckLinkInterval: 2 &nbsp; # Check link status interval (second)
  
  TCP-IP-1:
+
&nbsp; &nbsp; DevList:&nbsp;
    Params:
+
&nbsp; &nbsp; &nbsp; - Device-2
      Driver: Modbus-TCP
 
      ConnectType: Net
 
      IP: 127.0.0.1
 
      Port: 502
 
 
 
    Info:
 
      PollingInterval: 1000  # Polling interval in milliseconds
 
      Timeout: 100          # A request timeout in milliseconds
 
      Retry: 3              # Count of retry min:0 max:3 
 
      AliveTime: 60          # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
 
      CheckLinkInterval: 5  # Check link status interval (second)
 
  
    DevList:
 
      - Device-2
 
  
 +
# DeviceInfo: You can add a new device with unique name
 +
&nbsp; # <DeviceName>: Unique Device Name
 +
&nbsp; &nbsp; # Params: Station number
 +
&nbsp; &nbsp; # Profile: Profile file name
  
 
DeviceInfo:
 
DeviceInfo:
Device-1:  
+
&nbsp; Device-1:
  Params:  
+
&nbsp; &nbsp; Params:&nbsp;
    Station: 1
+
&nbsp; &nbsp; &nbsp; Station: 1
 
 
  Profile: MODBUS_DEVICE_01.yaml
 
  
Device-2:
+
&nbsp; &nbsp; Profile: MODBUS_DEVICE_01.yaml
  Params:
 
    Station: 2
 
  
  Profile: MODBUS_DEVICE_02.yaml
+
&nbsp; Device-2:
 +
&nbsp; &nbsp; Params:
 +
&nbsp; &nbsp; &nbsp; Station: 2
  
 +
&nbsp; &nbsp; Profile: MODBUS_DEVICE_02.yaml
  
 
</pre>
 
</pre>
Line 119: Line 125:
  
 
<span style="font-size:medium;">2. Sensor&nbsp;Configuration for Device-1: &lt;Install_folder&gt;\config\industry\Profile\MODBUS_DEVICE_01.yaml</span>
 
<span style="font-size:medium;">2. Sensor&nbsp;Configuration for Device-1: &lt;Install_folder&gt;\config\industry\Profile\MODBUS_DEVICE_01.yaml</span>
<pre>metadata:  
+
<pre>
  name: MODBUS_DEVICE_01.yaml
+
metadata:&nbsp;
  labels: ["MODBUS"]  
+
&nbsp; name: MODBUS_DEVICE_01.yaml
  Description: This profile is for Modbus device 01
+
&nbsp; labels: ["MODBUS"]&nbsp;
  version: 1.0.1
+
&nbsp; Description: This profile is for Modbus device 01
  UpdateData: 2020-01-08-14:25:30
+
&nbsp; version: 1.0.1
 +
&nbsp; UpdateData: 2020-01-08-14:25:30
  
 
Sensor:
 
Sensor:
  Temperature:
+
&nbsp; Temperature:
    Params:
+
&nbsp; &nbsp; Params:
      Address: 0   # Address
+
&nbsp; &nbsp; &nbsp; Address: 0 &nbsp; &nbsp;# Address
      Length: 1
+
&nbsp; &nbsp; &nbsp; Length: 1 &nbsp;
      DataType: int16
+
&nbsp; &nbsp; &nbsp; DataType: int16
      DataFormat: ABCD
+
&nbsp; &nbsp; &nbsp; DataFormat: ABCD
  
    Info:
+
&nbsp; &nbsp; Info:
      v: -1
+
&nbsp; &nbsp; &nbsp; v: -1
      asm: r # Access Right: r, w, rw
+
&nbsp; &nbsp; &nbsp; asm: rw &nbsp; &nbsp; &nbsp; # Access Right: r, w, rw
      min: -10 # Minimum Value  
+
&nbsp; &nbsp; &nbsp; min: -10 &nbsp; &nbsp; &nbsp;# Minimum Value&nbsp;
      max: 100 # Maximum Value
+
&nbsp; &nbsp; &nbsp; max: 100 &nbsp; &nbsp; &nbsp;# Maximum Value
      u: "celsius" # Unit
+
&nbsp; &nbsp; &nbsp; u: "celsius" &nbsp;# Unit
  
  Humidity:
+
&nbsp; Humidity:
    Params:
+
&nbsp; &nbsp; Params:
      Address: 1
+
&nbsp; &nbsp; &nbsp; Address: 1
      Length: 1
+
&nbsp; &nbsp; &nbsp; Length: 1 &nbsp;
      DataType: int16  
+
&nbsp; &nbsp; &nbsp; DataType: int16&nbsp;
      DataFormat: ABCD
+
&nbsp; &nbsp; &nbsp; DataFormat: ABCD
  
    Info:
+
&nbsp; &nbsp; Info:
      v: -1
+
&nbsp; &nbsp; &nbsp; v: -1
      asm: r # Access Right: r, w, rw
+
&nbsp; &nbsp; &nbsp; asm: rw &nbsp; &nbsp; &nbsp; # Access Right: r, w, rw
      min: -100 # Minimum Value  
+
&nbsp; &nbsp; &nbsp; min: 0 &nbsp; &nbsp; &nbsp; &nbsp;# Minimum Value&nbsp;
      max: 100 # Maximum Value
+
&nbsp; &nbsp; &nbsp; max: 100 &nbsp; &nbsp; &nbsp;# Maximum Value
      u: "percent" # Unit  
+
&nbsp; &nbsp; &nbsp; u: "percent" &nbsp;# Unit
  
 
</pre>
 
</pre>
Line 160: Line 167:
  
 
<span style="font-size:medium;">2. Sensor&nbsp;Configuration for Device-2: &lt;Install_folder&gt;\config\industry\Profile\MODBUS_DEVICE_02.yaml</span>
 
<span style="font-size:medium;">2. Sensor&nbsp;Configuration for Device-2: &lt;Install_folder&gt;\config\industry\Profile\MODBUS_DEVICE_02.yaml</span>
<pre>metadata:  
+
<pre>metadata:&nbsp;
  name: MODBUS_DEVICE_02.yaml
+
&nbsp; name: MODBUS_DEVICE_02.yaml
  labels: ["MODBUS"]  
+
&nbsp; labels: ["MODBUS"]&nbsp;
  Description: This profile is for Modbus device 02
+
&nbsp; Description: This profile is for Modbus device 02
  version: 1.0.1
+
&nbsp; version: 1.0.1
  UpdateData: 2020-01-08-14:25:30
+
&nbsp; UpdateData: 2020-01-08-14:25:30
  
 
Sensor:
 
Sensor:
  X-Axis:
+
&nbsp; X-Axis:
    Params:
+
&nbsp; &nbsp; Params:
      Address: 0   # Address
+
&nbsp; &nbsp; &nbsp; Address: 0 &nbsp; # Address
      Length: 1
+
&nbsp; &nbsp; &nbsp; Length: 1 &nbsp;
      DataType: int16
+
&nbsp; &nbsp; &nbsp; DataType: int16
      DataFormat: ABCD
+
&nbsp; &nbsp; &nbsp; DataFormat: ABCD
  
    Info:
+
&nbsp; &nbsp; Info:
      v: -1
+
&nbsp; &nbsp; &nbsp; v: -1
      asm: r # Access Right: r, w, rw
+
&nbsp; &nbsp; &nbsp; asm: rw &nbsp; &nbsp; &nbsp;# Access Right: r, w, rw
      min: -10 # Minimum Value  
+
&nbsp; &nbsp; &nbsp; min: -10 &nbsp; &nbsp; # Minimum Value&nbsp;
      max: 100 # Maximum Value
+
&nbsp; &nbsp; &nbsp; max: 100 &nbsp; &nbsp; # Maximum Value
      u: "mm" # Unit
+
&nbsp; &nbsp; &nbsp; u: "mm/sec" &nbsp;# Unit
  
  Y-Axis:
+
&nbsp; Y-Axis:
    Params:
+
&nbsp; &nbsp; Params:
      Address: 1
+
&nbsp; &nbsp; &nbsp; Address: 1
      Length: 1
+
&nbsp; &nbsp; &nbsp; Length: 1 &nbsp;
      DataType: int16  
+
&nbsp; &nbsp; &nbsp; DataType: int16&nbsp;
      DataFormat: ABCD
+
&nbsp; &nbsp; &nbsp; DataFormat: ABCD
  
    Info:
+
&nbsp; &nbsp; Info:
      v: -1
+
&nbsp; &nbsp; &nbsp; v: -1
      asm: r # Access Right: r, w, rw
+
&nbsp; &nbsp; &nbsp; asm: rw &nbsp; &nbsp; &nbsp;# Access Right: r, w, rw
      min: -100 # Minimum Value  
+
&nbsp; &nbsp; &nbsp; min: -100 &nbsp; &nbsp;# Minimum Value&nbsp;
      max: 100 # Maximum Value
+
&nbsp; &nbsp; &nbsp; max: 100 &nbsp; &nbsp; # Maximum Value
      u: "mm" # Unit  
+
&nbsp; &nbsp; &nbsp; u: "mm/sec" &nbsp;# Unit&nbsp;
  
 
</pre>
 
</pre>
 
 
  
 
= Demonstration =
 
= Demonstration =

Revision as of 12:06, 10 February 2020

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 data are acquired, WISE Agent will upload the data to the WISE-PaaS Cloud.


Features

EdgeSense Modbus-Master aims to collect data from Modbus Slave.

Feature:

  • Support connection with multiple Modbus slave.
  • Support access both Modbus TCP and RTU in one service.
  • Support individual read interval by connection.
  • Configurable sensor alias.
  • Support byte swap.
  • Currently support up-link Modbus Coil, Descrete input, Input register & Holding register data to WISE-PaaS , not support down-link from WISE-PaaS.

How to

Software Requirements

  • MQTT broker

Installation

Windows:

1. Download Modbus-Master for Windows from Release Table.

2. Double click the installer to launch the installer to install it to the machine.

Debian:

1. Download OPC-UA Client for Debian from Release Table.

2. Launch the installer to install it to the machine.

sudo ./device-modbus-master-3.0.1-Debian_9.9-rk3399.run

Configuration

EdgeSense Modbus Master can manage multiple Modbus Slave setting and individual sensor's parameters, below settings are default after Modbus Master installation.


1. Device Configuration: <Install_folder>\config\industry\device-industry.yaml

metadata: 
  name: "Modbus devices"
  labels: ["Modbus"] 
  Description: "Modbus TCP/RTU devices with 3 sensors in holding register area 40001~40003"
  UpdateData: 2020-01-08-14:25:30

# LinkInfo: You can add a new link with unique name
  # <LinkName>: Unique Link Name
    # Params: Serial Port or Network parameters
    # Info: Time interval of polling data & check link 
    # DevList: Device list which defined in DeviceInfo section

LinkInfo: 
  TCP-IP-1:
    Params: 
      Driver: Modbus-TCP
      ConnectType: Net
      IP: 127.0.0.1
      Port: 502
      Timeout: 1000          # A request timeout in milliseconds
   
    Info: 
      PollingInterval: 3000  # Polling interval in milliseconds
      Retry: 3               # Count of retry min:0 max:3
      AliveTime: 10          # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
      CheckLinkInterval: 2   # Check link status interval (second)

    DevList:
      - Device-1

  COM1:
    Params:
      Driver: Modbus-RTU
      ConnectType: Serial
      PortName: COM1
      BaudRate: 9600
      DataBits: 8
      StopBits: 1
      Parity: None
      Timeout: 1000          # A request timeout in milliseconds
    
    Info: 
      PollingInterval: 3000  # Polling interval in milliseconds 
      Retry: 3               # Count of retry min:0 max:3
      AliveTime: 10           # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
      CheckLinkInterval: 2   # Check link status interval (second)

    DevList: 
      - Device-2


# DeviceInfo: You can add a new device with unique name
  # <DeviceName>: Unique Device Name
    # Params: Station number
    # Profile: Profile file name

DeviceInfo:
  Device-1:
    Params: 
      Station: 1

    Profile: MODBUS_DEVICE_01.yaml

  Device-2:
    Params:
      Station: 2

    Profile: MODBUS_DEVICE_02.yaml


2. Sensor Configuration for Device-1: <Install_folder>\config\industry\Profile\MODBUS_DEVICE_01.yaml

metadata: 
  name: MODBUS_DEVICE_01.yaml
  labels: ["MODBUS"] 
  Description: This profile is for Modbus device 01
  version: 1.0.1
  UpdateData: 2020-01-08-14:25:30

Sensor:
  Temperature:
    Params:
      Address: 0    # Address
      Length: 1  
      DataType: int16
      DataFormat: ABCD

    Info:
      v: -1
      asm: rw       # Access Right: r, w, rw
      min: -10      # Minimum Value 
      max: 100      # Maximum Value
      u: "celsius"  # Unit

  Humidity:
    Params:
      Address: 1
      Length: 1  
      DataType: int16 
      DataFormat: ABCD

    Info:
      v: -1
      asm: rw       # Access Right: r, w, rw
      min: 0        # Minimum Value 
      max: 100      # Maximum Value
      u: "percent"  # Unit


2. Sensor Configuration for Device-2: <Install_folder>\config\industry\Profile\MODBUS_DEVICE_02.yaml

metadata: 
  name: MODBUS_DEVICE_02.yaml
  labels: ["MODBUS"] 
  Description: This profile is for Modbus device 02
  version: 1.0.1
  UpdateData: 2020-01-08-14:25:30

Sensor:
  X-Axis:
    Params:
      Address: 0   # Address
      Length: 1  
      DataType: int16
      DataFormat: ABCD

    Info:
      v: -1
      asm: rw      # Access Right: r, w, rw
      min: -10     # Minimum Value 
      max: 100     # Maximum Value
      u: "mm/sec"  # Unit

  Y-Axis:
    Params:
      Address: 1
      Length: 1  
      DataType: int16 
      DataFormat: ABCD

    Info:
      v: -1
      asm: rw      # Access Right: r, w, rw
      min: -100    # Minimum Value 
      max: 100     # Maximum Value
      u: "mm/sec"  # Unit 

Demonstration

1. Open Modbus Simulator: Launch ModSim32 and click "New" in program menu to create a new simulator page.

Modbus-Slave Modsim32 04.png


2. Set parameter as below:

  • Device Id: 1
  • Address: 0001
  • Length: 2
  • Modbus Point Type: HOLDING REGISTER

Modbus-Slave Modsim32 01.png


3. Enable Auto Simulation:

  • Double click on the sensor address 40001
  • Click "Auto Simulation"


Modbus-Slave Modsim32 02.png



4. Set simulation parameters:

  • Check "Enable"
  • Simulation Type: Increment
  • Change Interval (secs): 5
  • Step VAlue: 1
  • Low Limit: 10
  • High Limit: 20

Modbus-Slave Modsim32 03.png


5. Do the same step for the address 40002 and set simulation parameter as below:

  • Simulation Type: Increment
  • Low Limit: 60
  • High Limit: 80

Modbus-Slave Modsim32 05.png



6. Set Connection to Modbus/TCP Svr:

Modbus-Slave Modsim32 06.png




7. Edit Device Configuration for the demo: <Install_folder>\config\industry\device-industry.yaml

metadata: 
  name: "Modbus devices"
  labels: ["Modbus"] 
  Description: "Modbus TCP/RTU devices with 3 sensors in holding register area 40001~40003"
  UpdateData: 2020-01-08-14:25:30

# DeviceInfo: You can add a new device with unique name
 # <DeviceName>: Unique Device Name
   # Params:

LinkInfo: 
  TCP-IP-1:
     Params: 
       Driver: Modbus-TCP
       ConnectType: Net
       IP: 127.0.0.1
       Port: 502
   
     Info: 
      PollingInterval: 1000  # Polling interval in milliseconds
      Timeout: 100           # A request timeout in milliseconds
      Retry: 3               # Count of retry min:0 max:3   
      AliveTime: 60          # Link Timeout in second: SDK will release this link if there are any request over this AliveTime ( second )
      CheckLinkInterval: 5   # Check link status interval (second)

     DevList:
      - Device-1

DeviceInfo:
 Device-1: 
  Params: 
    Station: 1

  Profile: MODBUS_DEVICE_01.yaml


8. Edit Sensor Configuration for the demo: <Install_folder>\config\industry\Profile\MODBUS_DEVICE_01.yaml

metadata: 
  name: MODBUS_DEVICE_01.yaml
  labels: ["MODBUS"] 
  Description: This profile is for Modbus device 01
  version: 1.0.1
  UpdateData: 2020-01-08-14:25:30

Sensor:
  Temperature:
    Params:
      Address: 0   # Address
      Length: 1  
      DataType: int16
      DataFormat: ABCD

    Info:
      v: -1
      asm: r # Access Right: r, w, rw
      min: -10 # Minimum Value 
      max: 100 # Maximum Value
      u: "celsius"  # Unit

  Humidity:
    Params:
      Address: 1
      Length: 1  
      DataType: int16 
      DataFormat: ABCD

    Info:
      v: -1
      asm: r # Access Right: r, w, rw
      min: -100 # Minimum Value 
      max: 100 # Maximum Value
      u: "percent"  # Unit 


9. Restart Modbus Master services

  • Open Windows Task Manager
  • Restart service: device-modbus-protocol
  • Restart service: device-modbus-master



10. Verify sensor data at DeviceOn Monitor Sensor Data page

Modbus-Slave Modsim32 07.png


Release

This is an overview that displays Modbus Service versions and some stats and numbers for each release.

Index Version Date Platform OS Release Note Installer
1 v3.0.1

2020/01/21

x86_64 CPU
Windows 10
  • Support connection for multiple Modbus slave.
  • Support Modbus TCP and RTU in one configuration.
  • Support individual read interval by connection.
  • Support only get Modbus data.
device-modbus-master-3.0.1.exe
2 v3.0.1

Coming soon

ARM CPU
Debian
  • Support connection for multiple Modbus slave.
  • Support Modbus TCP and RTU in one configuration.
  • Support individual read interval by connection.
  • Support only get Modbus data.
device-modbus-master-3.0.1-Debian_9.9-rk3399.run

Above files are available at local server, please paste file's url in File Explorer to copy file. (How to access to EOSSFS file server )