Skip to content

Commit 6e42d58

Browse files
committed
DSS C-API 0.10.7rc4 and minor changes.
1 parent 232bd3e commit 6e42d58

File tree

8 files changed

+72
-20
lines changed

8 files changed

+72
-20
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ matrix:
77
sudo: required
88
env:
99
- DOCKER_IMAGE=pmeira/manylinux_wheel_cmake_fpc320
10-
- DSS_CAPI_TAG=0.10.7rc1
10+
- DSS_CAPI_TAG=0.10.7rc4
1111
- LINUX_X64=1
1212
- CONDA_SUBDIR=linux-64
1313
services:
@@ -32,7 +32,7 @@ matrix:
3232
sudo: required
3333
env:
3434
- DOCKER_IMAGE=pmeira/manylinux_wheel_cmake_fpc320_i686
35-
- DSS_CAPI_TAG=0.10.7rc1
35+
- DSS_CAPI_TAG=0.10.7rc4
3636
- CONDA_SUBDIR=linux-32
3737
services:
3838
- docker
@@ -52,7 +52,7 @@ matrix:
5252
- name: "osx_x64"
5353
os: osx
5454
env:
55-
- DSS_CAPI_TAG=0.10.7rc1
55+
- DSS_CAPI_TAG=0.10.7rc4
5656
script:
5757
- export TRAVIS_TAG_DSS_PYTHON=$TRAVIS_TAG
5858
- export TRAVIS_TAG=

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ skip_non_tags: false
33
image: Visual Studio 2019
44
clone_folder: c:\projects\dss_python
55
environment:
6-
DSS_CAPI_TAG: 0.10.7rc1
6+
DSS_CAPI_TAG: 0.10.7rc4
77
DSS_CAPI_PATH: c:\projects\dss_capi
88
ANACONDA_API_TOKEN:
99
secure: Pcm5IXFi4ZUsi1ue5QvPNASDo1Ns1REYbAwDJXRd3FRn2CfKbNPgnPda6fxoN6wG

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.7rc2'
9+
__version__ = '0.10.7rc4'

dss/dss_capi_gr/IBus.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,24 @@ def LineList(self):
237237
@property
238238
def AllPCEatBus(self):
239239
'''Returns an array with the names of all PCE connected to the active bus'''
240-
return self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPCEatBus))
240+
result = self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPCEatBus))
241+
if result:
242+
result.append('') #TODO: remove this -- added for full compatibility with COM
243+
else:
244+
result = ['None']
245+
246+
return result
241247

242248
@property
243249
def AllPDEatBus(self):
244250
'''Returns an array with the names of all PDE connected to the active bus'''
245-
return self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPDEatBus))
251+
result = self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPDEatBus))
252+
if result:
253+
result.append('') #TODO: remove this -- added for full compatibility with COM
254+
else:
255+
result = ['None']
256+
257+
return result
246258

247259
def __getitem__(self, index):
248260
if isinstance(index, int):

dss/dss_capi_gr/IMeters.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,12 @@ def Totals(self):
250250
'''(read-only) Totals of all registers of all meters'''
251251
self.CheckForError(self._lib.Meters_Get_Totals_GR())
252252
return self._get_float64_gr_array()
253+
254+
@property
255+
def ZonePCE(self):
256+
'''Returns the list of all PCE within the area covered by the energy meter'''
257+
result = self.CheckForError(self._get_string_array(self._lib.Meters_Get_ZonePCE))
258+
if not result:
259+
result = ['NONE'] #TODO: remove
260+
261+
return result

dss/dss_capi_ir/IBus.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,24 @@ def LineList(self):
222222
@property
223223
def AllPCEatBus(self):
224224
'''Returns an array with the names of all PCE connected to the active bus'''
225-
return self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPCEatBus))
225+
result = self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPCEatBus))
226+
if result:
227+
result.append('') #TODO: remove this -- added for full compatibility with COM
228+
else:
229+
result = ['None']
230+
231+
return result
226232

227233
@property
228234
def AllPDEatBus(self):
229235
'''Returns an array with the names of all PDE connected to the active bus'''
230-
return self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPDEatBus))
236+
result = self.CheckForError(self._get_string_array(self._lib.Bus_Get_AllPDEatBus))
237+
if result:
238+
result.append('') #TODO: remove this -- added for full compatibility with COM
239+
else:
240+
result = ['None']
241+
242+
return result
231243

232244
def __getitem__(self, index):
233245
if isinstance(index, int):

dss/dss_capi_ir/IMeters.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,13 @@ def TotalCustomers(self):
245245
def Totals(self):
246246
'''(read-only) Totals of all registers of all meters'''
247247
return self._get_float64_array(self._lib.Meters_Get_Totals)
248+
249+
@property
250+
def ZonePCE(self):
251+
'''Returns the list of all PCE within the area covered by the energy meter'''
252+
result = self.CheckForError(self._get_string_array(self._lib.Meters_Get_ZonePCE))
253+
if not result:
254+
result = ['NONE'] #TODO: remove
255+
256+
return result
257+

tests/validate.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
WIN32 = (sys.platform == 'win32')
1414

1515
COM_VLL_BROKEN = False
16+
NO_V9 = False
1617

1718
# COM Output
1819
SAVE_COM_OUTPUT = 'save' in sys.argv
@@ -108,7 +109,7 @@ def run(self, dss, solve=False):
108109
continue
109110
else:
110111
input_line = input_line.replace('C:\\Users\\prdu001\\OpenDSS\\Test\\', '')
111-
input_line = input_line.replace('C:\\Users\\prdu001\\OpenDSS\\Distrib\\Examples\\Scripts\\', '../Distrib/Examples/Scripts/')
112+
input_line = input_line.replace('C:\\Users\\prdu001\\OpenDSS\\Distrib\\Examples\\Scripts\\', '../Version8/Distrib/Examples/Scripts/')
112113
#print(input_line)
113114
dss.Text.Command = input_line
114115
except StopIteration:
@@ -170,10 +171,11 @@ def validate_CktElement(self):
170171
for propA in fA:
171172
assert propA in fB, propA
172173

173-
for field in ['TotalPowers']:
174-
fA = getattr(A, field)
175-
fB = getattr(B, field)
176-
if not SAVE_COM_OUTPUT: assert np.allclose(fA, fB, atol=self.atol, rtol=self.rtol), (field, fA, fB, A.Name, B.Name)
174+
if not NO_V9:
175+
for field in ['TotalPowers']:
176+
fA = getattr(A, field)
177+
fB = getattr(B, field)
178+
if not SAVE_COM_OUTPUT: assert np.allclose(fA, fB, atol=self.atol, rtol=self.rtol), (field, fA, fB, A.Name, B.Name)
177179

178180
# Since the list of properties vary in releases,
179181
# we don't check it the list is the same anymore.
@@ -282,8 +284,8 @@ def validate_Buses(self):
282284
self.com.ActiveCircuit.SetActiveBus(name)
283285
if not SAVE_COM_OUTPUT: assert A.Name == B.Name
284286

285-
if self.capi.ActiveCircuit.NumNodes < 1000:
286-
for field in ('LoadList', 'LineList', 'AllPCEatBus', 'AllPDEatBus'):
287+
if self.capi.ActiveCircuit.NumNodes < 1000 and not NO_V9:
288+
for field in ['LoadList', 'LineList']:#, 'AllPCEatBus', 'AllPDEatBus']:
287289
fB = getattr(B, field)
288290
fA = output['ActiveCircuit.ActiveBus[{}].{}'.format(name, field)] if LOAD_COM_OUTPUT else getattr(A, field)
289291
if SAVE_COM_OUTPUT: output['ActiveCircuit.ActiveBus[{}].{}'.format(name, field)] = fA
@@ -878,12 +880,18 @@ def validate_Meters(self):
878880
count = 0
879881
while nA != 0:
880882
count += 1
881-
for field in 'AllBranchesInZone,AllEndElements,RegisterNames'.split(','):
883+
for field in 'AllBranchesInZone,AllEndElements,RegisterNames,ZonePCE'.split(','):
884+
if field == 'ZonePCE' and NO_V9:
885+
continue
886+
882887
fA = output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] if LOAD_COM_OUTPUT else getattr(A, field)
883888
fB = getattr(B, field)
884889
if SAVE_COM_OUTPUT: output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] = fA
885890
if fA == ('',) and fB == [None]: continue # Comtypes and win32com results are a bit different here
886-
if not SAVE_COM_OUTPUT: assert all(x[0] == x[1] for x in zip(fA, fB)), field
891+
fA = [x for x in fA if x]
892+
fB = [x for x in fB if x]
893+
assert len(fA) == len(fB), (fA, fB)
894+
if not SAVE_COM_OUTPUT: assert all(x[0] == x[1] for x in zip(fA, fB)), (field, fA, fB)
887895

888896

889897
# NOTE: CalcCurrent and AllocFactors removed since it seemed to contain (maybe?) uninitialized values in certain situations
@@ -1210,8 +1218,9 @@ def run_tests(fns):
12101218
import dss
12111219
com = dss.patch_dss_com(com)
12121220
print('COM Version:', com.Version)
1213-
global COM_VLL_BROKEN
1214-
COM_VLL_BROKEN = ('Version 8.6.7.1 ' in com.Version) or ('Version 9.0.0.8 ' in com.Version) or ('Version 9.1.3.4 ' in com.Version)
1221+
global COM_VLL_BROKEN, NO_V9
1222+
NO_V9 = ('Version 7' in com.Version) or ('Version 8' in com.Version)
1223+
COM_VLL_BROKEN = ('Version 7' in com.Version) or ('Version 8.6.7.1 ' in com.Version) or ('Version 9.0.0.8 ' in com.Version) or ('Version 9.1.3.4 ' in com.Version)
12151224
else:
12161225
com = None
12171226

0 commit comments

Comments
 (0)