L35 / Power-flow analysis
Power Flow IV
Trace PQ and PV updates, distinguish intermediate estimates from completed-sweep mismatch, and test generator Q limits.
01 / UNDERSTAND & PREDICT
Understand the model, then predict the result
- Derive the PQ update from the conjugated power equation.
- Use each newly stored neighbor immediately; preserve the slack phasor.
- Separate PV reactive estimation, temporary angle and magnitude projection.
- Apply the completed-sweep power test and explain PV-to-PQ switching.
Isolate voltage without losing the conjugate
Conjugating S=VI* gives (P−jQ)/V*. Separate YiiVi, then divide by Yii. The old voltage remains in the denominator, so this is an iterative update rather than a direct linear solve. P and Q are net injections on the common 100 MVA base.
A sweep uses the newest stored neighbors
The source visits PQ bus 3 before PV bus 2, with no relaxation. Bus 3 uses the old V2; bus 2 immediately uses the new V3. Reusing only old neighbors would define a different iteration. Bus 1 remains 1.03∠0° at every visit.
Estimate reactive power at the PV visit
Calculate Qest using the old voltage at this bus and its newest neighbors, including YiiVi. This is a mixed-time intermediate estimate. With local reactive load, check generator capability using QG,est=Qnet,est+QL; this source example has no local load at bus 2.
Store the PV angle at the specified magnitude
Within Q limits, insert estimated net Q in the complex update. The temporary voltage generally has the wrong magnitude. Normalize it to |Vi|spec before storing it; the new angle is retained. Neither its real part nor its imaginary part is independently fixed.
Test powers from one completed vector
Recompute every bus power after all visits. While bus 2 is PV, test ΔP2, ΔP3 and ΔQ3, not slack P/Q or PV Q. A small voltage change alone is not the course stopping test. The run accepts only when the infinity norm is within epsilon and the active voltage/capability constraints hold; otherwise report the iteration cap.
A reactive limit releases voltage magnitude
If estimated generator Q violates a bound, use Qnet,spec=QG,lim−QL and treat the bus as PQ. Stop restoring its former voltage magnitude and add its Q mismatch to the active test. This teaching implementation latches the first violated bound for the rest of that run; each input change restarts the run. It does not implement PV restoration or a general capability curve.
Compare the first sweep with the accepted state
The flat start is [1.03,1.01,1]. Initially the maximum mismatch is 0.834920635 pu. The first complete sweep gives 0.080047480 pu, so it is not solved. With source Q bounds [−25,50] Mvar, sweep 11 is the first state below 1e−8 pu and reproduces L34. Q2 remains negative but within capability.
Baseline example: check each step
- First PQ update: V3=0.968521739−j0.065739130 pu. Store this complex voltage immediately.
- At the PV visit, Q2,est=−0.177129371 pu=−17.7129371 Mvar lies within [−25,50].
- Temporary V2=1.011364010+j0.004398320; after projection V2=1.009990449+j0.004392346 pu, with magnitude exactly 1.01.
- After the complete sweep, mismatches are [+0.008681607,+0.019085452,−0.080047480] pu. End-of-sweep Q2=−20.5197242 Mvar differs from the visit estimate.
- Sweep 10 still exceeds epsilon; sweep 11 passes. Final V3≈0.964414∠−3.652309°, P1≈37.88548 MW, Q1≈54.88715 Mvar and Q2≈−16.16487 Mvar.
- Set Qmin=0 Mvar: the first negative reactive estimate triggers PQ-min. Its Q becomes specified at zero and |V2| is allowed to depart from 1.01. Do not keep both constraints.
Cross-check the original slides
02 / EXPLORE
Change one input and explain the response
Compare sweeps 0, 1, 10 and 11. Explain the visit-time and end-of-sweep Q difference. Reverse the bus order, then set Qmin=0 and inspect the changed bus role, voltage magnitude and active mismatch vector. Finally set the cap to one sweep and explain why the run is not accepted.
Advanced parameters / test readings
Preparing the model.
Power mismatch after each completed sweep
Voltage magnitudes and the active PV target
Current intermediate values and numerical checks
Balanced three-bus steady state on 100 MVA; fixed impedances, no shunts/charging, unity taps and no local load at generator buses. Sequential unrelaxed GS; no guarantee of convergence from every start. A Q violation latches that bound as PQ for the remainder of this run; no PV restoration or general capability curve. The displayed sweep is clamped to the completed history when the run stops. Intermediate/capped states remain visible and are labeled unaccepted; failed or invalid updates show an error. Thermal and contingency limits are outside this model. With this latched-limit policy, changing the visit order or starting vector can trigger a different transient bound and lead to a different constrained endpoint.
03 / EDIT & COMPUTE
Edit code to reproduce the model independently
Reproduce the baseline, then modify the parameter scan. The source contains reusable independent model functions; edit the current function and inspect numerical checks.
case is a snapshot of the controls when you press Run. Call solve(case) and assign the final solution to result to plot it.
The first run needs internet access to download Python. Computation stays in your browser; the solver uses only the standard library.
Ready to run.
Output appears here.
Last Python run and current control reference
Inspect and edit the model source (advanced)
Edit this module's function and run again. case.module selects the module; solve(case) returns values, plots, and checks. The parameter experiment keeps the original JavaScript reference for comparison.
04 / CHECK & EXPLAIN
Companion experiment practice and feedback
100 MVA; z12=0.018+j0.060, z13=0.070+j0.210, z23=0.045+j0.135 pu; no charging/shunts, unity taps. Slack V1=1.03∠0°, PV P2=55 MW and |V2|=1.01, PQ load=90 MW+j30 Mvar. Start [1.03,1.01,1], visit 3 then 2, no relaxation. QG2 bounds [−25,50] Mvar, epsilon=1e−8, cap=100. Practice asks for the first complete sweep and the full run.
Practice uses fixed baseline inputs independently of the controls. Each field displays its tolerance.
See the worked solution
- First PQ update: V3=0.968521739−j0.065739130 pu. Store this complex voltage immediately.
- At the PV visit, Q2,est=−0.177129371 pu=−17.7129371 Mvar lies within [−25,50].
- Temporary V2=1.011364010+j0.004398320; after projection V2=1.009990449+j0.004392346 pu, with magnitude exactly 1.01.
- After the complete sweep, mismatches are [+0.008681607,+0.019085452,−0.080047480] pu. End-of-sweep Q2=−20.5197242 Mvar differs from the visit estimate.
- Sweep 10 still exceeds epsilon; sweep 11 passes. Final V3≈0.964414∠−3.652309°, P1≈37.88548 MW, Q1≈54.88715 Mvar and Q2≈−16.16487 Mvar.
- Set Qmin=0 Mvar: the first negative reactive estimate triggers PQ-min. Its Q becomes specified at zero and |V2| is allowed to depart from 1.01. Do not keep both constraints.
Finally, explain in your own words
- What are the inputs, references, and main assumptions?
- Compare sweeps 0, 1, 10 and 11. Explain the visit-time and end-of-sweep Q difference. Reverse the bus order, then set Qmin=0 and inspect the changed bus role, voltage magnitude and active mismatch vector. Finally set the cap to one sweep and explain why the run is not accepted.
- Did your code edit change physical parameters, the method, or representation bases? Which check helps identify that?
Passing numerical and understanding checks records this lecture’s companion practice as “practice checks passed.”
