Fix short-circuit source impedance scaling - #1547
Conversation
Signed-off-by: Shin <128954611+shin4141@users.noreply.github.com>
|
Thanks @shin4141 We shall review the implementation and the modified tests soon. |
| static ComplexTensor<sym> source_admittance(YBus<sym> const& y_bus, ShortCircuitInput const& input, | ||
| Idx source_number) { | ||
| assert(input.source_admittance_scaling.empty() || | ||
| input.source_admittance_scaling.size() == input.source.size()); | ||
| double const scaling = | ||
| input.source_admittance_scaling.empty() ? 1.0 : input.source_admittance_scaling[source_number]; | ||
| return scaling * y_bus.math_model_param().source_param[source_number].template y_ref<sym>(); | ||
| } |
There was a problem hiding this comment.
Nitpick: Could you please move the above comment of calculation_input_preparation regarding the reason to this place?
I would like a explaining docstring here along the lines:
"source admittance is calculated on sk for a specific u_ref for powerflow solvers within PGM.
However for generic short circuit calculation, sk is defined at rated voltage, so its source-equivalent impedance scales with c and the corresponding admittance scales with 1 / c = 1 / cabs(input.source[source_number])"
| std::vector<FaultCalcParam> faults; | ||
| ComplexVector source; // Complex u_ref of each source | ||
| ComplexVector source; // Complex u_ref of each source | ||
| DoubleVector source_admittance_scaling; // Multiplier for source y_ref in short-circuit calculations |
There was a problem hiding this comment.
I believe if we just do the cabs(input.source[source_number]) at short_circuit_solver directly, we wont need to add source_admittance_scaling right? Lets remove so if thats the case
| std::numeric_limits<double>::infinity()}; | ||
| auto const run_with_voltage_factor = [&](double voltage_factor) { | ||
| ShortCircuitInput input; | ||
| input.source = {voltage_factor}; |
There was a problem hiding this comment.
| input.source = {voltage_factor}; | |
| input.source = {{voltage_factor, 0.0}}; |
Good to be explicit
Fixes #1352
Changes proposed in this PR include
skbased on the connected node's rated voltage and carry an SC-only per-source admittance factor of1/cfrom short-circuit input preparation.c=0.95,c=1.0, andc=1.1, and update the 13 directly affected short-circuit golden files. Their JSON structure and non-numeric content are unchanged; the semantic changes are numeric SC results only.Local verification: focused property 6/6 assertions; all single/batch short-circuit validation 16,239/16,239 assertions; power-flow/state-estimation single/batch counterchecks 12,385/12,385 assertions; full configured CTest 198/198 tests; clang-format and
git diff --checkpass.Not run locally: Python pytest/coverage, Linux/Windows compiler matrices, sanitizers, full clang-tidy, or upstream CI.
Could you please pay extra attention to the points below when reviewing the PR
c=0.95) is handled per source, while existing internal solver inputs can retain a neutral scaling of 1.0.Checks
Assisted-by: OpenAI Codex (repository analysis, implementation, test design, and local verification).