• No results found

Windows Application Development Using PC for Multiple Modbus Slave Devices

N/A
N/A
Protected

Academic year: 2020

Share "Windows Application Development Using PC for Multiple Modbus Slave Devices"

Copied!
8
0
0

Loading.... (view fulltext now)

Full text

(1)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

Windows Application Development

Using PC for Multiple Modbus Slave Devices

V.Vijaypriya1, Dr.A.Samydurai2, Chenthamarai Selvam3, Hijo Joy4

PG Student, Department of Computer Science and Engineering, Valliammai Engineering College, Kattankulathur,

TamilNadu, India1,

Associate Professor, Department of Computer Science and Engineering, Valliammai Engineering College,

Kattankulathur, TamilNadu, India2,

Senior Principal Scientist, Central Scientific Instruments Organisation, CSIR Madras Complex, Chennai, Tamilnadu,

India3,

Research Intern, Central Scientific Instruments Organisation, CSIR Madras Complex, Chennai, Tamilnadu, India4,

ABSTRACT: The Software based design and implementation for Modbus Slave devices using Visual Basic.Net (VB.Net). Visual Studio 2017 Package was used and it contains the VB.Net Framework. Serial Port Communication (USB-RS485 converter) is used for communicating between PC and Microcontroller. In the proposed system PC acts as master and multiple Modbus devices like PQA, RISHABH acts as slave and it communicates through Modbus Remote Terminal Unit (RTU) Protocol. The Electrical parameters from Modbus Slave devices are Three-phases of Voltage, Current, Frequency, Reactive, etc. The different electrical parameters from Slave devices are displayed and monitored in window based application. The user can able to configure the electrical parameters from the window based application and real time chart is plotted in window based application for all electrical parameters. From window based application the real time data are stored in database and Report is generated.

KEYWORDS: Modbus, Visual Basic.Net, Master Device, Slave Device

I.INTRODUCTION

MODBUS is one of the most popular protocols used in the industrial world. MODBUS Protocol is a messaging structure developed by Modicon in 1979. It is used to establish master-slave communication between intelligent devices [1]. Modbus is a kind of communication protocol which is promoted by Modicon Corporation [2]. It is widely used in the industrial automation for many years. The protocol defines function codes and the encoding scheme for transferring data either as single points (1-bit, coils) or as 16-bit data registers [3]. Modbus allows devices communicate in a same bus. There can be only one Master device and up to 247 slave devices in the bus. The information is transmitted in frame format.Table.1 shows us Frame Format of Modbus RTU.

Table.1 Modbus RTU Frame Format

II.MODBUS RTU MESSAGE STRUCTURE

The Modbus protocol includes RTU supporting traditional RS-485. MODBUS RTU mode is the most common implementation, using binary coding and Cyclic Redundancy Check (CRC) error-checking [4].Communication on a

Name Start Address Function Data CRC

Length (bits)

(2)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

MODBUS network is always started by a Master with a query to a slave. The Maser/Slave method is used for data communication. Table.3 shows the Master sends out the request information, and Table.4 shows the Slave produces the response information and returns to the Master to respond to the request after receiving the correct information [5]. The MODBUS protocol needs to verify the data. MODBUS uses Master and Slave by receiving and sending the data in fixed time. MODBUS communication interface is built around messages as frame format. MODBUS transaction builds Modbus Remote Terminal Unit (RTU). RTU consists of slave address ranging from1-247. The function code indicates to the slave what kind of action to be performed. CRC check is performed on the message contents. RTU mode is used to define the bit contents of message fields. The CRC Value is calculated by the Master device [6]. The Slave device calculates a CRC again and calculated value will be compared with the actual value that will be received in the CRC field. A function code type tells the slave device what kind of action to be performed [7]. Table.2 shows us Function code types provided by a Modbus master device to a Modbus Slave device.

Function Code Function Code Type Access Size

01 Coil Read-write 1bit

04 Input Register Read-only 16 bits

03 Holding register Read-write 16 bits

Table.2 Modbus Function Code types

Table.3 Master Request to Slave device

Table.4 Slave Response to Master device

Field Name RTU

Slave Address 1F

Function Code 03

Starting Address High 00

Starting Address Low 00

Quantity of Register High 00

Quantity of Register Low 02

Error Check Low F3

Error Check High AA

Total Bytes 8

Field Name RTU

Slave Address 1F

Function Code 03

Byte Count 04

Data High 00

Data Low 06

Data High 00

Data Low 05

Error Check Low 28

Error Check High 56

(3)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

III RELATED WORK

[8] The authors have used Modbus‐RTU Communication protocol, it states the specific method to implement the serial port communication between computer and ADVANTECH 4018+ modules by the Serial Port control based on the analysis of the principle of communication in C#.NET. [6] The authors have designed a system and the content of Modbus Communication Protocol are introduced while the circuit interface of RS485 is given. The embedded real-time operating system IlC/OS-ll implements the communication between master station and slave station based on Modbus RTU communication protocol, and discusses the generation of Cyclic Redundancy Check in the Modbus Communication Protocol.

IV. SYSTEM OVERVIEW

A system overview of Master and Slave communication is shown in Figure1.The Master (PC) and many Modbus Slave devices is connected through Serial Port Communication (USB-RS485 converter).The Master Request contains Modbus Point Type and Number of points. Each Slave Response contains Slave ID and Start Address. The Master can communicate with many Slave devices at same time. USB-RS485 converter can send and receive data. Modbus RTU is a data transmission mode which based on the serial port, in order to realize the communication between master and slave devices, all the devices must be set in the same Network configured with different Slave ID.

IV.HARDWARE IMPLEMENTATION

(4)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

Figure.2 The Picture shows the integration of Master as PC and Slave as Modbus Devices like PQA, RISH using Modbus RTU Protocol

V.SOFTWARE IMPLEMENTATION

To develop a master device, open visual studio 2017 and create the new design in the FORM environment.

1. Common Controls in VB.Net Used for Designing Master Device

Button: Button is used to raise an event when the user clicks on it. It is used to design keys for Connect, Voltage, Current, Power, Active, Reactive, Voltage-Imbalance, Current-Imbalance, Power-Factor.

Textbox: It enables the user to enter text and provides configuration. It is used in the design of the display boxes for Slave Address, Start Address, Number of Points, Timer Interval, Send Data, Receive Data and Result.

Label: It Provides Real time data.

Timer: When the user clicks Connect button the timer will be enabled.

2. Template Creation for Multiple Slave devices

In Window Based Application New Form is created with three Tab control PQA, RISH, and REPORT. The Master request data will be displayed on the Display Textbox for the Send data. The Slave response data will be displayed on the Display Textbox for the Receive data. The Traffic data will be displayed on the Display Textbox for the Result. The electrical parameters Data from slave devices are displayed and monitored in Label R, Y, B. Real Time and Date will be displayed on the Label Time. In Combo-Boxes the user can able to configure the Modbus point type as 01: Coil Status, 03: Holding Register, 04: Input Register and Timer interval type as Minutes or Seconds. When the user clicks the Button named Voltage, Current, Power, etc a new form will be displayed with Real time chart and Real time data will be displayed on the Display Label for the Voltage-R, Voltage-Y, Voltage-B.

Connect Button: When the user clicks the connect button the electrical parameters Data will be displayed and the master request data and slave response data will be displayed on the Display textbox for Receive data and Send Data and the data will be stored in database.

3. Graphical Form for Multiple Slave Devices

(5)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

4. Serial Port Communication for Master and Slave Devices

Window based application contains serial port for communicating with PC to USB-RS485 converter. Serial Port class’s namespace is System.IO.Ports. Serial Port can send and receive data. The process of serial communication for Serial Port control is to open port, send data, receive data and close port. Modbus RTU is a data transmission mode which based on the serial port, in order to realize the communication between master and slave devices, all the devices must be set in the same Network configured with different Slave ID. Serial Port communication Parameters are Baud rate/bps-9600, Parity-None, Data Bits-8, Stop Bits-1.

5. Data Flow From Master to slave Devices

Data Flow between Master and Slave devices is shown in Figure3.Slave devices waits for request from the master and it will respond only if the request message contains its slave ID. Real time data are displayed in window based application. Then the data are stored in database and Report is generated in Excel sheet.

Figure.3 Data Flow between Master and Slave devices.

VI.RESULTS

In the figure.4, Window based application shows the real time Send data and Receive data with electrical parameters from PQA using MODBUS RTU protocol. The Real time chart is plotted for all PQA Parameters.

Figure.4 The above image displays PQA parameters with Real time data.

(6)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

Figure.5 The above image displays RISH parameters with Real time data.

In the figure.6, Window based application shows the Real time Chart for all electrical parameters from RISH and PQA when the user clicks the Voltage Button from figure4. The Real time chart window will be displayed.

Figure.6 The above image shows Real time Chart in window based application.

(7)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

Figure.7 The above image displays the data stored in database.

In the figure.8, Window based application shows the data exported from Database to Excel sheet using starting date to ending date.

Figure.8 The above image displays the Report Generated in window based application.

In the figure.9, the data from database are stored in excel sheet using Export to Excel Sheet button from figure.8.

(8)

ISSN(Online): 2320-9801 ISSN (Print): 2320-9798

I

nternational

J

ournal of

I

nnovative

R

esearch in

C

omputer

and

C

ommunication

E

ngineering

(A High Impact Factor, Monthly, Peer Reviewed Journal) Website: www.ijircce.com

Vol. 6, Issue 3, March 2018

VII.CONCLUSION

In .Net framework and VB.Net language, software development has been greatly facilitated with easy use of objects like Forms, Label, Textbox which can be inserted and their functions specified by coding. PC as the master devices successfully obtains all the parameters from Modbus slave devices to window based application. Master-slave communication mode based on Modbus RTU protocol is described in this paper. It can be applied to various electrical parameters. It can use any Modbus devices to display all values in window based application. From window based application the real time data are stored in database. From database the values are stored in Excel sheet and Report is generated in window based application.

ACKNOWLEDGMENT

I sincerely thank Director-CSIO, Scientist in charge-CSIO Chennai and all scientists in CSIO Chennai for permitting to work in this area and providing the infrastructures, facility and encouragement to pursue this work.

REFERENCES

[1] ZHANG Hao, HUANG Yun-yin, PENG Dao-gang. EGI based on the Modbus protocol for EWS[J]. Mechatronics,2007, 13(2):15-18.

[2] LI Juan, ZHANG Bo, QIU Dong-yuan. Multi-computer communication based on Modbus RTU in power quality monitoring system [J]. Electric Power Automation

Equipment, 2007, 27,(1):93-96.

[3] Jiangquan Li, Hongtao Deng, Qiao Liu et al, Typical Examples of Serial Port Communication and Measurement and Control Application in Visual C#.NET, Publishing House of Electronics Industry, Beijing, 2012.

[4] Lijun Dong, Shuwei Liu & Yiqing Hou,”Serial Communication Based on Modbus Protocol with Microsoft Visual Basic”, Industrial Control Computer ,pp.8 11, August 2006.

[5] FreeMODBUS stack, http://www.freemodbus.org/

[6] Kelong Wang, Daogang Peng, Lei Song and Hao Zhang, "Implementation of Modbus Communication Protocol based on ARM Coretx-M0", IEEE International Conference on System Science and Engineering (ICSSE),pp.69 - 73, July 2014

[7]ModbusTools,http://www.modbustools.com/index.html

[8] Pan Zhao, Yong Zheng , ”Implementation of Serial Port Communication Based on Modbus‐RTU Communication Protocol in C#.NET”, Electrical Engineering Research Volume 2, 2014

[9] Peng Dao-gang, Zhang Hao, Li Hui, et al. “Design and implementation of ARM embedded monitoring Platform based on Modbus protocol [J]”. Electric Power Automation Equipment, 2009, 29(1): 115-123

References

Related documents

To significantly reduce this computational effort, we formulate the joint ML estimation and detection as an integer least-squares problem, and show that for a wide range

Organizational and transactional documents associated with the new commercial enterprise (NCE) submitted with this Form I-924 have not been reviewed to determine compliance

After completing Master-level path studies (10-15 ECTS credits minimum) you can apply for the degree programme in ques- tion by separate application. When applying, you are

Gambar 5.4 Hasil Uji Antibakteri Sediaan masker gel peel off kombinasi Ekstrak Pegagan (Centella asiatica) dan Niacinamid replikasi pertama ...30. Gambar 5.5 Hasil Uji

Finally, we will see that by abandoning the “correlationism” inherent in the post-Kantian philosophy of finitude, Meillassoux’s speculative materialism also dismantles the

We carried out a meta-analysis of lipid traits based on three genome-wide association studies including more than 4,700 individuals of Mexican ancestry (two samples from Mexico

DOTS test cases continuously inserts and updates the data into the database for duration of time specified in DOTS configuration file making the database to grow

To more speci fically address the notion of functionally specialized DMN activity during self-reference, we determined which of the brain regions commonly activated during rest-