7th 7th IFAC IFAC Symposium Symposium on on Mechatronic Mechatronic Systems Systems September 5-8, 2016. 2016. Loughborough Loughborough University, UK 7th IFAC Symposium Symposium on Mechatronic MechatronicUniversity, Systems UK 7th IFAC on Systems September 5-8, September University, UK September 5-8, 5-8, 2016. 2016. Loughborough Loughborough Available University,online UK at www.sciencedirect.com
ScienceDirect IFAC-PapersOnLine 49-21 (2016) 246–253
Embedded Embedded Embedded
SCADA SCADA SCADA
for for for
Small Small Small
Applications Applications Applications
∗∗ Marcos V. V. Scholl Scholl ∗∗ Carlos Carlos R. R. Rocha Rocha ∗∗ Marcos ∗ ∗ Carlos R. Rocha ∗∗ Marcos V. Scholl Marcos V. Scholl Carlos R. Rocha ∗∗ ∗ ∗ Federal University of Rio Grande (FURG), Rio Grande (RS), Brazil Federal University of Rio Grande (FURG), Rio Grande (RS), Brazil ∗ ∗ Federal University
[email protected]). Rio Grande Grande (FURG), (FURG), Rio Rio Grande Grande (RS), (RS), Brazil Brazil (e-mail: Federal University Rio (e-mail:of
[email protected]). ∗∗ (e-mail:
[email protected]). ∗∗ Federal (e-mail: Institute of Education, Science and Technology of Rio
[email protected]). Federal Institute of Education, Science and Technology of Rio ∗∗ ∗∗ Federal Institute Science and Grande do of SulEducation, (IFRS), Rio Rio Grande(RS), Brazil of Federal Institute of Education, Science and Technology Technology of Rio Rio Grande do Sul (IFRS), Grande(RS), Brazil Grande do Sul (IFRS), Rio Grande(RS), Brazil (e-mail:
[email protected]) Grande do
[email protected]) Sul (IFRS), Rio Grande(RS), Brazil (e-mail: (e-mail:
[email protected])
[email protected]) (e-mail:
Abstract: Abstract: This This work work presents presents and and analyzes analyzes the the design design and and implementation implementation aspects aspects of of an an open open Abstract: This work presents and analyzes the design and implementation aspects of an open source Supervisory Control and Data Acquisition software. Case uses of the software also Abstract: This work presents and analyzes the design and implementation aspects of an source Supervisory Control and Data Acquisition software. Case uses of the software are areopen also source Supervisory Control and Data Acquisition software. Case uses of the software are also discussed, mostly focusing in embedded computational platforms and microcontroller-based source Supervisory Control and Data Acquisition software. Case uses of the software are also discussed, mostly focusing in embedded computational platforms and microcontroller-based discussed, mostly focusing in embedded computational platforms and microcontroller-based prototyping boards. The main objective of this software is to provide a low cost, open source discussed, in embedded platforms anda low microcontroller-based prototypingmostly boards.focusing The main objective ofcomputational this software is to provide cost, open source prototyping boards. The main objective of and tool open source and users. prototyping boards. The main objective of this this software software is to to provide provide aa low low cost, cost, open open source source and extensible extensible tool for for open source and scientific scientific users. is and extensible extensible tool tool for for open open source source and and scientific scientific users. users. and © 2016, IFAC (International Federation of Automatic Control) Hosting by Elsevier Ltd. All rights reserved. Keywords: Keywords: Supervisory Supervisory control, control, Data Data acquisition, acquisition, SCADA SCADA software, software, Embedded Embedded systems, systems, SCADA software, Keywords: Supervisory control, Data acquisition, Process automation, Open source, Computer software. Keywords: Supervisory control, Data acquisition, SCADA software, Embedded Embedded systems, systems, Process automation, Open source, Computer software. Process automation, automation, Open Open source, source, Computer Computer software. software. Process 1. 1. INTRODUCTION INTRODUCTION 1. 1. INTRODUCTION INTRODUCTION Since Since its its beginning, beginning, industrial industrial automation automation rely rely on on SuperSuperbeginning, industrial Since its automation rely on Supervisory Control And Data Acquisition (SCADA) Since its beginning, industrial automation rely on Supervisory Control And Data Acquisition (SCADA) systems systems visory Control And Data Data Acquisition (SCADA) systems to monitor plants, gathering distributed sensor visory Control And Acquisition to remotely remotely monitor plants, gathering (SCADA) distributedsystems sensor to remotely monitor plants, gathering distributed sensor data. SCADA systems are also used to remotely to remotely monitor gathering sensor data. SCADA systemsplants, are also used todistributed remotely operate operate operate data. SCADA are used to the by commanding their From simdata. SCADA systems are also also usedactuators. to remotely remotely operate the plants, plants, by systems commanding their actuators. From simthe plants, by commanding their actuators. From simple telemetry software, SCADA evolved to enable more the plants, by commanding their actuators. From simple telemetry software, SCADA evolved to enable more ple telemetry software, SCADA evolved such to enable enable more features to plant automation, as ple telemetry software, SCADA evolved to more features to enhance enhance plant automation, such as history, history, features to enhance plant automation, such as history, alarms and event handling (Bailey and Wright, 2003). features to enhance plant automation, as history, alarms and event handling (Bailey andsuch Wright, 2003). alarms and handling 2003). The of technology alarms and event event handling (Bailey (Bailey and and Wright, Wright, 2003). The evolution evolution of information/communication information/communication technology The evolution of information/communication information/communication technology brought more to suchtechnology as digital digital The evolution of brought more resources resources to these these systems, systems, such as brought more resources to these systems, such as digital networks, database management systems (DBMS) brought more resources to these systems, such as digital networks, database management systems (DBMS) and and networks, management systems (DBMS) and web-based Human-Machine Interfaces (HMI). As networks, database management systems (DBMS) and web-based database Human-Machine Interfaces (HMI). As aa result, result, web-based Human-Machine Interfaces (HMI). As aa result, SCADA began other web-based Human-Machine Interfaceswith (HMI). Assoftware, result, SCADA systems systems began to to interface interface with other software, SCADA systems began to interface with other software, such as Enterprise Resource Planning (ERP), ComputerSCADA systems began to interface with other software, such as Enterprise Resource Planning (ERP), Computersuch asManufacturing Enterprise Resource (ERP), ComputerAided (CAM) and Mainsuch Enterprise Resource Planning (ERP), ComputerAidedas Manufacturing (CAM)Planning and Computer-Aided Computer-Aided MainAided Manufacturing (CAM) and Computer-Aided Maintenance systems, exchanging information with Aided (CAM) information and Computer-Aided MaintenanceManufacturing systems, exchanging with all all sectors sectors tenance systems, exchanging information with of enterprises (Boyer, 2009). tenance systems, exchanging information with all all sectors sectors of industrial industrial enterprises (Boyer, 2009). of industrial industrial enterprises enterprises (Boyer, (Boyer, 2009). 2009). of Besides its application in industry, SCADA software Besides its application in industry, SCADA software Besides industry, software started be used such building Besides its application inareas, industry, SCADA software started to toits be application used in in other otherin areas, such as asSCADA building automaautomastarted to be used in other areas, such as building automation, generation/distribution of energy, telecommunication started to be used in other areas, such as building automation, generation/distribution of energy, telecommunication tion, generation/distribution of systems and in in scientific scientific experiments. experiments. As an an alternative alternative tion, generation/distribution of energy, energy, telecommunication telecommunication systems and As systems and in scientific experiments. an to program from scratch, the SCADA software systems and from in scientific As an alternative alternative to program scratch,experiments. the use use of of As SCADA software to program from scratch, the use of SCADA software brings several benefits, such as the reduction of time/cost to program from scratch, the use of SCADA software brings several benefits, such as the reduction of time/cost brings several benefits, benefits, such as as the the reduction of ability time/cost of customizable IHM, and to brings several such reduction time/cost of development, development, customizable IHM, and the theof ability to of development, customizable IHM, the ability communicate with different hardware hardware using well-known of development, customizable IHM, and and thewell-known ability to to communicate with different using communicate with different protocols Wright, 2003). communicate withand different hardware using well-known well-known protocols (Bailey (Bailey and Wright,hardware 2003). using protocols (Bailey (Bailey and and Wright, Wright, 2003). 2003). protocols As automation applications grow in size/complexity, As automation applications grow in size/complexity, As automation applications grow in SCADA systems to in to As automation applications grow in size/complexity, size/complexity, SCADA systems need need to improve improve in order order to provide provide the the in order to provide the SCADA systems need to improve necessary features to them (McCrady, 2013). This SCADA systems need to improve in order to provide the necessary features to them (McCrady, 2013). This results results necessary features to to them them (McCrady, expensive 2013). results in demanding, necessary features (McCrady, 2013). This Thissystems, results in more more computational computational demanding, expensive systems, in more computational demanding, expensive systems, which are also complex to use in the supervisory systems in more expensive systems, which arecomputational also complex todemanding, use in the supervisory systems which are to in supervisory systems implementation. Eventually, adoption of in which are also also complex complex to use usethe in the the supervisory systems implementation. Eventually, the adoption of SCADA SCADA in the adoption of SCADA in implementation. Eventually, small-scale applications, such as scientific experiments and implementation. Eventually, the adoption of SCADA in small-scale applications, such as scientific experiments and small-scale applications, such as asdue scientific experiments and embedded is to factors. small-scale applications, such scientific experiments and embedded ones, ones, is restricted restricted due to these these factors. The The embedded ones, is restricted due to these factors. The embedded ones, is restricted due to these factors. The
Partially Partially supported supported by by the the Federal Federal Institute Institute and Technology of Grande do Partially supported the Institute Partially supported by the Federal Federal Institute and Technology of Rio Rioby Grande do Sul. Sul. and Technology of Rio Grande do Sul. and Technology of Rio Grande do Sul.
of of of of
Education, Education, Education, Education,
Science Science Science Science
growing growing adoption adoption of of low low cost, cost, open open source source hardware hardware platplatgrowing adoption of low cost, open source forms in these applications reinforces the limitation, not growing of low cost, open source hardware platforms in adoption these applications reinforces the hardware limitation,platnot forms in these applications reinforces the limitation, not only because of the usually low processing power, but also forms in these applications reinforces the limitation, not only because of the usually low processing power, but also only because of usually processing power, but due to to the different different operating systems. Though supervisory only because of the theoperating usually low low processing power, but also also due the systems. Though supervisory due to operating systems. Though applications could developed directly using traditional due to the the different different operating systems. Though supervisory applications could be be developed directly usingsupervisory traditional applications could be developed directly using traditional languages, the time and work costs are limiting factors. applications could developed directly traditional languages, the timebeand work costs are using limiting factors. languages, the time and work costs are limiting factors. Also, software development requires skilled programmers languages, the time and work costs are limiting factors. Also, software development requires skilled programmers Also, requires skilled which software are not not development always available, available, especially in the the Do Do It It Also, software development requires skilled programmers programmers which are always especially in which are not available, especially in Do Yourself community, which is which are(DIY) not always always available, especially in the theincreasDo It It Yourself (DIY) community, which is becoming becoming increasYourself (DIY) community, whichsuch is becoming becoming increasingly as new as of Yourself (DIY) which is increasingly relevant relevant as community, new technologies technologies such as the the Internet Internet of ingly relevant as new new technologies such as the the Internet Internet of Things (IoT) more accessible non-technical users. ingly relevant as technologies such as of Things (IoT) are are more accessible to to non-technical users. Things are to users. This was was(IoT) the motivation motivation to the the project project of an an open open source source Things (IoT) are more more accessible accessible to non-technical non-technical users. This the to of This was the SCADA This wassoftware. the motivation motivation to to the the project project of of an an open open source source SCADA software. SCADA software. software. SCADA The project was preceded by the development of the The project was preceded by the development of the MisMisThe was by development the sion Monitoring and System (MMCS) The project was preceded preceded by the the development of software, the MisMission project Monitoring and Control Control System (MMCS)of software, sion Monitoring and Control System System Interface (MMCS) (HMI) software, which aimed aa Human-Machine to sion and Control (MMCS) software, whichMonitoring aimed to to be be Human-Machine Interface (HMI) to which aimed to be a Human-Machine Interface (HMI) to an open source Unmanned Underwater Vehicle (UUV) which aimed to be a Human-Machine Interface (HMI) to an open source Unmanned Underwater Vehicle (UUV) an open source Unmanned Underwater Vehicle (UUV) platform for experimental research (Rocha and Scholl, an open source Unmanned research Underwater Vehicle platform for experimental (Rocha and (UUV) Scholl, platform for and 2014). was to the a platform for experimental experimental research (Rocha and Scholl, Scholl, 2014). MMCS MMCS was designed designed research to give give to to(Rocha the operator operator a way way 2014). MMCS was designed to give to the operator a way way to interact with different vehicle configuration/mission 2014). MMCS was designed to give to the operator a to interact with different vehicle configuration/mission to interact with different vehicle configuration/mission modes, from a teleoperated mission to an autonomous to interact with different vehicle configuration/mission modes, from a teleoperated mission to an autonomous modes, from aa teleoperated mission an one. it be kinds mission, modes, from teleoperated mission to to an of autonomous one. Since Since it could could be used used in in different different kinds ofautonomous mission, it it one. Since it could be used in different kinds of it should be configurable, provide different widgets and one. Since it could be used in different kinds of mission, mission, it should be configurable, provide different widgets and twotwoshould be configurable, provide different widgets and twoway communication with the vehicle. This characteristics should be configurable, provide different widgets and twoway communication with the vehicle. This characteristics way communication the vehicle. characteristics are to SCADA However, since way communication with the software. vehicle. This This characteristics are common common to most most with SCADA software. However, since the the are common to most SCADA software. However, since project used open source hardware such the are common mostsource SCADA software.such However, since the the project used toopen hardware the Raspberry Raspberry project used source hardware such the Raspberry Pi and Halfacree, Raspberry project used open source2014; hardware such Pi theFoundation, Raspberry Pi (Upton (Upton andopen Halfacree, 2014; Raspberry Pi Foundation, Pi (Upton and Halfacree, 2014; Raspberry Raspberry Pi Foundation, Foundation, 2013) and Arduino (McRoberts, 2013; Team, Pi (Upton Halfacree, 2014; Pi 2013) and and Arduino (McRoberts, 2013; Arduino Arduino Team, 2013) 2013; Arduino Team, 2015), and thereArduino was no no (McRoberts, SCADA software software available for the 2013) and Arduino (McRoberts, 2013; available Arduino for Team, 2015), there was SCADA the 2015), there was no SCADA software available for platform at that time. 2015), there wastime. no SCADA software available for the the platform at that platform at that time. platform at that time. A revision revision process process in in the the MMCS MMCS design design led led to to the the EmEmA A revision process the design led Embedded SCADA for Applications project, A revision process inSmall the MMCS MMCS design(ESSA) led to to the the Embedded SCADA for in Small Applications (ESSA) project, bedded SCADA for Small Applications (ESSA) project, as it was observed that the software could be generalized bedded SCADA for Small Applications (ESSA) project, as it was observed that the software could be generalized as it was observed thatother the software software couldwhich be generalized generalized to be used in applications required as observed that the could be to it bewas used in several several other applications which required to be in applications required similar features. Since other its beginning, beginning, ESSAwhich was intended intended to be used used in several several other applications which required similar features. Since its ESSA was similar features. Since its beginning, ESSA was intended to be open source, in order to ease its adoption for similar features. Since its beginning, ESSA was intended to be open source, in order to ease its adoption for the the to be open source, in order to ease its adoption for the the open source and scientific communities, and to stimulate to be open source, in order to ease its adoption for open source and scientific communities, and to stimulate open source and scientific communities, and to stimulate its evolution by extensions provided by these users, who open source and scientific communities, and to stimulate its evolution by extensions provided by these users, who its its evolution evolution by by extensions extensions provided provided by by these these users, users, who who
Copyright © 2016, 2016 IFAC IFAC 246Hosting by Elsevier Ltd. All rights reserved. 2405-8963 © IFAC (International Federation of Automatic Control) Copyright © 2016 246 Peer review© of International Federation of Automatic Copyright 2016 IFAC 246 Copyright ©under 2016 responsibility IFAC 246Control. 10.1016/j.ifacol.2016.10.559
2016 IFAC MECHATRONICS September 5-8, 2016. Loughborough University, MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253
can adapt the software to their specific needs. Rocha and Scholl (2015) presented the design aspects of ESSA. In this work, the implementation results of ESSA are presented along some use cases scenarios. The following section summarizes the analysis of features and structure of SCADA software. Next, design aspects are briefly presented, followed by a presentation of the software development. Examples and result are discussed in the following. Finally, conclusions are made. 2. UNDERSTANDING SCADA SOFTWARE Since MMCS had similarities with the SCADA software used in the industrial courses of the institutions where the initial project was developed, a study of the features present in some commercial and open source SCADA was conducted. Most of the selected software are also adopted by local industries. The results are summarized here. 2.1 Modules From the observation of how SCADA software was used, it was noted that there are three modules or operating modes related one to another, as shown in Fig. 1. These modules are the runtime, the client and the designer.
SCADA modules Runtime Co
nfi
Client
gu
Communicate
e
fac
re
/Te s
t
Design
r nte ni
sig
De
Fig. 1. Modules of a SCADA software(Scholl, 2015b) The runtime module is the backend of a supervisory application. It is responsible for the continuous communication with the remote hardware in order to acquire data and to send commands. Also, the acquired data is processed and stored by this module, which can also execute automatic responses to events defined by the application developers, such as to command plant equipment and to fire alarms. The client module is the frontend of the application, providing a human-machine interface (HMI). This interface usually consists of different screens where operators can monitor plant variables and took actions interacting with widgets that emulate physical panel controls. This module has to be in continuous communication with the runtime module to update the interface based on the tags and to send to the runtime module actions taken by operators. The design module is used to create and define SCADA applications. Developers use this module to define communication parameters with remote hardware, variables, alarms, events and scripts. Also, the HMI is defined by creating screens with widgets that are used to display data and interact with the user. As the application is developed, the design module can interact with the client and the runtime ones to simulate/test the application, to give the developer insights of problems that the application have and a preview of the user interface. 247
247
These modules can be part of a single, monolithic program, or they can constitute different software per se, as servers (the runtime module), clients and in combinations where different runtime modules can work cooperatively to exchange information regarding the parts of the plant each one supervise, while different types of client modules provides the user experience according to the devices used. The design module is not usually required in the supervisory operation, being an independent feature that only the application developer/integrator of the automation system uses. 2.2 Components Supervisory applications run simultaneously in the runtime and client modules, since they have to communicate with the remote hardware and to present HMIs to users. These applications are created by integrating different specialized components provided by the SCADA software. Most of these software have similar components, which can be classified as follows. Tags These components store data in memory, which may be acquired from remote hardware or be defined/calculated by the application. The term is related to the instrumentation area; Drivers Loadable modules that handle data exchange between a SCADA application and remote hardware as Programmable Logic Controllers (PLCs) or microcontrolled devices. Each driver processes a specific communication protocol, and must be selected according to the one the remote hardware use. Usually, a driver component is connected to one remote hardware and linked to multiple tags, handling transparently the data synchronism between them; Data storage Persistent data storage is needed to keep the history of the plant operation. Data storage components are used to store tags values and event occurrences along with timestamps in storage media, using single files or interfacing with DBMS (Database Management Systems); HMI Different types of components fit in this class. Screens are the main type, representing what will be displayed in the user interface. Panels and boxes are other containers used to arrange widgets into an intuitive, friendly user interface. These widgets display data in textual or graphical form, sometimes emulating the appearance/behavior of physical instruments and commands. In the latter case, they are used to interact with the plant. Usually, active widgets are linked to tags in order to keep the first updated as data change values. Also, this link can be used to send commands to the remote hardware reflecting the user interactions; Alarms These are used to automatize the monitoring of tags. An alarm is usually defined by a tag and a condition based on this tag. When the condition is satisfied, the alarm can fire events or display messages in the user interface. Also, alarms can generate log entries to the data storage; Scripts Although the usual components deal with most cases needed in a supervisory application, most SCADA software provide a script language interpreter to implement complex actions, usually based on an existing
2016 IFAC MECHATRONICS 248 MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253 September 5-8, 2016. Loughborough University,
programming language. This actions are executed based on the occurrence of events. Fig. 2 shows how these components are related in an typical SCADA application. The results of this study and the definition of the hardware platform guided the design choices of the ESSA project.
Users
Client Web/Mobile
Desktop
From this list, it was noticed that the development should consider modular components, which should have clearly defined interfaces to allow them to be easily connected when creating an application and to be replaceable when needed with minimal modifications to the entire application configuration. This led to the adoption of an objectoriented approach to the conceptual design process.
HMI Scripts
Files
Data Storage
Tags
• Basic component set, since it should provide at least tags, drivers and data storage; • Visually resourceful, to enable developers to create interactive, intuitive HMI, there must be widgets that can present data not only textually, but also in graphical representations, preferably resembling actual instruments used in plants; • Support to different communication protocols, since different remote hardware can be monitored. At least commonly used protocols, such as Modbus (Modbus Organization, 2014) should be natively supported; • Extensible, allowing users to easily create and incorporate their own components to adapt the software to their needs, and in doing so, evolving it.
The class diagram shown in Fig. 3 illustrates the structural design devised to ESSA. It was based in the components identified in the previous study, and further analysis of how to implement modular components as objects. Only the classes necessary to the understanding of the conceptual design of ESSA are visible in this diagram.
Alarms
DBMS
Drivers Runtime
PLCs
Microcontrollers
Data Acquisition Systems
Fig. 2. SCADA components and their relationship in a typical application. 3. DESIGN ASPECTS The main objective of the ESSA project is to provide a SCADA software for embeddable and scientific applications. The software should be able to run in microcomputers and also in low power computational platforms such as the Raspberry Pi or the Beaglebone Black (Kridner, 2016), to mention some of the single-board computers based on the System-on-a-Chip (SoC) hardware. Also, it should be able to communicate not only with industrial remote hardware, but with microcontrollers and related boards such as the Arduino and the NodeMCU (NodeMCU Team, 2014). System requirements were defined based on the description above and the previous SCADA study. These can be summarized as: • Low demanding, since it should run in single board computers with low processing power; • Multiplatform, due to the different operating systems that the target computational platforms run, such as Linux, MacOS and Microsoft Windows; 248
Fig. 3. Conceptual class diagram of ESSA
2016 IFAC MECHATRONICS September 5-8, 2016. Loughborough University, MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253
The main class of an application is ESSA. It is a container for the application components and manages the execution lifecycle. In the same package, the Script class serve to store a script code, which is executed when the associated event occurs (instances of the Event class). The data package contains the Tag class, which is the base to specialized classes according to the source of the data it represents (from an external device or managed internally by the application). The Scan class manages the update scan cycle of a tag, in case of external hardware linked ones. To simulate variable changes in external devices, there is the Generator class which is specialized according to a particular time function (for instance, a sinusoidal one). The Adapter class is used to associate a Tag instance to a widget, and to modify the tag property value to the data type/range supported by the widget. User interface is defined by instances of the Screen class, which is a container for instances of Widget derived classes. This class defines the interface for derived classes which provide different visual presentations for data and ways to modify it from the user interface. Widgets must be data-aware, which means that they must update their presentation as it is notified of a value change in a tag property by an Adapter instance. The Link class represents the components which deal with remote hardware data exchange, defining the interface for derived classes, each one specialized in a communication protocol. One example of these derived classes is the ModbusLink, which deals with the Modbus communication protocol. Other protocols can be encapsulated by Link derived classes. To store data, two classes were devised, the Log and the History. The first is mainly used to register events and alarms in files, while the second is used to store tag values in databases. It is possible, however, to use Log instances to register tag property values in files. Finally, Alarm instances are used to continuously monitor tag values based on conditions which will fire Event instances when they are satisfied. Alarms events are logged and generate visual notifications which must be dismissed manually by the user in order to avoid unseen/unnoticed log messages.
249
Qt was chosen as the GUI (Graphical User Interface) due to its cross-platform features and its solid, well-structured object-oriented API (Application Programming Interface) (The Qt Company, 2016). A specialized Qt-based API called Qwt (Qt Widgets for Technical Applications) was also used to provide several widgets similar to physical instruments (Rathman and Wilgen, 2014). Qt is written in C++, but there are bindings for other languages, and this project used the PyQt one (Summerfield, 2007; Riverbank Computing, 2015). The Matplotlib API was used for plotting graphs based on the tags history (Hunter, 2007). The use of Qt as GUI simplified the development, since its classes provided almost every feature defined for the HMI package in the conceptual model of ESSA. So, the Screen and Widget classes were replaced by equivalent Qt/Qwt classes. Also, they are relatively easy to extend, and this resulted in some particular widgets created for ESSA. Fig. 4 depicts some of the widgets based on Qt, Qwt, Matplotlib and extended for ESSA. Other feature of Qt is Qt Designer, an application to graphically create user interfaces. Using simple modifications in its configuration files, Qt Designer recognized ESSA widgets and could be used to create ESSA screens. This is illustrated in Fig. 5, where a screen for an ESSA application is created in this software. In this first version of ESSA, the focus was in the runtime and the client modules, since they are the ones required to run an SCADA application. The adoption of Qt Designer as a development tool for ESSA applications provided some designer modules features in this initial version. XML (exTensible Markup Language) was chosen to describe ESSA applications (Bray et al., 2006), because of its structure, extensibility and the fact that Qt Designer already uses it for describe the screens. Also, there are several libraries that parse XML text, such as the ElementTree, which was used in ESSA to read/write XML files (Ogbuji, 2007). Regarding communication protocols, it was decided that the first version should deal with an open industrial protocol and at least one protocol suited for microcontroller prototyping boards (Arduino, in particular). Modbus was the first protocol to be considered, and among several implementations, minimalModbus was chosen to create
4. SOFTWARE DEVELOPMENT ASPECTS Since one of the ESSA fundamentals is to be open source, the choice of the development platform should consider this factor. Also, it should be multiplatform and allow that the applications should run with minimal (or none) modifications in different operating systems. Other factors include availability of libraries related to the software requirements and an active, large knowledge base. This led to the choice of Python as the primary programming language/environment (Lutz, 2013; Python Software Foundation, 2016). Python is a dynamic language, which has several libraries focused in scientific applications, graphical user interfaces (GUIs) and vast contributions of the user community, along with strong support of software companies. 249
Fig. 4. Some of ESSA widgets for creating user interfaces
2016 IFAC MECHATRONICS 250 MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253 September 5-8, 2016. Loughborough University,
the input from keyboard/trackball. This unit communicates with UUVs by TCP/IP network, using the built-in Ethernet support of Raspberry Pi in both ends (Rocha and Scholl, 2014). To test the data acquisition, the original assembly was modified to include the Inertial Measurement Unit (IMU) which would be mounted on the UUV in order to test the acquisition of analog and digital signals. Fig. 6 presents the MMCS unit with the incorporated IMU. Raspberry Pi
LCD Display
Fig. 5. Using Qt Designer to create ESSA screens the ModbusLink class, due to its simplicity and protocol coverage (Berg, 2015). For microcontrollers, Firmata was chosen, and the pyFirmata library was used to create the FirmataLink class (de Bruijn, 2015). To continuously synchronize tags with the remote hardware, a scan cycle mechanism had to be implemented, regarding that different tags could have different scan interval needs and that the communications could be slow. The scan cycles should not block the user interface, and to avoid this, ESSA uses a multithread approach, which was easily implemented with Python’s native implementation based on the threading library (Python Software Foundation, 2014). In this version of ESSA, DBMS support was not implemented. However, tag history and alarm messages were stored in text files using the logging native library (Python Software Foundation, 2015). This library provided a flexible, versatile event logging system that was needed for alarms and to store tag values every scan cycle. It must be observed that this first version of ESSA was developed as a final term work for one of the authors, with time limitations, which was the reason that some of the conceptual model definitions were not implemented. However, this limitations did not compromise the software basic functionality, as it is demonstrated in the use cases discussed in the next section. 5. EXAMPLES
Keyboard IMU
Arduino Analog signals
Fig. 6. MMCS embedded hardware The IHM was recreated using Qt Designer, duplicating the original interface created for the MMCS project. An attitude indicator (or artificial horizon) and a compass widgets were used to show data from the IMU, which was represented by tags linked to a FirmataLink object. Other widgets were used to show tags that would be synchronized with the remote hardware in the UUV by TCP/IP network. Since this is not yet supported in ESSA, this data is simulated by generator instances. The application was defined in the respective XML file using a text editor. Besides identifying the screen file, the application file describes the communication objects, tags, adapters and their associations. Part of the application is shown in Listing 1. Listing 1. Excerpt from the MMCS configuration file
To illustrate the use of ESSA in small applications, two examples are discussed, both using Arduino as a Remote Terminal Unit (RTU)/data acquisition board. The supervisory application, however, run in different computational platforms/operating systems. 5.1 Refactoring the MMCS One of the first applications to test ESSA functionality was a reimplementation of the Mission Monitoring/Control System, which was the inspiration to the present work. The MMCS software should run on microcomputers running Windows or Linux, or in a dedicated embedded hardware to be used in the field. This hardware is composed by a Raspberry Pi running Raspbian (a Linux distribution for this platform) and an Arduino Nano to acquire analog signals from joystick and potentiometers, complementing 250
xml version = ’ 1.0 ’ encoding = ’UTF -8 ’? > < essa > < install path = " / home / scholl / essa / " > install > < logs path = " / home / scholl / essa / logs / " > logs > < window name = " MMCS . ui " > window > < scan > 0.1 scan > < comunications > < comm type = " Arduino " > < name > commArduino name > < port >/ dev / ttyS0 port > < baudrate > 115200 baudrate > comm > comunications > < tags > < tag name = " tagIMU " id = " 1 " > < scan > 0.1 scan > < provider > ArduinoLink ( board = commArduino , pin = " a:0:i " ) provider > tag > tags > < adapters > < adapter type = " A d a p t e r C o n t i n u o u s " name = " AttIndic " id = " 1 " > < widget > d i a l A t t i t u d e I n d i c a t o r widget >
2016 IFAC MECHATRONICS September 5-8, 2016. Loughborough University, MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253
251
The boiler temperature simulated by the potentiometer is shown in a thermometer and in a LCD widgets. Also, when the temperature rises above 200o C , an alarm is fired displaying visual notification, as it can be seen in Fig. 9. The application runs in a microcomputer using Microsoft Windows as operating system.
< widgetProprier t y > value w i d g e t P ro p r i e r t y > < tag > tagIMU tag > < tagProprierty > value tagProprierty > adapter > adapters > essa >
After the description is complete, it is sufficient to create an ESSA instance in Python loading the XML file, as shown in Listing 2. Listing 2. Excerpt from the MMCS configuration file # -* - coding : utf -8 -* from runtime import ESSA scada = ESSA ( ’/ home / scholl / essa / config / mmcs . xml ’) scada . start ()
Fig. 7 presents the resulting supervisory application, which is a close approximation of the original MMCS IHM, including the execution.
Fig. 9. ESSA communicating with the hardware
Fig. 7. ESSA version of the MMCS IHM 5.2 Demonstration of ESSA widgets using Arduino
2
Listing 3. Excerpt of the Arduino demonstration configuration file
VIN
RESET
D0/RX
RESET2
D1/TX
AREF
D2
ioref
D3 PWM
A0
D5 PWM
A1
D6 PWM
xml version = ’ 1.0 ’ encoding = ’UTF -8 ’? > < essa > < install path = " / home / scholl / arduino " > install > < logs path = " / home / scholl / arduino / logs / " > logs > < window name = " H M I _ I n d u s t r i a l _ P l a n t . ui " > window > < scan > 0.1 scan > < comunications > < comm type = " Arduino " > < name > commArduino name > < port >/ dev / ttyACM0 port > < baudrate > 9600 baudrate > comm > comunications > < tags > < tag name = " t a g P o t e n t i o m e te r " id = " 1 " > < scan > 0.1 scan > < provider > ArduinoLink ( board = commArduino ,
D4 1
3
A2 A3
Arduino Uno (Rev3)
D7 D8
A4/SDA
D9 PWM
A5/SCL
D10 PWM/SS
LED
R2
5V
3V3
In order to test most of ESSA features using a simple hardware use case, a second example using Arduino was devised. A LED was used to indicate the intensity of a actuator (in the simulation, a heater), while a potentiometer supplied the input signal simulating an analog temperature sensor. Fig. 8 shows the schematics.
The IHM presents other widgets, as a plotter, two different dials, a slider and a button. The plotter is linked to a tag using a sinusoidal generator to simulate data acquisition from a remote hardware. The dark dial is linked to another simulated data tag, with a different function generator. The light dial is linked to the tag associated to the LED brightness in Arduino (using an 8 bits PWM signal), and the tag is linked to the slider, which is used to change the brightness. The button starts/stops the scan cycle, as so pauses the application. In the top right corner of the screen, there is an alarm indicator which is green in normal operation and turns red when an alarm is fired and not acknowledged. Part of the application is described in Listing 3.
D11 PWM/MOSI D12/MISO D13/SCK
R1
1
GND
N/C
2
Fig. 8. Hardware diagram 251
2016 IFAC MECHATRONICS 252 MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253 September 5-8, 2016. Loughborough University,
Also, the project is entering in a full revision process, in order to better define some features, add new ones, and to fix errors/performance issues observed in its first version.
pin = " a:0:i " ) provider > tag > < tag name = " tagLed " id = " 2 " > < scan > 0.1 scan > < provider > ArduinoLink ( board = commArduino , pin = " d:9:p " ) provider > tag > tags > < adapters > < adapter type = " A d a p t e r C o n t i n u o u s " name = " Adapter01 " id = " 1 " > < widget > d i al Bo i le rV al u e widget > < widgetProprie r t y > value w i d ge t P r o p r i e r t y > < tag > tagPotenti o m e t e r tag > < tagProprierty > value tagProprierty > adapter > adapters > < alarms > < alarm > < name > AlarmeBoiler name > < tags > tagPotent i o m e t e r tags > < type > maxmax type > < value > 200 value > < lifeGui > 15 lifeGui > alarm > alarms > essa >
It is considered that this is a contribution to the academic and open source communities that need a simple but complete tool to monitor their hardware. Being an open source project is a way to further contribute, since users can adapt the software to their needs and also create new components that will aid the software to evolve and to be shared to other users. The software is freely available at a repository (Scholl, 2015a). REFERENCES
The application source code in Python is almost identical to the one of the MMCS example, just changing the name of the configuration file. This illustrates the flexibility of ESSA to create a supervisory application. 6. CONCLUSION This work presented ESSA, an open source SCADA software focused on small and scientific applications which run not only in conventional microcomputers, but also in embeddable, low power computational platforms. The design and implementation aspects of the software were presented, with some examples of its use in applications where Arduino is used as the remote hardware. The project started as a final term work of one of the authors, contributing to the study of industrial software design. Also, it can be used as example of several APIs used in scientific systems, since its source code is open. Due to time limitations, some of the desired features were not implemented. However, the available components allow one to build supervisory applications for different types of hardware. The lack of a designer module is compensated in part by the use of Qt Designer, along with code templates that can be modified using a text editor. It was observed that the software runs with similar performance in different computational platforms, including embedded ones, at least for the cases it was used so far. This result indicates that these embedded computers have the potential to replace PC-based supervisory applications. As such, it can reduce costs to experimental research. Also, it enables integration to the experimental plants, where the HMI can be directly available in the equipment with touch displays, or remotely by a mobile/web interface. ESSA is considered a work in progress, though it is ready for basic usage. Further testing is required, using different remote hardware such as Programmable Logic Controllers (PLC), for instance. Since Modbus is supported by ESSA, using it for more robust applications would be intuitive. 252
Arduino Team (2015). Arduino uno. URL http://arduino.cc. Bailey, D. and Wright, E. (2003). Practical SCADA for Industry. Newnes - Elsevier, Amsterdam. Berg, J. (2015). Minimalmodbus. URL https://minimalmodbus.readthedocs.org. Boyer, S.A. (2009). Scada: Supervisory Control And Data Acquisition. International Society of Automation, Research Triangle Park, NC, 4th edition. Bray, T., Paoli, J., Sperberg-McQueen, C., Maler, E., Yergeau, F., and Cowan, J. (2006). Extensible markup language (xml) 1.1. URL http://www.w3.org/TR/xml11. de Bruijn, T. (2015). pyfirmata. URL https://github.com/tino/pyFirmata. Hunter, J.D. (2007). Matplotlib: A 2d graphics environment. Computing In Science & Engineering, 9(3), 90– 95. Kridner, J. (2016). Beagleboard.org - black. URL http://beagleboard.org/black. Lutz, M. (2013). Learning Python. O’Reilly Media, Sebastopol, CA, 5th edition edition. McCrady, S.G. (2013). Designing SCADA Application Software. Elsevier. McRoberts, M. (2013). Beginning Arduino. Apress, New York, 1rd edition edition. Modbus Organization (2014). The modbus organization. URL http://modbus.org. NodeMCU Team (2014). Nodemcu - an opensource firmware based on esp8266 wifi-soc. URL http://nodemcu.com/index en.html. Ogbuji, U. (2007). Python and xml. In xmlPrague: A conference on XML, 53–54. Charles University, Prague. Python Software Foundation (2014). threading higher level threading interface. URL https:// docs.python.org/2/library/threading.html. Python Software Foundation (2015). logging logging facility for python. URL https:// docs.python.org/2/library/logging.html. Python Software Foundation (2016). About python. URL http://www.python.org/about. Raspberry Pi Foundation (2013). Raspberry pi - an arm gnu/linux box for $25. URL http://www.raspberrypi.org. Rathman, U. and Wilgen, J. (2014). Qwt qt widgets for technical applications. URL http://qwt.sourceforge.net. Riverbank Computing (2015). Pyqt - what is pyqt? URL http://www.riverbankcomputing.co.uk/software/ pyqt/intro.
2016 IFAC MECHATRONICS September 5-8, 2016. Loughborough University, MarcosUK V. Scholl et al. / IFAC-PapersOnLine 49-21 (2016) 246–253
Rocha, C.R. and Scholl, M. (2014). Design aspects of an open platform for underwater robotics experimental research. In Proceedings of the 14th Mechatronics Forum International Conference, Karlstad, Sweden, 318–325. Karlstad University, Sweden - Karlstad. Rocha, C.R. and Scholl, M. (2015). Conceptual design of an open source scada system. In Proceedings of the 25th International Conference on Flexible Automation and Intelligent Manufacturing - FAIM 2015, volume 2, 182– 189. University of Wolverhampton, The Choir Press, Wolverhampton. Scholl, M.V. (2015a). Embeddable scada for small applications. URL https://github.com/marcosscholl/essa. Scholl, M.V. (2015b). Open Source SCADA System - Sistema SCADA Open Source. Final course monography, Rio Grande(RS), Brazil. Summerfield, M. (2007). Rapid GUI Programming with Python and Qt. Pearson Education, Indiana. The Qt Company (2016). Qt-home. URL http://www.qt.io. Upton, E. and Halfacree, G. (2014). Raspberry Pi User Guide. Wiley, West Sussex, 3rd edition.
253
253