Implementation of customized SCADA for X-Ray Machine
Abstract
This paper is an effort to enable the Delta PLC (Programmable Logic Controller) DVP14SS to communicate with the Visual Basic 6.0 using Modbus.DLL. The communication between DVP14SS and Visual Basic 6.0 is via Modbus Serial Protocol stated by Delta PLC manufactures. In automated systems there is control supervision, and also health and safety monitoring via supervisory control and data acquisition (SCADA) systems. Values of important parameters such as temperatures, pressures, voltages, etc. are sensed and transferred to monitoring stations in control rooms. After processing the information, decisions are made and supervisory commands are sent to change conditions such as set points or to engage emergency procedures. The data from sensors and set commands to actuators are sent via wired or wireless communication channels. So, communication mechanisms are an integral part of any complex automated system. The SCADA software�s are the software packages and are not free and the cost depends on tag count. Visual Basic 6.0 platform can be used to develop the SCADA application effectively. Using VB 6.0 a platform can be developed to integrate software and hardware across spectrum of vendors. Here, a simple approach is proposed; which takes care of the communication between Delta PLC and visual Basic using Modbus DLL (provided by Delta PLC). Visual Basic can serve as a cost effective solution since it is not necessary to purchase a licenses for a small scale application as well as it is cheaper than conventional SCADA packages.
I. Introduction
During the past decade, the industrial sector throughout the world has shifted from classical methods of control and Automation to the state of arts techniques. This allowed the industries to attain higher percentage of growth and production, which consequently gives rise to reduction in costs of the product .This trend of automation is gaining Automated systems use local control systems that utilize sensor information in feedback loops, process this information, and send it as control commands to actuators to be implemented & processed [2]. Such closed-loop feedback control is necessary because of the uncertainties in the knowledge of the process and in the environmental conditions. Feedback control systems rely heavily on the ability to receive sensor information and send commands using wired communications.
PLCs have become favourite tools in the control industry because of their simplicity, robustness, I/O interface and reliable performance
SCADA as the name suggests is not a full control system but rather focuses on the supervisory level. As such, it is a purely software package that is positioned on top of hardware to which it is interfaced, in general via PLCs, or other commercial hardware modules. SCADA systems are nowadays employed in major industries of the world including Oil and Gas, Petroleum, Food, Textile and other industrial sectors. SCADA systems are developed by major companies which include Wonderware Inc, Siemens, Rockwell Automation, Intellution and GE. However the prices they demand for their systems are discouraging the industries to switch towards automation [3].
Visual Basic is tool provides platform to develop new optimum Windows or SCADA applications. Visual Basic can communicate with PLC with various ways. Visual Basic does not have code for communication protocol inbuilt. User need to write code for communication protocol or need to purchase ActiveX controls which are used to develop applications.[4]
II. Method of Interfacing
The primary goal of SCADA system is to assist the operator in running a machine and managing a process. A good SCADA system will increase the productivity of the operator and machine, increase uptime, and assist in providing consistent product quality. The required functionality of SCADA will vary based upon the type and complexity of product produced the type of machinery used, the skills of the operator, and the degree of automation of the machinery [3]. The types of functionality typically included are:
� Link between PLC and PC.
� Visual HMI
� Trending Real Time and Archived Data [3].
Delta DVP14SS comes with serial port and the communication protocol is serial Modbus protocol which is a open resource Modbus protocol. Visual Basic acts as a Modbus Master device which issues request or commands (Query) on serial bus which is received by slave. PLC acts as a Modbus slave device and responds to the Master by sending massage called response. Modbus Query and Response contains fields like device address, function code, data, and error check [6]. Figure 1 shows the system block diagram.
Figure 1 Block diagram |
In the previous work [4] is an effort to show simple approach to communicate Delta PLC with visual Basic using MSComm control for more effective and efficient process control. .This paper is an effort to design and evaluate the the other approach to communicate Delta PLC using Modbus.dll provided by Delta PLC manufactures. DMT Modbus Library is used for development industrial device that support Modbus format, based on Windows Winsock API (WSA). The software developer can import the library for implementing device's communication via serial or ethernet. The MBDRV Communications Driver is a Windows Dynamic Link Library (DLL) that enables Windows programs to communicate with devices that understand the Modbus Protocol. The driver provides an easy way for the user to develop programs that access Modbus device�s points and registers. Information is passed using standard variables in the user�s host language [5].
The Modbus driver can be used with any language that supports calls to external DLLs, including C/C++ static/dynamic standard library, support Microsoft Visual C++ / Visual Basic, Borland C++ Builder, Sun Java J2SE, etc.[5]
DMT Library provides functions with the following steps:
- � Step1.Opening communication port
- � Step 2. Data access input/output functions
- � Step 3. Acquiring status functions if necessary
- � Step 4. Closing communication port
DMT library provides various functions related to communication control, Data access & communication Status between PLC and PC. Communication control functions include creating Modbus serial connection & closing the serial connection.e.g.
Function used to create Serial connection:
int OpenModbusSerial(char *comport_name, int baud_rate, int data_len, char parity, int stop_bits, int modbus_mode);
TABLE I
OpenModbusSerial Function Parameters [5]
Parameter | Value |
comport_name | Comport name, e.g. "COM1" |
baud_rate | Baud rate, e.g. 9600 |
data_len | Data length, e.g. 7 |
parity | Parity bit, e.g. 'E' |
stop_bits | Stop bit, e.g. 1 |
modbus_mode | Modbus mode, 1 for Modbus/ASCII, 2 for Modbus/RTU |
OpenModbusSerial function then returns the value to indicate whether the connection is successful or not e.g.
TABLE II
OpenModbusSerial Function Returned Value [5]
Value returned | Example |
-1 | Serial open failed |
Non zero | Serial open succeeded |
Function used to close Serial connection:
void CloseSerial();
Closes the Serial connection.
Data access functions include sending request for Modbus data & receive responses from Modbus data.e.g.
Function used to send request for Modbus Data:
int RequestData(int slave_addr, int func_code, const unsigned char *data, int datalen);
TABLE III
RequestData Function Parameters [5]
Parameter | Value |
station_addr | Station Address |
func_code | Function Code |
Data | Modbus Data |
Data_len | Modbus Data Length' |
RequestData function then returns the value to indicate whether the request sent is successful or not e.g.
TABLE IV
RequestData Function Returned Value [5]
Value returned | Example |
-1 | Send data failed |
Non zero | Total number of bytes sent will be returned |
Function used to recive response form Modbus Data:
int ResponseData(int *slave_addr, int *func_code, unsigned char *data);
TABLE V
ResponseData Function Parameters [5]
Parameter | Value |
station_addr | Returned Station Address |
func_code | Returned Function Code |
Data | Modbus Data (If error occurring, the Modbus Exception Code will returned) |
ResponseData function then returns the value to indicate whether the response sent is successful or not e.g.
TABLE VI
ResponseData Function Returned Value [5]
Value returned | Example |
-1 | Send data failed |
Non zero | The Modbus data byte count will be returned |
Communication status functions include acquiring the last serial error message & resetting the serial error message.e.g.
Function used to acquiring the last serial error message:
int GetLastSerialErr();
TABLE VII
GetLastSerialErr Function Returned Value[5]
Value | Message |
0 | No serial error |
1 | Invalid serial error code |
2 | Invalid baud rate |
3 | Buffer overflow error |
4 | Invalid character size |
5 | Invalid flow control |
6 | Cannot initialize serial device |
7 | Invalid initialization parameter |
8 | Cannot open serial device |
9 | Invalid parity |
10 | Serial device receive error |
11 | Invalid stop bit |
12 | Serial device transmit error |
Function used to reset the last serial error message:
void ResetSerialErr();
Used to reset Last Serial Error
III. IMPLEMENTATION
DVP14SS series MPU support Modbus ASCII/RTU communication format with speed of up to 115,200bps. and modification on data length (data bits, parity bits, stop bits).Modbus communication format ,CRC calculation ,Modbus addressing for various internal devices of PLC are the key factor in the interface. Communication parameters for COM can be manipulated by writing ladder program. Here default protocol settings are used hence no need to alter PLC program. [4]
Following steps are implemented to obtain desired objective.
1. Add DMT.bas module file into project (Figure 2).
Figure 2 DMT.bas Module
In DMT.bas module all functions are declared and defined in Modbus.dll
2. Copy DMT.dll into project.
Copying the DMT.dll file into project directory.
3. Declaring the Win32 API
Used to find serial port List from registry and shown in GUI.
4. Declare variable parameters for communication port.
Following variables are declared.
Used to create Modbus protocol String to send command or request to PLC.
5. Assign Modbus data
Function code 5 forces single coil M207 (Modbus address 08CF) ON state (Data FF00) [1][6].
6. Converting Hex data to String
7. Open Communication
Opens communication port with 9600 baud rate, even parity, 1 stop bit.
8. Request Modbus Data
9. Receive Response
10. Close Communication.
IV. RESULTS
Using VB and DMT.dll customised SCADA is developed for application for Remote operated X-Ray Machine.
Figure 3 GUI for X-Ray Machine
In this GUI seven stepper motor movements are controlled in both auto & manual mode. Current & set positions of each motor are also displayed on the GUI. In DMT Modbus.dll user an read four Modbus data registers simultaneously. Current positions of Stepper motor is calculated by the encoders connected to each motor. Stepper motor status is shown with the help of indicators.GUI also displays the current position of Collimator .Collimator can be opened or closed remotely with the help of buttons shown on GUI.
V. Conclusions
Visual Basic with industrial connections can be an alternative to costly proprietary automation Software�s. The main idea was to interface Visual Basic and Delta PLC DVP14SS for more effective and efficient process control. This work evidences proper communication between two powerful technologies used in industries. Visual Basic provides a platform where new solutions or highly customized SCADA's can be created with a richer experience than those that may be provided by standard SCADA offerings. By using Visual Basic that offers many advantages over SCADA packages as it comes free and not expensive. Also SCADA packages cost depend on the tag count and runtime licenses needs to be purchased. Thus for OEM Visual Basic offers the optimum cost solution. The PLC- VB interface has been tested for several real time processes and can serve better for many applications in the industry.
References
[1] �DVP PLC communication Protocol,� Delta Electronics Inc,www.delta.com.tw/industrialautomation (1998).
[2] Tahir Nizamuddin, Bilal Iqbal. �Design and Implementation of Locally Developed SCADA A Cost Effective Solution�. PCSIR, Institute of Industrial Electronics Engineering, (IIEE) Karachi 16(2010)
[3] Tieyi Zhang, Yun Zhang, Xiaorong Zhou. �Development on Serial Communication between Panasonic Electrical PLC and Computer based on VB�. Guangxi University, Nanning , China. Applied Mechanics and Materials Vols, 170-173(2012)
[4] S.S.Bidwai, V.B.Kumbhar. �Real Time Automated Control using PLC-VB Communication� International Journal of Engineering Research and Applications (IJERA) Vol. 3, Issue 3, pp.658-661 (Jun 2013).
[5] �DMT library Manual,� Delta Electronics Inc,www.delta.com.tw/industrialautomation .
[6] �Modbus communication Manual� MTL 8000 process control for process I/O ,The MTL Instruments Group PLC, England
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :