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

[BUG] Mismatch of values ​​in symmetric and asymmetric power flow mode

Open WinApiMan opened this issue 3 months ago • 8 comments

Hi! Questions have arisen regarding the results of object with Id = 46143. The same input file was processed in symmetric and asymmetric Power Flow calculation modes. The results differ by an order of magnitude.

Symmetrical and asymmetrical loads were connected to the node. When calculating in symmetrical mode, the library worked correctly, and the power readings through the transformer were accurate. When calculating in asymmetrical mode, the active and reactive power readings through the transformer were incorrect, across all phases.

I ask you to help me understand this issue. Thank you in advance!

Input File

calculate_model.json

Output Files

calculate_output_model asym.json

calculate_output_model sym.json

WinApiMan avatar Nov 11 '25 08:11 WinApiMan

@WinApiMan It seems difficult to compare the results 1-1. PGM does the following: The symmetric load gets distributed equally amongst 3 phases for asymmetric calculation. Whereas asymmetric load gets averaged out equally amongst 3 phases for symmetric calculation.

Hence the expected results should indeed differ by a bit. A asymmetric load with equal phase distribution can make result attributes comparable.

nitbharambe avatar Nov 11 '25 08:11 nitbharambe

@nitbharambe The different parameters are highlighted in red. The differences are up to 5-8 times. With the same input model, the load changed from 259% to 1155%.Please explain how this can be, I apparently don't understand something.

Image

WinApiMan avatar Nov 11 '25 10:11 WinApiMan

@WinApiMan The difference is indeed quite huge. What were the options used in the calculate_power_flow? ie. calculation_method or error tolerance etc?

nitbharambe avatar Nov 11 '25 11:11 nitbharambe

@nitbharambe

Asymmetric Image

Symmetric Image

WinApiMan avatar Nov 11 '25 12:11 WinApiMan

@WinApiMan Ok, I wish to reproduce this issue in my local PC. In a minimal way I tried to do following, but I receive an IterationDiverge. Is there anything additional you do to run the calculation?

from pathlib import Path

from power_grid_model.utils import json_deserialize_from_file, json_serialize_to_file
from power_grid_model import PowerGridModel, CalculationMethod
from power_grid_model.validation import assert_valid_input_data

input_path = Path("./calculate_model.json")
input_data = json_deserialize_from_file(input_path)

# This validation step raises an error on missing tan0 for lines. 
# This is needed for asym calculation otherwise a SparseMatrixError is received.
# assert_valid_input_data(
#     input_data=input_data, calculation_type=CalculationType.power_flow, symmetric=False
# )
input_data["line"]["tan0"] = 0

model = PowerGridModel(input_data)
asym_output = model.calculate_power_flow(
    calculation_method=CalculationMethod.newton_raphson,
    symmetric=False,
    error_tolerance=1e-3,
)
sym_output = model.calculate_power_flow(
    calculation_method=CalculationMethod.newton_raphson,
    symmetric=True,
    error_tolerance=1e-3,
)
json_serialize_to_file(Path("./sym_output.json"), sym_output)
json_serialize_to_file(Path("./asym_output.json"), asym_output)

(I see the transformer winding is YYn and this leads to the similar floating ground situation we are discussing in the https://github.com/PowerGridModel/power-grid-model/issues/1162)

nitbharambe avatar Nov 11 '25 13:11 nitbharambe

@nitbharambe For calculation we used 1.12 pgm version and for an asymmetric calculation iterations count = 1000. In the latest version 1.12.65 I get the sparse matrix error also. Can you run it on this version of the library?

WinApiMan avatar Nov 11 '25 13:11 WinApiMan

Okay. Same. If i make max_iteration=1000 instead of 20, I receive the SparseMatrixError too. This error has related cause as #1162 . How do i arrive at the result json files in the issue description?

nitbharambe avatar Nov 12 '25 07:11 nitbharambe

@nitbharambe Json files are attached to the current issue. In the latest version of the library we also have a sparse matrix error. Thank you for your reply, we will wait for the problem to be resolved #1162 .

WinApiMan avatar Nov 12 '25 08:11 WinApiMan