Microgrid State Estimation and IoT: Modelling Concepts and Design Algorithm

—State estimation is one of the main challenges in the microgrids, due to the complexity of the system dynamics and the limitations of the communication network. In this regard, a novel real-time event-based optimal state estimator is introduced in this technical paper, which uses the proposed adaptive send-on-delta (SoD) non-uniform sampling method over wireless sensors networks. The proposed estimator requires low communication bandwidth and incurs lower computational resource cost appropriate for Internet of things (IoT) communication networks. The threshold for the SoD sampler is made adaptive based on the average communication link delay, which is computed in a distributed form using the event-based average consensus protocol. The SoD non-uniform signal sampling approach reduces the trafﬁc over the IoT communication network due to the events transmitted only when there is a level crossing in the measurements. The state estimator structure is extended on top of the traditional Kalman ﬁlter with the additional stages for the fusion of the received events. The error correction stage is further improved by optimal reconstruction of the signals using projection onto convex sets (POCS) algorithm.


I. INTRODUCTION
Microgrids are small scale power systems that have been proposed for the optimal integration of renewable energy resources (RESs).However, having the smaller scale has decreased the inertia required for the stability of its operation, similar to any other fast dynamic system.Low inertia means that the system is prone to instabilities driven by disturbances more, and therefore robust controllers should be designed to stabilize its long-term operation [1], [2].The main element of the robust controllers is the adaptation to the current state of the system, as a high number of the robust control techniques are based on state feedback [3], [4].To address this requirement, observers are used for monitoring the state of the system because the state variables of a complex system are not available for direct measurement through the system outputs.Furthermore, due to the measurement noise, process noise, and the communication restrictions, continuous noisefree measurements are not available at the observers, which mandates the usage of estimation strategies in them [5], [6].
Additionally, the fast dynamic of the microgrid necessitates that this estimation takes place in real-time [7].
Two main approaches are proposed in the literature of state estimators, i.e. centralized and distributed strategies.These approaches have their own advantages, which suits them for the specific user application.Distributed state estimation strategies are usually used when the dynamic system has a large scale and the computation resource cost of a centralized option makes the solution expensive and infeasible [8].Despite distributed approaches solve the single failure point issue, they mandate the use of more measurement nodes, which is not suitable for medium sized microgrids [9], [10].
Contrary to distributed approaches, in centralized state estimators, the main assumption is to have a single node for the whole state estimation task.Therefore, computationally powerful measurement nodes are not needed as they have to only collect the data and transmit it [11], [12].The data transmission rate of the sensors significantly affects the performance of the estimator, the energy consumption of battery-based devices, and the network traffic [13].Most of the classic estimation theories have assumed that the signals are either continuous or sampled periodically with a constant period.However, the current communication technology trend is to use Internet of things (IoT) communication networks, which has constraints in the communication speed and its availability [7].These limitations mandates the use of modern techniques and theories for the state estimation to work based on non-uniform event-based data from the measurements in a microgrid.For example, authors in [14] used non-synchronized measurements from the smart meters, or the authors in [15] have used continuous measurements to find an accurate multilevel estimation strategy.Other studies such as [16]- [18], have tried to reduce the state space set and have used classic estimators, which are not optimal in resource utilization.A data-driven approach is also proposed in [19], which is able to work under uncertainties, with the cost of offline training.Several other works have been reported in the literature to address the sampling issue in IoT networks from the rate adaptiveness perceptive.In those works, instead of having the samples at unevenly distributed discrete instants, the periodic sampling rate is adaptively adjusted.In [20], AdaM algorithm is proposed which integrates a filtering unit along with the sampler.This approach increases the computing burden on the device, as it has to solve an optimization problem in realtime.In [21], a differential privacy-based sampling method is proposed, which hides the data correlation from the malicious attacker, with the cost of data encoding/decoding at both the transmitter and receiver ends.A co-design method is proposed in [22], that considers the medium access and sampling rate in the rate adjustment by compressing data into variable sizes chunks.The mentioned works suffer from the high computing burden on the remote monitoring device comparing to eventbased alternatives discussed previously.
The authors proposed an optimal state estimation framework for microgrids using the send-on-delta (SoD) sampling method, in their previous work [23].The proposed SoD sampling method was delay independent, which only checked if the signal has crossed a predefined threshold as the main condition for the event transmission.Considering the scale of the IoT sensors installed across a microgrid, which can be of thousands or more, this method is an inefficient usage of the communication bandwidth.Also, in that work, the effect of the communication delay was not considered, which is important in IoT wireless sensor networks.Therefore, in this paper to address the the network limitations, computational complexity, and microgrid requirements, a novel solution is proposed that considers the effect of communication delay by adaptively adjusting the threshold of SoD sampler, based on the proposed event-based average consensus protocol.The proposed estimator employs projection onto convex sets (POCS) technique [24] to optimally reconstruct the sparse signals from the measurement nodes and reduces the state estimation error of event-based Kalman filter.The experimental results of this research are detailed in the [25].

II. MICROGRID STATE ESTIMATION DATA MODELLING
AND THE OBSERVER ARCHITECTURE In this section, the microgrid state estimation problem is modelled from the measurement data viewpoint.A microgrid usually consists of energy storage (ES) systems, renewable energy sources (RESs), consumer loads and power converters.Generally, two voltage systems are considered for microgrids: DC (Direct Current) and AC (Alternating Current) microgrids.Each of these different types are dynamic systems that can be modelled using a set of (non)linear differential equations.Like any other type of dynamical system, every process has internal state variables, outputs, and inputs.The measurements set for the AC and DC microgrids state estimation are {Active power injected into each bus, Reactive power injected into each bus, RMS voltage of buses} and {RMS voltage of buses, RMS of the injected current into each bus}, respectively.

AC microgrids
p i ∈ P, Active power injected into each bus Other variables such as phase can be considered for AC microgrids as well, but the phasor measurement units (PMUs) are required for this high speed synchronization, which can be expensive.Therefore, indirect measurements with active and reactive power are used here, which have higher feasibility with lower cost.It is assumed that the measurements from the distributed sensors have the following error dynamics: where z is the output of the sensors, h(x) is the state to output mapping, and e i is the sensor error, which can be due to the noise, or inaccuracy.Also the state dynamics are modelled with the nodal admittance matrix (Y bus) of the grid.
The architecture of the proposed state estimator with eventbased measurements is shown in Fig. 1.The three parts are: the event-based adaptive Kalman state estimator, the eventbased signal reconstructor and the mean square error (MSE) comparator.The microgrid estimation input quantities are collected using the proposed adaptive send-on-delta (SoD) measurement technique.The event-based Kalman filter works based on the knowledge that the signal between the events is bounded by the δ threshold in the SoD sampler.The original signal is reconstructed in the signal conditioner based on the received events using the projection onto convex sets (POCS) algorithm, which is mainly used in the literature as a promising approach for low quality image reconstruction.In the last stage, the error comparator updates the estimated state input based on the difference of the reconstructed signal and the predicted output of the previous filtering stage.The SoD sampler threshold is adapted distributively based on the consensus value of the average communication delay.In this mechanism, each sensor calculates the round trip delay between itself the and the microgrid estimator, and adjusts the threshold according to the fused data from neighbor sensors.The main advantage of this mechanism shows itself when the microgrid components communicate over a shared wireless medium, which is usually the case in IoT-enabled microgrids [4].Optimal usage of network resources, meanwhile providing a high quality estimate of the microgrid state is the aim of the proposed estimation strategy.For example, consider that a microgrid is operating in a transient mode.Usually, in transient modes, the system exposes fast dynamics that lead to a very large number of events using the delay-independent SoD sampling method, which was tackled in our previous work [4].Communication delay directly proportional to the traffic rate (or packet generation rate) in a shared medium.As a result, the delay on the shared communication medium increases, which considerably decreases the quality of data and the state estimation accuracy.However, in our proposal, if the sensors achieve a consensus on the average communication delay on the shared communication medium, they can automatically adjust the SoD sampling threshold to a wider region, which leads to a lower number of events generated.As a result of this adaptivity, the quality of the data and the state estimation accuracy will be improved considerably, comparing to the previous proposed delay-independent method.To provide this average delay consensus for the sensors in a microgrid, a novel event-based average consensus protocol is proposed in Section VI, which works in parallel with the SoD sampling data flow.

III. DESIGN PROCESS OF THE STATE ESTIMATOR
This section summarizes the steps required for the microgrid state estimator, in a simplified sequence: 1) Finding the global small signal model of the microgrid in the form of a linear state space equation.In this step, the covariance for the process noise and the measurement noise should be chosen according to the microgrid specifications and sensor accuracies.In this work, we have converted the closed loop transfer function matrix, defined in equation (36) of [1], into minimal state space model to get equation (2).2) Choosing the initial value for the threshold of the SoD sampler.This value should be selected in accordance with the covariance values chosen in the previous steps, in order to prevent the noisy measurements generate unnecessary events and the resulted traffic.3) Building the communication topology graph for the event-based average consensus protocol defined in Theorem 1.The graph should be strongly connected, but doesn't need to be deterministic, as the average consensus protocol, designed in the next step, adjusts the SoD threshold dynamically.4) Choosing the average consensus parameters to have a guaranteed convergence rate for the consensus protocol.This value affects the event generation, therefore a tradeoff takes place between the number of events and the convergence rate of the protocol.
After these steps are taken in the design process, the parameters of the state estimator and the nodes are initialized with the corresponding microgrid parameters.In the results section, the values for the parameters of the case study microgrid are provided together with the results of the experiment.In the next section, the mathematical framework of the event-based Kalman filter with SoD sampling is developed.

IV. EVENT-BASED KALMAN FILTER BASED ON SEND-ON-DELTA
Minimal realization of the microgrid admittance bus (Y bus) and the small signal model of the controllers, results in the following multi-variable system for the estimation problem: where x ∈ R n is the system state and y ∈ R p is the measured output.w (t) and v(t) are the process noise and measurement noise, respectively, which are the uncorrelated, zero-mean white Gaussian random processes, satisfying the following: R is the measurement noise covariance, and Q is the process noise covariance.Also, w i and v j are the i-th and j-th elements of the w and v, respectively.It is presumed that the i-th sensor only transmits the data when the difference between the current value and the previous value is greater than the SoD threshold δ i .Using SoD method [26], the estimator continuously samples the data with a period of T from the measurement nodes.For example, if the last received i-th sensor value is y i at time t last,i , and there is no data received from i-th node for t > t last,i , then y i (t) is estimated as: The last received i-th sensor data is used to compute the output y computed,i even if there is no sensor data transmission: ) where ∆ i (t, t last,i ) =y i (t last,i ) −y i (t) and: In (7), measurement deviation increases from v i (t) to v i (t) + ∆ i (t, t last,i ).∆ i (t, t last,i ) is assumed to have the uniform distribution constrained by (8), therefore the variance of ∆ i (t, t last,i ) is 12 , which will be added to the output noise covariance matrix, R(i, i), in the Kalman estimator.
SoD-based State Estimation Algorithm: In order to suitably improve the update part of the standard Kalman filter algorithm, an improved algorithm is proposed here, which makes it adapted to the SoD event triggering condition by increasing the input covariance R k , at the instant of the events: 1) Initialization step x− (0), 2) Input measurement update end if 3) Project ahead x− ((k + 1)T ) = exp (AT )x (kT ) where Q d is the covariance of the process noise for the discretized microgrid state space realization, and y last is defined as follows (15): The presented event-based estimator is also able to be used in the implementation of the distributed controllers in networked systems.For further studies on the convergence analysis, one may refer to [7].It should be noted that in the proposed event-based observer, convergence is achieved by knowing the fact that Kalman filer is an optimal observer.Nevertheless, choosing smaller values for δ i would result in the a significant decrease in convergence time [26].

V. SIGNAL RECONSTRUCTION FORMULATION AND ESTIMATOR UPDATE RULE
The SoD sampled version of a signal contains the time instants that the original signal has changed more than the threshold in the SoD sampling (i.e.δ).If no sample has been generated by the SoD sampler, then it means that the original signal has remained in the region around the last event value with the radius of δ.Here, this is called the implicit information in the event data, which is used to solve the optimization problem of signal fitting and reconstruction.To formulate the optimization problem, the solution boundaries need to be determined.The implicit information from the SoD sampled signals are used to determine the required boundaries for the solution of the convex optimization problem, which is modelled in the following.This mechanism is illustrated in Fig. 2. To model and solve the optimization problem, projection onto convex sets (POCS) technique is used, which has been previously used for image reconstruction from low resolution cameras [27], [28] and for signal recovery from level crossing samples [29].SoD sampling is a generalization of level crossing or Lebesgue sampling, which also considers the signal initial value.To adjust this sampling technique to POCS formulation, the results of level-crossing sampling from [24] are extended, detailed in the next Section.

A. Implicit Information of Send-on-Delta Sampled Signal
Send-on-Delta sampling is a type of event-based sampling, where each event shows a crossing of the signal x(t) from a one dimensional region bounded by δ around the last sample.The event time instants t n ∈ Z, n ∈ Z are defined as: Fig. 2. SoD sampling method checks if the signal variation is more than the threshold δ.
The output of SoD sampler is the sequence of pairs (t n , x(t n )).The set of possible samples by assuming zero initial conditions is X e = {x(t 0 ), x(t 1 ), x(t 2 ), . . ., x(t n )}.In order to formulate the convex optimization problem, a convex region for the possible range of the reconstructed signal is defined according to ( 16): where θ − (t) and θ + (t) are the piece-wise constant lower and upper boundaries respectively, that are created from the following constraints: With this definition, the sign of the signal slope at the event instants (t n ) is defined as: The samples along with the implicit boundary information, take a form of sets membership.Therefore the solution for the reconstructed signal x(t) will fall into the following convex sets (C(R) and L 2 denote continuous function and Hilbert space, respectively): 1) From the explicit information (signal values at the time of events): 2) From the implicit information (the value of the threshold that generated this event): 3) From the knowledge that the signal is band-limited with maximum frequency Ω (Fourier decomposition of the highest order dynamics in the signals of the system): The set B is convex as the band-limited signals form a linear space.For the sets I and ξ, [24] provides the proof of convexity.The reconstructed signal should be a member of the set ξ ∩ I ∩ B as the constraint of the optimization.This constraint is usually a large region that makes finding the optimal solution a computation intensive task.Fortunately, because θ − (t) ≤ x(t) < θ + (t), one can easily derive that I ⊂ ξ.Therefore, the constraint is limited to the boundary defined by I ∩ B, which needs less computations for the task of real-time signal estimation.

B. Projection onto Convex Sets Signal Reconstruction
There are two methods to solve the formulated POCS problem in the literature, one-step and iterative projection.A detailed comparison of these two methods is provided in [24].As real-time state estimation for microgrids is the aim of this paper, the later method of iterative projection onto convex sets is used, which exhibits fast computations with low precision loss.Iterative solution for POCS works by having two or more convex sets, and on each iteration the initial solution is projected to one of those convex solutions sets.By repeating the projection iteratively to those sets, the initial estimate gets closer to the optimal solution.
The projection of the signal g onto a continuous convex set C results in another signal x(t), which is nearest to signal g: where the projection P Cg is closer to any y ∈ C than g: For the event-based signal reconstruction problem, the initial guess x0 should be first projected onto convex set B with the following projection operator: having defined sinc(y) = sin(y) y .( * is the convolution) The projection operator onto convex set I for clipping the signal to the boundary defined by θ is: Finally, by applying this operator for both projections, the desired accuracy of signal reconstruction will be achieved: The condition for stopping the projections depends on the required accuracy measures and is application dependant.By practical experiments, authors have found that 10 iterations provides an acceptable accuracy for the microgrid experiment duration, which is used in the experiment.

C. Mean-Square Error Comparator Update Rule
Normally, the measurements from the nodes arrive with the added noise signal.The noise is assumed to be the derivative of the Brownian motion, which is called white noise or Gaussian noise.The traditional Kalman filter is build on top of this assumption that the noise is Gaussian, however, by using the SoD sampling technique, the reconstructed signal becomes a non-Gaussian stochastic process.This leads to degradation of the estimation accuracy and longer convergence time, if it converges.Therefore, an estimator update rule is proposed here that compares the output of the Kalman filter and the reconstructed signal in real-time, and injects the correction value to the input of the Kalman filter, respectively.The correction is a dynamic offset value, which is added as described in the following: where y i predict and y iconstruct are the output of the signal reconstructor and the event-based Kalman filter, respectively.

VI. EVENT-BASED AVERAGE DELAY CONSENSUS
Each measurement unit, calculates the estimator communication link delay using acknowledgment round-trip delay (RTD) [30].This value is then shared with neighbor units using the proposed event-based communication protocol.Each unit then decides the value of its SoD sampler threshold based on the average communication delay, using a linear droop mapping.In other words, when the average delay increases, the threshold for SoD sampling is also increased in order to reduce the network traffic.The droop rate can be different for the units, which provides the potential to prioritize the sampling of each unit, however for simplicity of the results comparison, a shared practical droop value is assumed in this paper.The value of the droop is tuned based on the IoT network setup of the microgrid.In the following section, the event-based average delay consensus protocol is described.

A. Basic Graph Theory
The measurement unit are connected by an undirected graph G(V, E) with the nodes or vertices V = (1, ..., N ), and the set of edges E ⊂ V × V.The nodes in the graph represent the measurement units, and the edges denoting the communication link between the nodes.The condition (i, j) ∈ E holds if there is a link allowing the information flow from node i to node j and vice versa.A = [a ij ] ∈ R N ×N , represents the graph adjacency matrix, where a ij > 0 if (i, j) ∈ E, and a ij = 0 otherwise.d i = N