Skip to content

Conversation

@nitbharambe
Copy link
Member

@nitbharambe nitbharambe commented Oct 31, 2025

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.

Signed-off-by: Nitish Bharambe <[email protected]>
@nitbharambe nitbharambe self-assigned this Oct 31, 2025
@nitbharambe nitbharambe added the bug Something isn't working label Oct 31, 2025
@nitbharambe nitbharambe changed the title add cases SparseMatrixErrors: power flow and short circuit special case Oct 31, 2025
@nitbharambe
Copy link
Member Author

nitbharambe commented Oct 31, 2025

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)]  

Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
@TonyXiang8787
Copy link
Member

@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.

Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
Signed-off-by: Nitish Bharambe <[email protected]>
@nitbharambe
Copy link
Member Author

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 nitbharambe marked this pull request as ready for review November 12, 2025 15:50
@sonarqubecloud
Copy link

param0.ytt() = y0_series;
}

auto const low_admittance = 0.5 * 1e-12 * sn_ / base_power_3p / uk_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this admittance of susceptance? Since we're only adding it to the imaginary part of Y = G + jB

param.value[i] = dot(sym_matrix, y012, sym_matrix_inv);
}

// for (size_t phase = 0; phase < 3; ++phase) {
Copy link
Member

@petersalemink95 petersalemink95 Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder that there is commented out code here

@TonyXiang8787
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants