lanl-ansi / PowerModelsDistribution.jl

A Julia/JuMP Package for Unbalanced Power Network Optimization
https://lanl-ansi.github.io/PowerModelsDistribution.jl/stable/
Other
146 stars 43 forks source link

[BUG] Inconsistant units possible between line and linecode? #469

Open John-Boik opened 3 months ago

John-Boik commented 3 months ago

In create_dss_object, for linecodes, several lines similar to the following appear:

    linecode.r1 = linecode.r1 / _convert_to_meters[linecode.units]
    linecode.x1 = linecode.x1 / _convert_to_meters[linecode.units]

Similar equations are also used when creating lines. Apparently in PMD, if units is not given for a linecode, then the multiplier defaults to 1.0 and a units=m is set for the linecode. But when units is not given for linecode, DSS apparently looks to the definition of units on lines that use the linecode, to determine what the units for linecode should be. Isn't it true that in the PMD parser, there would be an inconsistency in values if units for linecode is not given, but is given for lines that use the linecode, and these units are not meters?

If so, part of the solution might be to search for all lines that use a linecode when creating the linecode and units is not given. If all such lines have at most one unique value for units, then that is the value that the linecode should have. If lines are created after linecodes, then the search and any units changes might be more complicated.