File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import print_function
2
2
import os , sys
3
3
import numpy as np
4
+ from scipy .sparse import csc_matrix
4
5
5
6
cd = os .getcwd ()
6
7
no_properties = os .getenv ('DSS_PYTHON_VALIDATE' ) == 'NOPROP'
@@ -752,6 +753,16 @@ def validate_Circuit(self):
752
753
elif type (v [1 ]) == float :
753
754
assert abs (v [0 ] - v [1 ]) < atol , (k , type (v [1 ]))
754
755
756
+ def validate_YMatrix (self ):
757
+ NN = self .capi .ActiveCircuit .NumNodes
758
+ if NN > 2000 : # test only on small strings
759
+ return
760
+
761
+ ysparse = csc_matrix (self .capi .YMatrix .GetCompressedYMatrix (factor = False ))
762
+ ydense = self .capi .ActiveCircuit .SystemY .view (dtype = complex ).reshape ((NN , NN ))
763
+ assert (np .allclose (ydense , ysparse .todense (), atol = self .atol , rtol = self .rtol ))
764
+
765
+
755
766
def validate_all (self ):
756
767
self .rtol = 1e-5
757
768
@@ -785,6 +796,8 @@ def validate_all(self):
785
796
self .validate_Meters ()
786
797
# print('Reclosers')
787
798
self .validate_Reclosers ()
799
+ # print('YMatrix')
800
+ self .validate_YMatrix ()
788
801
789
802
#self.atol = 1e-5
790
803
# print('Buses')
You can’t perform that action at this time.
0 commit comments