Low Cost Portable System for Converting Mosul Electrical Substations to Smart One’s

Today electricity supplement still has power failures and blackouts due to the lack of automated analysis and the utility's low visibility over the grid. Small and undetected electrical problems can have far-reaching consequences. These failures cause not only high-energy losses, but also costly unscheduled outages, severe injury to employees, and even a fire. Therefore, the monitoring of electrical substations is essential to detect faults and ensure long-term safe operation, safety, protection, and reliability. Internet of things technology provides the possibility of obtaining station data in realtime. In this research, two systems were designed, implemented, and tested in high voltage electric stations. The first part is designed to obtain data on the environmental conditions at the substations, and the important parameters from the transmission lines at the substations in real-time, which help to prevent power outages by relying on engineers who can analyze comprehensively the electrical energy. The system also provides the Automatic Under Frequency Load Shedding ability if the frequency in the stations falls below the normal limit, which contributes to maintain the efficiency and the quality of electrical energy in the substations, and provides protection for the substations. The second part is designed to obtain the values of the parameters that determine the electrical transformers' conditions and monitors the status of the line in terms of switching off and on in real-time at the substations. Thus, these proposed systems are transforming the traditional substations into smart substations. The performance of the system is introduced based on correlation of data and percentage error. The best correlation was for the current data and the least percentage error was for the current. We strongly believed that the proposed system is vesible.


INTRODUCTION
Electricity is a very handy and useful form of energy. Electrical power systems are huge and very complex networks. It is one of the most critical components of national and global infrastructure, and its failure has significant direct and indirect consequences for the economy and national security [1].
The power grid is made up of power plants, high-voltage transmission lines, low-voltage distribution lines, and load centers (residential and commercial buildings). Transmission lines carry high-voltage power over vast distances, whilst distribution lines carry lower-voltage electricity over shorter distances to homes and businesses. Transmission and distribution lines are connected by substations. A substation is responsible for converting voltages up and down as well as continuously measuring, monitoring, safeguarding, and managing its component of the grid. Electricity continues to be exposed to blackouts due to a lack of automated analysis and inadequate knowledge of utilities across the grid [2].
Systematic electrical substation inspection is crucial to detect faults, because if left unchecked, Electrical problems that go unnoticed might have far-reaching implications. These shortcomings not only result in excessive energy losses, but they also result in energy losses that are unneeded. It also has the potential to cause costly unplanned outages, catastrophic technical injuries, or a fire. In order to assure secure long-term operation, the integrity, protection, and general reliability of this sort of industrial installation, dependable, precise, and regular inspections are required [3].
With the growing complexity of the power grid, the infrastructure is seen considered weak against problems that negatively affect the general performance and the stability of the network, although the fault indicators technology has provided a way to identify faults, the technical staff still has to make a manual effort and inspect the devices for longer hours to discover and determine the fault in the power stations, also automation of substations has become essential to increase their efficiency and improve the quality of the energy provided [4].
Transformers are one of the most critical elements in substations in electrical power transmission systems. Some parameters of the transformer operation are Temperature of oil, Moisture level, Level of floats, Operation of cooling fans, Electrical load levels, and Gas sensors. These levels should be measured manually periodically by the operating personnel which will be a tedious and inefficient way of monitoring, therefore the automation of transformer in the substation is very important to allow for a change from periodic and manual to condition-based maintenance. For efficient power supply from generation units to end users, reliable and real-time information is essential to realize the vision of smart grids. The impact of structural degradation, natural accidents, and equipment failures, which cause power disturbances and outages, can be avoided by online grid condition monitoring. To maintain grid protection, reliability, performance, and uptime, there is an increasing need for intelligent and low-cost monitoring and control using online sensing technologies. IoT technology provides an easy way to monitor problems at the power grid without spending manual efforts and extra time [5,6].
The Internet of Things, commonly abbreviated as the word (IoT) is a term that has recently evolved; this refers to the new Internet age that enables communication and understanding between interconnected devices, as well as between separate devices and physical objects. The goal of the IoT is to use networks to create connections between objects while minimizing time and location limitations. The idea of the Internet of Things (IoT) enables objects to exchange data for communication purposes through wired or wireless connections. The IoT's real-time capability is considered a crucial feature for monitoring and managing power system applications. Therefore, machine operators can use the real-time monitoring system to make informed decisions on technological as well as electrical matters in substations. IoT enables the electricity grid to be measurable (able to be calculated and visualized), controllable (able to be optimized and manipulated), and automated (able to adapt and selfheal) by using sensing, embedded processing, and wireless communication [7,8].
A variety of monitoring projects, including various instruments and technologies, are deployed in electrical stations. These projects, on the other hand, are frequently old, pricey, and in need of renovation to ensure a better execution. The current project entails, two systems were designed, each design is dedicated to implement a specific process, and and including hardware and software, such as controllers, networks, sensors, applications, and operating systems. The system block diagram is shown in fig. 1.
The first system is developed using the ESP32S microcontroller and Cayenne platform. PZEM-004T sensor to measure all important parameters at the same time in substations, these parameters include (current, voltage, apparent power, power factor, frequency), and compute active power and reactive power by relying on the equations of the power triangle. (DHT11) sensor to measure (temperature and humidity), and a relay module to control the break the feeder of line depending on the frequency value.
The second system is designed to obtain the values of the oil and winding temperature, from the transformers in real-time. In addition, it monitors the status (ON) or (OFF) position of any The tests are accomplished in the real substations to analyze the performance of the project and evaluate the operation of the Cayenne platform.
The remainder of this paper is organized as follows. Section 2 shows the related works; section 3 describes the analysis of the first system design. Section 4 explains the software algorithm of the first system, section 5 describes the analysis of the second system design. Section 6 explains the software algorithm of the second system, section 7 describes the tests and displays the obtained results, section 8 describes the systems cost, and section 9 displays the conclusion and future work.

RELATED WORKS
Many ways of monitoring the electric grid have been the subject of several studies and researches in the domain of computer science, electronics, control and automation, electrical, and technology fields have been carried out that deal with the different methods of monitoring the electric grid. Trupti Sudhakar Somkuwar et al. [9] proposed a system for monitoring and controlling the electric power transmission line using the (WSN) (Wireless Sensor Network). The system reports a failure in the transmission lines and sends data to the monitoring station, and then the monitoring station sends a short message (SMS) to the line operator about the location of the line where the fault occurred. The system consists of a microcontroller (Atmega16) that can communicate with (Google map API (Application Programming Interface)) to locate the fault and show it on the area map. Then sending a text message to the line operator through (GSM) (Global System for Mobile Communications). Ravikumar V. Jadhav et al. [10] proposed a system for monitoring the power distribution transformer metrics and accessing transformer data in real-time using the Internet of Things. The system monitors the primary and secondary voltages on both sides of the transformer, as well as the primary and secondary currents from the supply unit, transformer temperature, active and reactive power. Matlab Simulink is used to simulate a three-phase circuit, data is stored in the database, data is captured in every part of the circuit and analyzed in real-time by representing the data in the form of (graphs). These drawings help the operator in identifying information about the transformers and continuous monitoring of all measurements. Mrs. Asha John et al. [11] proposed an automation system for a power substation using a built-in processor is (Raspberry pi) to automate a substation (11kv). The system consists of meters for current, voltage, active power, reactive power, and power factor. These readings are taken from the (RS485) port that connects to the Raspberry pi in series via (USB) (Universal Serial Bus). Digital and analog measurements can be controlled via (GPIO) (General Purpose Input/Output) pin located in (Raspberry pi), the system is programmed using (Codesys IEC611313-3) platform. Rohit R. Pawar et al. [12] designed a system for monitoring various gauges in power distribution transformers. The system consists of two parts. The first part is (Hardware), consisting of a (PIC18F4550) (Programmable Integrated Circuit) controller and various sensors to measure (current, temperature, oil level, vibration, and humidity), these sensors considered as input devices to (RTU) (Remote Terminal Unit), all readings display on the LCD (Liquid Crystal Display) and the webpage. The second part is (Software), using SQL (Structured Query Language). Shilong Li et al. [13] proposed a system for monitor the oil level in the transducer tank, using the XS128 microcontroller and oil level sensor. The oil level sensor is installed in the glass oil tube, and the control unit is in the control room of the secondary station, a signal is sent in real-time to the controlling center when a height or low oil level in the transformer. Each oil tank in the transformer is equipped with an oil level sensor whose output is (4-20 mA), the current signal for each circuit is converted to a voltage signal which converted to the actual oil level in the transformer through specific equations. Hassan Jama et al. [14] proposed a system for monitoring and protecting the distribution transformers based on the Internet of Things. The system divides into two units, a control unit, and a monitoring unit. A control unit consists of a microcontroller (ESP8266-E12), (current, temperature, and humidity (DHT22)) sensor. The microcontroller collects data continuously and sends it to the monitoring unit that uses the (Thingspeak) platform for real-time monitoring, analysis, and control. Md. Sanwar Hossain et al. [15] designed a monitoring and control system for electrical substation equipment. The system provides sufficient information to determine the current quality and quantity of oil in the transformers, when any alarming situation occurs, the operator is provided with a warning message with the corrective action to be taken. The system consists of an (ATmaga328-P) controller that communicates with the (ESP8266wifi) unit in a series. The ultrasonic sensor, to determine the oil level in the transformer, infrared sensor, to sense the quality of the transformer oil depending on the radiation emitted from the oil. Rashmi S et al. [16] proposed a conductor temperature monitoring system in the transmission lines, using a temperature sensor (LM35), an (Atmega AVR) microcontroller. (

ANALISYS OF THE FIRST SYSTEM DESIGN
The components of the first system, as well as the proper connections and the actual position of each device in the assembly, are shown in fig. 2. A variable voltage supply 220 volts was used to test the conversion ratio that was used in the code, which depended on the line voltage in the real substation, the power supply was used to supply the voltage to the microcontroller as well as to the IoT modem. The components utilized in this project will be discussed below.

ESP32 Microcontroller Module
The ESP32 is a dual-core board that is equipped with two Xtensa LX6 processor boards.
It is launched in September 2016 by Espressif Systems to replace the μC ESP8266. A powerful embedded Wi-Fi and Bluetooth unit are included in the ESP32. The memory is immense (RAM 512KB), (16MB flash). Furthermore, 448KB of ROM, 520KB of SRAM, and two (8KB) of RTC memory [19]. ESP32 has 36 GPIOs, 14 of which are Analog to Digital converters (ADC), ISP pins used to connect the ESP32 to the SD card reader. The VCC is given for the ESP32 ranges from 2.2V to 3.6V. Micro USB used to upload the software and supply power to the board, or uses a (3.7V) battery to supply it with power [20].

PZEM-004T sensor
PZEM-004T module is accept an input voltage of 80 to 260 V AC, a maximum current of 100A, and a rate of 45-65Hz. It has an embedded processing capability of SD3004 SoC (produced by SDIC) specified for electrical power measurement [21]. The sensor (PZEM-004T) is used for voltage, current, frequency, power, and power factor measurements. To easily communicate with the microcontroller, the circuit of this sensor depends on the communication protocol (UART) [22]. PZEM-004T specifications is:

DHT11 Sensor
The DHT11 is a Temperature and Humidity Sensor. DHT11 can be correlated with Microcontrollers such as ESP32, ESP8266, Raspberry Pi, Arduino, and so on. In the operating temperature range of 0 to 50°C, it is capable of calculating relative humidity between 20 and 90 percent RH with an accuracy of ±5 percent RH. The temperature is also measured in the 0-50°C range with a ±2°C precision. With 8bit resolution, all values are returned. This provides high unwavering efficiency and longhaul reliability [23].

Relay module
This is a 4-channel relay interface board with LOW Level 5V, and each channel requires a driver current of 15-20mA. It can be used to power several high-current devices and equipment. It is fitted with AC250V 10A or DC30V 10A high-current relays. It has a standard interface that can be directly operate by microcontrollers. This module is optically isolated for safety criteria from the high voltage side and prevents the ground loop when interfacing with the microcontroller [24].

Variable power supply 220V AC
This power voltage transformer converter is designed with a built-in copper coil for long time use. Featuring a clear voltage output meter. It is manufactured by "FlowerW", it is dimensions 24.13 x 24.13 x 21.08 cm, and weight is 4.99 Kilograms [25]. It is used to supply the voltage to the PZEM-004T sensor and obtain initial results.

My Device Cayenne Platform
The Cayenne platform is used in this project. The cayenne platform is considered very useful in IoT applications for being an open-source IoT platform in addition to being supportive of the MQTT (Message Queue Telemetry Transport) protocol, which will be described below.
MQTT: The abbreviation for MQTT is (Message Queuing Telemetry Transport), which is a communication protocol. It based on the (TCP/ IP) protocol used to exchange data over the Internet. Created in 1999 by IBM, characterized by ease of use, uncomplicated, lightweight, Low energy consumption, the transmission of information very quickly, does not require a large use of memory. It is also characterize by high reliability, depending on broker in its work (MQTT Broker) [26,27].
My Device Cayenne Platform allows uploading data for IoT projects and creating monitoring by creating a free account on mydevices Cayenne as fig. 3.

SOFTWARE ALGORITHM OF THE FIRST SYSTEM
In this section, we will explain all the details about the application code that is written and the programming language that is used to deploy it.

Arduino IDE
The

Power triangle
The power triangle graphically shows the relationship between active power, reactive power, apparent power, and power angle. Where, P= Active power, Q= Reactive power, S= Apparent power, PF= Power factor, = Phase angle [31,32].
The power triangle equations as shown in the above equations were used to calculate the phase angle value and to use the latter in calculating the active power and reactive power. As for the apparent power, despite the ability of the PZEM-004T sensor to calculate its value, the relationship between voltage line and voltage phase shown in equation (5) was adopted, because using a single sensor is sufficient to measure a single phase only, while the substation is fed by 3 phases per line.
Below is a description of the suggested algorithm. Furthermore, as illustrated in the flowchart of fig.5, the cayenne platform is used to connect the ESP32 board to the cloud as well as to view the acquired data in the cloud. The flow of the chart is interrupted whenever the power or internet is turned off.

ANALISYS OF THE SECOND SYSTEM
DESIGN The measuring devices used in the station are (Messko st160) [34] as fig. 6, produced by the German company MR. It was noted that the (Messko) meter had a signal converter (TT30) to convert the sensor signals into analog (4-20mA). Therefore, sensors that support this feature have been chosen, and they convert the current readings into values of oil temperature and windings, which will be explained in the following paragraphs.  The basic parts of the hardware system consist of microcontroller ESP32S, explained in details in section 3, HW-685 current to voltage module, and optocoupler (PC817), that will be explained below.

HW-685 current to voltage module
The HW-685 4-20mA Current Sensing Module is an input device that provides a usable output in response to the input measured, this module can measure currents from 4-20mA. Board size (42mm × 25mm ×10mm), and weight (11g). The HW-685 sensor converts the current measured into voltage. There are two potentiometers on the module for calibrating the zero and maximum voltages. With the 4 to 20mA range, the current is normally (4mA) when the measured or process variable is at zero and (20mA) when the measured or process variable is at full scale [35]. The 4-20 mA current-loop is analog signaling, it has been a popular method of sending instrumentation signals. Typically, the measured physical variable has a minimum value of 4 mA and a maximum value of 20 mA. A nonzero minimum current value aids in the detection of possible transmission issues such as broken wires. This sensor usually gets its operating power from the loop (24 V) and doesn't need any additional power. It has a precision 250-ohm resistor across the input terminals to convert the 4-20 mA variance into a 1-to-5 V swing [48]. Fig.8 shows a 4-20 mA current-loop [35,36].
Equation (8) is used to measure the output voltage value that corresponds to the input current value.
Where, is a measured physical value, represents the minimum value of measurement range, ℎ ℎ the maximum value for measurement range, the minimum value for current, ℎ ℎ the maximum value for current, and the current corresponding to the measured value [37].

Linear DC power supply PS-305D
A 30V/5A power supply, it is Brand, Zhaoxin is reliable. Most medium voltage applications, MCUs, and motors that require a voltage of 0-30V can use it, while 0-5A offers ample current for medium power applications. The big red display shows precisely what voltage and current you have set [38]. It is used in this work to supply the voltage to the HW-685 to calibrate the values of the input current.

Calibration of HW-685 Sensor
After connecting the electrical circuit of the system, Fig. 7, the HW-685 sensor is calibrated to set the upper and lower limits of the

Optocoupler (PC817)
PC817 is a four-pin optocoupler that consists of an IRED (Infrared Ray Emitting Diode) and a phototransistor. The main feature of PC817 is it connects to the section of the circuit optically not electrically. The basic operating concept of PC817 is to pass electrical signals through light, allowing the circuit to read the electrical signal and use it as an output. When there is a power supply on the input side, IRED emits IR (Infrared Ray) waves and activates the phototransistor [39].

SOFTWARE ALGORITHM OF THE
SECOND SYSTEM In this section, we will explain all the details about the application code that was written. Arduino IDE application, that described in section 4, was used to program the system in C ++ language.
The proposed algorithm is described in the flowchart of fig. 9. The flow of the chart is ended at any time that the power or the internet is shut off.

TESTS AND RESULTS
Various tests have been applied in high voltage substations to assess the efficiency of the system. Based on IoT technology, all the important parameters have been remotely measured and alarms applied in real-time at the transmission substation. An automatic feeder out of work has been applied in the proposed system.
In this section, the results of these tests obtained for the power system are recorded to illustrate the proposed system efficiency.

In field test and results for the first system
The proposed monitoring system is installed and tested in a real power substation (West Mosul station 132KV), as shown in fig. 10. In this test, the PZEM-004T sensor is supplied with an AC input voltage and current from the output of the secondary transformer for the (Badush line) at the West Mosul station, and the sensor is directly connecting to the ESP32S controller. The results (voltage, current, frequency, active power, reactive power, apparent power, and power factor), as well as results of temperature and humidity from the DHT11 sensor, will be stored on the cloud, and displayed using the Cayenne platform.
On Jan 18, 2021, data are obtained via the Cayenne platform after connecting the system to the station and switching it on, it was checked that the readings were roughly equal to the real values in the station's gauges, as shown below; fig. 11 shows the reading of the station's gauges. Fig. 12 shows the results on the Cayenne platform. The difference between the results obtained on the Cayenne platform and the readings in the station's gauges for the values of the voltage, current, apparent power, and frequency was (0.21), (0.53), (0.21), and (0.22) sequentially. The error rate is caused by electromagnetic waves and other noise sources in the substations.
The system is kept connected to the station for a week and all readings were obtained in real time through the Cayenne platform on the website and mobile application.
The values of the active power and reactive power can be verified by relying on the equations of the power triangle, where the apparent power (S) is equal to the square root of the sum of the square of the value of the active power (P) and the reactive power (Q). Data are collected for one week in the Cayenne cloud and displayed on the Cayenne platform as shown in fig.13, 14, and 15 graphs of weekly readings of apparent power, voltage, and frequency. The increase and decrease in the values are noticed depends on the general performance of the sub-station. As for the points where there is no reading in the graphs and shown in a straight line, this is due to a general interruption in the electrical network in the city of Mosul.
The graphs in fig. 16 and 17 show the reading of two channels on the mobile device through the Cayenne app., this reading for the voltage, and current for a one hour, from (8:30 pm) to (9:30 pm).
The correlation factor is calculated between the real values at the substation and the values read by the Cayenne platform for all parameters. It it concluded that the correlation factor for voltage is 0.9902, for current 1, for active energy 0.9996, and for reactive power 0.9995, as shown in fig. 18, 19, 20, and 21.  The percentage error is calculated between the real values in the substation and the values on the Cayenne platform for one week for the values of the voltage, current, active power, and reactive power as shown in fig. 22. The average percentage error is calculated as fig. 23, for the values of voltages (0.32%), current (0.11%), active power (0.6%), reactive power (0.8%), which indicates the efficiency and accuracy of the proposed system for monitoring real-time readings from the substation.

In-field test and results for the second system
The proposed monitoring system has been installed and tested in a real power substation (Yaremja secondary station 132 kV), as shown in fig.  24      In this test, the HW-685 sensor is supplied with an analog current signal from the signal converter (TT30) of the measuring devices for the oil and winding temperature (Messko st160). The results will be stored on the cloud, and displayed using the Cayenne platform.
On Apr 13, 2021, data are obtained via the Cayenne platform after connecting the system to the station and switching it on, it was checked that the readings were roughly equal to the real values in the station's gauges, as shown below; fig. 25 shows the reading of the transformer panel, and the results on the Cayenne platform.
On March 29, 2021, the electrical line state monitored via the Cayenne platform after connecting the proposed system to the auxiliary switches inside the panel of the electrical line at West Mosul station 132KV. An out-of-work line chosen, to test the proposed system, the line is manually turned off and on, and its condition is monitored on the Cayenne dashboard. Fig. 26 shown the installation at the substation. Fig. 27 shown the status of line at substation.

SYSTEMS COST
The system cost is according to the prices of the electronic components, written in the

Conclusion
The smart systems are proposed in this paper for monitoring important parameters in electrical substations and transformers based on the Internet of things, to reduce disasters and economic losses in the important equipment in the stations. The first proposed system included monitoring of the important parameters voltage, current, power, frequency, power factor, active power, reactive power, temperature, and humidity. Dataare continuously transmitted and displayed in real-time on the Cayenne platform through the ESP32S module. The proposed system is tested at the 132kV West Mosul station, and readings were obtained in real-time on the Cayenne website and mobile application. The correlation factor is calculated between the real values at the station and the values on the Cayenne platform. The correlation factor for voltage is 0.9902%, for current 1%, for active power is 0.9996%, and for reactive power is 0.9995%. The average percentage error is calculated for the values of voltages (0.32%), current (0.11%), active power (0.6%), reactive power (0.8%), which indicates the efficiency of the designed system that can be adopted in electric power substations for transmission and distribution. The second proposed system included monitoring of the oil and windings temperature for the electrical transformer for evaluating the condition and potential for a power transformer to fail, to reducing unexpected malfunctions. This system also monitoring the (on) and (off) state of the electrical line in real-time. The second proposed system is tested at the Yaremja secondary station at 132 kV, and readings were obtained in real-time on the Cayenne website. The implementation of these systems reduces the severity of disasters in the stations and is considered a step for the transition from traditional substations to smart substations. The amount of systems cost is (82$), which is very cheap. The system has proven its feasibility, as the smart substation saves the time and effort that the engineers and technicians spend in obtaining the important readings in the stations and knowing the station's stability, where it can be recovering. Daily, weekly and monthly data can be retrieved due to the MQTT cloud supported by the Cayenne platform.

Future Work
The following suggestion has been stimulated during this research.
1) The proposed system can be developed by linking more than one monitoring system for multiple substations together so that the responsible authorities can monitor and control these systems remotely.
2) The system can be developed to detect the occurrence of fire in the substations and send an alert to the responsible authorities to take the appropriate action.
3) Adding new sensors to the system to improve its functionality.

4)
Adding new hardware to the system, such as a camera for auto-observation and surveillance, as well as some facilities that allow for the implementation of an auto-monitoring alarm system.

5)
The system can be developed by designing an automatic power factor correction unit to reduce lost energy in the system and improve load-carrying capabilities to increase system stability and efficiency.