Skip to content

Commit c24c9c4

Browse files
committed
Update docs for 0.10.1 and fix some validation.
1 parent 5ba9aa6 commit c24c9c4

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
Python bindings and misc tools for using OpenDSS (EPRI Distribution System Simulator). Based on CFFI and DSS C-API, aiming for full COM compatibility on Windows, Linux and MacOS.
44

5-
<p align="center">
6-
<img alt="Overview of related repositories" src="https://raw.githubusercontent.com/dss-extensions/dss_python/master/docs/images/repomap.svg?sanitize=true" width=600>
7-
</p>
5+
See also the other projects from [DSS-Extensions.org](https://dss-extensions.org/):
86

9-
If you are looking for the custom OpenDSS C-API library, see [`DSS C-API`](http://github.com/dss-extensions/dss_capi/).
7+
- [DSS C-API library](http://github.com/dss-extensions/dss_capi/): the base library that exposes a slightly modified version of EPRI's OpenDSS through a more traditional C interface, built with the open-source Free Pascal compiler instead of Delphi.
8+
- [OpenDSSDirect.py](http://github.com/dss-extensions/OpenDSSDirect.py/): if you don't need COM compatibility, or just would like to check its extra funcionalities. You can mix DSS Python and OpenDSSDirect.py -- for example, if you have old code using the official COM objects, you could quickly switch to DSS Python with very few code changes, and then use [`opendssdirect.utils`](https://dss-extensions.org/OpenDSSDirect.py/opendssdirect.html#module-opendssdirect.utils) to generate some DataFrames.
9+
- [OpenDSSDirect.jl](http://github.com/dss-extensions/OpenDSSDirect.jl/): a Julia module, created by Tom Short (@tshort), recently migrated with the help of Dheepak Krishnamurthy (@kdheepak) to DSS C-API instead of the DDLL.
10+
- [DSS Sharp](http://github.com/dss-extensions/dss_sharp/): available for .NET/C#, also mimics the COM classes, but Windows-only at the moment. Soon it will be possible to use it via COM too.
11+
- [DSS MATLAB](http://github.com/dss-extensions/dss_matlab/): presents multi-platform integration (Windows, Linux, MacOS) with DSS C-API and is also very compatible with the COM classes.
1012

1113
Version 0.10.1, based on OpenDSS revision 2504. While we plan to add a lot more funcionality into DSS Python, the main goal of creating a COM-compatible API has been reached.
1214

@@ -15,11 +17,9 @@ Most of the COM documentation can be used as-is, but instead of returning tuples
1517

1618
The module depends on CFFI, NumPy and, optionally, SciPy.Sparse for reading the sparse system admittance matrix.
1719

18-
If you are not bound to the COM API and its quirks, you might be insterested in OpenDSSDirect.py. [OpenDSSDirect.py](https://github.com/NREL/OpenDSSDirect.py/) exposes a more Pythonic API and contains extra utilities. Thanks to @kdheepak, OpenDSSDirect.py v0.3+ uses DSS Python's backend -- this means you can use both modules at once. For example, if you have old code using the official COM objects, you could quickly switch to DSS Python with very few code changes, and then use [`opendssdirect.utils`](https://nrel.github.io/OpenDSSDirect.py/opendssdirect.html#module-opendssdirect.utils) to generate some DataFrames.
19-
2020
## Recent changes
2121

22-
- **2019-02-17 / version 0.10.1: Under development. Check the new [changelog](docs/changelog.md#0101) document for a list.**
22+
- **2019-02-17 / version 0.10.1: Integrate DSS C-API changes/fix, some small fixes, and more error-checking. Check the new [changelog](docs/changelog.md#0101) document for a list.**
2323
- 2018-11-17 / version 0.10.0: Lots of changes, fixes and new features. Check the new [changelog](docs/changelog.md#0100) document for a list.
2424
- 2018-08-12 / version 0.9.8: Reorganize modules (v7 and v8), adds 8 missing methods and new backend methods for OpenDSSDirect.py v0.3+. Integrates many fixes from DSS_CAPI and the upstream OpenDSS.
2525
- 2018-04-30 / version 0.9.7: Fix some of the setters that used array data.
@@ -128,7 +128,7 @@ for i in range(len(voltages) // 2):
128128
print('node %d: %f + j%f' % (i, voltages[2*i], voltages[2*i + 1]))
129129
```
130130

131-
If you do not need the mixed-cased handling, omit the call to `use_com_compat()` and use the casing used in this project, which should make most of the COM instance conventions.
131+
If you do not need the mixed-cased handling, omit the call to `use_com_compat()` and use the casing used in this project, which should use most of the COM instance conventions.
132132

133133
If you want to play with the experimental OpenDSS-PM interface (from OpenDSS v8), it is installed side-by-side and you can import it as:
134134

@@ -204,8 +204,7 @@ Besides bug fixes, the main funcionality of this library is mostly done. Notable
204204

205205
Questions?
206206
==========
207-
If you have any question, feel free to open a ticket on GitHub, or contact directly me through email (pmeira at ieee.org) or [Twitter](https://twitter.com/PCMMeira).
208-
Please allow me a few days to respond.
207+
If you have any question, feel free to open a ticket on GitHub, or contact directly me through email (pmeira at ieee.org). Please allow me a few days to respond.
209208

210209

211210
Credits / Acknowlegement

conda/meta.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package:
22
name: dss_python
3-
version: "0.10.1dev"
3+
version: "0.10.1"
44

55
source:
6-
git_rev: "0.10.1-dev"
6+
git_rev: "0.10.1"
77
git_url: https://github.com/dss-extensions/dss_python.git
88
#path: ..
99

docs/changelog.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
Released on 2019-02-17.
44

5-
See also the [changes from DSS C-API](https://github.com/dss-extensions/dss_capi/blob/ed2a6b322a5e102ba61c6565e5e0eb23247b9221/docs/changelog.md#version-0101) for detailed changes, including changes from the official OpenDSS code since 0.10.0.
5+
This is a minor DSS Python release that contains lots of changes from DSS C-API. See also the [changes from DSS C-API](https://github.com/dss-extensions/dss_capi/blob/ed2a6b322a5e102ba61c6565e5e0eb23247b9221/docs/changelog.md#version-0101) for details, including changes from the official OpenDSS code since 0.10.0.
6+
7+
DSS Python has recently moved from https://github.com/PMeira/dss_python/ to the new https://dss-extensions.org/ and https://github.com/dss-extensions/dss_python/
68

79
## Major changes:
8-
- More and faster error checking.
910

11+
- More and faster error-checking! Python exception will be raised for more errors and with a lower overhead.
12+
- Fix for `YMatrix.getI` and `YMatrix.getV` (ported from OpenDSSDirect.py)
13+
- Fix for `ActiveCircuit.ActiveCktElement.Variable` and `ActiveCircuit.ActiveCktElement.Variablei`: now returns a tuple of `(value, errorcode)`, compatible with COM.
14+
- New `DSS.Error.EarlyAbort`: controls whether all errors halts the DSS script processing (Compile/Redirect), defaults to True.
1015

1116
# 0.10.0
1217

dss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
from .v7 import *
77
from .patch_dss_com import patch_dss_com
88

9-
__version__ = '0.10.1-dev'
9+
__version__ = '0.10.1'

tests/validate.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ def run(self, dss, solve=False):
119119
dss.ActiveCircuit.Solution.Mode = enums.SolveModes.Daily
120120
dss.ActiveCircuit.Solution.Solve()
121121

122+
self.realibity_ran = True
123+
try:
124+
dss.ActiveCircuit.Meters.DoReliabilityCalc(False)
125+
except DssException as ex:
126+
if ex.args[0] == 52902:
127+
self.realibity_ran = False
128+
129+
130+
122131
self.atol = dss.ActiveCircuit.Solution.Tolerance
123132

124133
self.AllBusDistances.append(dss.ActiveCircuit.AllBusDistances)
@@ -823,14 +832,15 @@ def validate_Meters(self):
823832

824833

825834
# NOTE: CalcCurrent and AllocFactors removed since it seemed to contain (maybe?) uninitialized values in certain situations
826-
for field in 'AvgRepairTime,Peakcurrent,RegisterValues,Totals'.split(','):
835+
fields = 'AvgRepairTime,Peakcurrent,RegisterValues,Totals' if self.realibity_ran else 'Peakcurrent,RegisterValues'
836+
for field in fields.split(','):
827837
fA = output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] if LOAD_COM_OUTPUT else getattr(A, field)
828838
fB = getattr(B, field)
829839
if SAVE_COM_OUTPUT: output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] = fA
830840
if not SAVE_COM_OUTPUT: assert np.allclose(fA, fB, atol=self.atol, rtol=self.rtol), ('Meters("{}").{}'.format(A.Name, field), fA, fB)
831841

832-
833-
for field in 'CountBranches,CountEndElements,CustInterrupts,DIFilesAreOpen,FaultRateXRepairHrs,MeteredElement,MeteredTerminal,Name,NumSectionBranches,NumSectionCustomers,NumSections,OCPDeviceType,SAIDI,SAIFI,SAIFIKW,SectSeqIdx,SectTotalCust,SeqListSize,SequenceIndex,SumBranchFltRates,TotalCustomers'.split(','):
842+
fields = 'CountBranches,CountEndElements,CustInterrupts,DIFilesAreOpen,FaultRateXRepairHrs,MeteredElement,MeteredTerminal,Name,NumSectionBranches,NumSectionCustomers,NumSections,OCPDeviceType,SAIDI,SAIFI,SAIFIKW,SectSeqIdx,SectTotalCust,SeqListSize,SequenceIndex,SumBranchFltRates,TotalCustomers' if self.realibity_ran else 'MeteredElement,MeteredTerminal,Name'
843+
for field in fields.split(','):
834844
fA = output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] if LOAD_COM_OUTPUT else getattr(A, field)
835845
fB = getattr(B, field)
836846
if SAVE_COM_OUTPUT: output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] = fA

0 commit comments

Comments
 (0)