{'fraction_non_alphanumeric': 0.02897461862607389, 'fraction_numerical': 0.00937510208081534, 'mean_word_length': 4.661919733678565, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Linear State Estimation and Bad Data Detection for Power Systems with RTU and PMU Measurements

In this paper, a novel linear algorithm is proposed for state estimation including bad data detection of power systems that are monitored both by conventional and synchrophasor measurements. Both types of data are treated simultaneously and the states are estimated in rectangular coordinates. The proposed estimator is based on the linear weighted least square method. To enable the derivation of linear measurement functions, the network is modelled in terms of voltages and currents in rectangular form and pseudo-measurements are used to represent conventional measurements. Furthermore, the largest normalized residual test is used to detect bad data. To validate the accuracy and robustness of the proposed algorithm, several test cases of different sizes are solved and the results are presented and discussed.


I. INTRODUCTION
State Estimation (SE) is a mathematical algorithm that has a crucial role in power system monitoring. SE processes raw measurement data collected from measurement devices installed throughout the grid and provides an estimate of the system states, i.e. voltage magnitudes and angles for all system buses. Based on these estimates, the system operator gains insight into the actual operating state of the grid.
The measurement data have been obtained for decades by Remote Terminal Units (RTU), which measure voltage magnitudes, as well as active and reactive power injections and line flows. To estimate the state of the system, these types of data are most commonly processed by a Weighted Least Square (WLS) algorithm, as initially proposed in [1]. WLS minimizes the weighted mismatch between the measured values and their corresponding measurement functions that relate them to the system states. These functions are based on power flow equations, and are therefore highly nonlinear.
The SE area has been a matter of great research interest lately, due to an increased utilization of Phasor Measurement Units (PMU) in transmission networks, which diversified the available measurement set. PMUs provide highly accurate measurements of current and voltage phasors. Additionally, the measured values are synchronised in time via Global Positioning System, which further enhances the accuracy. Therefore, achieving full system observability solely by PMUs would be an ideal scenario, since the states could be estimated with a high precision. Furthermore, this would render the SE problem linear [2], which drastically improves the computational efficiency. However, this scenario is unlikely to happen in the foreseeable future, mainly due to the high cost of a PMU installation [3]. Consequently, novel hybrid SE methods are needed that will be able to include measurements provided both by RTUs and PMUs, thereby leveraging the broad system coverage by the former, and increased accuracy of the latter.
Many hybrid estimators were proposed in literature to address the aforementioned problem. The multi-stage estimators in [4]- [6] process conventional and synchrophasor measurements separately. In [4], [5] this is done sequentially, while the algorithm in [6] utilizes two separate estimators for RTU and PMU measurements that are executed in parallel, which is followed by a fusion stage to produce final estimates. Another group of hybrid SE methods are single-stage estimators that account for all types of measurements simultaneously. Different approaches for PMU current measurement transformation are used in [7], [8], while the algorithm in [9] incorporates all measurements directly, which is enabled by the expansion of the state vector to include current magnitudes and angles. All these approaches are based on the nonlinear WLS algorithm, and therefore need to employ iterative solution methods.
Recent advances in the field of power system simulation include the efforts to apply concepts of circuit theory to a range of power system related problems [10], [11]. By leveraging this idea, novel hybrid circuit-based estimators were derived in [12]- [14]. These are characterized by simultaneous treatment of conventional and synchrophasor measurements, and by states being estimated in rectangular coordinates. Furthermore, the methods in [13], [14] propose fully linear estimation algorithms, resulting in a substantially decreased computational time. However, these approaches are not robust against bad data.
Raw measurement data contain random errors due to imperfections of the measuring equipment and disturbances in the communication channels. Filtering these errors is the primary task of any state estimator. However, the capability of the SE algorithm to detect gross measurement errors and suppress their negative effect on the estimation accuracy is also an important feature. All previously listed algorithms, including the circuit-based estimators, are not bad data resilient. In general, this is a well-known drawback of all estimators based on the WLS approach. To overcome this issue, a postprocessing step called the Largest Normalized Residual (LNR) test is most commonly utilized to detect and identify bad data [15]. This approach was used in [16] for the nonlinear WLSbased estimator which treats both RTU and PMU data. The main drawback of the LNR test is that it detects only one bad measurement per iteration. Therefore, the estimation process has to be repeated until all bad data have been detected, which, in combination with the inherent nonlinearity of the WLSbased estimators, results in a significant computational burden.
To avoid the use of the post-processing step, a separate class of estimators that are robust against outliers are proposed in [17]- [19]. These are based on the Least Absolute Value algorithm, which in general has a very high computational complexity, and is vulnerable to leverage points [15]. Alternatively, the robust method proposed in [20] employs separate Maximum Correntropy Criterion-based estimators for RTU and PMU data, followed by a fusion stage to generate final estimates. An iterative solution approach is still needed. In this paper, a novel linear state estimation algorithm including bad data detection is derived for systems that comprise both conventional and synchrophasor measurements. Both types of measured data are processed simultaneously, and the states are estimated in rectangular coordinates. The proposed estimator utilizes a linear WLS framework, which yields very high computational speed and scalability of the algorithm. This is enabled by representing RTU data by pseudo-measurements that are linearly related to the system states. Finally, LNR testing is employed in the post-processing stage to suppress the negative effect of bad data that might occur in the measurement set.
The remainder of the paper is structured as follows. Section II gives an overview of the conventional WLS method, along with the description of the LNR test for bad data detection. Furthermore, the approach for linear modelling of RTU data used in circuit-based estimators is explained. The proposed linear SE algorithm is presented in Sect. III. Section IV showcases simulation results, and the main conclusions are summarized in Sect. V.

II. TECHNICAL BACKGROUND A. Conventional WLS-based state estimation
Power system state estimation is traditionally formulated as a Weighted Least Square problem. The vector of states that are estimated comprises angles (θ) and magnitudes (V ) of the bus voltages: The voltage angle of an arbitrarily chosen bus is usually set to zero to serve as a reference, and is therefore removed from the state vector. A measurement set z is represented as: where h(x) are measurement functions relating measurement values to the state variables, and e is the vector of measurement errors, which are assumed to be normally distributed and uncorrelated. By minimizing the weighted sum of squares of the measurement residuals, i.e. by solving the following optimization problem: the most probable state of the system can be found. Therein, R is a diagonal measurement error covariance matrix and for each measurement i, R i,i is equal to the square of the standard deviation σ of the corresponding measurement. Hence, R −1 comprises weight coefficients for all measurements.
In order to find the optimal solution, i.e. the optimal state vector, the first-order optimality conditions are derived for (3). Measurement functions h(x) for the measurements of injected powers and line flows are derived from the power flow equations and are therefore nonlinear, thus rendering the entire optimization problem nonlinear. As a result, an iterative procedure has to be utilized to solve it. The following equation holds at each iteration k: where (4) is solved for ∆x k at each iteration, until its value is smaller than a predefined convergence threshold. Alternatively, if the WLS problem is linear, e.g. if the measurement set comprises only PMU measurements of voltage and current phasors and the state vector is formulated in rectangular coordinates [2], there is no need to execute an iterative procedure, as the measurement functions h(x) are linear and the system states can be estimated directly by solving the following equation for x: where H is a constant Jacobian matrix.

B. Bad data detection and identification
As mentioned, certain measurements may contain large errors, which can occur due to various reasons. Therefore, one of the main tasks of any state estimator is to detect the existence of outliers in the measurement set and suppress their negative effect on the accuracy of the state estimates.
A common method to detect bad data in WLS-based SE algorithms is using normalized residuals [15]. The first step is to solve the SE problem and calculate the measurement residuals r i for each measurement i: wherex is the vector of estimated states. Then, normalized residuals are calculated as: where Ω is the residual covariance matrix, computed as Ω = The so obtained normalized residual vector r N has a standard normal distribution, since it is assumed that measurement errors have Gaussian distribution and are uncorrelated. Thus, the existence of bad data in the measurement set can be detected by finding the largest normalized residual, r N max , and comparing its value against a predefined threshold q. If r N max < q, no bad data is detected and the estimation process is completed. However, if r N max > q, the corresponding measurement is identified as bad data and is removed from the measurement set. The SE algorithm is then executed again until no bad data is detected.
Alternatively, if the measurement b is identified as bad data, instead of removing it from the measurement set, it can be corrected by subtracting the estimated value of its error from the actual measured value z b . The corrected value of the measurement b is therefore calculated as: The SE procedure is repeated after the correction is made. For more details, the reader is referred to [15].

C. Linear modelling of RTU measurements
An Equivalent Circuit Formulation (ECF) for the power flow problem has been recently proposed in [10], [11]. The main idea of this method is that an entire power system can be represented by an equivalent circuit in terms of voltage and current state variables in rectangular coordinates. As a result, the equivalent circuit consists of two coupled subcircuits, where the first sub-circuit represents real voltages and currents, while the second one comprises their imaginary parts. The ECF approach was applied to the state estimation problem in [12] for the first time. The resulting nonlinear estimator treated RTU and PMU measurements simultaneously and provided state estimates in rectangular coordinates. The only nonlinearity in this formulation was associated with the circuit representation of RTU measurements. This work was leveraged in [13] to derive a fully linear estimator by reformulating the circuit model for RTU measurements. A similar approach was also proposed in [14]. In this paper, while still relying on the circuit approach for RTU modelling, we formulate the measurement functions such that (5) becomes directly applicable.
Directly deriving measurement functions for the power measurements of RTUs yields nonlinear functions in terms of real and imaginary voltages and currents. Hence, if an RTU bus k is observed and the measurement set comprises bus voltage magnitude (V k ), and active (P k ) and reactive (Q k ) power injections, the following relations between injected current and voltage at this bus are derived [13]: where V R,k and V I,k are real and imaginary voltages at bus k, and I R,k and I I,k are real and imaginary injected currents 1 .
Since V k , P k and Q k are measurement values, these equations are linear in terms of the system states.
As an additional preparatory step, we introduce two equations based on Kirchhoff's current law (KCL), one for real and one for imaginary currents, for each RTU bus k: where I R,i and I I,i are real and imaginary currents flowing through the network components i, i.e. shunts, transmission lines and transformers, that are incident to the observed RTU bus k, and I R,err,k and I I,err,k represent error terms that need to be minimized. Hence, in an ideal case where all measurements are perfectly accurate, I R,err,k and I I,err,k are equal to zero. Each current in (11)-(12) has a positive sign if its reference direction is out of the bus, and negative if it is directed into the bus. In case line flows are available instead of injected powers, the same modelling technique can be used. Finally, it is important to mention that the previously described modelling method assumes that the voltage magnitude is available for each RTU bus, which is a reasonable assumption since voltage has to be measured in order to obtain power data. For more details on linear RTU modelling used in the circuit-based estimators, the reader is referred to [13], [14].
III. PROPOSED LINEAR STATE ESTIMATOR To achieve a linear SE formulation, the state vector in the proposed algorithm consists of bus voltages in rectangular coordinates: where V R and V I are vectors of real and imaginary bus voltages. For a system with N buses, the size of vector V R is N , while there are N − 1 elements in V I , since one bus serves as the reference for all angles, and its imaginary voltage is therefore fixed. The proposed SE method utilizes linear WLS, and therefore obtains the estimate of the system states by solving (5) for x. The structure of individual terms in (5) used in the proposed method will be discussed below.

A. Measurement vector z
Conventional and synchrophasor measurements are treated simultaneously, and the vector of measurements which is processed by the proposed method is: where z P M U is the vector of PMU measurements, consisting of voltages (V R,P M U , V I,P M U ) and currents (I R,P M U , I I,P M U ) in rectangular coordinates, while z RT U is the vector of RTU measurements comprising voltage magnitudes (V ), as well as active and reactive injections (P inj , Q inj ) and line flows (P f low , Q f low ). It is important to emphasize that the vector of originally available measurements z org is not the same as z as we use in (5). While both comprise raw PMU measured values, conventional measurements are accounted for in z by representing the original RTU data from z org as pseudo-measurements:  with eight pseudo-measurements equal to zero. This lays the foundation for the derivation of linear measurement functions that relate the RTU pseudo-measurements to states, based on the idea discussed in Sect. II-C. The derivation of these functions will be discussed in the following section.
B. Measurement functions h(x) and Jacobian H Since the states are estimated in rectangular coordinates, the appropriate models must be derived for all power system components in terms of voltages and currents in rectangular form.
A pi-model of a transmission line connecting buses k and m is given in Fig. 1. To find the relation between real and imaginary voltages and currents of the line, we start with the following general equation: The complex admittance of the series branch is Y branch = 1 R+jX = R R 2 +X 2 −j X R 2 +X 2 , while the admittance of the shunt branch is Y sh = j B 2 . After incorporating these real and imaginary admittance terms into (16), the following expressions for real and imaginary series and shunt branch currents are obtained: where V C,ser , C ∈ {R, I}, is the voltage across the series branch, equal to the difference of voltages at buses k and m, while V C,sh is the voltage at the bus where the corresponding shunt is located. One can observe that the currents in (17)- (20) are linear functions of voltages, since all network parameters are constants. The linear models for other network components, i.e. transformers, phase-shifters, tap-changers and shunt elements, can be derived by applying the same technique, and will not be presented here due to space limitations, but the reader is referred to [10]. Once the entire network is modelled in terms of voltages and currents in rectangular form, linear measurement functions h(x) can be defined with respect to the measurement vector z in (15) as follows: 1) PMU voltage: It is assumed in this paper that PMU current and voltage measurements are available in rectangular coordinates. Also, the state vector comprises bus voltages in the same form. Hence, the measurement functions for real and imaginary PMU voltages at bus k are trivial: 2) PMU injected current: The measurement functions for the PMU real and imaginary injection currents at bus k are defined according to the KCL: h P M U I I,inj,k = i∈N inc,k where N inc,k is the set of all network components incident to bus k and I C,i , C ∈ {R, I}, are the currents flowing through these components. As mentioned above, these currents are linear functions where I C,ser,km , C ∈ {R, I}, is the current flowing through the series branch from bus k to m, and I C,sh,k is the current flowing through the shunt branch incident to bus k. The same above-mentioned sign convention still holds. 4) RTU power injections: As it was explained in Sect. III-A, if the measurements of voltage magnitude (V k ) and active (P k ) and reactive (Q k ) power injections are available at bus k, these data are represented in the measurement vector z by two pseudo-measurements equal to zero. These are related to the states based on the approach presented in Sect. II-C, thus the measurement functions are derived based on the KCL equations for real and imaginary currents at bus k. One can observe the analogy between (2) and (11)- (12). Zero values on the right-hand side in (11)- (12) correspond to the RTU pseudo-measurements in z, hence one pseudo-measurement is related to the KCL equation for the real currents, and the other corresponds to the KCL equation for imaginary currents.
Mismatch currents I C,err,k , C ∈ {R, I}, correlate to the error terms e in (2), while I C,k + i∈N inc,k I C,i terms essentially represent the measurement functions h(x). Finally, if I R,k and I I,k are replaced with the expressions in (9)-(10), the following relations are obtained for the measurement functions relating real and imaginary RTU injection pseudo-measurements at bus k to the system states: All currents in expressions (27)-(28) have a positive sign if they are directed away from the bus. If the value of P k denotes generation conditions, the term P k /V 2 k will be negative. The same applies to the reactive power and the sign of Q k /V 2 k . 5) RTU line flows: If an RTU located at bus k measures voltage magnitude (V k ), as well as active (P km ) and reactive (Q km ) line flows in the transmission line connecting this bus to bus m, this measurement set will be represented in the measurement vector z by two pseudo-measurements equal to zero. These are related to the system states by applying the same approach as in the case of RTU power injections. Hence, the corresponding measurement functions are: The sign convention is the same as in the case of power injections.
A very important feature of the proposed estimator is that all measurement functions are linear, which is achieved by estimating voltages in rectangular coordinates and transforming RTU measurements to yield pseudo-measurements that are linearly related to the states. Finally, the measurement Jacobian is calculated as H = ∂h(x)/∂x, where h(x) is the vector of measurement functions, while x is the vector of states. Since all measurement functions are linear, H is a constant matrix. The size of H is M × (2N − 1), where M is the number of measurements in z, and N is the number of buses.

C. Measurement error covariance matrix R
Same as in conventional WLS, the measurement errors are assumed to be normally distributed and uncorrelated. Thus, R is a diagonal matrix in the proposed algorithm, where for each measurement i the corresponding diagonal entry R i,i denotes the variance of the measurement. The size of R is M × M , where M is the number of measurements in z.
For each PMU measurement with standard deviation σ, the corresponding variance is simply calculated as σ 2 . On the contrary, variances of the RTU pseudo-measurements are calculated based on their measurement functions and the error propagation theory [21]. If bus k is observed and the measurement set consists of voltage magnitude (V k ) and active (P k ) and reactive (Q k ) power injections, variances of the terms P k /V 2 k and Q k /V 2 k can be calculated based on the following general rule: where the measurements A and B are transformed to the pseudo-measurement f , and σ A , σ B and σ f are standard deviations of A, B and f , respectively. Let σ 2 P,k be the obtained variance of the term P k /V 2 k , and let σ 2 Q,k denote the calculated variance of Q k /V 2 k . Then, variances of the real and imaginary RTU pseudo-measurements that represent the observed measurement set are approximated based on their measurement functions (27)-(28). According to the error propagation theory, the properly calculated variance of the real RTU pseudomeasurement would be equal to V 2 R,k σ 2 P,k + V 2 I,k σ 2 Q,k , while the variance of the imaginary pseudo-measurement would be equal to V 2 I,k σ 2 P,k + V 2 R,k σ 2 Q,k . However, values of rectangular bus voltages are states and are not known prior to the execution of the algorithm. Therefore, the variances of the real and the imaginary pseudo-measurements are set to σ 2 P,k and σ 2 Q,k , respectively. These values are chosen since, in general, real voltages are substantially higher then their imaginary counterparts, and therefore the corresponding terms in the measurement functions predominantly define the appropriate weight coefficient, i.e. the variance. In case the measurement set comprises measurements of voltage magnitude and active and reactive line flows, variances of the corresponding real and imaginary pseudo-measurements are determined by applying the same approach.

D. Bad data processing
Gross errors in either RTU or PMU measurements can severely bias the estimated states. Therefore, it is very important to detect them and suppress their negative effect on the estimation outcome. To this aim, the proposed algorithm utilizes the largest normalized residual test that was explained in Sect. II-B. Normalized measurement residuals are calculated according to (7) and the value of the largest normalized residual r N max is compared to the threshold q. Since the normalized measurement residuals have standard normal distribution, the value of the threshold q is set to 3 [15]. If r N max > q, the corresponding measurement is identified as bad data. Instead of eliminating it from the measurement set, its value is corrected based on (8) and the estimation process is executed again. This process has to be repeated as long as bad data are detected in the measurement set. However, the overall computational time is still very low due to the linearity of the estimator. The benefit of correcting bad data instead of removing it is that the data structure remains the same. Also, it prevents any RTU pseudo-measurement, which essentially represents a set of three RTU measurements, from being eliminated from the estimation process if any of the original measured values that it is related to has a large error. Therefore, the proposed algorithm is robust against bad data in both RTU and PMU measurement sets.

IV. NUMERICAL RESULTS
The performance of the proposed algorithm is evaluated by using the IEEE 14, 57 and 118 bus test systems, and the 2869 and 13659 test systems provided by the PEGASE project [22]. Accuracy and computational time are examined for the cases where: i) the measurement set consists only of measurements with random Gaussian errors and there are no bad data; ii) bad  Injection  Flow  14 buses  5  14  11  10  36  57 buses  13  40  47  50  112  118 buses  19  76  106  96  298  2869 buses  409  1362  2652  2596  5134  13659 buses  1557  5294  12870 12786 25682 data are present in the measurement set. The full algorithm is executed in both cases, i.e. both state estimation and bad data detection and correction stages are employed.

A. Test cases without bad data
The measurement set comprises both conventional and synchrophasor measurements for all test systems. The set of RTU measurements consists of bus voltage magnitudes, as well as active and reactive power injections and line flows. It is assumed that each PMU device has a sufficient number of channels to monitor all lines incident to the bus where it is located. Therefore, the set of PMU measurements comprises phasors of bus voltages and line currents in rectangular coordinates. It should be emphasized that PMU measurements in polar form can also be incorporated, by transforming them into rectangular coordinates and calculating the corresponding variances based on the error propagation theory [21]. In each test case, one PMU bus is selected to serve as the slack bus, thus providing the reference for the voltage angles. The structure of the measurement sets for all test systems is presented in Table I. Obviously, the majority of measurements are provided by RTUs, which corresponds to the current situation in real transmission networks, which are still predominantly monitored by legacy measurements. Locations and number of measurements were selected so that the full system observability is ensured for all test systems.
All measurement errors are assumed to have Gaussian distribution with zero mean and are not correlated. For each measurement i, the measured value is randomly selected from the range [z t i − σ i , z t i + σ i ], where z t i is the true value of the measurement i obtained from the power flow simulation in MATPOWER, while σ i is its corresponding standard deviation. The standard deviations for different types of measurements are given in Table II.
Two different performance indices are used in order to evaluate the accuracy of the proposed method. The first one is the sum of variances of the estimated states: wherex and x t are estimated and true values, respectively. The second index essentially compares variances of the estimated measurement values and their original values:  Fig. 2 for the 14 bus test case. One can observe very high accuracy of each individual estimated voltage value. Furthermore, the average computational time is given for each test case in Table  III. The obtained values are very low, which is the consequence of utilization of the linear WLS framework. Also, it is shown that the algorithm is fast even for very large systems, which demonstrates the scalability of the proposed method.

B. Test cases with bad data
Two different test cases are examined in order to evaluate the capability of the proposed algorithm to accurately estimate the state of the system when bad data are present in the measurement set. Both test cases are based on the IEEE 14 bus test system. Case 1 represents the situation in which there is only one measurement with large error. For this experiment, the same measurement set is used as for the 14 bus test system in the previous section. However, the value of one PMU measurement, namely the real voltage at bus 1, is altered by 30%. Case 2 considers the presence of multiple bad data. Again, the measurement set for the 14 bus test system from the previous section is used as the initial point. Then, the following PMU and RTU measurements are manually changed: real   Table IV. The capability of the algorithm to accurately estimate the states in the presence of bad data is clearly demonstrated, since the values of σ 2 x are almost the same as in the case when there are no bad data. Furthermore, the absolute errors of real and imaginary estimated voltages for the case of multiple bad data, presented in Fig. 3, show very high accuracy of each individual estimated state. Finally, the average computational time, presented in Table IV, is still very low for both test cases, even though multiple iterations of the state estimation and bad data correction stages have to be executed. Again, this is enabled by the linearity of the proposed estimator.
To check the scalability when bad data are present, the measurement set for the 2869 bus test case from the previous section is used, with three measurements altered by 50%, namely the real voltage at bus 1 and active and reactive power injections at bus 455. The obtained average value of index σ 2 x is 0.00128 and the computational time is 0.1645s. Therefore, the negative effect of bad data is suppressed and the additional computational burden imposed by running several iterations of the algorithm to correct all bad data is not significant.

V. CONCLUSION
A novel linear state estimation algorithm is proposed for the systems that comprise conventional and synchrophasor measurements. The estimator is based on the linear WLS approach, which is enabled by the adequate treatment of the RTU data and network modelling in terms of voltages and currents in rectangular form. All measurements are accounted for simultaneously and the states are estimated in rectangular coordinates. The obtained results demonstrate very high accu-racy of the proposed method, as well as its low computational burden. Furthermore, utilization of the WLS framework enables the use of the LNR test that renders the algorithm bad data resilient, which comes at a low computational cost due to the linearity of the estimation stage.