Professional Documents
Culture Documents
Amit Golhani
Power Electronics and Technology Center (PEATC)
Larsen & Toubro Electrical and Automation
Navi Mumbai, India
Amit.Golhani@lntebg.com
493
• The core-libraries, where performance critical task, III. RESULT AND DISCUSSION
communication and control mechanism is As the approach of Scripting Engine for SCADA
implemented, are developed using compiler-based development resolves around using scripts for UI
C/C++ language. development, unlike conventional approach, the ease of the
• SQL Server is used for historical database storage. development of UI is enhanced and dependency on the
• SMTP protocol is used for remote notification of proficient C/C++ programmer is reduced. In order to compare
SCADA status. the conventional approach with Scripting Engine approach for
SCADA development, SCADA HMI screens are developed
C. Functionality Provided using both approaches with no functional difference.
The following essential functions are implemented for Following are the observations noted when Scripting Engine
Scripting Engine of SCADA that can be used by SCADA approach for SCADA development is compared with the
Engineer for SCADA HMI development based on which conventional approach:
evaluation is done.
• Database Functions: A. Standard Python Library extension
The Database Function for SCADA includes function The standard python library includes String, Math, Time
for retrieving historical data from historical database, and File handling functions that can be used by SCADA user
which can be used for reporting, getting object (device) for SCADA development. Apart from that, this standard
and tag details (both system and user-created) from online library functions are extended in the Scripting Engine
database. The SCADA Engineer can use it to display the considering the requirements of the SCADA and its users.
data on SCADA HMI using easy to use python script.
B. Auomated Database Connection management
• Tag Functions: For retrieving the historical data or alarm data using
This includes the set of functions mostly used for the conventional approach, the users have to explicitly open
control and monitoring of remote field devices. It includes the connection, generate the query for retrieving the data from
the function for getting and setting on field device’s tag the server and should close the connection, upon receiving the
values as well as monitoring the live status of devices. data. The user will also have to deal with complex datatypes
These functions are mainly used for displaying the field of the library for programmatically accessing SQL Server to
values on SCADA UI component by SCADA Engineer. retrieve the values from the SQL server.
The SCADA Engineer can also provide the SCADA Eg. Functionality in C++:
Operator to control the Tag values by writing the display
logic using this set of functions. PGconn* connection=NULL;
connection=PQconnectdb("user=********** password=**********
dbname=HistoricalDB hostaddr=127.0.0.1 port=5432");
• Communication Functions: PGresult* res;
These functions include the functions to notify the res=PQexec(conn, "BEGIN");
remote user about SCADA status. The functions include res=PQexec(conn, Sql_statement.c_str()); // Sql_statement is the query
res=PQexec(conn, "FETCH ALL FROM record");
the function to send SMS and email and to read SMS and Close_connection(conn);
Email. The SCADA Engineer can configure the functions
for SCADA UI components representing devices, to Additionally, to convert the data from the complex
automatically notify the remote user about the device datatype to the simple format, which can be used in UI
status. development, complex logic has to be written and memory has
to be managed carefully, to avoid memory leakage.
• File Handling Functions: Unlike the conventional approach, the user has to be
These functions include functions for file handling concerned about passing the proper Tag ID and Timestamp
which the SCADA Engineer can use to design the range for query generation and the Scripting Engine will
SCADA HMI and providing the user to handle the files handle the connection, query generation and handling complex
using SCADA HMI. datatypes.
Eg. Functionality in Python:
• Standard library extension:
data_req=DATA_REQUEST(1, b"14/10/15 09:35", b"10/12/15 17:00",
In addition to above functionality provided, the
b"value_number")
standard python library (Time and String Functions) is retrieve_historical_data(byref(data_req))
also extended, which can be used by SCADA Engineer to
write display logic. In the above example DATA_REQUEST is the structure
defined in Scripting Engine. The value can be retrieved by
accessing the data member of the structure.
494
C. Automated Memory management person who is proficient with buffer management
For retrieving the historical data or alarm data using programmatically and well versed with socket programming.
conventional approach, the user has to delete the memory In addition, the user has to free the allocated memory space as
allocated to the data handling variable once it is given to UI the amount of data received in this type of communication is
screen component, as it will lead to memory leakage. huge. And the application is more prone to memory leakage.
Using the scripting engine approach, the memory is Eg. For sending SMS using conventional approach, the user
automatically deallocated at python-level, once the variable is will have to createFile, readFile and writeFile for comport
out of scope. The memory management at library level is using fileAPI and will have to extract the response received.
handled by the destructor of DATA_REQUEST. For doing the same task using Scripting Engine
## The destructor approach, the user can open COM port, send SMS and close
def __del__(self): COM port using a simple function.
lib.delete_obj.restype=None
lib.delete_obj.argtypes=[ctypes.POINTER(DATA_REQUEST)]
lib.delete_obj(self) Eg. Sending SMS using Scripting Engine:
The similar approach is implemented for all other
functions of Scripting Engine for automating memory i=openComport(3, 9600, "8N1")
sendSMS(i, "+91**********", "Message")
management, reducing the burden at user-side. closeComport(i)
495
Using the scripting engine approach, the user is not proficient in complex compiler-based language. The
concerned with the declaration of the datatype and can directly customization of application at user side is possible with the
use it. scripting language. Thus, the Scripting Engine helps in rapid
Eg. Python with Qt: development of SCADA and is far better than the
bIsChecked=self.ui. isPolling.isChecked() conventional approach of C/C++. As, all of the performance
critical tasks are managed at the library level, the performance
H. Performance of the resulting application is acceptable, balancing the best of
In [[4]], the performances of the different scripting both the languages (Compiler-based and Interpreter-based).
languages are compared with respect to Kilobytes lines of
code. In SCADA screen development using Scripting Engine
approach, the typical screen size can range from 4kB to 100
Acknowledgment
kB as only the business logic is scripted and rest of the The authors are thankful to Dr. Shubha Pandit, the
performance critical task are managed at the library level. Principal of K J Somaiya College of Engineering, Prof.
Thus, the drawback of Python being slow for real-time Bharthi Narayan, Head of Computer Department, Mr. Rahul
application development than compiler-based languages is Rane and Mr. Shishir Gupta from Larsen & Toubro
compensated. Automation, Navi Mumbai, for providing the opportunity and
The performance test has been done to check the necessary facilities for the preparation of the paper.
performance difference between the conventional approach
and Scripting Engine approach. To do this, 500 objects were References
created in Database of objectType Meter and all the objects of
that object type were retrieved on SCADA screen initialization [1] Hans Christian Woithe and Ulrich Kremer, "A Light Weight Scripting
and displayed on the screen. for the Slocum Glider", IEEE Oceans 2010 Conference, Sydney,
Australia, May 2010.
Table 2 Comparative analysis of Scripting Engine approach and [2] M. McLaughlin and M. Katchabaw, "A Reusable Scripting Engine for
Compiler based approach in terms of Performance Automating Cinematics and Cut-Scenes in Video Games", Proceedings
of CGSA 2006 Symposium.
[3] Milivoj Bozic, Dusan Zivkov, Istvan Pap and Goran Miljkovic,
"Scriptable Graphical user Interface Engine for embedded platform",
21st Telecommunication Forum TELFOR 2013.
[4] Mrunali Tandel, Prof. Uday Joshi and Amit Golhani, "Literature
Review: Scripting in Qt for Scripting Engine development",
International Journal of Computer Science and Information
Technologies, Vol. 7(3), 2016, 1242-1245.
[5] QiangXie, Jinfeng Liu and Pai H. Chou, "Tapper: A lightweight
Scripting engine for highly constrained wireless sensor nodes", IPSN
IV. CONCLUSION 2006.
The Scripting Engine for SCADA aims to provide a [6] SCADA (Supervisory Control and Data Acquisition),
http://whatis.techtarget.com/definition/SCADA-supervisory-control-
flexible solution to the SCADA development. As interpreter- and-data-acquisition
based language is used, there is no need for the compilation at [7] Scripting|Mono, http://www.mono-
user side, unlike the traditional approach where the object project.com/docs/advanced/embedding/scripting/
rendering and command interpretation was done using C/C++ [8] Qt Documentation, 2016, http://doc.qt.io/qt-5/index.html
language. The ease with which the scripting language is [9] PyQt Whitepaper, Riverbank Computing Limited,
adopted and learned is nowhere closer to the compiled www.riverbankcomputing.com, 2013.
language. Thus, the SCADA engineer need not be a person
496