DSS_Python 0.10.6
On 2020-07-31, version 0.10.6 has been released on the official Python package repository (PyPI) for Windows, macOS and Linux. For Anaconda cloud (channel PMeira), packages are available for macOS and Linux.
Note: Although the majority of features are ported frequently from the official OpenDSS and validated with a large suite of tests, this is not an official EPRI project.
The main differences in behavior compared to the official OpenDSS are listed in https://github.com/dss-extensions/dss_capi/blob/0.10.x/docs/known_differences.md
Installation
Using pip (Python versions: 2.7, 3.5 to 3.8):
pip install dss_python
Or install it with conda (available for Python versions 3.5 to 3.8 for macOS and Linux):
conda install -c pmeira dss_python
Recent changes
Changes in 0.10.6, since 0.10.5
Check the changelog document for a detailed list for all releases.
- Updated to DSS C-API 0.10.6, which includes most changes up to OpenDSS v9.0.0.3.
- Debug builds of DSS C-API are now included. See the Debugging document.
- New
DSS.LegacyModels
: allow using the legacy/deprecated models forPVsystem
,Storage
,InvControl
, andStorageController
. - New
DSS.Error.ExtendedErrors
: controls if the new extended error messages are used. - Many new properties and functions in
DSS.ActiveCircuit.PDElements
. - Now most of the low-level API calls are checked, mapping the errors from the
DSS.Error
interface to Python exceptions more frequently.
DSS C-API 0.10.6 changes:
- This version should be fully API compatible with 0.10.3+. The behavior of some functions changed with the new extensions. Especially, empty strings are explicitly return as nulls instead of "\0". This conforms to the behavior already seen in arrays of strings.
- The binary releases now use Free Pascal 3.2.0. We observed the solution process is around 6% faster, and results are even closer to the official OpenDSS.
- The releases now include both the optimized/default binary and a non-optimized/debug version. See the Debugging document for more.
- Extended API validation and Extended Errors mechanism:
- The whole API was reviewed to add basic checks for active circuit and element access.
- By default, invalid accesses now result in errors reported through the Error interface. This can be disabled to achieve the previous behavior, more compatible with the official COM implementation -- that is, ignore the error, just return a default/invalid value and assume the user has handled it.
- The mechanism can be toggled by API functions
DSS_Set_ExtendedErrors
andDSS_Get_ExtendedErrors
, or environment variableDSS_CAPI_EXTENDED_ERRORS=0
to disable (defaults to enabled state).
- New Legacy Models mechanism:
- OpenDSS 9.0+ dropped the old
PVsystem
,Storage
,InvControl
, andStorageController
models, replacing with the new versions previously known asPVsystem2
,Storage2
,InvControl2
andStorageController2
. - The behavior and parameters from the new models are different -- they are better, more complete and versatile models. Check the official OpenDSS docs and examples for further information.
- The implementation of the new models in DSS C-API was validated successfully with all test cases available. As such, we mirror the decision to make them the default models.
- As an extension, we implemented the Legacy Models option. By toggling it, a
clear
command will be issued and the alternative models will be loaded. This should allow users to migrate to the new version but, if something that used to work with the old models stopped working somehow, the user can toggle the old models. The idea is to keep reproducibility of results while we keep updating the engine and the API. - Since EPRI dropped/deprecated the old models, we might drop them too, in a future release. Please open an issue on GitHub or send a message if those old models are important to you.
- The mechanism can be controlled by API functions
DSS_Set_LegacyModels
andDSS_Get_LegacyModels
, or environment variableDSS_CAPI_LEGACY_MODELS=1
to enable (defaults to disabled state).
- OpenDSS 9.0+ dropped the old
- WireData API: expose the
CapRadius
property as a new pair of functions. - PDElements API: extended with many batch functions exposing equivalents to some CSV reports:
AllNames
,AllMaxCurrents
,AllPctNorm
,AllPctEmerg
,AllCurrents
,AllCurrentsMagAng
,AllCplxSeqCurrents
,AllSeqCurrents
,AllPowers
,AllSeqPowers
,AllNumPhases
,AllNumConductors
,AllNumTerminals
. CktElement_Get_SeqPowers
: fix issue for positive sequence circuits (wrong results could corrupt memory).- Many API functions were optimized to avoid unnecessary allocations and copies.
- Some bugs found in DSS C-API and also reported upstream (already fixed in SVN):
CapRadius
DSS property: if the radius was initialized usingGMRac
,CapRadius
was left uninitialized, resulting in invalid/NaN values.Sensors
API: some functions edited capacitors instead of sensors.
- Updated to the official OpenDSS revision 2903, corresponding to versions 9.0.0+. Changes include:
- ExportCIMXML: updated.
- Relay: Fix in
GetPropertyValue
. - Line: In
DumpProperties
andMakePosSequence
, the length is handled differently for lines withLineGeometry
orLineSpacing
. - Bus API: new
LineList
,LoadList
functions. - Lines API: SeasonRating now returns NormAmps if there's no SeasonSignal.
- New command DSS
Zsc012
: "Returns symmetrical component short circuit impedances Z0, Z1, and Z2 for the ACTIVE 3-PHASE BUS. Determined from Zsc matrix." PVsystem2
,Storage2
,InvControl2
,StorageController2
updated and renamed.
Reminder: mixed-case handling
If you were using use_com_compat
to allow mixed-cased attributes, it should work better than before. You may now use use_com_compat(warn=True)
to warn when you use an attribute that wouldn't exist without calling use_com_compat
. The intention is that the user should run their code to get a list of warnings, fix it, and then remove use_com_compat
since it does have a small performance impact.