4
4
import warnings
5
5
6
6
from ._utils import get_string , dss_py
7
+ from . import _utils
7
8
8
9
is_pandas_installed = True
9
10
@@ -23,12 +24,12 @@ def __init__(self, module, function):
23
24
24
25
def __iter__ (self ):
25
26
import opendssdirect as dss
26
-
27
+
27
28
try :
28
29
idx = self .module .First ()
29
30
except :
30
31
return # no circuit?
31
-
32
+
32
33
if dss .Error .ExtendedErrors () and idx == 0 :
33
34
return # nothing to iterate
34
35
@@ -47,7 +48,7 @@ def run_command(text, dss=None):
47
48
48
49
r = []
49
50
for l in text .splitlines ():
50
- dss .dss_lib .Text_Set_Command (l .encode ("ascii" ))
51
+ dss .dss_lib .Text_Set_Command (l .encode (_utils . codec ))
51
52
r .append (get_string (dss .dss_lib .Text_Get_Result ()))
52
53
53
54
return "\n " .join (r ).strip ()
@@ -245,9 +246,9 @@ def monitor_to_dataframe(dss=None):
245
246
if dss .Solution .Mode () in (dss_py .enums .SolveModes .Harmonic , 17 ):
246
247
# Note: Mode 17 is HarmonicT but it was not exposed in the enum
247
248
# ported from COM as of 2021-01-03
248
- columns = ['frequency' , 'harmonic' ]
249
+ columns = ['frequency' , 'harmonic' ]
249
250
else :
250
- columns = ['hour' , 'second' ]
251
+ columns = ['hour' , 'second' ]
251
252
252
253
columns .extend (col .strip () for col in dss .Monitors .Header ())
253
254
data = dss .Monitors .AsMatrix ()
0 commit comments