Skip to content

AltDSS/DSS C-API 0.14.2

Compare
Choose a tag to compare
@PMeira PMeira released this 26 Feb 09:46
· 24 commits to master since this release

AltDSS/DSS C-API is a library that exposes a plain C API for an unofficial/alternative 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: AltDSS-Python, DSS-Python, OpenDSSDirect.py, OpenDSSDirect.jl (Julia language), DSS# (.NET/C# bindings), DSS MATLAB, AltDSS-Rust, AltDSS-Go, and the dss.hpp C++ header-only library, besides third-party projects.

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.
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

Changes since 0.14.1

Minor release to address issues found in the Alt API. Besides Lines_Get_Parent, the other changes do not affect behavior of the classic API functions.

  • Alt/Bus: fix Lines/Loads/PCElements/PDElements when multiple elements are present
  • Alt/CE: Fix Alt_CE_Get_RegisterValues in the C header.
  • Alt/PDE: Check for missing solution in a few functions.
  • Commands/CalcLaplacian: Give proper error message instead of crashing or giving "access violation" messages.
  • Circuit/API: check if there is a circuit in Circuit_Save.
  • Lines/API: adjust behavior of Lines_Get_Parent when the compat flag is off.

Full Git Changelog: 0.14.1...0.14.2

Changes from 0.14.0 to 0.14.1

Minor release to address issues found through AltDSS-Python. These shouldn't affect software that use only the classic API.

  • Alt_PCE: implement two missing functions
  • DSSObj, LineGeometry: for the alternative API, add array shortcuts for Wire; use the array shortcuts more.
  • SetterFlags_AllowAllConductors:
    • Update value of SetterFlags_AllowAllConductors to 0x40000000 to avoid difficulties in Python.
    • Propagate setting when using Obj/Batch APIs; adjust Line.Conductors.

Full Git Changelog: 0.14.0...0.14.2

Changes from 0.13.4 to 0.14.0

Starting on this version, we will call DSS C-API and related projects AltDSS, an alternative implementation of OpenDSS, to make it more clear that this is not supported by EPRI and many extra features are not present in the official OpenDSS. Watch the DSS-Extensions org on GitHub for more announcements soon, including some support for the official implementation (still Windows-only at the moment). The name change does not mean compatibility or other aspects are expected to change, the project will still follow the basic guidelines of compatibility that have been followed since 2018.

This version should match OpenDSS v9.8.0.1 (SVN r3723). Remember to check the compatibility flags and Known differences.

  • Another large internal (Pascal) code refactoring step and general clean-up. Check the commits for details, too many to list. A last step is under progress and will be merged in the next major release.

  • Capitalization of property names adjusted! A first pass was done to try to make the property names more uniform. Since OpenDSS is case insensitive, we are free to change the capitalization as we see fit. In the past, the official OpenDSS already changed some property names, so a general suggestion for users that process the property names is to transform the names to upper or lower cases before comparing. This should ensure better stability across past and future versions of both DSS-Extensions and the official OpenDSS. For code that do not check the names in a case insensitive approach, DSS C-API 0.14.0 provides a function to adjust the property names (Settings_SetPropertyNameStyle), allowing the user to choose between three alternatives: the "Modern" version with adjusted capitalization; "Lowercase" names; and "Legacy" names. "Legacy" names can be used to avoid updating the names.

  • Introduces a preview of JSON schema (new), JSON export (updated) and import (new). Too many details to include in the changelog. Includes many updates to the internal metadata. A separate project will be posted at https://github.com/dss-extensions/AltDSS-Schema and community feedback is welcome. Note: the JSON schema will be used for projects and features beyond JSON IO.

  • Introduced options and improve correctness for save circuit. During the testing of the JSON dump, issues were fixed when saving Line, LineGeometry, Transformer, AutoTrans, XfmrCode. The issues vary from simple omissions to invalid exported DSS code. The property tracking feature below also helps generating clear and valid DSS scripts from save circuit, eliminating properties invalidated when changing some component definitions. To allow easier control of the save function without modifying the DSS language, a new Save function was added to the circuit API (Circuit_Save), coupled with the new DSSSaveFlags enumeration, which contains the option flags. This function also allows exporting the whole circuit as a single string.

  • Introduce property tracking. Setting some properties now mark conflicting property definitions as unset. This affects some functionality for saving circuits and is also used for the JSON schema, for instance. An example: a user creates a load with kW=10 kvar=0. Later, the user updates the load, setting PF=0.9. Setting the power factor toggles the load internal state to use kW and PF as the load definition, but kvar is still marked as set. The DSS engine correctly tracks the order that properties were defined, so everything works as expected. Now, with the growing usage of DSS implementation to export the circuit, every single user is required to correctly implement this tracking if they want to ensure compatibility. That is, dumping the data from this example generator in an unordered dictionary/map/etc. for processing and later dumping back to DSS scripts will result in the wrong model.

    • Users can, of course, still query the value of all properties.
    • See also NoPropertyTracking compat flag.
    • Currently implemented, at least partially, in the following DSS classes (plus Lines and Loads API): LineCode, LineGeometry, LoadShape, Generator, Load, PVSystem, Storage, VSource, Fault, Line, Reactor, Transformer.
    • This functionally may be extended to other classes in future versions, if required.
  • Introduce "Setter" flags. These are flags used to tweak how the property update is done. Notably,AvoidFullRecalc (some other flags are only using by the engine, internally): some specific properties like Load.kW can be updated both directly through a DSS script (or Text interface), or through the dedicated Loads API in any of the specific language bindings of the many APIs. The dedicated API does not force a YPrim update and full load model recalculation.

    • When using this flag AvoidFullRecalc in the Obj/Batch APIs, the behavior will follow the dedicated Loads API.
    • Other flags include ImplicitSizes and AllowAllConductors. Both are currently used for enabling some of the JSON Schema functionally.
    • For batch operations, SkipNA was introduced to allow handling scenarios with non-uniform data.
    • The relevant API functions were updated to include an extra function argument with the setter flags.
    • Is this AvoidFullRecalc the same as SkipSideEffects compat flag? No. AvoidFullRecalc is still valid and by design (including some behavior listed in OpenDSS docs), whereas SkipSideEffects is potentially unintended behavior.
  • New compatibility flags in DSSCompatFlags:

    • ActiveLine (0x10). In the official OpenDSS implementation, the Lines API use the active circuit element instead of the active line. This can lead to unexpected behavior if the user is not aware of this detail. For example, if the user accidentally enables any other circuit element, the next time they use the Lines API, the line object that was previously enabled is overwritten with another unrelated object. This flag enables this behavior above if compatibility at this level is required. On DSS-Extensions, we changed the behavior to follow what most of the other APIs do: use the active object in the internal list, starting on version v0.14.0.
    • NoPropertyTracking (0x20): On DSS-Extensions/AltDSS, when setting a property invalidates a previous input value, the engine will try to mark the invalidated data as unset. This allows for better exports and tracking of the current state of DSS objects. Set this flag to disable this behavior, following the original OpenDSS implementation for potential compatibility with older software that may require the original behavior; note that may lead to erroneous interpretation of the data in the DSS properties. This was introduced in DSS C-API v0.14.0 and will be further developed for future versions.
    • SkipSideEffects (0x40). Some specific functions on the official OpenDSS APIs and internal code skip important side-effects. By default, on DSS-Extensions/AltDSS, those side-effects are enabled. Use this flag
      to try to follow the behavior of the official APIs. Beware that some side-effects are
      important and skipping them may result in incorrect results.
      This flag affects some of the classic API functions (Loads, Generators, Vsources) as well as the behavior of some specific DSS properties (Line: Rg, Xg, rho; Transformer/AutoTrans: XSCArray).
  • New Alt and Obj families of functions. A new family of functions was added to allow most legacy API operations and new functionality directly on objects and batches, instead of relying on "active..." idiom. A new package, AltDSS-Python, will be published to illustrate the new approach. Since the engine is shared, users can mix both approach (e.g. use AltDSS-Python and OpenDSSDirect.py in the same script).

  • Batch/API:

    • Allow using batches with simple functions that return float64/int32 for each object.
    • Allow using INT32_MAX and NaN for missing values, which can be skipped with the SetterFlags_SkipNA flag. Sooner or later, there should a better alternative, but this can be useful in the time being.
  • Headers:

    • Remove stdint_compat.h. This was only required for very old or non-standard compiler like MSVC 2008. Users that require that can still source the file from older releases or get similar files from other sources.
    • Include stddef.h when building as C code.
    • Mark CktElement_Get_IsIsolated with (API Extension)
    • Add more const qualifiers. Especially useful for the new Rust and Golang bindings.
  • Specific bug fixes:

    • AutoTrans: fix DumpProperties, readd bank property (unused internally).
    • Commands/Save: add version and timestamp to master file.
    • DynamicExp and DynEqPCE: fix DumpProperties; extend to support JSON in/out.
    • Generator: fix default value for D (as DSS property); previously, the value was left uninitialized. It seems to only affect user models, so it doesn't seem like a big issue. Explicitly providing a value would also work fine as a workaround.
    • Line and LineCode: fix formatting issues in DumpProperties
    • LoadShape: fix some issues when copying/saving data when using float32 data (which users need to explicitly opt-in).
    • PriceShape/TempShape: adjust setters for mean/stddev properties
    • Relay: fix handling of DOC_PhaseCurveInner (DSS property)
    • Reactor: in some situations, R and X were not synched with Z. Fixed by removing the internal duplication (does not affect user code).
    • Sensor: DeltaDirection was not initialized; make clear an explicit action.
    • SwtControl: If no element is attached (misuse), set state as "none".
    • Transformers/API: Transformers_Get_LossesByType and Transformers_Get_AllLossesByType now check if the transformer is enabled.
    • API/general: avoid tiny memory leaks (pointer size, 8 bytes) on empty data and some error situations.
    • Bus/classic API: fix Bus_Get_N_interrupts; was previously returning the duration instead.
    • Circuit_Capacity (API, command): fix register index, remove magic numbers. (Bug introduced back in 2008!)
    • Circuit/API: fix Circuit_Enable and Circuit_Disable (enabling/disabling circuit elements by name). An equivalent fix is included in the official OpenDSS v9.7.1.1, in the COM interface. Additionally, provide error message when trying to use invalid element names.
    • Obj/Batch API: better handling of booleans. With this change, any non-zero value is interpreted as true, which simplifies integration with other programming languages. This was the original intention.
    • API/Iteration: Fix issues with iteration in a few of the internal functions which could have resulted in empty results in some situations. These situations occurred only during testing, so we don't expect many users were affected.
  • Misc:

    • Error handling: add a few numeric checks, and check for errors in more places during solution algorithms. The changes should help finding issues earlier and/or more easily.
    • Check for null pointers (usually missing circuit solution) in a few more places.
    • Properties/capitalization: adjust capitalization of nearly all property names. Use lowercase for description keys (help strings). Feedback on the capitalization is welcome. As a reminder, OpenDSS is case-insensitive, but other other are not. Providing a better internal representation of the properties will help other tools to use the internal names without extra work (no need for each tool to adjust capitalization), and it doesn't affect the DSS engine itself nor compatibility with the upstream OpenDSS.
    • Obj/API: introduce ExtraClassIDs to get some special lists.
    • Classic to Obj/Alt API bridge: add many *_Get_Pointer functions (e.g. CktElement_Get_Pointer, Loads_Get_Pointer). These functions return a pointer that can be used in the Obj API. This should enable an easier migration from the classic API, or allow users to use the Obj API to complement the classic API where the latter is lacking.
    • API/Callbacks: dss_callback_message_t function signature extended with two more arguments. We are not aware of any user using these, but if you are, remember to update your callbacks.
    • API/Extended errors: add a few more checks, and disable some error messages when extended errors are disabled. (Extended errors are extra error checks introduced to signal wrong usage of the DSS engine; extra = not present in the original/official codebase)
    • API/Text: microoptimize Text_CommandBlock for single commands. That is, users could use Text_CommandBlock for both single and multi-line strings without performance impacts. We did not replace Text_Set_Command in order to avoid potential compatibility issues.
    • API/Events: generalize the API for event extensions.
    • API/Obj: handle incorrect array sizes better, add error messages.
  • Ported from the official SVN:

    • r3637: "Removing force EventLog for StorageController to match all the other controls and their defaults." (by davismont)
    • r3640: "Updated "Show" fault study report to better arrange output. (...)" (by aovallev)
    • r3642: "Skipping disabled meters when interpolating all meters." (by celsorocha)
    • r3646: updates to TInvDynamicVars.CalcGFMYprim (by davismont)

Full Git Changelog: 0.13.4...0.14.2

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 ARM32 binaries will be added manually if there are any requests (please feel free to create a new issue on GitHub).

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 (since it's built as a shared library, you don't need to worry about Free Pascal).

Checksums

SHA256

97d45e9eac3f511ecda0e151f745b1c2ce51f9f57157097786bd6aac42b875f5  dss_capi_0.14.2_darwin_arm64.tar.gz
23f18426f644e69cc02c77c7c3e2720c4a8fe28a64705582bf87f03eecb5b3ab  dss_capi_0.14.2_darwin_x64.tar.gz
e71109bbc6f4e9bc9edef707de13ece5ab7a4081ae438df4ff35733b675dadc0  dss_capi_0.14.2_linux_arm64.tar.gz
dd01f724afbd671155ec053bd9ae83a82284cc6162cdaada9ae087d1ebb3ca46  dss_capi_0.14.2_linux_x64.tar.gz
bec82e4c83841dfef7d4e660a26856e0ad654303869de79adc488b03c6c9cbc3  dss_capi_0.14.2_linux_x86.tar.gz
2f63d820b14fcb2d93f6037a95215147b2d932d58b926e2af82372de8d1d971b  dss_capi_0.14.2_win_x64.zip
cbfcf3e6900fe3436b12db1a80a933805b4dd528487f30699309fc2b827d2f9c  dss_capi_0.14.2_win_x86.zip
020ce922189a339ce74bed9b629a9a9b7c405d002ccb8dc92565afdc57280575  messages.tar.gz
41b9040faddc682b7dde2a276981a8e9670997fadd64b0e09d85daadfc60dd68  messages.zip

SHA512

f1d0ae7a0f2a56a42cc2e188a04768463370449ea65dc9ca4290122a343270f420c63f060247496e581063ec1cfba871f45525bf0bd049af885f0fd4651c4fbb  dss_capi_0.14.2_darwin_arm64.tar.gz
3cf6c10de155d06659b410b74d00e766d40fa01bb166c1c36746ec7d179347afb15242d93148f852ac498b53491a189a36f9d4e63db49fafaf19da9f16e27e5f  dss_capi_0.14.2_darwin_x64.tar.gz
f62a6b6b9f5e5e0167c4ec55f5223a190e2afdfcba10721e327ed8093da3847f3059f6e177c10aca3e39757c006bb21b7951c06a8f1a35854738e8c9469287f6  dss_capi_0.14.2_linux_arm64.tar.gz
835f03463b6324cc22967ab9c53dac24d7b28706dc03e119a4b4f4ad5afd3e259fa858fb7ccf5291ba8c39ddd5a3a83f60bb34b3ec461370502de82fc0c3483f  dss_capi_0.14.2_linux_x64.tar.gz
bb82da0423c445fe8ba5dfc5cb9b2a9aa555924a35e53c69d382fc1b15b097c0afb13a4004f46891e3bffc2770157da84565b2922e5df13f88564ccdf74c421b  dss_capi_0.14.2_linux_x86.tar.gz
384c2e9db34292ed886b009825889a8546d67ddde692cbb44dd2b89c02cd6bf57f3d2c6a978d024075b82cea75b84d38036e8b507e76373a4c2a90564f65f0a1  dss_capi_0.14.2_win_x64.zip
046f0148522ca2fdb153a797ff8db764203171093fd0f6e478767d0015f790841727c18dab548d4464879ec89e482a2d6f8cbc69cddf30cf48e605fdadff9b4b  dss_capi_0.14.2_win_x86.zip
0af95f0f4754e7b8f0f316732fe21475a6ab49ad13172710a9f3d3797f639686d2cd2b5ea20a312dd80f5b33da4464e2411733fe5a8f6e04f6e51cabe13fecb9  messages.tar.gz
a2e5acaf55e51f61d17431a7e66d1173e178ad12bcffa87a70ac503b2a0b5ee63695fbde05c3204aed59a92207bd1dab903768835f0f0da94e0ade19804f22cf  messages.zip