Open John-Boik opened 3 months ago
It looks like the problem is a bit worse. It appears that circuit.ToJSON()
ignores both xhl
and x12
in DSS files for transformers, and instead uses the default value of 700.
Also, the same problem appears in OpenDSSDirect.py and dss_python versions. And the problem is not in the ToJSON
function itself, as inspection of the OpenDSSDirect transformer (e.g., DSS.Transformers.Xhl()
) shows the problem too.
Looks like you found a corner-case bug, but it's the other way around -- X23
and X13
should have replaced the zero with the default/replacement values. That isn't happening due to a missing flag, should be fixed in the next release (in a few days).
An example DSS file comes from the test sets of PowerModelsDistribtion
Zero should not be allowed for X12
, X23
and X13
(XHL
, XLT
and XHT
are synonyms). If zero is provided, it's should be replaced by a default value. Non-zero values seem to be working as expected. If PMD is generating 0 for those, it's invalid data.
On the OpenDSS GUI, it will give a warning popup about the zero value, but still replace the value. When running through the official COM DLL with AllowForms=false (the typical scenario for automation with the official OpenDSS), users don't see the warning and the behavior matches what happens here on DSS-Extensions.
Nowadays, on DSS-Extensions, it might be a better idea to adjust that to generate a proper error when 0 is used as input, adding a compatibility flag to restore the current/legacy behavior. Same idea for read-only properties (OpenDSS silently ignores writing to those). I'll make changes according to this.
Redundant properties/fields (search for "redundant" in https://dss-extensions.org/dss-format/Transformer.html ) such as synonyms are omitted from the JSON output, so XHL
shouldn't appear, only X12
. We chose to use X12
and mark XHL
as redundant given that XHL is context-specific and the concept of H(igh) and L(ow) voltage windings don't always match with the actual voltages and can be confusing to new users.
Also note that (X12
, X13
, X23
) is somewhat redundant with XSCArray
(but actually this one is more general). Looking into the original issue, I noticed that XSCArray
doesn't handle the replacement values in case of zeros, so I'll just add an extra constraint to this to ensure non-zero values and error out otherwise. It might be a good idea to keep only XSCArray
down the line in the JSON output (and maybe rename it to just XSC
), but I won't change that now since there might be a better way to handle this.
Also, the same problem appears in OpenDSSDirect.py and dss_python versions.
Yeah, all projects here share the same engine, it wouldn't make sense to group these in the same GitHub org and have them behave differently. The general behavior should be very close across all programming languages we support. There will be an option to use the official engine in the next release of DSS C-API, but it will be quite limited -- none of our extended functionality at engine level, and initially only supporting Windows since it's supported by EPRI at the moment.
I'm not sure if this is the right repository to report this problem, but it looks like the circuit.ToJSON function of OpenDSSDirect will ignore transformer parameters xhl, xht, and xlt, thus setting these parameters to their default values. But it will recognize the alternative versions of the parameters, x12, x13, and x23.
An example DSS file comes from the test sets of PowerModelsDistribtion, given below. Saving this as a file and using the script below to generate a JSON object, the object has default values for xhl, xht, and xlt of transformer [1], rather than zeros. Changing the DSS file to use x12=0, x13=0, and x23=0 instead results in a JSON object with the correct (zero) values.
Julia Script, where the DSS file is saved as filename.dss:
DSS script: