power-grid-model icon indicating copy to clipboard operation
power-grid-model copied to clipboard

SparseMatrixErrors: power flow and short circuit special case

Open nitbharambe opened this issue 3 months ago • 4 comments

Relates to issue: #1162

Changes proposed in this PR include:

  • Added a small admittance at zero sequence where unavailable.
  • Test for all combinations of windings for 2 grids:
  1. source -- trafo
  2. source -- trafo --- asym_load Only DYn and YnD delta combination is added as the behaviour is same as Y for other windings.

Note that:

  • All output is calculated from current main branch.
  • If the results were failing for these cases earlier, the result validation is skipped.
  • Certain test cases for NRPF are marked as xfail for IterationDiverge. These are YNd, YYn, YY, YnY.

nitbharambe avatar Oct 31 '25 09:10 nitbharambe

Sparse Matrix error in the reported issue occurs at (12,12) which is the 33rd. (case not uploaded here)

y_bus_admittance size = 100
y_bus_admittance[33] = [(0.44371+-0.7763i), (-0.221855+0.38815i), (-0.221855+0.38815i), (-0.221855+0.38815i), (0.44371+-0.7763i), (-0.221855+0.38815i), (-0.221855+0.38815i), (-0.221855+0.38815i), (0.44371+-0.7763i), ]  

original_mat_data_ size = 100
original_mat_data_[33] = [(0.221855+-0.38815i)(-1+0i)(-0.221855+0.38815i)(0.221855+-0.38815i)(1+0i)(-0.221855+0.38815i)(-0.44371+0.7763i)(0+0i)(0.44371+-0.7763i)]  


rhs size = 34
rhs[12] = [(0+0i), (0+0i), (0+0i), ]  

With small finite impedance of r=1e-6, x=1e-6: (Still gives out SpaarseMatrixError)

original_mat_data_[33] = [(0.221855+-0.38815i)(-1+0i)(-0.221855+0.38815i)(0.221855+-0.38815i)(1+0i)(-0.221855+0.38815i)(-0.44371+0.7763i)(0+0i)(0.44371+-0.7763i)]  

Minimal test case 1 of power flow calculation happens at (0,0)

original_mat_data_ size = 4
original_mat_data_[0] = [(0.0277275+-0.557822i), (-0.0138637+0.278911i), (-0.0138637+0.278911i), (-0.0138637+0.278911i), (0.0277275+-0.557822i), (-0.0138637+0.278911i), (-0.0138637+0.278911i), (-0.0138637+0.278911i), (0.0277275+-0.557822i), ]  
original_mat_data_[1] = [(-0.11091+2.23129i), (0.055455+-1.11564i), (0.055455+-1.11564i), (0.055455+-1.11564i), (-0.11091+2.23129i), (0.055455+-1.11564i), (0.055455+-1.11564i), (0.055455+-1.11564i), (-0.11091+2.23129i), ]  
original_mat_data_[2] = [(-0.11091+2.23129i), (0.055455+-1.11564i), (0.055455+-1.11564i), (0.055455+-1.11564i), (-0.11091+2.23129i), (0.055455+-1.11564i), (0.055455+-1.11564i), (0.055455+-1.11564i), (-0.11091+2.23129i), ]  
original_mat_data_[3] = [(7.07107e+08+-7.07107e+08i), (-0.22182+4.46258i), (-0.22182+4.46258i), (-0.22182+4.46258i), (7.07107e+08+-7.07107e+08i), (-0.22182+4.46258i), (-0.22182+4.46258i), (-0.22182+4.46258i), (7.07107e+08+-7.07107e+08i), ]  

rhs size = 2
rhs[0] = [(0+0i), (0+0i), (0+0i), ]  
rhs[1] = [(7.07107e+08+-7.07107e+08i), (-9.65926e+08+-2.58819e+08i), (2.58819e+08+9.65926e+08i), ]  

Minimal test case 2 of short circuit calculation happens at (0,0).

Validation test: short_circuit/sc-sparse-matrix-error-asym-iec60909
y_bus_admittance size = 4
y_bus_admittance[0] = [(0.0666667+-0.663325i)(-0.0333333+0.331662i)(-0.0333333+0.331662i)(-0.0333333+0.331662i)(0.0666667+-0.663325i)(-0.0333333+0.331662i)(-0.0333333+0.331662i)(-0.0333333+0.331662i)(0.0666667+-0.663325i)] 

original_mat_data_ size = 4
original_mat_data_[0] = [(0.0333333+-0.331662i)(-1+0i)(-0.0333333+0.331662i)(0.0333333+-0.331662i)(1+0i)(-0.0333333+0.331662i)(-0.0666667+0.663325i)(0+0i)(0.0666667+-0.663325i)]  
original_mat_data_[1] = [(-0.0673401+0.670025i)(0.03367+-0.335013i)(0.03367+-0.335013i)(0.03367+-0.335013i)(-0.0673401+0.670025i)(0.03367+-0.335013i)(0.03367+-0.335013i)(0.03367+-0.335013i)(-0.0673401+0.670025i)]  
original_mat_data_[2] = [(-0.03367+0.335013i)(0+0i)(0.03367+-0.335013i)(-0.03367+0.335013i)(0+0i)(0.03367+-0.335013i)(0.0673401+-0.670025i)(0+0i)(-0.0673401+0.670025i)]  
original_mat_data_[3] = [(995.105+-9951.05i)(-0.0340101+0.338397i)(-0.0340101+0.338397i)(-0.0340101+0.338397i)(995.105+-9951.05i)(-0.0340101+0.338397i)(-0.0340101+0.338397i)(-0.0340101+0.338397i)(995.105+-9951.05i)]  

rhs size = 2
rhs[0] = [(0+0i)(0+0i)(0+0i)]  
rhs[1] = [(1094.54+-10945.4i)(-10026.3+4524.8i)(8931.73+6420.6i)]  

nitbharambe avatar Oct 31 '25 14:10 nitbharambe

@nitbharambe the mismatch in the failed cases is actually pretty small, only like 1e-6 p.u. I think we can further reduce the admittance. Double floating point has 16 digits, we can make it half, like 1e-8 as the admittance scaler.

TonyXiang8787 avatar Nov 12 '25 12:11 TonyXiang8787

The reasoning for the fail seems too varied. Its 1e-4 in some cases. But I see setting the admittance as 1e-12 worked. (1e-8 or 1e-10 failed as well)

@nitbharambe the mismatch in the failed cases is actually pretty small, only like 1e-6 p.u. I think we can further reduce the admittance. Double floating point has 16 digits, we can make it half, like 1e-8 as the admittance scaler.

nitbharambe avatar Nov 12 '25 15:11 nitbharambe

@nitbharambe closing this in favor of #1189 to reduce the number of added test cases. I keep the branch there so you can decide later do you want to archive those additional cases somewhere.

TonyXiang8787 avatar Nov 16 '25 13:11 TonyXiang8787