forked from PauloRadatz/py_dss_interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_tests.py
41 lines (31 loc) · 1.08 KB
/
script_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
# @Time : 11/23/2022 1:13 PM
# @Author : Paulo Radatz
# @Email : pradatz@epri.com
# @File : script_tests.py
# @Software: PyCharm
import py_dss_interface
import pathlib
import numpy as np
import os
dss = py_dss_interface.DSSDLL()
dss = py_dss_interface.DSS()
dss.text("set DefaultBaseFrequency=60")
script_path = os.path.dirname(os.path.abspath(__file__))
dss13_path = os.path.join(pathlib.Path(script_path), "tests", "py_dss_interface", "cases", "13Bus", "IEEE13Nodeckt.dss")
dss.text(f"compile {dss13_path}")
dss.text(f"batchedit load..* daily=default")
dss.text("set mode=daily")
dss.text("New monitor.m1 element=Transformer.XFM1 terminal=1 mode=0")
dss.text("Set maxcontrol=100")
dss.text("Set maxiterations=100")
dss.text("Set controlmode=off")
dss.text("Set mode=daily stepsize=1.0h number=24")
dss.cktelement.bus_names = ["A", "B"]
dss.circuit.set_active_element("Transformer.XFM1")
print(dss.cktelement.name)
a = dss.cktelement.voltages_mag_ang
b = dss.cktelement.currents_mag_ang
dss.solution.solve()
dss.monitors.first()
actual = dss.monitors.channel(1)