1P1Q Screening vs. AC Power Flows

1P1Q Screening vs. AC Power Flows

A Comparison Study for a Generator Disturbance

1P1Q screening estimates the complex voltage V vector following a disturbance using simulation tools Matlab and MatPower (Free, open-source Electric Power System Simulation and Optimization Tools for MATLAB).

My Approach:

This project considers either an outage if generator 2 or generator 3 , but not both, affecting the voltage.

The program flow and algorithm is as follows:

  1. Run pre-contingency fast-decoupled XB version power flow analysis
  2. Obtain base case complex voltage vector V
  3. Ask the user to select a valid generator (either 2 or 3) to be out
  4. Delete the user selected generator from the gen data structure
  5. Edit the radial branch reactance and resistance of the generator out to be near infinity*
  6. Determine Bp,Bpp,Sbus,Ybus,Yf,Yt
  7. Determine bus types (pv, pq values)
  8. Perform 1P half=iteration
    Compute real power mismatch and delP
    Determine swing bus
    Remove swing bus from Bp matrix
    Creates temporary Vm voltage magnitudes and removes the swing bus
    Computes delTheta
    Augments delTheta for the swing bus
    Updates the complex voltage
  9. Perform 1Q half-iteration
    Determines the swing bus
    Removes swing and pv buse(s) from Bpp and Vm matrices
    Computes Reactive Power Mismatch
    Computes delVmag
    Augment the delVmag for the swing and pv bus(s)
    Update the complex voltage
  10. Compute Branch flows
    Reads data and converts to internal bus numbering
    Calculates complex power at from branch
    Calculates complex power at the to branch
  11. Display Branch flows
    Prints the post-contingency branch flows at from and to ends in MATLAB

* The author found out that to approximate the 1P1Q bus flows to that of the AC solution, that the outage generator branch had to be modeled as “almost-off” so that power would not want to flow there. The pre-contingency solution considered it in service, however, when the generator is out, there is no load and incentive for the power to flow down the node to the bus. The AC solution correctly assigned a 0 flow to the post-contingency solution, but in the 1P1Q process, without the branch impedances taken to infinity, there would be >0 (big number) of branch flow on that branch, which does not make sense. By changing the branch impedance to near infinity, it corrects the current calculations and hence the power flows.

My Summary:

The 1P1Q method produced a good estimation for the generator outage compared to the AC solution. The most error in approximation came on the radial branch leading to the swing bus and the branch leading to the load. The method estimated both the MW and MVAR in good approximation. The results of the bus, Vmagnitude, and Vangles (in radians) were outputted in MATLAB after each 1P and 1Q half-iteration for a generator outage. The updated estimated complex V was then used to calculate the complex power branch flows. The post-contingency branch flows for the 1P1Q method is outputted at the end of the 1P1Q program. A separate program called “program3ac.m” runs the AC portion of the power flow analysis. It is important that before you run the AC solution, that the generator to be out, is commented out of the gen[] data structure in the wscc9bus.m file and saved. The AC solution looks only at the structure of the bus. The results of the AC power flow program will display the same complex branch power flows which are in good approximation to the 1P1Q method flows. The comparison of the flow values between 1P1Q and AC was done in excel. The excel file is attached for your reference.


The demonstration of Matlab code, output, and tables are discussed in the project report that you can download in PDF format here. An Excel comparison sheet (results) of the project is here.


Generator 2 Outage – Matlab Results for 1P1Q Screening

Generator 2 Outage Matlab Results

Generator 3 Outage – Matlab Results for 1P1Q Screening

Generator 3 Outage Matlab Results

Generator 2 Outage – Comparison of 1P1Q Screening vs. AC Power Flows

Generator 2 Outage Comparaison 1P1Q vs AC

Generator 3 Outage – Comparison of 1P1Q Screening vs. AC Power Flows

Generator 3 Outage Comparison 1P1Q vs. AC

My Solution Code

You can view and download the GitHub repository here.

You can also download a zip archive of the project code here.

Kathleen has 15 yrs. of experience analyzing business IT needs and engineering solutions in payments, electric utilities, pharmaceutical, financial, virtual reality, and internet industries with a variety of technologies. Kathleen's project experience has been diverse ranging from executing the business analysis “design phase” to hands-on development, implementation, and testing of the IT solutions. Kathleen and her husband reside in Indiana with no children, instead living along with their fur babies.