G-PST / power-flow-exercise

Apache License 2.0
7 stars 6 forks source link

deviations in RTS-GMLC load flow results for PowerSystems #26

Open claytonpbarrows opened 2 years ago

claytonpbarrows commented 2 years ago

The differences between the matpower and PowerSystems results are caused by:

  1. Different initial bus voltage conditions (also causes differences for PowerModels). This is due to how the bus voltages are parsed from the matpower file. If the bus voltage settings and generator voltage settings are consistent in the matpower case, the issue is resolved.
  2. The representation of the shunt susceptances on buses 106, 206, and 306. MATPOWER doesn't appear to include Bs in the calculation of reactive power demand in the power flow but PowerSystems does. The issue is resolved when the Bs values are set to 0.0 in the matpower case.

@BenoitJeanson and @rbolgaryn : On point 2 above, pandapower and PowSybl appear to agree with MATPOWER. Is there a reason to omit the shunt susceptance from the power flow?

claytonpbarrows commented 2 years ago

Looking at the matpower results from the RTS-GMLC power flow for bus 106:

================================================================================
|     Bus Data                                                                 |
================================================================================
 Bus      Voltage          Generation             Load        
  #   Mag(pu) Ang(deg)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)
----- ------- --------  --------  --------  --------  --------
  101  1.047   -8.285    168.00     -8.16    108.00     22.00 
  102  1.047   -8.345    168.00    -38.28     97.00     20.00 
  103  1.014   -7.878       -         -      180.00     37.00 
  104  1.020  -10.569       -         -       74.00     15.00 
  105  1.050  -10.742       -         -       71.00     14.00 
  106  1.108  -13.473       -         -      136.00     28.00 
================================================================================
|     Branch Data                                                              |
================================================================================
Brnch   From   To    From Bus Injection   To Bus Injection     Loss (I^2 * Z)  
  #     Bus    Bus    P (MW)   Q (MVAr)   P (MW)   Q (MVAr)   P (MW)   Q (MVAr)
-----  -----  -----  --------  --------  --------  --------  --------  --------
   1    101    102      8.00    -26.22     -8.00    -24.28     0.002      0.01
   2    101    103      0.67     13.15     -0.53    -18.69     0.133      0.51
   3    101    105     51.33    -17.09    -50.75     16.80     0.579      2.24
   4    102    104     35.99     11.04    -35.55    -12.98     0.440      1.69
   5    102    106     43.00    -45.04    -41.35     45.37     1.657      6.36
   6    103    109      3.74    -18.14     -3.65     15.13     0.086      0.33
   7    103    124   -183.20     -0.17    183.88     28.43     0.673     28.27
   8    104    109    -38.45     -2.02     38.83      0.55     0.383      1.48
   9    105    110    -20.25    -30.80     20.51     29.10     0.267      1.02
  10    106    110    -94.65    -73.37     96.36   -213.28     1.708      7.44

The bus reactive load is Qd = 28.0, the reactive power injected at bus 106 on line 106-110 is Q_106_110_f = -73.37, and the reactive power injected at bus 106 on line 102-106 is Q_102_106_t = -45.3700. So the balance Qd + Q_106_110_f + Q_102_106_t = 0.0 works out.

But, on line 102-106, the sending end injects Q_102_106_f = -45.04 and the loss is reported as Q_102_106_loss = 6.36. So Q_102_106_f - Q_102_106_loss + Q_102_106_t should equal 0.0, but instead Q_102_106_f - Q_102_106_loss + Q_102_106_t = -6.03. This suggests that the value reported for Q_102_106_loss includes the injection from the shunt.

That's OK, it just makes comparisons with PowerSystems and PowerModels difficult since the shunt injections are explicitly accounted for in the Julia packages, instead of lumped in with line losses.

claytonpbarrows commented 2 years ago

By contrast, the results from PowerSystems yield:

julia> Q_102_106_f = sum(get_reactive_power_flow.(br_in))
-0.04742066928911919

julia> Q_106_110_f = sum(get_reactive_power_flow.(br_out)) 
-1.3709462843623568

julia> Qd = sum(get_reactive_power.(load))
0.28

julia> Qshunt = get_magnitude(b)^2 * imag(get_Y(s))
-1.0658916758520902

julia> Q_102_106_f - Q_106_110_f - Qd + Qshunt
-0.022366060778852725

and the reactive power loss on line 102-106 is 0.022.

claytonpbarrows commented 2 years ago

I'm now convinced that this is mostly an issue of reading the log file vs. the numeric results from matpower. More specifically, I've learned a few things:

  1. The bus Q Gen/Load values reported by matpower do not include the shunt injections
  2. The branch Q injections do not include shunt injections, but the Loss calculation does
  3. Matlab truncates all the values, so to make a precise comparison, we need to read the results.mat file in Julia (TODO)
jd-lara commented 2 years ago

@claytonpbarrows these results should be updated using PowerFlows.jl. We made several improvements to the way that the power gets distributed across devices and found a bug in the calculation of load power https://github.com/NREL-SIIP/PowerFlows.jl/issues/5

In future releases of PowerSystems the power flow solving capabilities will be moved to PowerFlows.jl