dss-extensions/dss_capi

`save circuit`: add flags to filter and tweak the output

PMeira opened this issue · 1 comments

PMeira commented

Some potential flags:

  • insert CalcVoltageBases (currently disabled by default in DSS C-API)
    • insert SetkVBase to ensure correct voltages when manually populated
  • keep or exclude (current default = exclude) the disabled elements
  • keep or exclude (current default = include) the default unedited objects
  • single or multiple (current default) files
    • for single file, keep ordering of elements (since OpenDSS doesn't reorder the elements, for some systems the order can have a large impact on the solution results, usually within or very close to the tolerance, but still different results)
    • for multiple files, save separate "feeders" (defined by EnergyMeters; currently the default behavior)
  • include the options and config as dumped in TSolutionObj.DumpProperties
  • save open terminals, maybe handle swtcontrol action=o...

Suggestions welcome.

Done, pending more testing before the next release.

    /*
    Equivalent of the "save circuit" DSS command, but allows customization
    through the `saveFlags` argument, which is a set of bit flags. 
    See the "DSSSaveFlags" enumeration for available flags:

    - `CalcVoltageBases`: Include the command CalcVoltageBases.
    - `SetVoltageBases`: Include commands to set the voltage bases individually.
    - `IncludeOptions`: Include most of the options (from the Set/Get DSS commands).
    - `IncludeDisabled`: Include disabled circuit elements (and LoadShapes).
    - `ExcludeDefault`: Exclude default DSS items if they are not modified by the user.
    - `SingleFile`: Use a single file instead of a folder for output.
    - `KeepOrder`: Save the circuit elements in the order they were loaded in the active circuit. Guarantees better reproducibility, especially when the system is ill-conditioned. Requires "SingleFile" flag.
    - `ExcludeMeterZones`: Do not export meter zones (as "feeders") separately. Has no effect when using a single file.
    - `IsOpen`: Export commands to open terminals of elements.
    - `ToString`: to the result string. Requires "SingleFile" flag.

    If `SingleFile` is enabled, the first argument (`dirfilePath`) is the file path,
    otherwise it is the folder path. For string output, the argument is not used.

    (API Extension)
    */
    DSS_CAPI_DLL char* Circuit_Save(const char* dirfilePath, int32_t saveFlags): PAnsiChar; CDECL;