S1031 of 56
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

S10 · Lesson 31 · State estimation

Redundant meters with random errors, the weighted least-squares estimate and its gain matrix, the chi-square test that tells a good set of measurements from a bad one, normalized residuals that point to the bad meter, observability, and a Python estimator

A control room receives tens of thousands of measurements every few seconds: line flows, injections and voltages, sent over telemetry from meters with ordinary errors, plus the occasional gross one when a transducer fails or a breaker status is wrong. A power flow can't use them directly. It takes exactly one input per unknown, it has no place for the extra flow measurements, and a single bad input spoils its answer. What does the control room actually know about the state of its system, and how sure is it?

  • The three-bus DC network of lesson 20 (lines 0.1, 0.2 and 0.25 pu) has five meters: the flows on lines 1–2, 1–3 and 2–3 (σ = 0.01 pu) and the injections at buses 2 and 3 (σ = 0.02 pu). The unknowns are the two bus angles.
  • The x axis is the reading of the line 1–3 meter, with the other four fixed at good values. The curves are the weighted sum of squared residuals J and the line 1–3 meter's normalized residual.
  • The estimate accepts readings that keep J below the chi-square threshold of 11.34 (3 degrees of freedom, 99%): roughly 0.63 to 0.72 pu. Outside that band the test flags bad data, and the normalized residual, above 3, points at the meter responsible.

Predict

Two meters read the same flow: one with σ = 0.01 pu reads 0.80, the other with σ = 0.02 pu reads 0.85. What's the weighted least-squares estimate?

Name it

The measurement model

Collect the m measurements in z and the n unknowns (bus angles and voltage magnitudes) in x. Each measurement is a function of the state plus an error: z=h(x)+e. The errors are taken as independent, zero-mean Gaussians with variances σi2. In the DC model h is linear, z=Hx+e; in the AC model H is the Jacobian of h and the solution iterates, just as Newton's power flow does.

Weighted least squares

The estimate minimizes the weighted sum of squared residuals

J(x)=∑i(zi−hi(x))2σi2=(z−Hx)TW(z−Hx),W=diag(1/σi2)

Setting its gradient to zero gives the normal equations and the estimate

x^=G−1HTWz,G=HTWH

G is the gain matrix. Its inverse is the covariance of the estimate, so it tells how well each state is known. Each measurement's error spreads into every state through G−1HTW, which is why a gross error can hide in the estimate unless the residuals are tested.

Is the estimate any good?

If the errors really are Gaussian with the assumed σ, the minimum J(x^) follows a chi-square distribution with m−n degrees of freedom. Its mean is m−n. The test compares J with the value that a chi-square variable exceeds only 1% (or 5%) of the time: for 3 degrees of freedom, 11.34 at 99%. A larger J says some measurement is far worse than its σ claims.

Which meter is bad?

The residuals r=z−Hx^ have covariance Ω=R−HG−1HT, where R=diag(σi2). The normalized residual |ri|/Ωii is a standard normal variable for a good meter, so values above about 3 are suspicious, and the largest one usually marks the bad measurement. Remove it, estimate again, and test again.

Observability and redundancy

The state can be estimated only if G is invertible: the system is observable. With exactly n well-placed measurements, J is always zero and nothing can be tested. Redundancy (m well above n, typically 1.5 to 2.5 times) is what makes bad data detectable. A critical measurement, one whose loss would make the system unobservable, always has a zero residual, so an error in it can never be detected.

Worked example

Estimate the state of the three-bus network from readings 0.83, 0.67, 0.21, −0.62 and −0.88 pu (flows 1–2, 1–3, 2–3; injections at buses 2 and 3).

Show the solution
  1. Measurement functions. The flows are −10θ2, −5θ3 and 4θ2−4θ3, and the injections 14θ2−4θ3 and −4θ2+9θ3, which give H's rows.
  2. Gain matrix. With weights 10,000 for the flows and 2,500 for the injections: G=(1,690,000−390,000−390,000652,500)
  3. Solve the normal equations. θ^2=−0.08283radθ^3=−0.13456rad
  4. Residuals. The estimated flows are 0.828, 0.673 and 0.207 pu, and the residuals are all a fraction of their σ.
  5. Test J. J = 0.21, far below the 11.34 threshold for 5 − 2 = 3 degrees of freedom, so the set is accepted.
  6. Compare with the truth. The true angles, from the loads of 0.6 and 0.9 pu, are −0.08182 and −0.13636: the estimate is within 0.002 rad.

Answer θ^2 = −0.08283 and θ^3 = −0.13456 rad, and J = 0.21 passes the test.

Worked example

The line 1–3 meter's reading is corrupted to 0.50 pu. What do the test and the residuals show?

Show the solution
  1. The shifted estimate. The estimate shifts to −0.0793 and −0.1195 rad: the bad reading has dragged both angles.
  2. Test J. J rises to 170, far above 11.34, so the set is rejected.
  3. Normalized residuals. They are 6.5, 13.0, 5.8, 0.8 and 7.4.
  4. Find the bad meter. Several exceed 3, because the error has spread through the estimate into the other residuals, but the largest, 13.0, belongs to the line 1–3 meter.
  5. Remove it and estimate again. From the remaining four, J = 0.06, well below the threshold for 2 degrees of freedom (9.21), and the angles are −0.0829 and −0.1350 rad, back near the true values.

Answer J = 170 rejects the set, and the largest normalized residual, 13.0, points to the line 1–3 meter.

Worked example

Three meters read the same flow: 1.00 (σ = 0.01), 1.03 (σ = 0.02) and 0.95 pu (σ = 0.04). Find the WLS estimate, its standard deviation and J, and test J at 95%.

Show the solution
  1. Weights. They are 10 000, 2500 and 625, one over each σ squared.
  2. Estimate. x^=(10000×1.00+2500×1.03+625×0.95)/13125=1.0033pu
  3. Its standard deviation. σ=1/13125=0.0087pu
  4. Weighted squared residuals. J=0.11+1.78+1.78=3.67
  5. Test at 95%. With 3 − 1 = 2 degrees of freedom the 95% threshold is 5.99, so no bad data is flagged; the precise meter dominates the estimate.

Answer x^ = 1.0033 pu with σ = 0.0087 pu, and J = 3.67 is under the 5.99 threshold, so no bad data is flagged.

Check

Meter A (σ = 0.015 pu) reads 0.8 and meter B (σ = 0.05 pu) reads 0.84 for the same flow. What's the weighted least-squares estimate, in per unit?

Check

For those two meters (σ = 0.01 and 0.02 pu), what's the standard deviation of the estimate, in per unit?

Check

An estimator has 30 measurements and 5 state variables. How many degrees of freedom does its chi-square test have?

Check

A residual is 0.03 pu and the residual's standard deviation Ωii is 0.006 pu. What's its normalized residual?

Check

A meter has σ = 0.01 pu, and its row of HG−1HT has diagonal entry 0.005² pu². What's the standard deviation of its residual, in per unit?

Check

A reading is off from its estimate by 0.3 pu with σ = 0.01 pu. How much does that one residual add to J?

Check

Write the estimator: wls(H, z, sigma) returns the estimate, the residuals and J, and find_bad(H, z, sigma) returns the index of the meter to discard, or None when the set passes the 99% chi-square test.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Check

Two meters read the same flow: 0.98 pu (σ = 0.01) and 1.1 pu (σ = 0.05).

(a)

What is the WLS estimate?

(b)

What is J?

Check

Two meters of standard deviations s and t read a and b for the same quantity.

Step 1

What is the estimate?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Explain why

Why does a state estimator need more measurements than unknowns, and why can't it find an error in a critical measurement?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.