Skip to content

DSS C-API v0.13.0

Compare
Choose a tag to compare
@PMeira PMeira released this 28 Mar 17:26
· 233 commits to master since this release

DSS C-API is a library that exposes a plain C API for an unofficial implementation/port of OpenDSS, the Distribution System Simulator from EPRI (the Electric Power Research Institute), aiming for full COM compatibility and beyond. It allows using most of the OpenDSS features on Windows, Linux and macOS with compatible behavior across multiple processor architectures. It is the lower level API used by the other projects in DSS Extensions: DSS Python, OpenDSSDirect.py, OpenDSSDirect.jl (Julia language), DSS# (.NET/C# bindings), DSS MATLAB, and the dss.hpp C++ header-only library.

All derived/downstream projects, including the documentation sites and dss.hpp headers, will be updated in the next hours/days to use this new engine.

See the changelog for a complete list of changes since 0.12.1, initially listed below.
See also the updated "Known Differences" document, which lists the main differences between the DSS C-API codebase and the main/official OpenDSS.

For a growing general repository about the projects, see https://github.com/dss-extensions/dss-extensions

Besides the changes listed below, a lot of effort went into DSS-Python to complement our testsuite. More about that on upcoming DSS-Python release.

Changes since 0.12.1

Includes porting of most official OpenDSS features up to revision 3595. Check the OpenDSS SVN commits for details. Some of the changes are kept behind the new CompatFlags (see below).

Version 0.13.0 was expected to be version 0.12.2. Due to some more large changes from the upstream/official OpenDSS, we decided to increment to 0.13 instead.
Although only officially released on March 2023, most of the changes below were already available in an alpha version release on December 2022.

  • Clean-up several files to ease the transition from Pascal to C++; more enum usage, remove redundant internal properties, rename some class members, etc. Some final steps still remain (that work is done in private branches).
  • Fixes a couple of minor memory leaks.
  • Removed our old Legacy Models mechanism. Right now, the API functions still exist, but will have no effect when setting and will throw an error. For a future version, the functions will be removed. This toggle was introduced in 2020, some time after the removal of the legacy models in the official OpenDSS. We believe users had enough time to fully migrate and the extra maintenance burden is not justified anymore.
  • Transition some deprecated and buggy properties to throw specific errors, instead of generic messages. Issue: #118
  • Export command: When the user provides a filename, use it as-is, otherwise could be an invalid path in case-sensitive file systems (e.g. Linux, most likely).
  • Dump and Save commands: in some cases, our internal "hybrid enums" were not being converted correctly for dumps. A few classes had incomplete dump implementations since v0.12.0; some strings needed to be escaped for correct output.
  • CtrlQueue: adjust string formatting of items; although this doesn't affect the numeric results, the strings from the queue had some truncated numbers.
  • Property system: For compatibility with the official version, allow autoresizing some arrays when given conflicting number of elements through the text interface or scripts.
  • Like property: Although not recommended and deprecated in the official OpenDSS, the sequence of properties filled in the original copy is also copied. If you use Like, remember to check if the copy actually worked since some classes are known to not copy every property correctly.
  • Plotting and UI: The engine side plotting callback system is now complete. There are fixes for DaisyPlot and GeneralDataPlot, especially multi-platform handling. Changed how some properties are exposed in the JSON interchange to the callbacks. Implement argument handling and callback dispatch for DI_Plot, CompareCases and YearlyCurves.
  • New commands: Fix potential issue with null pointers and duplicate names when DuplicatesAllowed=False.
  • EnergyMeter: Fix error message when the metered element is not a PDElement.
  • CIMXML export: Fix issues present since v0.12.0; reported in dss-extensions/OpenDSSDirect.py#121
  • Parser: properly error out when given excessive number of elements for matrices; implemented due to the report in dss-extensions/OpenDSSDirect.py#122
  • Port most changes from the official OpenDSS up to SVN revision 3595 (OpenDSS v9.6.1.1 + a couple of CIMXML updates); check OpenDSS v9.6.1.1 README.txt for some complementary info to the list below.
    • Relay, UPFC, UPFCControl changes ported.
    • CIMXML exports: Various updates.
    • RegControl: More log and debug trace entries.
    • LoadMult: Set SystemYChanged when changing LoadMult through a DSS script or DSS command (doesn't affect Solution_Set_LoadMult)
    • Port PVSystem, Storage, InvControl, and StorageController changes, including the new grid-forming mode (GFM). For DSS Extensions, we added a new class InvBasedPCE to avoid some redundancy and make things clearer.
    • Port DynamicExp and related functionality. In our implementation, we also add a new class DynEqPCE to avoid some redundant code (could still be improved). the Generator and the new InvBasePCE derive from this new DynEqPCE. Note: the DynamicEq functionality from the upstream still seems incomplete and some things are not fully implemented or maybe buggy, so we only ported now to remove the burden of porting this down the line. If you find issues, feel free to report here on DSS Extensions, but we recommended checking first with the official OpenDSS -- if the issue is also found in the official version, prefer to report in the official OpenDSS forum first so everyone gets the fixes and our implementation doesn't diverge too much.
    • CktElement/API: add a few new functions related to state variables.
    • Circuit, Line: port the LongLineCorrection flag now that it seems to be fixed upstream. Note that we didn't publish releases with the previous buggy version from the upstream OpenDSS (that applied the long-line correction for everything).
    • LineSpacing: port side-effect from upstream; changing nconds now reallocates and doesn't leak previously allocated memory. Not a common operation, so it's not very relevant.
    • CktElement: port code for handling losses in AutoTrans
  • Other API updates:
    • DSSContext API: allow null pointer for the prime/default instance. This should ease the transition. Issue: #119
    • Error API: add Error_Set_Description to allow easier setting an error message from callbacks (this is for advanced usage)
    • Batch and Obj API:
      • For a couple of fast-path operations, add checks for edit state, automatically issuing BeginEdit and EndEdit for the objects in the batch.
      • Allow passing strings (object names) instead of pointers for object references
      • Automatically add new elements to the current DSSContext (since we have not yet published a manipulation API)
      • For symmetric matrices, if the user passes only the triangle, follow the same convention as the Text interface. Includes specific fix for (parts of) complex matrices (like the R or X matrices when internally Z is stored). If the user provides full matrices, the previous behavior was correct, no changes required.
    • Fuses_Reset: fix C header (remove extra/unused parameter)
    • Fuses_Get_State and Fuses_Get_NormalState: add missing string copy. Sometimes this could cause memory corruption.
    • Bus_Get_ZSC012Matrix: check for nulls
    • Bus_Get_AllPCEatBus, Bus_Get_AllPDEatBus: faster implementations
    • Meters_Get_CountBranches: reimplemented
    • Monitors_Get_dblHour: For harmonics solution, return empty array. Previously, it was returning a large array instead of a single element ([0]) array. A small issue adjusted for compatibility with the official COM API results.
    • Reactors_Set_Bus1: Match the side-effects of the property API for two-terminal reactors.
    • New DSS_Set_CompatFlags/DSS_Get_CompatFlags function pair: introduced to address some current and potential future concerns about compatibility of results with the official OpenDSS. See the API docs for more info.
    • New DSS_Set_EnableArrayDimensions/DSS_Get_EnableArrayDimensions: for Array results in the API, implement optional matrix sizes; when setting DSS_Set_EnableArrayDimensions(true), the array size pointer will be filled with two extra elements to represent the matrix size (if the data is a matrix instead of a plain vector). For complex number, the dimensions are filled in relation to complex elements instead of double/float64 elements even though we currently reuse the double/float64 array interface. Issue: #113

Note that a couple of SVN changes were ignored on purpose since they introduced potential issues, while many other changes and bug-fixes did not affect the DSS C-API version since our implementation is quite different in some places.

Full Git Changelog: 0.12.1...0.13.0

Precompiled binaries

Most of the binaries available here are built through GitHub Actions, as are most of the development builds (you need to be logged in to be able to download dev builds). Linux ARM binaries will be added manually as time permits (please feel free to create a new issue if we delay it too much).

Users rarely need to build the Pascal binaries themselves, since there aren't many Free Pascal compiler flags that affect them. We do recommend building KLUSolveX optimized for your machines, especially for HPC clusters.