In this section, the conceptualization of creating an SCADA-IoT architecture based on the Node-RED platform is exposed. A case study inquiring the software architecture, the configuration and implementation of the specific components, as well as the network linking them together, will be interpreted afterwards.
2.1. Concept and Architecture
The concept of IoT expands the already existing vision of traditional SCADA, by embedding diverse material components in information systems linking them to digital representations, providing the ability to collect and transfer data, in real-time, over a multitude of different protocols. As SCADA is built on the main principles of assuring real-time information monitoring and the control of processes, the notion of IoT caters to the interoperation and integration of contemporary modules and services that facilitate data aggregation, as well as archiving historical data in order to ensure analytics of it, which permit a wider understanding regarding the meaning of the acquired information. Mainly, an integrated architecture of SCADA with an IoT platform encompassing a diversified amalgamate of network protocols allows for the achievement of a comprehensible quality of production.
Preliminary to creating an IoT-based SCADA application, ensuring the integrity of the data collected, as well as an efficient streaming mechanism, represent the foundation of it. Since an IoT solution implies the existence of multiple devices and services, acquiring values from them depends upon certain communication protocols that facilitate data transmission. The authors’ perspective for the proposed IoT-based SCADA system is that it has to assure communication protocols and platform independency with respect to the cost issue.
In the sense of the physical support, some of the frequently used communication technologies include: ETHERNET, RS232/RS485, universal serial bus (USB), Wifi, Global System for Mobile Communications (GSM), etc. These options comprise parts of actual solutions urged by the contemporary industries that adopt IoT implementations. Ethernet represents a high-speed and reliable connection method, often utilized in different sectors of industries. It offers a less vulnerable option for disruptions, alongside an inexpensive alternative to other cable mediums. Its popularity was sustained through technological advancements, because of the backward compatibility it provides. RS232 fundamentally constitutes a transferring standard, remarked by its simplicity, frequently used in point-to-point connections, which is resistant to noise. It is not efficient regarding the transmission speed when distances are relatively long, nor price-wise due to its requirement of separate transceiver chips, as well as convertors. In the case of short transmission distances, the most favorable solution would be the Bluetooth Low-Energy protocol, which combines the conventional Bluetooth designation in addition to lower power consumption. The core of the proposed SCADA solution is based on Node-RED. The Node-RED IoT environment is platform-independent and therefore it can run on various operating systems. Various hardware platforms are able to handle Node-RED, including some with preinstalled environments, for instance Raspberry Pi, IoT 2040, etc. Therefore, the physical support assurance is an easy issue with the variety of hardware modules and their networking possibilities.
The important issue is the interfacing with devices, basically to have communication protocols both for the new and old/legacy systems. The automation and industrial world is still full of legacy systems, because of the long-lasting functionality and sometimes the inability of the companies to change the legacy systems from grounds. Therefore, starting from serial protocols as Modbus, Canopen, Profibus, etc., and continuing with Ethernet-based protocols as Modbus TCP, Profinet, Ethernet/IP, etc., the SCADA system has to assure their availability in order to obtain a wide applicability. Node-RED is an open-source, nodes and flows-based environment that is continuously augmented with various nodes. In the beginning, Node-RED was conceived as an IoT environment, but with the occurrence of industrial interfacing, it moved to being an IIoT environment. Many serial and Ethernet-based legacy protocols exist in Node-RED. All of the above-mentioned interfacing nodes vigorously subsist in Node-RED, and the system is continuously growing.
Regarding older SCADA interfacing, classic OPC DA is also available in Node-RED (node-red-contrib-opc-da), assuring basically the ability for Wrapper and Gateway implementations in Node-RED, that allow moving from older protocols towards new and efficient ones, assuring the interoperability of systems (e.g., studies from [
13,
14]). New protocols from various OSI levels are present in Node-RED. OPC UA has been present for a long time now, evolving constantly and enlarging its possibilities. An OPC UA client can be used to connect to devices for data integration and an OPC UA server is utilized for higher level data integration, or for interoperation with same level devices that extract exposed data. The new Sparkplug B is also present, assuring the connection with other Sparkplug B devices using MQTT transport protocol. Sparkplug B assures connection with Ignition devices (Edge or Vision based devices). MQTT represents a universal transfer protocol that provides a simple and lightweight method of passing messages, its small code footprint constituting a primary advantage, alongside a bandwidth usage that permits remote connections to rapidly exchange data between clients, thus making it an efficient transfer protocol commonly used in IoT applications for high-level entity interaction. An MQTT node is present in Node-RED, allowing Mosquitto-based data communications. In addition, AMQP nodes are present, assuring together with MQTT, the communication to the cloud. The connection to the cloud is also possible (e.g., nodes for Azure, AWS—Amazon Web Services), but Node-RED developed its own cloud version that hosts Node-RED, Front End Node-RED (FRED). Adopting cloud services for IoT-based solutions is a very important aspect of data centralization and management, in order to guarantee the safe, efficient and fast delivery of it. Distinct integrations of cloud-hosted systems, apace with profiling wireless transmission protocols, ensure fair operational costs and minimal requirements of the network.
As an IoT platform generally archives historical data for future analytics, a storage methodology is to be implemented into the infrastructure of the system. In regard to data handling in the IoT sector, choosing a database that offers the right capabilities represents an aspect of high importance, in any given context. These capabilities refer to scalability, portability, efficiency when it comes to writing, compressing and accessing stored data, information security and relative costs of the implementation. Regarding database connection and usage, Node-RED allows connecting to various databases, starting from MSSQL, MySQL, SQLite, PostgreSql, Oracle, etc., and continuing with time-series databases as the newer InfluxDB. Although classic SQL relational databases can be utilized to satisfy the competitive medium of contemporary developments, more optimized options are represented in today’s sector of network solutions. Usually, a time-based storage system is more efficient in regard to depositing and manipulating new data, as it allows for rapid logging and accessing of the data. In Node-RED, being a modular and highly customizable environment, the logging, archiving and reporting, which are very specific to SCADA, can be realized with a complete know-how of a software developer, even on the integrator level. However, tools such as Grafana are also available for easy customizing database manipulation and graphical representations of data within the visual dashboard (also a very important feature in SCADA). Node-RED provides the possibility of developing a dashboard which emulates the monitoring SCADA component.
Thereby, regarding a cost-benefit balance, it would be difficult to identify shortcomings related to classic SCADA systems. Regarding the multiple connectivity options to devices and services, the modern modular approach and scripting, as well as the possibilities of data analyzing and manipulation, are providing many more options than other SCADA systems. Moreover, in the authors’ opinion, Node-RED represents the environment with one of the highest potentials for IoT/IIoT, and follows the proposed conceptual approach with a high rate increase for SCADA solutions. Basically, the entire SCADA project will be exposed through flows that can be exported as .json files. The flow-based guiding concept offers a high technological readiness level (TRL) and allows the easy identification of tags, objects, data vehiculation, etc. Therefore, it can be rapidly accepted by SCADA integrators.
2.2. Case Study
In the process of implementing the Node-RED-based SCADA solution, it is mandatory to select a specific protocol that permits data transfers through the network of components. A primary key is determining the appropriate protocol for the desired result of communication. The advantages and disadvantages of each communication protocol should be taken into consideration, as they differ in their utility, transmission rate and distance. In the IoT context of development, wireless communications are the preliminary solution regarding data transmission. Prior to determining the most suitable protocol for data transference, the background in which it will be employed should be taken into consideration, as some factors such as power usage, network bandwidth and range require different configurations. Due to the fact that scalability is of high importance in the development of a SCADA-IoT integration, refinement of the interoperable network represents a part of the criteria that determines the possibility of adaptability for future directions of expansion, as usage scenarios can be predetermined for a finite number of cases. To satisfy the imposed requirement, IoT platforms should allow for such new integrations at any given time, not affecting the initial integrity of the system, nor inquiring risks. Adaptability solicits a vast diagram of usage scenarios, as numerous devices require different operating abilities. Other facilities that should be granted by a communication network developed in the context of IoT are efficiency, with the aim to employ technologies able to handle the real-time nature of such systems, and security.
The architecture of the implemented functional case-study SCADA system based on Node-RED is depicted in
Figure 1. The structure will be presented with regard to its modules and components in the following paragraphs. The chosen protocol was the widely spread Modbus TCP, but it could have been any other protocol. In the case study, the data originate from a PLC (in this case, all the logic and hardware components are being simulated), and is read via Modbus TCP/IP inside the core, which is represented by the Node-RED fraction of the application. Node-RED processes the raw data and provides the insertion of the resulted time series in the database, into the determined measurement. Grafana performs timed queries on the data source provided, ensuring the visualization of metrics. Afterwards, the panels that ensued from the dashboard are imported into the user interface from Node-RED to assure a single useful monitoring medium. The MQTT broker redirects all the published messages to all subscribed clients. Lastly, an important segment is constituted by the two selected clients utilized in favor of testing the communication resulting from the network created by the multiple entities.
In the supervised process within the SCADA solution, the logic on which the application is developed is as follows: two motors can be controlled through a PLC using two digital inputs as the switches that turn them on/off (the off state is set to 0, while on is defined by 1), an analogical input that sets the revving of motor 1 with values in range of 0–100%. Both motors have distinct values at which they are considered damaged: for motor 1, the values are designated to be 0–3, with 0 indicating there is no alert to deal with, whereas values 1–3 mean that there is either an over-current, an over-temperature or both issues. The total number of damage values that were registered for motor 1 is stored in a registry. Motor 2 has a general damage alert set at value 1. With reference to the speed of motor 1, depending on the read percentage, a certain state will be assigned to the registry in question. These states are set from 0–4 in the following format:
The previously specified parameters are assigned to the subsequent registries:
address 40001-tag 1—Revving of motor 1
address 40002-tag 2—Total number of damage values that were registered for motor 1
address 40003-tag 3—On/off switch value for motor 1
address 40004-tag 4—On/off switch value for motor 2
address 40005-tag 5—Damages that intervened for motor 1
address 40006-tag 6—Motor 2 general damage
address 40007-tag 7—State of motor 1
Using the logic described above, a Modbus TCP/IP protocol simulator was used to recreate the required environment for further development of the IoT network. Any application that can simulate the necessary configuration of the Modbus TCP/IP protocol will achieve the imposed requirements. Therefore, it was chosen to continue the implementation using Mod_RSsim, which can successfully accomplish all conditions. The Modbus simulator was used because of the current worldwide issues that did not allow the authors to test and validate the developments until the last moment. However, the developments were also validated in laboratory using Siemens stands based on S7-1214C PLC where a Modbus TCP server was implemented, Scalance switches, Teltonika 4G routers, Siemens motors, frequency converters, encoders, etc.
The accumulation of data collected from the characteristic registries is to be stored in a database. Considering the predicaments promulgated by the IoT domain, InfluxDB was elected by virtue of its capacity to write and access data in a very small amount of time. Instead of the classic database, where the information is stored in tables, InfluxDB approaches a different method of storing data, inside measurements. A measurement consists in a record that has a timestamp which is granted to every series written. As it incorporates continuous queries, as well as a retention policy system, both of which enable the maintenance of data, this database can be utilized at adequate performance, even after a period of time. In this manner, a two hours default retention policy was defined in the database, meaning that stored series will be kept for an interval of two hours. A second retention policy was required for gathering compressed data, the result of a continuous query that calculates the average of fields in the measurement every 30 minutes, which lasts the equivalent of a year, meaning 52 weeks.
In order to enhance the visualization of metrics, Grafana, the open source software capable of analyzing data and creating graphics and alerts that can be embedded, was employed for the purpose of further expanding the possibility of monitoring data in a single interface. Certain settings were called with the aim of encapsulating the visualizations created: it was necessary to allow embedding in Grafana’s settings, as well as anonymous access (since the purpose of this implementation is the usage of protocols and the construction of an IoT network that allows intercommunication, security was not addressed in a detailed manner). Furthermore, to concede the connection from either device to the constituents of the dashboard customized in Grafana, port 3000 was forwarded. To access the series stored inside the database, the data source of the newly created dashboard was set to InfluxDB that runs on the local server, resorting to port 8086, by selecting the corresponding name of the database and the measurement. Moreover, choosing to add a new panel in the desired dashboard in Grafana will allow selecting a visualization method for the retrieved data. Every visualization panel provides a specific set of features that can be modified to meet the necessities of the implied application. In this case, the dashboard consists in seven visualization panels with the following queries: four of the mentioned panels have queries that fetch data from the measurements in regard of setting up a graph that allows monitoring of revving speed and number of occurring damages, two of the panels display the total number of alerts and current revving of motor 1, while the final one reveals alerting rules and current situation for both motors. The creation method was identical for all the panels, excepting the select statements. The only differences consist in the chosen method of visualization, in addition to the exhibited information.
For further developing the project, setting up a MQTT broker comprises a cardinal stage. Hence, the broker will be represented by a Mosquitto broker, since it allows additional extension of the final result. Mosquitto is an open source MQTT broker, suitable for the build-out of this system. As clients utilized for testing purposes, two applications, MQTT.fx for Windows operating system and MQTTClient for iOS, will be put to practical use. The role of the previously mentioned applications is to publish messages in a topic that the broker will redirect to diverse clients which are subscribed to that specific topic.
Since the purpose of this project was to construct a SCADA application, it involved combining a multitude of constituents described former to this paragraph. These elements form a network which facilitates the interconnectivity between the real and the digital world, thus defining the concept behind the meaning of Internet of Things. In order to highlight a central point of the application, Node-RED, a software program developed by IBM, was utilized. This grants the ability to build the ideology of communication between all the components specified above. The main administrator application is divided into two sub-flows and one flow. One sub-flow is used for obtaining data through the Modbus TCP/IP protocol from the registries and the other sub-flow is utilized for importing visual elements from Grafana, as the cardinal purpose of the project is to integrate all components into a single practical interface that enables the interaction of all entities.
As previously mentioned, the first step of the development consists of accessing the registries that contain written data. To do so, an injection node was configured to send a signal that will start the reading cycle every one second. A cycle is represented by a series of actions, as follows: after the input signal, a function node sets up the required options, which will be used by a server flex getter node, afterwards reaching another function node in which the payload is processed for further insertion into the database. The function node that establishes the options contains information such as the input, which will be the payload of the previous node, the function code, which will be 3 in this case, since we are reading holding registers, the starting address of the primary registry (the first tag declared was 40001, the equivalent of it being 0 for setting up the options node) and the number of units that are to be read. All the information listed above provides the node that is connected to the server with the needed preferences for reading the data. The connection to the server is created by adding a new Modbus client in the nodes that require it, with the desired configuration matching the simulator. The port needs to be the same one selected in the simulator, in this context, being 502.
Furthermore, it is necessary to define a dictionary using Javascript programming language so that the data are stored correctly in the measurement. To be able to reach certain values and publish them to a specific topic or make use of them in other contexts (for example, if we need to write a value based on another variable) we declared global variables using the function global.set(). Access to these global variables is granted by the function global.get() and it can be called in function nodes from any flow or sub-flow. After data processing, the information formatted is stored into the InfluxDB database (see
Figure 2). The connection to this database is established through a server, by setting its properties in this manner: specify the IP address of the host and the port on which they communicate, followed by the database name.
A second step in the finalization of the main component is importing the panels from Grafana into a single dashboard in Node-RED (see
Figure 3). To achieve this embedding, the grouping system in the layout tab from Node-RED is used. Every panel was given a tab and positioned in the desiderated location on the interface. The panels are embedded by using a function node. In this node, the payload is represented by the IP address on which the Grafana server runs, the port 3000, a link obtained from individual panels, the refresh time, theme, from and to date which belong to the predefined variable called msg, and the ID of the panel.
These two sub-flows will be integrated into the main flow of the application. This flow (see
Figure 4) establishes the main logic behind the complete functionality of the whole system. First and foremost, the elements contained by the dashboard, specifically represented by a slider node, two switch nodes and a non-editable text node, were configured and added to different groups in the desired location on the user interface. These nodes link the visual graphics to the logic implemented behind. Furthermore, to extend the monitoring facility of this application, a Scalable Vector Graphics (SVG) node was utilized which permitted the access to a scalable vector graphics editor. The outcome was animated to enact the current state of the motors, by using the defined properties which have been customized according to the input. To provide a correct set of options, the payload of the messages passed through was descripted in a function node chartering the command in order to update the style for the specified selector in an according manner (a selector consists in the group that is to be modified), as well as the name and value of the attribute, which in this case was fill.
Following the user’s selections, the transmitted values are passed to function nodes that process the read data and publish the results in a MQTT topic through a “mqtt out” node configured to connect to the local broker through the port 1883. The broker manages the published messages and distributes them further to all subscribed clients. The Node-RED context also constitutes a client subscribed to the topics, thus messages are also reaching this part of the network via “mqtt in” nodes. As a final step in this development process, the messages reach a “Modbus-Write” node which allows changing the value at the address of the stated holding register.