{'fraction_non_alphanumeric': 0.028672596942741168, 'fraction_numerical': 0.017488556870196046, 'mean_word_length': 4.796996245306634, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modeling and real time digital simulation of microgrids for campuses Malta and Jordan based on multiple distributed energy resources

Received Jun 15, 2020 Revised Aug 7, 2020 Accepted Aug 21, 2020 This paper presents the modeling and real-time digital simulation of two microgrids: the malta college of arts, science and technology (MCAST) and the german jordan university (GJU). The aim is to provide an overview of future microgrid situation and capabilities with the benefits of integrating renewable energy sources (RES), such as photovoltaic panels, diesel generators and energy storage systems for projects on both campuses. The significance of this work starts with the fact that real measurements were used from the two pilots, obtained by measuring the real physical systems. These measures were used to plan different solutions regarding RES and energy storage system (ESS) topologies and sizes. Also, the demand curves for the real microgrids of MCAST and GJU have been parameterized, which may serve as a test bed for other studies in this area. Based on actual data collected from the two pilots, a real-time digital simulation is performed using an RT-LAB platform. The results obtained by this tool allow the microgrid manager to have a very accurate vision of the facility operation, in terms of power flow and default responses. Several scenarios are studied, extracting valuable insight for implementing both projects in the future. Eventually, the proposed models would be a blueprint for training and research purposes in the microgrid field.


INTRODUCTION
Electrical energy is a key element in the social and economic growth of nations. The traditional electrical power system represents a complete ecosystem that supports socio-economic development through the provision of a secure and reliable supply of electricity at a minimum cost to all sectors. The future of electrical systems will be much more focused on small-scale generation and distribution where end-users will be active participants with localized energy management systems that can interact on a free energy market in a number of countries. Regulatory reforms have been made to support this transformation by allowing endusers to invest in RES. Thus, a new concept of power supply networks emerges to generate, distribute, and regulate the power flow on national, regional and local scale [1].

MCAST AND GJU MICROGRID PILOTS DESCRIPTION
Towards better understanding the examined scenarios and configurations, this section presents in detail the topologies of the two pilots. As already stated, the designed microgrids are based on real-life premises that have been designed towards operating as fully functional microgrids. The simulated scenarios are synthesized from real-data extracted from the actual infrastructure.
Business scenarios and technical use cases are developed to cover basic microgrid functionalities for the MCAST and GJU pilot sites. The aim is to deliver a hybrid control architecture that incorporates both centralized and decentralized principles in a multi-agent scheme [41,42]. The conceptual architecture, based on 3-level hierarchical control requirements, is thoroughly modelled. Then, different scenarios are executed in real-time digital simulation.

MCAST microgrid pilot description
The pilot microgrid will cover the part of MCAST campus which consists of three buildings (D, F, and J) and an underground car park as shown in Figure 1. The current electrical network of the MCAST pilot area consists of two substations (SS1 for J and SS2 for D and F). Every substation is separated into two parts: one for the high voltage (HV) switchgear and transformers and another one for the low voltage (LV) switchgear [30,40].
There are 63.24 kWp PV systems installed on the three buildings (D, F and J). So far, a 21.12 kWp PV is connected to the LV system in Block J (SS1). Another two facilities with 21.12 kWp and 21 kWp, located on top of Block D and Block F, respectively, will be connected very soon to SS2. Figure 2 displays the microgrid pilot. The building management system (BMS) (is developed using Trend 963 Server Package using Trend IQ4E controller) for the pilot buildings is already collecting energy data. To support real-time microgrid operation, the infrastructure has already been designed and currently being deployed to support open-protocol gateways, which are in turn "linked" to the main controller. This incorporates standard protocols and drivers, such as Modbus (both RTU and TCP/IP), Bacnet IP and Lon, all of which will be required to enable interaction between systems [40,41]. Through these interfaces, data is gathered from each system, as shown in Figure 3. Additional data can be added in the future as necessary.
Every building is equipped with a BMS to control the loads (HVAC, lights, etc.) in floor level but not all of them log the data. In order to solve this problem, the loads are categorized according to their functionality into four types: offices, classrooms, labs and services. Then, the consumption per m 2 of each type is calculated and aggregated values for each building are extracted to create the various load profiles.

GJU microgrid pilot description
The microgrid pilot will cover the whole campus of GJU which consists of thirteen buildings plus another three under construction. The main station contains two 33/11 KV transformers. Every one of which feeds three 11/0.4 KV transformers located around the campus feeding all the buildings. In total, there are six transformers in a loop configuration around the campus to increase the reliability of the system, see Figure 4.
The microgridis expected to use four sources of electricity (Utility grid, PV system, diesel generator and ESS) in order to meet the demand in the campus while achieving high reliability and low operating cost. Figure 5 shows the GJU campus microgrid pilot [41][42][43]. Every building is equipped with a BMS to control the loads (HVAC, lights, etc.) in floor level but not all of them log the data. In order to solve this problem, the loads are categorized according to their functionality into four types: offices, classrooms, labs and services. Then, the consumption per m 2 of each type is calculated and aggregated values for each building are extracted to create the various load profiles.

MODELING MICROGRID SYSTEMS COMPONENTS
In order to be able to model the microgrid and perform a digital simulation in real time, we first modeled the microgrid components such as: a) building model, b) PV system model, c) ESS model, and d) diesel generator model, for both MCAST and GJU pilot microgrids, in discrete time EMT simulation models [44][45][46].

Building model
The building model is a Three-phase load model (4-wire) and depends on the seasonal load profiles, Figure 6. In this block, typical load profiles are used and must be updated according to the MCAST and GJU measurements [41][42][43][44][45][46]. The load models are modeled as ideal current sources where the absorbs current ensures that follows the load profile consumption according to the existing voltage conditions as shown in Figure 6.

PV model
The PV system model is built using Matlab/Simulink and it contains a 3-wire interconnection. The production of power (PPV) depends on the solar irradiation for 24h (every 1s), the temperature of the environment and configuration of the PV panels. To enable the appropriate operation of the PV system, an advanced model for the grid side converter (GSC) has been developed. As shown in Figure 7 the GSC is managed by its controller based on a synchronization method, a PQ controller, a current controller and a maximum power point tracker (MPPT) and a Q-profile unit according to [44][45][46][47][48] The high-level configuration of the PV system can be modified by the user and the PV system is able to provide voltagereactive power support into the grid during voltage sag events.

Battery energy storage system model
The battery energy storage system (BESS) model is designed in a similar way with the PV model [44][45][46], it contains a grid-tied inverter with 3-wire interconnection while the charging and discharging rate (kW) depend on the rating of the inverter and the characteristics of the storage device. There are two ways for managing the ESS. The first option is to allow the BESS to autonomously schedule it operation during a day in order to maximize its profit considering a variable pricing scheme Figure 8. The second option is to externally manage the scheduling of the BESS by set-point send by an external controller which considers maximizing the self-consumption of the microgrid. It should be noted that the BESS has been designed in a way it optionally provide reactive power support during voltage sag.

Diesel generator model
Diesel generator is actually one of the most important components of the microgrid, since it will operate as the master in case of islanding. The generator is simulated based on the sixth-order state space model. For the stable and controllable operation of the microgrid, the diesel generator is equipped with local controllers and more specifically, an AC5A exciter and a speed regulator based on the isochronous governor model. Figure 9 illustrates the diesel engine model [44][45][46]. Furthermore, the governor controller is constructed to able to change the generator"s active power output according to set points, which canderive from the microgrid central controller for a proper energy scheduling during the interconnected mode.

Complete model of microrids MCAST and GJU
After implementing all these microgrid systems components models, the models are combined together to form a complete MCAST and GJU microgrid system with grid connected and islanded. On the complete model of MCAST microgrid we have one renewable energy source are included two PVs system model installed in building D and F and one in building J with a 63.24 kWp total energy generation. We have also one BESS and diesel generator on building D and F and one diesel generator on building. Loads are based on the active and reactive power data provided by MCAST [40,49].
On the complete model of GJU microgrid we have also one renewable energy source are included one PV system model installed in buildings (B,D,E,F) with a 320 kWp total energy generation. We have one battery storage system in buildings (B,C,D) and 6 diesel generators one in each building. Loads are the active and reactive power data provided by GJU [43]. Simulation of the system using the MATLAB/Simulink tool [44][45][46], the powers measurements are displayed and observed as explained in the real-time digital simulation in Section 5.

REAL TIME SIMULATION
The objective of the real-time simulator is to test the different electrical equipment in the most natural possible conditions: as if they were connected to the real physical systems associated with them. Therefore, the real-time simulator must reproduce as closely as possible the dynamic behavior of the electrical system under control [36]. The real-time digital simulation of the electrical system to be controlled passes through different phases: a) A modeling phase that consists in the putting of equation of the system. b) Design an algorithmic specification (choice of sampling period, discretization and quantification). c) Finally, a phase of real -time implantation.

Hardware and software architecture
The hardware equipment installed in our SCAMRE laboratory consists of two connected simulators, the wanda-4u and the OP-5600 as shown in Figure 10. The wanda-4u target has two CPU processors including 2 enabled cores and 16 I /Os, and two CPUs including 2 enabled cores and 16 I/Os, for the OP-5600. The main role of the target is the execution of different computation subsystems. The computation subsystem will be executed in real-time (or accelerated simulation mode) on a CPU core of the real-time target. The development, editing, verification and compilation of models are done on the host computer. Its second mission is to function as a console or command post in charge of control and observation during the simulation. Ethernet protocol is used to communicate between hosts and targets. The data between computation subsystem and GUI subsystem is exchanged asynchronously through the TCP / IP link.
All models studied are modeled and developed in the Matlab/Simulink environment. RT-LAB is a graphic platform that allows making 4 main processes: edit models under Simulink directly via RT-LAB, compile (consist to transform Simulink model into a real time application), load and execute the digital simulation on the real-time targets.
Multi-processor operating mode enables real-time simulations on RT-LAB platform. The overall purpose is to separate a complex system to some simple subsystems and do parallel operations in multiprocessor. RT-LAB connects physical devices to the simulation system to make the simulation closer to reality and get more realistic results [50,51].

IMPLEMENTATION, RESULTS AND DISCUSSION
For better visibility of the projects presented, it is mandatory to realize a microgrid model and to simulate it in real-time with the eMEGAsim software. For this reason, the entire model has to be rearranged mainly into two or three subsystems, which are master, slave and console subsystems. The microgrid system is modeled in an environment that integrates Simulink/SimPowerSystems with the eMEGAsim simulation of the RT LAB platform. This platform improves the simulation of significantly large systems with real-time performance across multiple CPUs.

MCAST microgrid pilot and scenarios
Before moving on to real-time digital simulation, we first start by separating the model into 2 subsystems (SM_MCAST and SC_Monitoring) to distinguish the computation subsystem from the GUI subsystem and to assign the first subsystem to CPU core, as depicted in Figure 11. The OpComm block ensures communication between the two subsystems (computation and GUI).All subsystems inputs must first go through an OpComm block before any operations can be done on the signals they are associated with. We used the OpWrite File block from the RT-LAB library to record Simulink signals and data in a MAT file using a Mux block. Figure 12 show the compelte system architecture.

Scenarios, results and discussion
In order to test the correct operation of the microgrid MCAST that we model, we realized three different simulation scenarios in real time with 50µs step simulation. For the first scenario, a simulation of one-hour duration under normal conditions in grid-connected mode is performed. The data corresponds to a period of one hour, from 8:00 am to 9:00 am, of the 13/07/2017 representing a high-load period as shown in Figures 13 and 14.
For the second scenario, the same data is used. Now, the power from the grid is interrupted during 15 minutes (islanded operation). Finally, the last scenario corresponds to an evening period, from 19:50 pm to 20:50 pm of the same day as shown in Figures 13 and 15.

MCAST Scenario 1
The results of the first scenario of the real-time digital simulation are shown in Figure 16 and Figure  17. The first figure is divided into eight illustrations that represent active (a) and reactive (b) power generated (grid, PVs, diesel generators), active (c) and reactive (d) powers of loads, active battery power (e), battery SoC (f), solar irradiance (g) and temperature (h) data respectively. The second figure represents load voltage and current profile during the real-time digital simulation.
From 0s to 3600s we see that the active and reactive power generated is proportional to the loads (the power generated is greater than the building loads because in the model we have other constant loads). 80% of the energy produced comes from the grid and the rest of 20% is generated by the PVs. The power generated by the grid is between 220 kW and 270 kW, and the power produced by the PVs is between 48 kW and 50 kW, the power generated by the diesel generator is 0 kW given the fact that the microgrid is constantly in grid-connected mode. The diesel generation is expected to start when there is a power failure in the grid and the microgrid operates in islanded mode. From 0s to 2400 s the battery is on charging mode and the state of charge is between 65% and 95%.

MCAST Scenario 2
The results of the second scenario of the real-time digital simulation are shown in Figure 18 and are divided into six illustrations that represent total active and reactive power generated (grid, PVs, diesel generators) (a,b,c,d,e,f) respectively. According to the case. From 0s to 3600s, we see that the total active and reactive power generated is proportional to the loads. At 1800s, the power grid is interrupted, we see that the power generated by the grid becomes 0 kW and the diesel generator takes the role of producing the power to ensure the continuity of production. At 2700s, the power grid is restored, the power generated by the diesel generator becomes 0 kW, the grid becomes again the master energy source. We conclude that the diesel generator becomes the master in the case of islanding mode. Figure 18. Results of MCAST Real-time digital simulation (scenario 2)

MCAST Scenario 3
The results of the third scenario of the real-time digital simulation are shown in Figure 19 and are divided also into six illustrations that represent total active (a) and reactive (b) power generated (grid, PVs, diesel generators), active (c) and reactive (d) power loads and solar irradiance (e) and temperature (f) data respectively. From 0 to 3600 s we see that the total active and reactive power generated is proportional to the night loads. From 0s to 1700s the power generated by the PVs decreases from 5 kW to 0 kW and it represents 2% of the total production of the power. The solar irradiance decreases from 108W/m2 to 0W/m2. The temperature also decreases from 23,1oC to 20,1oC. At 1700s grid represents 100% of the total production of power.

GJU microgrid pilot and scenarios
Before proceeding to the real-time digital simulation of the GJU model, the same procedure was followed in the same way as the MCAST model as shown in Figure 20. An OpComm block was added to provide communication between the computation subsystem and the GUI subsystem. We also used the OpWriteFile block of the RT LAB library to record Simulink signals and data into a MAT file using a Mux block, Figure 21 show the complete GJU System Architecture in RT-LAB for the real-time digital simulation.

Scenarios, results and discussion
To test the good operation of the modelled GJU microgrid, 3 different simulation scenarios were realized in real-time with 50µs step simulation. For the first scenario we have simulated a one hour duration under normal grid-connected conditions (morning); the data selected for this simulation include a timeframe from 10:00 am to 11:00 am of the 10/07/2017, representing the period where the load is very high as shown in Figure 22. For the second scenario we used the same data as the previous scenario but with different conditions, where the power from the grid has been uninterrupted for a period of 18 minutes (islanded operation). For the last scenario we proceeded in the same way as the first scenario but with data from 16:30 pm to 17:30 pm of the same date, representing the sunset moment as shown in Figure 23. The results of the first scenario of the real-time digital simulation are shown in Figures 24 and 25. The first figure is divided into eight illustrations that represent active (a) and reactive (b) power (grid, PVs, diesel generator), active (c) and reactive (d) power of loads, active battery power (e), battery SoC (f), solar irradiance (g) and temperature (h) data, respectively.

GJU Scenario 2
The results of the second scenario of the real-time digital simulation are shown in Figure 26 and are divided into six illustrations that represent different outputs show (a,b,c,d,e,f) total active and reactive power (grid,PVs,diesel generator). From 0s to 3600 s we see that the total active and reactive power generated is proportional to the loads. At 2040 s we disconnect the grid using a 3 phase breaker, we observe that the power generated by the grid becomes 0 kW and the diesel generator breaker closes and takes the role of producing the power to ensure the continuity of production. At 3150 s we connect the grid, we see that the 3 phase breaker of diesel generator opens and the power generated becomes 0 kW, the grid becomes master. We conclude that the diesel generator becomes the master in case of islanding mode.

GJU Scenario 3
The results of the third scenario of the real-time digital simulation are shown in Figure 27 and it divided also into six illustrations that represent different outputs show (a,b,c,d,e,f), represent respectively, total active and reactive generated power (grid, PVs, Diesel generator), active and reactive power loads, solar irradiance and temperature data. From 0s to 3600s we see that the total active and reactive power generated is proportional to the night loads. From 0s to 2400s the power generated by the PVs decreases from 10 kW to 0 kW and it represents 1% of the total production of the power. The solar irradiance decreases from 26 W/m2 to 0 W/m2. The temperature also decreases from 21,8 0C to 20,2 0C. At 2400s grid represents 100% of the total production of power.

CONCLUSION
In this paper two microgrid models have been designed based on actual premises of two university campus in Malta (MCAST) and Jordan (GJU) using RT-LAB platform. One-hour real time digital simulation is performed using the OP5600 simulator. Three different scenarios are evaluated for each model and the results are satisfying for both the MCAST and GJU pilots.
The real-time digital simulation on RT-LAB platform allowed us to study several scenarios in very close to reality conditions, and to make several tests on the models conceived without risk, before deploying them in the field. The results obtained have validated the proper functioning of the electrical energy management in the two future microgrids to be realized. The validation was obtained thanks to the real time digital simulation capable of performing calculations at a time step of up to 10 μs.
Future work can be directed towards the optimization, analysis and decentralized control of microgrids that would involve different energy management strategies. The optimization aims to reduce the current loads present in buildings as well as to optimize the use of current renewable generation systems. However, in order to be able to evaluate simulation results, both optimization and control must be synchronized with real-time data to be able to monitor the current situation in buildings. We can then make HIL simulation using real sources of electrical power and real energy sources equipment to validate the final design and move directly to field deployment. Efficient energy management and the integration of RES while providing a laboratory concept, can adapt microgrids to the real state in the future.