|
13 | 13 | WIN32 = (sys.platform == 'win32') |
14 | 14 |
|
15 | 15 | COM_VLL_BROKEN = False |
| 16 | +NO_V9 = False |
16 | 17 |
|
17 | 18 | # COM Output |
18 | 19 | SAVE_COM_OUTPUT = 'save' in sys.argv |
@@ -108,7 +109,7 @@ def run(self, dss, solve=False): |
108 | 109 | continue |
109 | 110 | else: |
110 | 111 | 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/') |
112 | 113 | #print(input_line) |
113 | 114 | dss.Text.Command = input_line |
114 | 115 | except StopIteration: |
@@ -170,10 +171,11 @@ def validate_CktElement(self): |
170 | 171 | for propA in fA: |
171 | 172 | assert propA in fB, propA |
172 | 173 |
|
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) |
177 | 179 |
|
178 | 180 | # Since the list of properties vary in releases, |
179 | 181 | # we don't check it the list is the same anymore. |
@@ -282,8 +284,8 @@ def validate_Buses(self): |
282 | 284 | self.com.ActiveCircuit.SetActiveBus(name) |
283 | 285 | if not SAVE_COM_OUTPUT: assert A.Name == B.Name |
284 | 286 |
|
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']: |
287 | 289 | fB = getattr(B, field) |
288 | 290 | fA = output['ActiveCircuit.ActiveBus[{}].{}'.format(name, field)] if LOAD_COM_OUTPUT else getattr(A, field) |
289 | 291 | if SAVE_COM_OUTPUT: output['ActiveCircuit.ActiveBus[{}].{}'.format(name, field)] = fA |
@@ -878,12 +880,18 @@ def validate_Meters(self): |
878 | 880 | count = 0 |
879 | 881 | while nA != 0: |
880 | 882 | 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 | + |
882 | 887 | fA = output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] if LOAD_COM_OUTPUT else getattr(A, field) |
883 | 888 | fB = getattr(B, field) |
884 | 889 | if SAVE_COM_OUTPUT: output['ActiveCircuit.Meters[{}].{}'.format(nA, field)] = fA |
885 | 890 | 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) |
887 | 895 |
|
888 | 896 |
|
889 | 897 | # NOTE: CalcCurrent and AllocFactors removed since it seemed to contain (maybe?) uninitialized values in certain situations |
@@ -1210,8 +1218,9 @@ def run_tests(fns): |
1210 | 1218 | import dss |
1211 | 1219 | com = dss.patch_dss_com(com) |
1212 | 1220 | 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) |
1215 | 1224 | else: |
1216 | 1225 | com = None |
1217 | 1226 |
|
|
0 commit comments