Modbus Rules
Modbus Rules refers to a Modbus Command that Elastel gateway act as a Modbus Master to acquire data from southbound Modbus slave devices. One rule including assigned which interface for slave device, the slave device ID, the Modbus function code, (Read Holding Register) Start address, quantity count, data type…and other parameters.
Go to Data Collect >> South Devices>> Modbus Rules to view and configure Modbus commands list for slave devices.
- The order of Modbus rules
- Specify the Device Name when add a Modbus rule
- Configure the belonged interface that the rule applied
- Configure the Tag Name of the specified register value, Multiple Tags can be configured by separated semicolon when reading continuous registers.
- Preview the current value that collected from southbound device under this rule communication
- Configure the slave device ID
- Configure the Modbus command function code. eg: 3-read holding register
- Configure the read starting address
- Configure the count of read quantity
- Configure the data type of the register
- Specify the reporting center that the collected data be reported to. The number is associated to North App>>Reporting Center>>Server <1~5>
- Enable/disable the rule be applied
- Edit the added rule
- Delete the added rule
- Add a new rule
- Export and import the rules configuration in csv template file. This is useful for rules configuration backup and batch operation
Add a Modbus Rule
Take an example to explain and add a Modbus rule, in this example, we will read a temperature & humidity sensor which following Modbus RTU protocol with RS485 interface.
Following the sensor’s datasheet to read temperature and humidity instruction example:
Read the temperature and humidity values of device address 0x01
Inquiry frame (hexadecimal):
Address code | Function code | Starting address | Data length | Check code low | Check code high |
---|---|---|---|---|---|
0x01 | 0x03 | 0x00 0x00 | 0x00 0x02 | 0xC4 | 0x0B |
Response frame (hexadecimal): (for example, the temperature is -9.7°C and the humidity is 48.6%RH)
Address code | Function code | Return valid Number of bytes | Humidity value | Temperature value | Check code Low | Check code High |
---|---|---|---|---|---|---|
0x01 | 0x03 | 0x04 | 0x01 0xE6 | 0x1 0x31 | 0xDA | 0x7C |
Temperature calculation: Temperature: 131 H ( hexadecimal ) = 305 => Actual Temperature = 305/10= 30.5℃ Humidity calculation: Humidity: 1E6 H ( hexadecimal ) = 486 => Actual Humidity = 486/10= 48.6 %RH
Briefly the reading temperature and humidity Modbus Command would be, 01 03 00 00 00 02 C4 0B
The response data would be, 01 03 04 01 E6 01 31 DA 7C
And the actual value should be divide 10, so the Modbus Rule on Elastel gateway configuration would be,
- Set the rule order
- Specify the Device Name
- Configure the belonged Interface, in this example, the temperature and humidity sensor connect on COM1-RS485 port
- Configure the Tag Name of the registers’ value. Multiple Tags can be configured by separated semicolon when reading continuous registers
- Configure the sensor Device ID
- Configure the Modbus command function code. In this example the function code is 3-read holding register
- Configure the read starting address
- Configure the count of read quantity
- Configure the data type of the register, check the information from sensor datasheet
- Specify the reporting center that the collected data be reported to. The number is associated to North App>>Reporting Center>>Server <1~5>
- Configure the operator function, options: “None”, “+”, “-”, “*”, “/”, and “Expression”
- Configure the operand
- Configure the accuracy of calculated value
-
Enable/disable SMS&Email Reporting. It will send report to specified phone number and Email address when value changed or value out of certain range.
- Enable/disable the rule be applied