forked from PauloRadatz/py_dss_interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
line_example.py
67 lines (45 loc) · 1.85 KB
/
line_example.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
# @Time : 11/15/2021 10:00 AM
# @Author : Paulo Radatz
# @Email : pradatz@epri.com
# @File : line_example.py
# @Software: PyCharm
import py_dss_interface
import pathlib
dss = py_dss_interface.DSSDLL("C:\OpenDSS_rep\Version8\Source")
dss_file = r"C:\Users\ppra005\Box\Documents_PC\Projects\2021\OpenDSSTestFramework\Elements\Line\impedances.dss"
dss.text(f"compile [{dss_file}]")
dss.lines_write_name("line")
print("--------------------TEXT--------------------\n\n")
print(f"Original R1 {dss.text('? line.line.r1')}")
print(f"Original R0 {dss.text('? line.line.r0')}")
print(f"Original X1 {dss.text('? line.line.x1')}")
print(f"Original X1 {dss.text('? line.line.x0')}")
dss.solution.solve
y_original_text = dss.circuit_system_y()
dss.text("edit line.line r1=2 r0=4 x1=6 x0=8")
print(f"New R1 {dss.text('? line.line.r1')}")
print(f"New R0 {dss.text('? line.line.r0')}")
print(f"New X1 {dss.text('? line.line.x1')}")
print(f"New X1 {dss.text('? line.line.x0')}")
dss.solution.solve
y_new_text = dss.circuit_system_y()
print("\n\n--------------------DLL--------------------\n\n")
dss.text(f"compile [{dss_file}]")
dss.lines_write_name("line")
print(f"Original R1 {dss.lines_read_r1()}")
print(f"Original R0 {dss.lines_read_r0()}")
print(f"Original X1 {dss.lines_read_x1()}")
print(f"Original X1 {dss.lines_read_x0()}")
dss.solution.solve
y_original_dll = dss.circuit_system_y()
dss.text("edit line.line r1=2 r0=4 x1=6 x0=8")
print(f"New R1 {dss.lines_read_r1()}")
print(f"New R0 {dss.lines_read_r0()}")
print(f"New X1 {dss.lines_read_x1()}")
print(f"New X1 {dss.lines_read_x0()}")
dss.solution.solve
y_new_dll = dss.circuit_system_y()
print("\n\n--------------------Comparison--------------------\n\n")
print(f"y_original_text == y_original_dll {y_original_text == y_original_dll}")
print(f"y_new_text == y_new_dll {y_new_text == y_new_dll}")