dss-python 0.15.7__tar.gz → 0.15.8a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dss_python-0.15.7 → dss_python-0.15.8a1}/PKG-INFO +2 -2
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IBus.py +7 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICircuit.py +7 -7
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSS.py +7 -3
- dss_python-0.15.8a1/dss/Oddie.py +84 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/__init__.py +2 -2
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/_cffi_api_util.py +10 -1
- dss_python-0.15.8a1/dss/_version.py +1 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/pyproject.toml +1 -1
- dss_python-0.15.7/dss/_version.py +0 -1
- dss_python-0.15.7/dss/messages/properties-en-US.mo +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/.gitignore +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/LICENSE +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/README.md +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IActiveClass.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICNData.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICapControls.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICapacitors.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICktElement.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ICtrlQueue.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSSElement.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSSEvents.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSSProgress.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSSProperty.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSS_Executive.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IDSSimComs.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IError.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IFuses.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IGICSources.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IGenerators.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IISources.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILineCodes.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILineGeometries.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILineSpacings.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILines.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILoadShapes.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ILoads.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IMeters.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IMonitors.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IPDElements.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IPVSystems.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IParallel.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IParser.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IReactors.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IReclosers.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IReduceCkt.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IRegControls.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IRelays.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ISensors.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ISettings.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ISolution.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IStorages.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ISwtControls.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ITSData.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IText.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ITopology.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/ITransformers.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IVsources.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IWireData.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IXYCurves.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IYMatrix.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/IZIP.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/UserModels/__init__.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/UserModels/bases.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/UserModels/wrappers.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/_types.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/enums.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/examples.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/patch_dss_com.py +0 -0
- {dss_python-0.15.7 → dss_python-0.15.8a1}/dss/plot.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dss-python
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.8a1
|
|
4
4
|
Summary: Python interface (bindings and tools) for OpenDSS. Based on the AltDSS/DSS C-API project, the alternative OpenDSS implementation from DSS-Extensions.org. Multiplatform, API-compatible/drop-in replacement for the COM version of OpenDSS.
|
|
5
5
|
Project-URL: Homepage, https://github.com/dss-extensions/DSS-Python
|
|
6
6
|
Project-URL: Documentation, https://dss-extensions.org/DSS-Python
|
|
@@ -55,7 +55,7 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
|
55
55
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
56
56
|
Classifier: Topic :: Scientific/Engineering
|
|
57
57
|
Requires-Python: >=3.7
|
|
58
|
-
Requires-Dist: dss-python-backend==0.14.
|
|
58
|
+
Requires-Dist: dss-python-backend==0.14.6a1
|
|
59
59
|
Requires-Dist: numpy>=1.21.0
|
|
60
60
|
Requires-Dist: typing-extensions<5,>=4.5
|
|
61
61
|
Provides-Extra: all
|
|
@@ -463,6 +463,13 @@ class IBus(Base):
|
|
|
463
463
|
return self.__getitem__(index)
|
|
464
464
|
|
|
465
465
|
def __iter__(self) -> Iterator[IBus]:
|
|
466
|
+
if self._api_util._is_odd:
|
|
467
|
+
for i in range(self._lib.Circuit_Get_NumBuses()):
|
|
468
|
+
self._check_for_error(self._lib.Circuit_SetActiveBusi(i))
|
|
469
|
+
yield self
|
|
470
|
+
|
|
471
|
+
return
|
|
472
|
+
|
|
466
473
|
n = self._check_for_error(self._lib.Circuit_SetActiveBusi(0))
|
|
467
474
|
while n == 0:
|
|
468
475
|
yield self
|
|
@@ -206,14 +206,14 @@ class ICircuit(Base):
|
|
|
206
206
|
self.PVSystems = IPVSystems(api_util)
|
|
207
207
|
self.Vsources = IVsources(api_util)
|
|
208
208
|
self.LineCodes = ILineCodes(api_util)
|
|
209
|
-
self.LineGeometries = ILineGeometries(api_util)
|
|
210
|
-
self.LineSpacings = ILineSpacings(api_util)
|
|
211
|
-
self.WireData = IWireData(api_util)
|
|
212
|
-
self.CNData = ICNData(api_util)
|
|
213
|
-
self.TSData = ITSData(api_util)
|
|
214
|
-
self.Reactors = IReactors(api_util)
|
|
209
|
+
self.LineGeometries = ILineGeometries(api_util) if not api_util._is_odd else None
|
|
210
|
+
self.LineSpacings = ILineSpacings(api_util) if not api_util._is_odd else None
|
|
211
|
+
self.WireData = IWireData(api_util) if not api_util._is_odd else None
|
|
212
|
+
self.CNData = ICNData(api_util) if not api_util._is_odd else None
|
|
213
|
+
self.TSData = ITSData(api_util) if not api_util._is_odd else None
|
|
214
|
+
self.Reactors = IReactors(api_util) if not api_util._is_odd else None
|
|
215
215
|
self.ReduceCkt = IReduceCkt(api_util) #: Circuit Reduction Interface
|
|
216
|
-
self.Storages = IStorages(api_util)
|
|
216
|
+
self.Storages = IStorages(api_util) if not api_util._is_odd else None
|
|
217
217
|
self.GICSources = IGICSources(api_util)
|
|
218
218
|
|
|
219
219
|
if hasattr(api_util.lib, 'Parallel_CreateActor'):
|
|
@@ -134,14 +134,14 @@ class IDSS(Base):
|
|
|
134
134
|
self.Executive = IDSS_Executive(api_util)
|
|
135
135
|
|
|
136
136
|
#: Kept for compatibility.
|
|
137
|
-
self.Events = IDSSEvents(api_util)
|
|
137
|
+
self.Events = IDSSEvents(api_util) if not api_util._is_odd else None
|
|
138
138
|
|
|
139
139
|
#: Kept for compatibility.
|
|
140
140
|
self.Parser = IParser(api_util)
|
|
141
141
|
|
|
142
142
|
#: Kept for compatibility. Apparently was used for DSSim-PC (now OpenDSS-G), a
|
|
143
143
|
#: closed-source software developed by EPRI using LabView.
|
|
144
|
-
self.DSSim_Coms = IDSSimComs(api_util)
|
|
144
|
+
self.DSSim_Coms = IDSSimComs(api_util) if not api_util._is_odd else None
|
|
145
145
|
|
|
146
146
|
#: The YMatrix interface provides advanced access to the internals of
|
|
147
147
|
#: the DSS engine. The sparse admittance matrix of the system is also
|
|
@@ -157,7 +157,7 @@ class IDSS(Base):
|
|
|
157
157
|
#: and run scripts inside the ZIP, without creating extra files on disk.
|
|
158
158
|
#:
|
|
159
159
|
#: **(API Extension)**
|
|
160
|
-
self.ZIP = IZIP(api_util)
|
|
160
|
+
self.ZIP = IZIP(api_util) if not api_util._is_odd else None
|
|
161
161
|
|
|
162
162
|
Base.__init__(self, api_util)
|
|
163
163
|
|
|
@@ -444,6 +444,10 @@ class IDSS(Base):
|
|
|
444
444
|
|
|
445
445
|
**(API Extension)**
|
|
446
446
|
'''
|
|
447
|
+
|
|
448
|
+
if self._api_util._is_odd:
|
|
449
|
+
raise NotImplementedError("NewContext is not supported for the official OpenDSS engine.")
|
|
450
|
+
|
|
447
451
|
ffi = self._api_util.ffi
|
|
448
452
|
lib = self._api_util.lib_unpatched
|
|
449
453
|
new_ctx = ffi.gc(lib.ctx_New(), lib.ctx_Dispose)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import Optional
|
|
3
|
+
from ._cffi_api_util import CffiApiUtil
|
|
4
|
+
from .IDSS import IDSS
|
|
5
|
+
from enum import Flag
|
|
6
|
+
|
|
7
|
+
class OddieOptions(Flag):
|
|
8
|
+
MapErrors = 0x01
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IOddieDSS(IDSS):
|
|
12
|
+
r'''
|
|
13
|
+
The OddieDSS class exposes the official OpenDSSDirect.DLL binary,
|
|
14
|
+
as distributed by EPRI, with the same API as the DSS-Python and
|
|
15
|
+
the official COM interface object on Windows. It uses AltDSS Oddie
|
|
16
|
+
to achieve this.
|
|
17
|
+
|
|
18
|
+
**Note:** This class requires the backend for Oddie to be included in
|
|
19
|
+
the `dss_python_backend` package. If it is not available, an import
|
|
20
|
+
error should occur when trying to use this.
|
|
21
|
+
|
|
22
|
+
AltDSS Oddie wraps OpenDSSDirect.DLL, providing a minimal compatiliby layer
|
|
23
|
+
to expose it with the same API as AltDSS/DSS C-API. With it, we can
|
|
24
|
+
just reuse most of the tools from the other projects on DSS-Extensions
|
|
25
|
+
without too much extra work.
|
|
26
|
+
|
|
27
|
+
Note that many functions from DSS-Extensions will not be available and/or
|
|
28
|
+
will return errors, and this is expected. There are some issues and/or
|
|
29
|
+
limitations from OpenDSSDirect.DLL that may or may not affect specific
|
|
30
|
+
use cases; check the documentation on https://dss-extensions.org for
|
|
31
|
+
more information.
|
|
32
|
+
|
|
33
|
+
:param library_path: The name or full path of the target dynamic library to
|
|
34
|
+
load. Defaults to trying to load "OpenDSSDirect" from `c:\Program Files\OpenDSS\x64`,
|
|
35
|
+
followed by trying to load it from the current path.
|
|
36
|
+
|
|
37
|
+
:param load_flags: Optional, flags to feed the [`LoadLibrary`](https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa)
|
|
38
|
+
(on Windows) or `dlopen` (on Linux and macOS, whenever EPRI supports it). If not provided, a default set will be used.
|
|
39
|
+
|
|
40
|
+
:param oddie_options: Optional, Oddie configuration flags. If none passed,
|
|
41
|
+
the default settings (recommended) will be used. For advanced users.
|
|
42
|
+
'''
|
|
43
|
+
|
|
44
|
+
def __init__(self, library_path: str = '', load_flags: Optional[int] = None, oddie_options: Optional[OddieOptions] = None):
|
|
45
|
+
from dss_python_backend import _altdss_oddie_capi
|
|
46
|
+
lib = _altdss_oddie_capi.lib
|
|
47
|
+
ffi = _altdss_oddie_capi.ffi
|
|
48
|
+
NULL = ffi.NULL
|
|
49
|
+
|
|
50
|
+
c_load_flags = NULL
|
|
51
|
+
if load_flags is not None:
|
|
52
|
+
c_load_flags = ffi.new('uint32_t*', load_flags)
|
|
53
|
+
|
|
54
|
+
if library_path:
|
|
55
|
+
library_path = library_path.encode()
|
|
56
|
+
lib.Oddie_SetLibOptions(library_path, c_load_flags)
|
|
57
|
+
ctx = lib.ctx_New()
|
|
58
|
+
else:
|
|
59
|
+
# Try the default install folder
|
|
60
|
+
library_path = rb'C:\Program Files\OpenDSS\x64\OpenDSSDirect.dll'
|
|
61
|
+
lib.Oddie_SetLibOptions(library_path, c_load_flags)
|
|
62
|
+
ctx = lib.ctx_New()
|
|
63
|
+
if ctx == NULL:
|
|
64
|
+
# Try from the general path, let the system resolve it
|
|
65
|
+
library_path = rb'OpenDSSDirect.dll'
|
|
66
|
+
lib.Oddie_SetLibOptions(library_path, c_load_flags)
|
|
67
|
+
ctx = lib.ctx_New()
|
|
68
|
+
|
|
69
|
+
if ctx == NULL:
|
|
70
|
+
raise RuntimeError("Could not load the target library.")
|
|
71
|
+
|
|
72
|
+
if lib.ctx_DSS_Start(ctx, 0) != 1:
|
|
73
|
+
raise RuntimeError("DSS_Start call was not successful.")
|
|
74
|
+
|
|
75
|
+
if oddie_options is not None:
|
|
76
|
+
lib.Oddie_SetOptions(oddie_options)
|
|
77
|
+
|
|
78
|
+
ctx = ffi.gc(ctx, lib.ctx_Dispose)
|
|
79
|
+
api_util = CffiApiUtil(ffi, lib, ctx, is_odd=True)
|
|
80
|
+
api_util._library_path = library_path
|
|
81
|
+
IDSS.__init__(self, api_util)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
__all__ = ['IOddieDSS', 'OddieOptions']
|
|
@@ -17,8 +17,8 @@ if os.path.exists(_properties_mo):
|
|
|
17
17
|
lib.DSS_SetPropertiesMO(_properties_mo.encode())
|
|
18
18
|
|
|
19
19
|
from ._cffi_api_util import CffiApiUtil, DSSException, set_case_insensitive_attributes
|
|
20
|
-
# from .altdss import Edit
|
|
21
20
|
from .IDSS import IDSS
|
|
21
|
+
from .Oddie import IOddieDSS, OddieOptions
|
|
22
22
|
from .enums import *
|
|
23
23
|
|
|
24
24
|
DssException = DSSException
|
|
@@ -44,4 +44,4 @@ try:
|
|
|
44
44
|
except:
|
|
45
45
|
__version__ = '0.0dev'
|
|
46
46
|
|
|
47
|
-
__all__ = ['dss', 'DSS', 'DSS_GR', 'prime_api_util', 'api_util', 'DSSException', 'patch_dss_com', 'set_case_insensitive_attributes', 'enums', '
|
|
47
|
+
__all__ = ['dss', 'DSS', 'DSS_GR', 'prime_api_util', 'api_util', 'DSSException', 'patch_dss_com', 'set_case_insensitive_attributes', 'enums', 'IOddieDSS', 'OddieOptions']
|
|
@@ -334,7 +334,8 @@ class CffiApiUtil(object):
|
|
|
334
334
|
'''
|
|
335
335
|
_ctx_to_util = WeakKeyDictionary()
|
|
336
336
|
|
|
337
|
-
def __init__(self, ffi, lib, ctx=None):
|
|
337
|
+
def __init__(self, ffi, lib, ctx=None, is_odd=False):
|
|
338
|
+
self._is_odd = is_odd
|
|
338
339
|
self.owns_ctx = True
|
|
339
340
|
self.codec = codec
|
|
340
341
|
self.ctx = ctx
|
|
@@ -466,18 +467,26 @@ class CffiApiUtil(object):
|
|
|
466
467
|
|
|
467
468
|
|
|
468
469
|
def register_callbacks(self):
|
|
470
|
+
if self._is_odd:
|
|
471
|
+
return
|
|
472
|
+
|
|
469
473
|
mgr = get_manager_for_ctx(self.ctx)
|
|
470
474
|
# if multiple calls, the extras are ignored
|
|
471
475
|
mgr.register_func(AltDSSEvent.Clear, altdss_python_util_callback)
|
|
472
476
|
mgr.register_func(AltDSSEvent.ReprocessBuses, altdss_python_util_callback)
|
|
473
477
|
|
|
474
478
|
def unregister_callbacks(self):
|
|
479
|
+
if self._is_odd:
|
|
480
|
+
return
|
|
475
481
|
mgr = get_manager_for_ctx(self.ctx)
|
|
476
482
|
mgr.unregister_func(AltDSSEvent.Clear, altdss_python_util_callback)
|
|
477
483
|
mgr.unregister_func(AltDSSEvent.ReprocessBuses, altdss_python_util_callback)
|
|
478
484
|
|
|
479
485
|
# The context will die, no need to do anything else currently.
|
|
480
486
|
def __del__(self):
|
|
487
|
+
if self._is_odd:
|
|
488
|
+
return
|
|
489
|
+
|
|
481
490
|
self.clear_callback(0)
|
|
482
491
|
self.clear_callback(1)
|
|
483
492
|
self.unregister_callbacks()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.15.8a1"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.15.7"
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|