Intelligent energy management based on SCADA system in a real Microgrid for smart building applications

Energy management is one of the main challenges in Microgrids (MGs) applied to Smart Buildings (SBs). Hence, more studies are indispensable to consider both modeling and operating aspects to utilize the upcoming results of the system for the different applications. This paper presents a novel energy management architecture model based on complete Supervisory Control and Data Acquisition (SCADA) system duties in an educational building with an MG Laboratory (Lab) testbed, which is named LAMBDA at the Electrical and Energy Engineering Department of the Sapienza University of Rome. The LAMBDA MG Lab simulates in a small scale a SB and is connected with the DIAEE electrical network. LAMBDA MG is composed of a Photovoltaic generator (PV), a Battery Energy Storage System (BESS), a smart switchboard (SW), and different classi ﬁ ed loads (critical, essential, and normal) some of which are manageable and controllable (lighting, air conditioning, smart plugs operating into the LAB). The aim of the LAMBDA implementation is making the DIAEE smart for energy saving purposes. In the LAMBDA Lab, the communication architecture consists in a complex of master/slave units and actuators carried out by two main international standards, Modbus (industrial serial standard for electrical and technical monitoring systems) and Konnex (an open standard for commercial and domestic building automation). Making the electrical department smart causes to reduce the required power from the main grid. Hence, to achieve the aims, results have been investigated in two modes. Initially, the real-time mode based on the SCADA system, which reveals real daily power consumption and production of different sources and loads. Next, the simulation part is assigned to shows the behavior of the main grid, loads and BESS charging and discharging based on energy management system. Finally, the proposed model has been examined in different scenarios and evaluated from the economic aspect.


Introduction
The economic and environmental challenges by the utilization of fossil fuels have caused restructure in the conventional power system. Hence, future grids, which are called smart grids [1], have newer types of digital and high-tech devices that make the system be able to establish two-way communication between supply and demand-side [2]. These systems have more options, such as realtime monitoring [3], control, and communication which is held between generation and demand which cause to enhance efficiency, reducing the energy consumption, and increase the reliability of the system, which helps to have a secure, flexible and intelligent operation [4]. The conventional grids' restructuring into smart grids involves the small-scale power generation units near the consumers under the name distributed generation (DG) based on renewable energy sources (RES).
The utilization of DGs, energy storage systems (ESSs), loads, along with electric vehicles and smart modules, e.g. smart meters and switches, in low and medium voltages causes the emergence of microgrids (MGs) [5]. (HMI), which is the software part of the SCADA system, is useful for controlling and monitoring purposes [27]. The typical architecture for the software SCADA part is server-client when in the server is located the main SCADA program called by the client where is located the HMI.
Some papers discussed different aspects of using SCADA in MGs, while the novelty of this study is taking benefit from all four aspects of SCADA for an intelligent energy management target, which is not investigated in previous studies. In this regard, Fig. 1 clearly shows the LAMBDA (Laboratorio di Impianti Elettrici, Microgrid e Domotica) lab's SCADA with the multi-protocol architecture for the hardware part: -A KNX subsystem dedicated to the technical lighting systems (with a DALI subsystem) and AC smart plugs. -A Modbus subsystem dedicate to electrical equipment (BESS, GenSet), smart switchboard and smart meters. -A PLC dedicated to the fast controls.
-A TCP-IP network as backbone to which the SCADA software is uploaded.
In the Modbus subpart two RTU main devices are located, the Com'X 510 and Acti Smartlink. The RTUSs collect data from smart meters and equipment. As will be discussed in detail in section 4.2, the data connection of equipment with RTU is based on MODBUS protocol, while that for sensors and lighting is based on KNX and DALI protocols. Moreover, PLC S7-1200 is used for the proper faster operation of LAMBDA MG. In the last layer, all data are transferred into the data center rack for monitoring purposes that is carried out by Windows Central Controller (WinCC).
Modbus is an application-layer messaging protocol (request/ reply), positioned at level 7 of the OSI model. It provides client/ server communication between devices connected on different types of buses or networks. KNX is an open standard (EN 50090, ISO/IEC 14543) for commercial and domestic building automation. KNX devices can manage lighting, HVAC, security systems, energy management, audio video, remote control, etc. The software SCADA system is based on the serve-multi client Movicon platform. The HMI has to satisfy the usability concepts introduced by Standard ISO 9241 for ergonomics of human-system interaction. The usability of a SCADA software system is based on 10 Nielsen heuristics. An HMI interface is usable when it satisfies the information needs of the end user who is using and interrogating it, by being provided with facilitated access and browsing with contents that are easily understood.

Paper contributions
Due to the complex challenges for energy management [28,29] in MGs, in this paper, a real-time EMS based on the SCADA system is used in the LAMBDA lab to overcome these problems. Due to the sources of the LAMBDA lab, this article tries to present the control strategy for different parts, which mostly focuses on the Battery Energy Storage System (BESS) control strategy and minimizing the power exchange with the main grid. Finally, the proposed control strategy is investigated in a simulated model in MATLAB Simulink and the experimental data from the SCADA system to verify the control strategy and show the flexibility of the system in different conditions. Several papers have focused on EMS; however, realtime EMS based on SCADA is considered in this paper as a novelty with the below contributions: Proposing a centralized EMS in an educational building MG. Intelligent EMS by considering the SCADA system with Modbus and KNX protocols. Considering energy exchange minimization through the MG and main grid and its economic aspects.

Paper organization
This manuscript is organized as follows: the LAMBDA lab equipment is described in Section 2. In Section 3, the experimental data evaluation and simulation results are presented. The economic investigation of the LAMBDA MG LAB is discussed in Section 4. Finally, the conclusion to confirm the work is examined in Section 5.

LAMBDA MG LAB equipment
The sources of the LAMBDA MG are: -the main grid; -a Diesel Generator for island mode; -a photovoltaic generator. A battery energy storage system is connected to the lambda mg by a smart switchboard. The loads are divided in normal, essential, and critical. Fig. 2 shows the overall scheme of the LAMBDA lab which will be discussed in detail separately.

Solar PV modules
The 12 kW PV array is divided into two strings with two maximum power point tracking (MPPT) in order to maximize the utilization of the PV array under different irradiation and temperature levels [30,31]. 44 PV modules, according to Fig. 3, are monitored by an integrated SCADA system. Rated power, voltage and efficiency of each module are 270 W, 31 V and 16.27%, respectively.
The I-V curve of the PV for different irradiances and temperatures is shown in Fig. 4 (a) and (b). The PV system power is obtained by the equation (1): The GHI is the global horizontal irradiation (W/m 2 ), S is the total area (m 2 ), and h is the efficiency.

Battery energy storage system
A three-phase Lithium-Ion BESS with an internal inverter and equipped MPPT solar charge controller is used. The nominal capacity of the battery is 6.5 kWh, 710 Vdc/3A, with charging and discharging capability of 2.2 kW and 1.8 kW, respectively. Charging equation (3) and discharging equation (4) for Li-ion BESS are as follows [32]: where: Additionally, the BESS is fitted with an integrated web server through a network, which allows monitoring of the state of charge (SOC), and the history of the energy capacity.

PV system inverter
Regarding the arrangement of the PV modules in two strings, the selected PV inverter has the rated input voltage between 320 and 800 V and output voltage of 380 V with an efficiency of about 98%. This specific inverter doesn't have the internal boost converter and only operates in grid-connected mode [33]. A single-stage topology is proposed to enhance PV system efficiency and decrease the costs. Besides, high-power density, simple configuration, and less circuit cost are the main advantages of the single-stage topology compared to the multi-stage topology. In the single-stage converter topology, only a converter extracts power from the PV modules by means of an MPPT controller, while it makes a connection between the utility grid in a single stage. The three-  phase grid-connected PV system schematic diagram with a singlestage converter is shown in Fig. 5.
The inverter in this project has two internal MPPT controllers for two PV strings. The MPPT algorithm extracts the maximum available power of the PV panels (optimized V-I), to increase the efficiency of the system. The inverter's control strategy is done by the voltage source converter (VSC), which sense the grid parameters continuously to undertake pulse generation for the inverter [34]. As mentioned before, it is crucial to evaluate the rated voltage and frequency at the output and voltage at the input of the inverter. Initially, VSC checks the grid availability to detect the main grid parameters. The voltage controller is formed by the MPPT algorithm, the synchronization algorithm, and the DC bus voltage, to acquire reference current for the current controller block.
The synchronization algorithm for getting a controllable power factor in the connection must detect voltages and currents (Vabc, Iabc) of the grid. By using Park transform from a stationary phase coordinate system (abc) to a rotating coordinate system (dq0), Vdq and Idq are obtained. The current controller block, by the PI controller, controls the parameters, and appropriate quantities apply to the Pulse Width Modulation (PWM) for the inverter.

Loads
The LAMBDA loads contain three main categories, Critical Loads, which must be considered all the time, essential loads which have a lower priority, and should be supported in case of extra power, and the last one is normal load, has the lowest importance and can be considered if there is any residual power.
For the emergency situation, an uninterruptible power supply (UPS) with the same rated power for critical loads has been considered. Table 2 shows all categories of the load demand in the LAMBDA lab.

Experimental data evaluation and simulation results
The EMS for the BESS has been investigated in two scenarios based on the load shedding that is implemented according to load classification. In this part, the real-time case, based on the SCADA system and connection protocols (first scenario) and the simulation model in MATLAB (second scenario) will be discussed.

Real-time EMS results by SCADA system
The first functional level for energy management control strategy starts with detecting current direction by the Split-Core Current sensor (SCCS), which is an interface between the main grid and LAMBDA lab, which is shown in Fig. 6. Regularly, the current sensor is considered and installed directly before the feed-in and other measurements to ensure efficient self-consumption. The SCCS consists of a connection socket and three separate split cores, and a measurement sensor with the maximum tolerance is 100 A (nominal current 50 A) per phase. Part 3 which is folding transformers of SCCS, capture all data of demand, and supply current   units into the main grid and then transmits the recorded results to the Current sensor in part 2 by connection sockets in section 1. The SCCS makes the system able to program the relays for load control, real-time monitoring, and other functions. Fig. 7 reveals the whole system configuration of the LAMBDA Lab composed of sources and different load categories. The main purpose of this paper is to reduce exchanged power between the case study and the main grid. So, to reach this aim, on the first side of the feeders, a smart meter and a circuit breaker have been used.
The real-time data is gathered into Modbus, before transferring the data to the SCADA system by the LAN interface to consider a real-time energy management strategy by means of sending appropriate commands to local controllers (PLC 1200 system). If the PV generation decreases suddenly, due to some environmental reasons such as shadow or cloud, and, if the loads are not crucial, the SCADA system implements load shedding strategy by ordering to loads' breakers to be opened. The critical point of this study is that the rest of the electrical department is considered as the main grid from the LAMBDA lab point of view and that is supplied by extra power generated by the PV system. The SCADA system in the LAMBDA lab collects data of the devices based on the two different Modbus and KNX communication protocols. Fig. 8 shows a comprehensive communication layer of the LAMBDA MG Lab. Modbus and KNX are two protocols used for metering/supervisory of electrical systems and building automation, respectively. So, there are two gateways, as the interface for the network, which are accessible from the PC through the LAN.
Based on Fig. 8, the Modbus protocol is considered to connect the recorded data between the energy server and the SCADA system. Meanwhile, the KNX protocol is used for the smart department goals to save energy by controlling the light, presence, HVAC, etc. Finally, there is the last gateway between KNX and another communication protocol, called a digital addressable lighting interface (DALI), which is responsible for the regulation of the lighting system. The energy server, Com'X 510, is one of the two utilized Modbus masters in the LAMBDA lab, which can handle the energy flow, log data, collects and stores data such as electricity, temperature, and humidity. It is possible to do it since it is connected via Modbus Serial RS-485 to five digital energy meters iEM3100 series, which measure voltages, currents, powers, and others electric quantity. The energy meters are the main Modbus that are registered addresses to insert and obtain the desired data. Then, the Com'X 510 is connected via Ethernet with an Acti9 Smartlink SI B, which acts as a second master. In this manner, the Com'X 510 acts as a transparent gateway. The Acti9 Smartlink system concentrates real-time data from electrical distribution panels to achieve EMS goals by 7 and 11 channels depending on the device numbers. Currently, the LAMBDA MG has three Smartlinks; one acts as a master and two others as the slaves. The master one is connected to the auxiliary's contactors to command and observe the loads and source situation and the slaves prepare the wireless connection for the PowerTags, which perform the load monitoring.
The LAMBDA MG Lab support about 50% of the energy in Electrical Engineering department, hence, the aim is to consider the whole of the department as a smart MG, initially to reduce the exchange power as possible with main grid and secondly reduce the consumed energy by controlling all the process to accelerate the emerging trend of smart buildings as a future platform as shown in Fig. 9 which is implemented in class 40.
Hence, KNX is used to set and program the devices in the system. The sensors and actuators communicate by means of a telegram that is composed of physical address, data, and group address. As a part of a smart building, Fig. 9 clarifies the location for the elements in the different sub-areas, which is the biggest classroom in the electrical department. The same with other places, class 40 is connected to the LAMBDA lab through a LAN cable.

Simulation results
This study takes advantage of MATLAB Simulink. In this step, two PV strings are considered by two variable inputs, irradiation and temperature. For the irradiance, the model considers three different levels: maximum, medium, and zero amount. For the ambient temperature, the model considers the LAMBDA lab's average value for a year. These conditions cause three different power levels generated by the PV, with simulate peak production of PV that usually happens at noon, the average value in the afternoon, and zero value that system experiences during nights, respectively. Before the next step, these two PV strings are connected to the point of common coupling (PCC) with two dedicated MPPT via a typical inverter. In the second step, the BESS is connected to the PCC, where the intelligent power flow is applied, via a bidirectional buck-boost converter and an exclusive inverter as shown in Fig. 10. The internal schematic and control strategy of each inverter and converter has been fully described in its exclusive section.
According to Fig. 11, the bidirectional converter operates as a boost converter in discharging mode, and for charging modes, it operates as a buck converter. Hence, if VDC is higher than the DC link reference voltage (VDC, ref), the first switch, S1, will turn off, and S2 will turn on. Thus, the converter works as a buck converter and reduces VDC to the BESS voltage (VBESS) to provide the necessary condition for the BESS charging mode and absorb extra power from the PV. Similarly, when VDC is lower than the VDC, ref the S1 will turn on, and S2 will turn off and the converter works as a boost converter. The amount of difference value, obtained by comparing the real quantity and references will be entered to PI controller to reduce the constrain amount of the error, and create BESS reference current (Iref). To create pulses for the bidirectional converter, the BESS current (Ibat) must compare with Iref to prepare PWM generator appropriate input. The PWM generator will create proper pulses for S1 and S2 to assign charging or discharging modes.
In addition, a two-level load is considered to model peak and normal conditions, so to illustrate load variation, the maximum amount of the load in the model is considered in the middle of the period. As a result, from 0.3 s to 0.7 s, the peak load power value is considered almost 9 kW, while in the rest of the period, load power is about 2 kW to model critical and a part of essential loads. The grid is simulated in two different modes, sending/receiving power to/ from the PCC when the system requires power to satisfy the loads and existing extra power conditions, respectively. The proposed flowchart in Fig. 12, provides an overall structure by considering various strategies for either load control or BESS different modes.
The PV power, critical, essential, and normal loads (PCL, PEL, and PNL, respectively), and SOC must be read from the meters to begin the EMS process. Then, the comparison between load demand and PV generation has been formed as follows:   In case of more PV generation rather than critical load, the BESS must be in charging mode. In this regard, a fully charged BESS condition should be considered. Hence, Pref can be allocated to essential and normal loads, according to their importance. Otherwise, the BESS charging limit of flowed power to BESS, which is 2200W (Pch,max) must be considered. So, if Pref is lower or equal to limitation, the BESS will charge with the value of Pref, while on the other case, the BESS will charge with the maximum rate (Pch,max), and the rest of power will flow to the essential and normal loads. In the second case, normal mode, the PV generation, and loads are equal, and as a result, exchanged power with the main grid is equal to zero. On discharge mode, the PV production is less than loads consumption; consequently, all the essential and normal loads must be turned off.
In the following, an empty battery condition must be considered because, in this situation, the grid must provide the total required power. Otherwise, if the required power is less than the BESS discharging limit, which is 1800W (Pdch,max), the BESS can supply loads solely. Still, if it is more than a limitation, the BESS will discharge with the maximum rate, and the required power will be imported from the grid. Fig. 13 shows the PV power generation, load consumption, exchanged power with the main grid, and the BESS power. The BESS must be in charging mode from beginning to 0.3 s due to higher PV production compared with the amount of demand. Also, between 0.7 s and 0.8 s, which is the most outstanding part of the BESS function, at 0.7 s the load was decreased to 2 kW while the PV generation remains over 2 kW; consequently, the BESS starts to charge but at the 0.8 s PV generation goes to zero, to model night hours, and the BESS started to discharge to the load again. However, the BESS condition alters to discharging mode due to higher power demand rather than PV generation. Charging and discharging limits, which are 2200 W and 1800 W, respectively, are clearly shown. Due to these limitations, the grid must treat as a load in a case of a higher rate of power, rather than charging limit and act as a source when required power is more than the discharging limit. So, exchanged power with the grid is negative from 0.3 s onward except 0.7e0.8 s that BESS is charging, which means the grid is providing power to satisfy the loads. As it is clear, the load voltage must be constant during any scenario applied to the system due to the vitality of protecting the customers' equipment. Fig. 14 reveals that this criterion is achieved because the load's voltage remains in steady state at 230V, which is the load's nominal voltage, during the whole period. Also, by increasing load power  and according to the power equation, which is equal to multiplication of voltage and current, the load's current must increase because the load voltage is fixed at 230V. The load's current reaches a peak of 39A between 0.3 and 0.7s to provide 9 kW power, while in   the rest of the period, the current experience the amount just below 9A to satisfy 2 kW load. Fig. 15 Shows the BESS parameters during the energy management behavior by illustrating the voltage, current, and SOC%. The current flowed into the BESS indicates the BESS's mode and multiplication with voltage provide the instantaneous power, which changes by alteration of the current. In this regard, whenever the current is negative, the BESS is in charging mode, and SOC% increases relatively with the amount of imported energy to the BESS, before 0.3s, and between 0.7 and 0.8s that is mentioned before. Positive current represents the discharging condition that SOC% proportionately decreases with the amount of exported energy from the BESS, for the rest of the period.

Economic investigation of the local loads in LAMBDA MG LAB
First, it is noticeable that the BESS discharges only on the local LAMBDA loads. Fig. 16, provides a daily description for two days in a row, 5th, and 6th December, regarding energy and power management of the BESS. In these schemes, blue and purple parts represent the charging and discharging behavior of the battery, that they depend on hours of sunlight; therefore, from 8 a.m. to 4 p.m., the battery receives energy to charge. In this regard, on 5th December, the profile of the BESS (charging) reaches þ2.02 kW, which nominally is 2.2 kW, and on 6th December, the discharging power reaches À1.66 kW, which nominally is À1.80 kW. In addition, the battery state of charge is provided in the figure, which is a gray line, and as it is predicted, it is increased when the BESS received energy and decreased when it released energy. As it is shown, on 5th December, the day starts while SOC is about 13%, which means, on 4th December, the BESS did not wholly discharge.
The green line demonstrates the energy of the battery. It peaks to 6.33 kWh on 6th December, which is close to the nominal capacity is 6.50 kWh. Exchanged power with the grid consists of two different modes. In the first one, which has shown in red, the grid must compensate lack of power when the BESS is empty; this matter is clearly shown on 5th December that on 2 a.m. the battery was empty, which can be understood from SOC that dropped to zero, and as a result, power entered from the grid to satisfy critical loads. Another mode is feed-in power, which is in orange, represents extra power that PV generates while the loads are satisfied, and the BESS is full or receiving power with the highest rate (2200 W); in this case, this amount of power transfer to the grid.
As currently installed smart meters are collecting only the LAMBDA local loads which reaches 3 kW during the day and 1 kW at nights (the rest of the department is not involved for the real-time measurement), Fig. 17, provides experimental data of the LAMBDA lab in 2019 regarding the proportion of each source, including the main grid (the red one), PV array (the blue one), and the BESS (the green one), in satisfying the critical load in different conditions. Obviously, from November to February, the amount of imported energy from the grid is much more than other months due to a few outstanding reasons. First, the irradiation and temperature are less than other months causing less PV production. Besides, in January, for example, the load's received energy rises to about 396 kWh because of cold weather resulting in more HVAC usage; consequently, the amount of energy received from the grid is almost 140 kWh. In the middle eight months, on the other hand, the generated energy from the PV is much more than in other months. For instance, in June, the PV generated almost 267 kWh that results in a very negligible amount of imported energy from the grid. Moreover, in August, the system received a near-to-zero amount of energy from the grid because the lab was closed and the required power was for just satisfying the critical load, so the PV production provided required energy during the days, by storing energy in the BESS, the loads were satisfied during the nights. Table 3 provides experimental data that is obtained from the SCADA system regarding the amount of energy that the LAMBDA lab receives from the main grid and PV array in three different conditions, system without PV and BESS, with PV and without BESS and with PV and BESS. The amount of received energy from the grid when there isn't PV and BESS is much more than other cases especially, in a case of the system with full equipment.
The first part of the Table 3. Reveals the amount of imported energy from the grid strongly depends on the existence of PV and BESS. In this regard, the amount of energy saving when the system uses only PV is about 160 kWh on average for a single month, while this result will be more outstanding when BESS is used because of the amount of energy saving peaks to 334 kWh on June and reaches 240 kWh, on average, for a single month. About the monthly imposed cost that can be saved by using PV and BESS and proper strategy, the results are interestingly shown in the second part based on the approved cost that is 0.25 V per 1 kWh. The amount of cost-saving reaches a peak of almost 57% when the system uses only PV and when the system is fully-equipped by both PV and BESS, the system experienced about 88% cost-saving on average for a single month and peaks to almost 83 V in June.
In the last section of Table 3, payback information is indicated according to the initial investment of the LAMBDA lab and the annual profit earned by the PV production. Payback time is the amount of time to recover the total initial cost, and it is a critical factor in designing and risk analyses of a project, from a financial point of view. In this regard, the total imposed initial cost for providing equipment and installations is about 27 kV, while the electricity tariff for residential customers in Italy is considered 0.25 V/kWh. The payback time can be calculated by dividing total investment into total earned a profit, which is considered about 3900 V/yr. As it is clearly shown after seven years, the initial cost will be paid back.

Conclusion
MG testbeds play a significant role in order to design, implement, and investigate the proper control strategies for building applications. These testbed systems can be modified by using renewable energy sources for environmental issues. The LAMBDA MG testbed which is fully equipped SCADA system has the possibility to implement the real energy management projects. The LAMBDA MG lab follows two main aims in this paper. First, to create the infrastructure for the electrical department to make it smart based on SCADA system and second, to decline the import power from the main grid with the self-consumption enhancement. Hence, the real-time and simulation forms are investigated. The operation of the LAMBDA MG in real-time mode by SCADA system shows the energy exchanged to the main grid which is at the lowest level and leads to near zero energy building systems. Also, in the simulation model, the aim remains the same, and the battery energy storage system discharged when the PV could not satisfy the loads entirely and the grid contributes just in a case that battery energy storage and the PV system could not supply the loads. As it is calculated, the full SCADA system implementation in LAMBDA MG  LAB caused enormous reduction in its energy cost up to 98% (in June) and also, the average of monthly electricity bill declined by 87% only for the local LAMBDA loads (Table 3). Finally, the initial imposed cost will return after a seven-year lifetime.