# Design of a Partially Grid-Connected Photovoltaic Microgrid Using IoT Technology
## 5 Results and Discussion
The main objective of the battery in this system is to supply critical loads during the night and temporarily support the load demand during cloud train  
Figure 16: (**a**) Waveform of instantaneous voltage and current of microgrid computed at a load power of 100 kW, (**b**,c**) THD analysis of load voltage and current, respectively. In the case of the persistence of clouds for long periods or during the night, the demand is partially supplied by the battery bank and the non-critical loads are switched to the utility grid. To study this case, a load profile of an academic institute is adopted [65]. The critical load is chosen to be 20% of the peak power (20 kW) of the load demand. With a total absence of irradiance for one day, a suitable size of the battery is calculated to be 480 kWh. If the _SOC_ of the battery is nearly fully charged (95%) and under the assumption of the total absence of irradiance in the next day, the battery power should be increased up to 600 kWh. Therefore, the battery bank with this rated capacity is capable to provide power to the critical loads for 24 h, as shown in Figure 17b. The above case represents the most extreme conditions to operate the system. However, for weather conditions, like in Saudi Arabia which has a clear sky condition for most of the year, the battery bank is sized to supply the critical loads at the night and during short cloud periods during the day. This means the suitable size of the battery for the above-mentioned case can be reduced to be in the range of 240 kWh. Figure 18 displays voltage power curve of the microgrid in which the voltage regulation action of the controllers is clearly achieved. The controllers succeeded in regulating the voltage to be within 10% of its nominal value for load power change up to 200 kW. After this limit, a load shedding action should be taken to prevent the unstable operation of the microgrid. However, instead of load shedding, some loads are carefully selected to be transferred to the utility grid in the partially grid-connected mode. The selection procedure is achieved by the above-mentioned algorithm. An example to verify the proposed algorithm result is displayed in Figure 19. In this case, the algorithm is applied on five non-critical loads of 40, 20, 20, 60, 25 kW. The loads are sequentially connected to the microgrid at times of 1, 2, 3, 4, and 5 s, respectively. As displayed in the figure, the connection of load#4 resulted in a significant voltage drop below the accepted limits (10% of the nominal voltage). In this situation, one or more loads have to be disconnected from the microgrid and transferred to the utility grid. The selection of this (or these) load (s) depends on the power difference between the load demand and the available power of the microgrid. In this case, load# 4 was selected to be transferred to the utility. When the load demand decreases or the microgrid conditions were improved, the voltage attained its nominal value, therefore the disconnected load was restored to the microgrid again. Figure 17: (**a**) Variation of PV power, _SOC_ and Battery power with changing of load power computed for (**a**) variable irradiance and (**b**) 24 h absence of irradiance with load profile of an academic institute. Regarding the IoT network, the designed smart-meter prototype was evaluated from the data transmission point of view. The measured data throughout boosted mode communication is depicted in Figure 20. The measured results show that ZigBee with a bit rate of 6.7 kbps is capable of handling the bit rate and latency required for effective reporting of the load demands to the microgrid controller through the designed IoT connection. The latency for the communication between the smart meter and the controller in this measurement was within 10 s. To assess the effectiveness of the LoRa communication protocol in handling the communication requirements (bitrate, latency, and coverage) between smart meters and the microgrid controller, the LoRa physical layer was simulated using Matlab.