forked from FlorianShepherd/pandapower-youtube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0_simbench_ts.py
More file actions
34 lines (27 loc) · 1.17 KB
/
Copy path0_simbench_ts.py
File metadata and controls
34 lines (27 loc) · 1.17 KB
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
# Youtube Tutorial Machine Learning 1: https://www.youtube.com/watch?v=kHbAMoCv-d4
import simbench as sb
grid_code = "1-HV-urban--0-sw"
net = sb.get_simbench_net(grid_code)
profiles = sb.get_absolute_values(net, profiles_instead_of_study_cases=True)
print(profiles.keys())
print(net)
sgen_p = profiles[("sgen", "p_mw")]
load_p = profiles[("load", "p_mw")]
load_q = profiles[("load", "q_mvar")]
print(sgen_p)
import matplotlib.pyplot as plt
load_p.sum(axis=1).plot(label="load")
sgen_p.sum(axis=1).plot(label="sgen")
plt.legend()
plt.show()
import pandapower.timeseries as ts
from pandapower.control.controller.const_control import ConstControl
from pandapower.timeseries.data_sources.frame_data import DFData
ds = DFData(sgen_p)
ConstControl(net, "sgen", "p_mw", element_index=net.sgen.index, profile_name=sgen_p.columns, data_source=ds)
ds = DFData(load_p)
ConstControl(net, "load", "p_mw", element_index=net.load.index, profile_name=load_p.columns, data_source=ds)
ds = DFData(load_q)
ConstControl(net, "load", "q_mvar", element_index=net.load.index, profile_name=load_q.columns, data_source=ds)
ts.OutputWriter(net, output_path="./", output_file_type=".json")
ts.run_timeseries(net)