DC Microgrid Utilizing Artiﬁcial Intelligence and Phasor Measurement Unit Assisted Inverter

: Community microgrids are set to change the landscape of future energy markets. The technology is being deployed in many cities around the globe. However, a wide-scale deployment faces three major issues: initial synchronization of microgrids with the utility grids, slip management during its operation, and mitigation of distortions produced by the inverter. This paper proposes a Phasor Measurement Unit (PMU) Assisted Inverter (PAI) that addresses these three issues in a single solution. The proposed PAI continually receives real-time data from a Phasor Measurement Unit installed in the distribution system of a utility company and keeps constructing a real-time reference signal for the inverter. To validate the concept, a unique intelligent DC microgrid architecture that employs the proposed Phasor Measurement Unit (PMU) Assisted Inverter (PAI) is also presented, alongside the cloud-based Artiﬁcial Intelligence (AI), which harnesses energy from community shared resources, such as batteries and the community’s rooftop solar resources. The results show that the proposed system produces quality output and is 98.5% efﬁcient.


Discussion
This section provides a literature survey and then compares the proposed approach with the approaches discussed in the literature. Community microgrids have emerged as an alternative to address the rising societal demands for electric infrastructures. They are not only economical and environmentally friendly, but also promise a long list of ambitious goals including premium reliability, superior power quality, improved sustainability, and smooth integration of renewable energy [1]. They are typically capable of operating in islanded or grid-connected mode. Though the technology is proven, it faces the following three major technical challenges.

Initial Synchronization of DC Microgrid with the Utility's AC Grid
Synchronization is the process of connecting an incoming microgrid with the running utility grid. In the case of a DC microgrid, it first requires conversion of DC to AC and then matching the AC signal characteristics (i.e., voltage, phase, and frequency) to that of a utility grid's AC signal characteristics [2]. Mismatching any of these characteristics during the initial connection makes the microgrid incapable of delivering power to a utility grid. In traditional grids, the initial synchronization is achieved by controlling the excitation and the governor's speed. However, in DC microgrids, initial synchronization is achieved by controlling inverter functions such as (a) a reference sine waveform signal, (b) input voltage, and (c) shape and pattern of pulse width in Pulse Width Modulator

Slip Management during Connected Mode Operation
Slips, also known as frequency oscillations, result during the grid-connected operation when the frequency of the microgrid is not closely matched with that of the utility grid. If a slip is not managed, oscillations will be produced, and the system may fall out of synchronization and fail to deliver the power to the utility grid. Literature shows that the inverter's output frequency is a function of the reference signal frequency applied to the PWM of the inverter, therefore slip can be managed by controlling the frequency of the reference signal [3]. Reference [13] proposes the frequency control method based on zerocrossing, however, poor performance is reported by the authors themselves. To enhance the performance, a modified zero-crossing method is proposed in [14], but it is computeintensive. Reference [15] suggests a Discrete Fourier Transform (DFT)-based frequency measurement, however, DFT produces erroneous results during rapid frequency deviation as stated by [16]. Reference [10] presents frequency control by using PLL, however, the reliability is a challenge. Reference [2] suggests a controller, and [11] proposes a linear-time continuous system, however, both are vulnerable to system uncertainties. Reference [12] also presents a PLL-based synchronization approach with a DQ power flow, but only to cater for changing wind speed conditions for a nine wind turbine system. Though DFT produces erroneous results during rapid frequency deviation, if the reference signal could adapt its characteristics (magnitude, frequency, and phase angle) closely enough to the utility grid's AC voltage characteristics continuously, on a real-time basis according to the varying load conditions of the grid, it will play a vital role in grid synchronization. Thus a new PMU Assisted Inverter (PAI) for the DC microgrid is proposed. From these references, it is learnt again that a reference signal that could adapt its frequency according to the load conditions is vital in slip management.

Production of Distortion-Free, Pure Sine Wave
The DC microgrid uses an inverter to convert DC into AC. The inverter uses electronic switches such as Insulated Gate Bipolar Transistors (IGBT). The non-ideal characteristics of the IGBTs set a zero-current-clamping phenomenon that distorts the AC waveform each time it crosses zero voltage and hence it is called Zero Crossovers Distortions [17,18]. Compensation to these distortions is important to attain the pure sinusoidal waveform demanded by the AC utility grid. This requires the width of the PWM signal to be adjusted in each switching cycle. The pulse width is adjusted by adjusting the reference sine waveform signal [18]. Reference [19] that presents a survey of numerous solutions also establishes that PWM requires the direct adjustment of real-time pulse-width in each switching cycle. To accomplish this task, [20] suggests a Proportional Integral Controller, [21] uses a tri-carrier Sinusoidal PWM, [22] presents a dead-time compensation scheme, and [23] proposes a Single-channel Time Analyzer for measuring the narrow pulse width of a pulse train. However, these techniques increase the complexity of the system. Reference [24] successfully compensates for voltage distortion, but the input signal includes narrow pulses, [25] presents a protection algorithm that ensures that no switch is turned on during the dead time, but the fifth, sixth and seventh current harmonics are generated in the reference frame. Active-power, reactive-power, frequency, and voltage droop control are proposed in [26][27][28], however, these are compute-intensive. Reference [29] also designs a control of grid-side inverter, but it is limited only to a permanent magnet AC generator. From these references, it is learnt yet again that a reference signal that could adapt its frequency according to the load conditions is vital in mitigating zero crossovers distortions.

Proposed Approach in View of Prior Art
From the literature review presented above, it is inferred that DC microgrids face three major technical problems, i.e.: (i) Initial synchronization with the utility grid, (ii) Instantaneous slip management during operation, and (iii) Distortions produced by the inverter electronics.
From the literature review, it is also noticed that almost all the prior approaches hint that there is a need for such a reference signal whose characteristics (magnitude, frequency, and phase angle) not only closely resemble that of the connecting utility grid's AC voltage characteristics but also adjust them on real time according to the changes in the grid's voltage. In view of the issues and the prior approaches, this research presents the following six contributions. These are also be seen in Table 1: (i) A new "PMU Assisted Inverter (PAI)" for DC microgrids is proposed. The proposed inverter is designed to continually receive real-time PMU data from the utility's network about the utility grid's AC voltage characteristics (magnitude, frequency, and phase). (ii) A new "Reference Signal Generator" is devised for the proposed inverter. It continuously uses the PMU data and produces the reference signal for the inverter. Therefore, the characteristics (magnitude, frequency, and phase angle) of the reference signal keep changing in real time according to the characteristics of the grid's voltage. Thus, the inverter output signal, which is a function of the reference signal, closely mimics the utility grid's AC voltage. Since the proposed inverter produces the output signal that closely mimics the grid's voltage, it helps the DC grid achieve a graceful initial synchronization with the utility grid. (iii) Since the utility grid's frequency varies due to the unpredictable load variations, it may result in slips or frequency oscillations. If slips are not managed, the system may fall out of synchronization. A new "Pulse Width Modulator (PWM)" is designed for the proposed inverter. Since the modulating signal's frequency follows the grid's frequency, the output frequency of the inverter stays synchronized with the grid frequency, which helps the DC grid mitigate the slips or frequency oscillations during the connected operation. (iv) Since the inverter uses an Insulated Gate Bipolar Transistor (IGBT), the non-ideal characteristics of the IGBT distort the AC waveform each time it crosses zero voltage and hence it is called Zero Crossovers Distortions. Compensation to these distortions requires the width of the PWM signal to be adjusted in each switching cycle. A new "Distortion Observer and Controller" is designed for the proposed inverter. The distortion observer also uses the reference signal from the above noted reference signal generator to adjust the pulse width in real time. It helps the DC grid mitigate the zero crossover distortions. (v) A "Policy Manager" is also proposed, and its algorithm is designed to manage the community based DC sources, i.e., rooftop solar panels and the residents' EVs, connected to a community battery bank. The policy manager is installed with an energy meter to measure the energy pooled into, or used from the community battery bank, and the depreciation of the contributing resources. The policy manager also schedules the discharging/recharging of the EV batteries. (vi) An Artificial Intelligence (AI) based smart client is also proposed that sits in the microgrid. It is programed to communicate with the utility company's network to fetch the PMU data and forward it to the proposed inverter (i.e., reference signal generator) in real-time. A policy algorithm for the Smart client is also designed that makes smart decisions, as explained in some other sections. To validate the concept, a novel intelligent DC microgrid architecture is also proposed. It is novel because it employs (a) the proposed PMU Assisted Inverter (PAI), (b) the cloud-based Artificial Intelligence (AI), and (c) the community-based DC microgrid that harnesses energy from grid-connected Electrical Vehicles' (EVs) batteries and the community's rooftop solar resources.

PMU Assisted Inverter (PAI)
The proposed PAI comprises (i) Inverter Circuit, (ii) PMU data-based Reference Signal Generator, (iii) Pulse Width Modulator (PWM), (iv) Distortions Observer, and (v) Distortion Controller, as shown in the red dotted line boundary in Figure 1.
For grid-connected mode, the inverter takes input from the DC microgrid, a pulse

PMU Assisted Inverter (PAI)
The proposed PAI comprises (i) Inverter Circuit, (ii) PMU data-based Reference Signal Generator, (iii) Pulse Width Modulator (PWM), (iv) Distortions Observer, and (v) Distortion Controller, as shown in the red dotted line boundary in Figure 1.
For grid-connected mode, the inverter takes input from the DC microgrid, a pulse width modulated signal from the PWM, and a feedback signal from the distortion controller. In the previous section, it is established that a reference signal that continually adapts itself on a real-time basis to closely mimic the AC grid voltage plays a vital role in initial synchronization, slip management, and distortions mitigation. The proposed PMU data-based reference signal generator receives real-time data about the grid's voltage characteristics from the utility grid's PMU through a smart client via the communication network and constructs a reference signal. Thus the inverter's output AC voltage mimics the utility grid voltage making it ready for initial synchronization with the utility grid. When all the synchronization conditions are met, and the need for grid-connected mode is realized by the smart client, it wirelessly sends a command to the Synchronizing Relay to allow the PAI to connect the microgrid to the utility grid. The need for shifting from island mode to grid connected mode is to meet the utility grid's demand during peak hours.
The smart client receives this data with a very high temporal resolution of 120 measurements per second about the utility grid's real-time AC voltage waveform characteristics (magnitude, frequency, and phase) from a nearby PMU installed in the utility grid's distribution network via the communication network. These many data sets are good enough to construct a reference signal whose characteristics not only closely resemble that of the utility grid's AC voltage but also continually adapt in real-time according to the varying load conditions of the grid.
Historically, PMUs have been used to monitor transmission lines. Now, the smaller version of them is desired to be installed on distribution networks. The data from these PMUs will be collected either in the utility's network server or cloud-based server. Utilities will be able to share this data sooner in the future with the approval of the proper authority, e.g., NERC, FERC, TRE, etc. with customers, trusted third parties, Independent Service Providers (ISO) for value-added services, or universities for collaborative research.
Any inverter, including the proposed PAI, uses two transistor pairs for its operation. The Zero Crossovers Distortions are triggered by these two transistor pairs. The trigger comes from the delay between the turn-off of one transistor pair and the turn-on of its complement pair. Though crossover delay is kept as low as possible (between 1 and 2 s), it can still cause large voltage distortions [31]. These distortions not only distort the quality of the voltage signal but also become the subject for causing "slips". To compensate for these distortions, and thereby manage the slips, reference signal adjustments are required in each switching cycle [20]. This is accomplished by using the Distortion Observer and Distortion Controller that continually measure the amount of distortion "D", compute the state average models for the inductor and capacitor, and then adjusts Ldi/dt, CdVc/dt, and the pulse-width. Thus, the PWM, the Distortion Observer, and the Distortion Controller that also receive the reference signal continually compare the inverter output AC voltage with the real-time reference voltage and make sure that the output signal is distortion-free, and its characteristics are within the limits dictated by the PMU aided reference signal. Such a distortions free output AC signal helps avoid slips and keeps it tightly synchronized with the utility grid during the entire operation.
A microcontroller is used to control the above process. The microcontroller runs the algorithm shown in the flowchart of Figure 2. All the steps in the algorithm make sure that the inverter output AC voltage mimics the utility grid voltage, it is ready for initial synchronization with the utility grid when all the other grid connectivity conditions are met, that the distortions are controlled in each switching cycle on a real-time basis to avoid slips, and the inverter output is tightly synchronized with the utility grid during the entire operation. Microcontrollers run embedded software code that is written in chronized with the utility grid during the entire operation.
A microcontroller is used to control the above process. The microcontroller runs the algorithm shown in the flowchart of Figure 2. All the steps in the algorithm make sure that the inverter output AC voltage mimics the utility grid voltage, it is ready for initial synchronization with the utility grid when all the other grid connectivity conditions are met, that the distortions are controlled in each switching cycle on a real-time basis to avoid slips, and the inverter output is tightly synchronized with the utility grid during the entire operation. Microcontrollers run embedded software code that is written in Matlab/Simulink, (hereinafter simply Matlab) to execute the steps shown in the flowchart. The code is explained in section II, Simulation and Mathematical Analysis.

DC Microgrid
Solar panels owners and EV owners may want to sell the surplus energy to the utility company, and buy back the energy when they need it. The utility may want to buy energy to meet peak demand, or feed power during an outage, or address the grid regulation issue [33]. A unique intelligent DC microgrid architecture is presented that employs the proposed Phasor Measurement Unit (PMU) Assisted Inverter (PAI), the cloud-based Artificial Intelligence (AI), and that harnesses energy from community shared resources. The proposed DC microgrid consists of a Community Battery Bank that is charged by the community's Electric Vehicles (EV)' batteries, and the rooftop solar panels. The community battery bank is proposed to sit in between the community's energy resources and the utility grid. This approach offers at least two advantages i.e., (a) multiple energy resources of a community can be connected to the utility grid through only one proposed PAI, rather than multiple inverters and synchronizers, each dedicated for each individual EV or a solar panel, and (b) the community battery bank in the middle inherently provides fast recharging of EVs batteries because the EV fast chargers are inherently DC chargers. The figures show single phase AC for simplification, however, the system converts a DC input into a three-phase AC output, with per phase voltage of 120 Volts, and power of 700 kW. The other relevant parameters used are: system frequency 60 Hz; DC side resistive load, 40 Ohms; line equivalent resistance, 1 Ohm; line equivalent inductance, 0.01 H; DC side capacitance, 0.08 F; PMU data receive rate of up to 120 measurements per second; and DC to AC conversion sampling rate of 8 kHz To achieve an efficient energy supply system, the proposed DC microgrid consists of a Policy Manager. The policy manager also has the functionalities of the battery management system. It monitors and manages the community battery bank, the EVs, and the solar panels connected to it. The policy manager also controls the discharging/recharging of the EV batteries. The policy manager is equipped with an energy meter that measures all the Energies 2021, 14, 6086 7 of 17 energy pooled into the community battery bank, a Cycle Counter that counts the cycles and the depth of charge and discharge for each EV battery in each cycle, and the Computation Logic that computes the depreciation of each connected EV battery. The policy manager follows the specific policy algorithm shown in Figure 3, for making intelligent decisions for fair compensation to owners for the EV battery depreciation [33], and charging and discharging the EVs in a way that the EV owners find their EVs charged at the time when they need them. The policy manager sends all the information about the above tasks to the smart client continually. The community-based DC microgrid may be controlled and managed by an Independent Service Operator. This will generate new revenue streams for the Independent Service Operator. The readers interested in microgrid local regulations, compliance requirements, and the existing technical guidelines may see [34].

Communication Network
The communication network consists of communication channels, the local devices situated at the DC microgrid, such as AI-Smart Client, and the remote devices situated in the cloud, such as AI server situated in the Cloud, and a PMU either situated in the Cloud or utility's network. The communication channels for the local devices are local area networks, such as Wi-Fi, and for remote devices are wide area networks, such as 4G, 5G, or Internet channels. The tasks of the above-noted AI Client, AI Server, and PMU Server are explained below.
The AI Smart Client's major task is to make smart decisions for the microgrid. For example, it controls the direction of the flow of electricity from the microgrid to the utility grid or from the utility grid to the microgrid. The smart client's flow switching decision is based on several factors, such as available capacity in the community battery bank, when to charge and discharge the community battery bank so that it may meet the changing needs of the EVs, when to charge/discharge the connected EVs, how urgent is it to charge the EVs, charging and discharging priorities of the EVs, scheduling and time management, utility company's load predictions for the next 24 h, to find how important it is to meet utility grid's peak demand, and at what time. To make such important flow switching decisions, the AI Smart Client continually receives performance data from the PAI, the policy manager, and the Google-based AI server. The AI based smart client, in coordination with the policy manager, predicts and optimizes the performance of the battery bank

Communication Network
The communication network consists of communication channels, the local devices situated at the DC microgrid, such as AI-Smart Client, and the remote devices situated in the cloud, such as AI server situated in the Cloud, and a PMU either situated in the Cloud or utility's network. The communication channels for the local devices are local area networks, such as Wi-Fi, and for remote devices are wide area networks, such as 4G, 5G, or Internet channels. The tasks of the above-noted AI Client, AI Server, and PMU Server are explained below.
The AI Smart Client's major task is to make smart decisions for the microgrid. For example, it controls the direction of the flow of electricity from the microgrid to the utility grid or from the utility grid to the microgrid. The smart client's flow switching decision is based on several factors, such as available capacity in the community battery bank, when to charge and discharge the community battery bank so that it may meet the changing needs of the EVs, when to charge/discharge the connected EVs, how urgent is it to charge the EVs, charging and discharging priorities of the EVs, scheduling and time management, utility company's load predictions for the next 24 h, to find how important it is to meet utility grid's peak demand, and at what time. To make such important flow switching decisions, the AI Smart Client continually receives performance data from the PAI, the policy manager, and the Google-based AI server. The AI based smart client, in coordination with the policy manager, predicts and optimizes the performance of the battery bank The AI Smart Client's second task is to continually receive real-time PMU data, up to 120 measurements per second, about the utility grid's real-time AC voltage waveform characteristics (magnitude, frequency, and phase) from the utility's PMU data server. For the proof of concept, at the time of writing this manuscript, PMU data could not be received from the utility company. Therefore, a Matlab-based PMU simulator was used. The data received from the Matlab simulator mimics the data received from an actual PMU. The Matlab simulator is explained in the next section.
The AI Smart Client's third task is to continually communicate with the Google-based AI server. The AI server is available to the interested AI users under the Pre-General Availability Terms of the Google Cloud Platform. The structured data in the form of CVS files with data primitives, such as numbers, classes, strings, timestamps, lists, and nested fields, is sent and received with the AI server. The AI-Smart Client uses the Auto Machine Learning (Auto ML) application of the Google-based AI server. AutoML uses this data to train ML-Tables and to predict the utility grid's load condition. The code used to accomplish the objective is provided by Google [35].
AI Smart Server, Smart Client, and PMU not only perform the above-noted tasks but can also shape load that can be highly beneficial to utilities. This is why AI Smart Server and Client-based approaches recently have begun attracting significant research interest in the field of demand-side response [36].

Inverter Output
This section evaluates the performance of the PAI. Matlab/Simulink is employed. Simulink is an add-on product to Matlab that enables the rapid construction of virtual prototypes. It includes a comprehensive library that enables the users to produce a running model. For the simulation, a set of parameters explained above is used. A Matlab-based PMU simulator is used that employs the PMU processing algorithm developed in [33], customized to execute the proposed approach as shown in Figure 4. In the figure, the phasor estimation (P n ) is computed using Discrete Fourier Transform (DFT), the sampling period (t), the sampling window (N), the frequency deviation (∆ω), and the calibration factors. Frequency deviation is estimated in real-time because, in any power system operation, the frequency is never steady. This deviation may be small or large, depending on load fluctuation. Thus, the frequency estimation methodology plays a key role in producing real-time data that is used for the construction of the reference signal. Thus according to [32], P n the phasor estimation is given by: Energies 2021, 14, x FOR PEER REVIEW 10 of 21 where 1 ab v is the inverter output voltage without the dead time distortion (td), and ∆v is the crossover voltage distortion that degrades the inverter output voltage vinv. The inverter output voltage vinv is also a function of L (sum of L1 and L2) and is given as: and thus the grid current ig can be expressed as:   The key element in any PWM-based inverter is the frequency and phase of the reference signals. the PMU simulator output (PMU Sim O/P ) supplies these parameters to the PMU aided reference signal generator. The PMU reference signal generator uses these parameters and defines the duty cycle of the carrier pulses generated and thus the signal frequency of the output signal (that mimics the utility frequency).
The PWM carrier signal defines the sampling rate of DC to AC conversion. The higher the sampling rate, the more pulses per 60 Hz generated, and thus the purer the AC output becomes. An 8 kHz sampling rate is used by overcoming the crossover distortion as explained below. The PWM output is then fed to the inverter. Reference [37] provides simulation code for both the PWM and the inverter. The mitigation of zero crossover distortions (also known as dead time effect, t d .) is explained here. In the inverter circuit shown in Figure 5, two pairs of IGBT (Q1-Q4 and Q2-Q3) are used in Leg-A and Leg-B respectively. The output of these legs are v ao and v bo . Q1-Q4 and Q2-Q3 are switched synchronously in a diagonal way, and consequently, v bo = −v ao . Therefore, the inverter output voltage v inv is given as: where v 1 ab is the inverter output voltage without the dead time distortion (t d ), and ∆v is the crossover voltage distortion that degrades the inverter output voltage v inv . The inverter output voltage v inv is also a function of L (sum of L 1 and L 2 ) and is given as: and thus the grid current i g can be expressed as: where v 1 inv is the fundamental, v h inv is the distortion in the inverter output voltage, and v g is the grid voltage. Equations (2) and (4) show that the distortions of the inverter output voltage v inv also affect the injected grid current i g . Assuming v 1 ab = v 1 inv , Equation (4) can be simplified as: Energies 2021, 14, x FOR PEER REVIEW 11 of 21 It shows that the grid current distortions due to dead time depend on the duration of the dead time of the inverter output current. The larger the dead time, the more the distortions occur because the more the PWM pulses are missed. The proposed Distortion Controller computes the missed pulses by comparing the distortions observer's output with the real-time reference signal and provides adequate compensation by adjusting the modulation index. For short circuit protection, the IGBT collector-to-emitter voltage is monitored. For additional protection, the smart client's continuously monitors both voltage and frequency and automatically disconnects the system from the grid if any parameter is outside the permitted range.
Refer to Figure 6, which verifies that the inverter output voltage (plot-c) mimics the "reference signal" (plot-a) that is generated by the proposed Reference Signal Generator. The proposed Reference Signal Generator generates the signal using the data provided by the proposed PMU Simulator. Plot (b) shows the output of the Width Modulator (PWM). The modulator uses the reference signal (plot-a) and thus the output pulse width modulated signal adapts according to the reference signal. Thus plot-c, the inverter output, mimics the (plot-a) as claimed. Pulse Width Modulator (PWM) uses the Vector Control algorithm for the control of pulse width modulation. It is used to keep the output voltage of the inverter at the rated voltage of 120 V AC in a single phase, and 230/400 V in three phase system. The figures show single phase AC for simplification, however, the system converts a DC input into a three-phase AC output.  Figure 7 proves that the output of the proposed inverter and smart client based synchronizer promptly succeeds to achieve the voltage magnitude, frequency, and phase angle in the allowable range for synchronization. Figure 7a shows the Matlab simulated output AC voltage of the proposed inverter (see plot-a), the utility grid voltage (plot-b), and Figure 7b shows the smart client based synchronizer. The smart client based synchronizer synchronizes the microgrid with the utility when the grid voltage magnitudes, the frequencies, and the phase angles difference are within specified limits. Comparison of plots (a) and (c) shows that there is a difference of 1.5%, 0.1%, and 0.1% of voltage amplitudes,  Figure 7 proves that the output of the proposed inverter and smart client based synchronizer promptly succeeds to achieve the voltage magnitude, frequency, and phase angle in the allowable range for synchronization. Figure 7a shows the Matlab simulated output AC voltage of the proposed inverter (see plot-a), the utility grid voltage (plot-b), and Figure 7b shows the smart client based synchronizer. The smart client based synchronizer synchronizes the microgrid with the utility when the grid voltage magnitudes, the frequencies, and the phase angles difference are within specified limits. Comparison of plots (a) and (c) shows that there is a difference of 1.5%, 0.1%, and 0.1% of voltage amplitudes, frequencies, and phase angles respectively when the synchronizer immediately achieved synchronization. Please note reference [38] provides the synchronization guidelines i.e., voltage magnitudes difference of a few percent, the frequencies difference of 0.2%, and the phase angles difference of 0.2% are allowed. Since the inverter output AC voltage created using the proposed mechanism is well below the set guidelines, the Synchronizer promptly acquires the initial synchronization.  Figure 8 confirms that the output AC voltage of the proposed Inverter significantly mitigates the zero crossover distortions that help in avoiding slips, which ultimately improves the voltage stability and power quality. Voltage stability in a microgrid is the ability to retain the voltage level within a specified range during a steady state, or transient conditions caused by a sudden change in loads, the occurrence of a fault, or invertors operation. Distortion determines the quality of the sinusoidal waveform, stability of the power system, and the average power transferred to the load. Therefore, compensation of distortions is imperative. The suggested approach minimizes distortion and thus improves the overall grid operation. Figure 8 shows that the proposed solution offers a 10% improvement in voltage stability, and an 11% improvement in voltage quality. In the same figure, the Voltage Stability and Quality Index (VSQI) triangle is based on Equation (5). This equation is borrowed from Ref [9] and is given by the  Figure 8 confirms that the output AC voltage of the proposed Inverter significantly mitigates the zero crossover distortions that help in avoiding slips, which ultimately improves the voltage stability and power quality. Voltage stability in a microgrid is the ability to retain the voltage level within a specified range during a steady state, or transient conditions caused by a sudden change in loads, the occurrence of a fault, or invertors operation. Distortion determines the quality of the sinusoidal waveform, stability of the power system, and the average power transferred to the load. Therefore, compensation of distortions is imperative. The suggested approach minimizes distortion and thus improves the overall grid operation. Figure 8 shows that the proposed solution offers a 10% improvement in voltage stability, and an 11% improvement in voltage quality. In the same figure, the Voltage Stability and Quality Index (VSQI) triangle is based on Equation (5). This equation is borrowed from Ref [9] and is given by the  Figure 9 verifies that the proposed inverter achieves higher efficiency. According to Reference [39], the inverter efficiency is the ratio of the usable AC output power to the sum of the DC input power, and the typical grid-tied inverter efficiencies are about 93% under most operating conditions. The proposed inverter achieves an efficiency of 98%, which is 5% more than the inverters that use a non-adaptable reference signal. The higher efficiency is achieved due to the PMU assisted reference signal generator that receives real-time data about the utility grid's voltage from the PMU to construct a real-time reference voltage signal for the inverter.  Figure 9 verifies that the proposed inverter achieves higher efficiency. According to Reference [39], the inverter efficiency is the ratio of the usable AC output power to the sum of the DC input power, and the typical grid-tied inverter efficiencies are about 93% under most operating conditions. The proposed inverter achieves an efficiency of 98%, which is 5% more than the inverters that use a non-adaptable reference signal. The higher efficiency is achieved due to the PMU assisted reference signal generator that receives real-time data about the utility grid's voltage from the PMU to construct a real-time reference voltage signal for the inverter.  Figure 10 demonstrates that the AI based smart client, in coordination with the policy manager, predicts and optimizes the performance of the battery bank. The battery bank efficiency that is managed by the policy manager is also simulated. The simulation is performed using the battery equivalent circuit for different State of Charge (SOC) conditions,   Figure 10 demonstrates that the AI based smart client, in coordination with the policy manager, predicts and optimizes the performance of the battery bank. The battery bank efficiency that is managed by the policy manager is also simulated. The simulation is performed using the battery equivalent circuit for different State of Charge (SOC) conditions, and the algorithm that is provided in Figure 10. The efficiency graphs show that with the AI based smart client, and the policy manager, 6% enhanced efficiency can be achieved. The algorithm, as shown in the flowchart, initializes the constants of the battery equivalent circuit. The constants consist of battery capacity, the number of cells, internal resistances, discharge current, and Peukerts constant (k) a unique constant number for every battery. The battery equivalent circuit comprises of circuit elements, i.e., Voltage (E), Resistance (R2), open circuit voltage (Voc), and internal Resistance (R), that is directly proportional to SOC condition, and δ, the temperature variation, as explained in Ref. [40].

Efficiency of Battery Bank Managed by Policy Manager and Smart Client
After the initialization step, the algorithm estimates the open circuit voltage of the battery using then the number of steps, CRn, by using where T is the time the battery needs to discharge, and then the supplied charge. The literature provides numerous hands-on methods, as well as Python Libraries, and Matlab Block Libraries based open source codes for measuring the varying internal resistance. The proposed Matlab program is based on the steps of connecting a resistance of known value in the circuit with a battery, measuring the voltage through the battery, calculating current, measuring the voltage through the resistor, finding the voltage drop, and using Kirchoff laws to calculate the remaining resistance, which would be internal resistance, The algorithm, as shown in the flowchart, initializes the constants of the battery equivalent circuit. The constants consist of battery capacity, the number of cells, internal resistances, discharge current, and Peukerts constant (k) a unique constant number for every battery. The battery equivalent circuit comprises of circuit elements, i.e., Voltage (E), Resistance (R2), open circuit voltage (Voc), and internal Resistance (R), that is directly proportional to SOC condition, and δ, the temperature variation, as explained in Ref. [40].
After the initialization step, the algorithm estimates the open circuit voltage of the battery using then the number of steps, CR n , by using then the depth of discharge (DoD) using where T is the time the battery needs to discharge, and then the supplied charge. The literature provides numerous hands-on methods, as well as Python Libraries, and Matlab Block Libraries based open source codes for measuring the varying internal resistance. The proposed Matlab program is based on the steps of connecting a resistance of known value in the circuit with a battery, measuring the voltage through the battery, calculating current, measuring the voltage through the resistor, finding the voltage drop, and using Kirchoff laws to calculate the remaining resistance, which would be internal resistance, and repeating these steps. The AI agent then predicts the battery resistance for different values of current, SOC, and at varying temperatures. Finally, the Matlab simulator plots various efficiency graphs for different active load conditions and SoCs. These efficiency graphs are shown in Figure 11. The graphs show that with an AI based smart client and policy manager, 6% enhanced efficiency can be achieved. graphs are shown in Figure 11. The graphs show that with an AI based smart client and policy manager, 6% enhanced efficiency can be achieved. As a closing comment, and for the comprehensiveness of the paper, it is stated that though hybrid AC/DC architectures have been studied, they present various drawbacks such as, see [41], (a) fault detection in DC is more difficult than in AC due to the zerocrossings of the current in AC, (b) reliability of hybrid microgrids is lower than in AC grids due to the power converter interface needed in the distribution network, and (c) the management of hybrid microgrids is more complex because it involves the control of AC devices, DC devices and the interface power converter between them.

Summary of Test Cases
Test Case-1: Refer to Figure 6 which verifies that the inverter output voltage (plot-c) mimics the "reference signal" (plot-a) that is generated by the proposed Reference Signal Generator. The proposed Reference Signal Generator generates the signal using the data provided by the proposed PMU data based reference signal construction.
Test Case-2: Refer to Figure 7, which proves that the smart client based synchronizer promptly succeeds to synchronize the output of the proposed inverter with the utility grid by rapidly bringing the voltage magnitude, frequency, and the phase angle of the inverter in the allowable range for synchronization.
Test Case-3: Refer to Figure 8, which demonstrates that the output AC voltage of the proposed Inverter significantly mitigates the zero crossover distortions and helps in avoiding slips, and thus ultimately improving the voltage stability and power quality.
Test Case-4: Figure 11. Discharge Efficiency Characteristics with and without Proposed Method.
As a closing comment, and for the comprehensiveness of the paper, it is stated that though hybrid AC/DC architectures have been studied, they present various drawbacks such as, see [41], (a) fault detection in DC is more difficult than in AC due to the zerocrossings of the current in AC, (b) reliability of hybrid microgrids is lower than in AC grids due to the power converter interface needed in the distribution network, and (c) the management of hybrid microgrids is more complex because it involves the control of AC devices, DC devices and the interface power converter between them.

Summary of Test Cases
Test Case-1: Refer to Figure 6 which verifies that the inverter output voltage (plot-c) mimics the "reference signal" (plot-a) that is generated by the proposed Reference Signal Generator. The proposed Reference Signal Generator generates the signal using the data provided by the proposed PMU data based reference signal construction.
Test Case-2: Refer to Figure 7, which proves that the smart client based synchronizer promptly succeeds to synchronize the output of the proposed inverter with the utility grid by rapidly bringing the voltage magnitude, frequency, and the phase angle of the inverter in the allowable range for synchronization.
Test Case-3: Refer to Figure 8, which demonstrates that the output AC voltage of the proposed Inverter significantly mitigates the zero crossover distortions and helps in avoiding slips, and thus ultimately improving the voltage stability and power quality.
Test Case-4: Refer to Figure 9, which confirms that the proposed inverter achieves higher efficiency which is 5% more than the inverters that use a non-adaptable reference signal. The higher efficiency is achieved due to the PMU assisted reference signal generator that receives realtime data about the utility grid's voltage from the PMU to construct a real-time reference voltage signal for the inverter.
Test Case-5: Refer to Figure 10, which proves that the AI based smart client, in coordination with the policy manager, predicts and optimizes the performance of the battery bank for different State of Charge (SOC) conditions, and achieves 6% enhanced efficiency.

Conclusions
Viable wide-scale deployment of community microgrids faces three major technical problems, i.e., initial synchronization with the utility grid, instantaneous slip management during operation, and distortions produced by the inverter electronics. This paper presents a unique PMU assisted Inverter, named PAI that solves the above noted three distinct issues. The proposed inverter continually receives real-time PMU data from the utility's network about the utility grid's AC voltage characteristics (magnitude, frequency, and phase). This proposed inverter not only offers improved efficiency but also enhances stability and power quality.
The proposed "Reference Signal Generator" continuously uses the PMU data and produces the reference signal for the inverter. Therefore, the characteristics (magnitude, frequency, and phase angle) of the reference signal keep changing in real time according to that of the grid's voltage. Thus, the Inverter output signal is a close replica of the utility grid's AC voltage. This proposed idea improves the DC grid synchronization process with the utility AC grid.
The proposed "Pulse Width Modulator (PWM)" uses the reference signal from the above noted reference signal generator. Since the modulating signal's frequency follows the grid's frequency, therefore the output frequency of the inverter stays synchronized with the grid frequency. This proposed idea mitigates the frequency oscillations or slips during the connected operation, and thus improves stability.
The proposed "Distortion Observer and Controller" also uses the reference signal from the above noted reference signal generator to adjust the pulse width in real time. This proposed idea mitigates the zero crossover distortions, thus it improves the power quality of the connected grid operation.
To validate the concept, the paper also presents a community-based DC microgrid architecture that employs the community resources such as EVs' batteries and the community rooftop solar cells in addition to the proposed PAI. The proposed architecture enables the community resources to simply and efficiently bid into ancillary markets. The salient benefits of the proposed solution are that it: (a) provides a three in one solution to the above noted three distinct issues, (b) enables the DC microgrid to harness diversified community resources but still use only one PAI, rather than plurality of inverters and synchronizers, and (c) provides fast charging capability and scheduling flexibility for charging/discharging at any arbitrary time that suits the EV owners. The results show that the PAI's output AC voltage exceeds the guidelines set for synchronization equipment, thus it can easily assist in acquiring initial synchronization. The results also show that the proposed PAI manages frequency slips and mitigates zero crossing distortions successfully. The limitation of this research is that it is based on simulation only. The continuation of the work in future plans to collaborate with a local utility company to receive real time PMU data instead of simulated data. This would also provide a proof of concept to validate the results obtained from the simulation.

Future Work
Though the proposed intelligent DC microgrid commissioned with Phasor Measurement Unit assisted inverter architecture offers several benefits, if not properly cyber secured, it may be prone to cyberattacks. For instance, a disgruntled community resident may conduct a "replay attack" or "false data injection", into the community-based microgrid and change the set-points. Though addressing cyber-security issues does not fall into the scope of this paper, most of the attacks can be identified through anomalies detection or attack signature detection. An AI Smart Server and Client coupled with machine learning approaches, as discussed in [35], can detect cyberattack signatures and behaviors from known and new threat actors. It is planned to focus on AI-based Cybersecurity attack detection. The authors also plan to study the application and effectiveness of AI and PMU based DC microgrids for quantifying the Power Quality Limits for distributed generation.
Author Contributions: R.Y. came up with the idea of using PMU data to create a reference signal. M.A. endorsed the idea, reviewed the paper, and provided useful feedback. H.A. endorsed the concept, did a prior art search, and helped address the comments. All authors have read and agreed to the published version of the manuscript.