Skip to content
Snippets Groups Projects
Commit 9447d6bb authored by Markus Mirz's avatar Markus Mirz
Browse files

update and added example

parent 8ff81d90
No related branches found
No related tags found
No related merge requests found
......@@ -34,8 +34,8 @@ def plot_dpsim_abs_diff(filename1, label1, node1, filename2, label2, node2):
figure_id = 1
#plt.figure(figure_id)
plt.figure(figure_id, figsize=(12 / 2.54, 6 / 2.54), facecolor='w', edgecolor='k')
plot_single_ts(figure_id, ts_abs1)
plot_single_ts(figure_id, ts_abs2)
#plot_single_ts(figure_id, ts_abs1)
#plot_single_ts(figure_id, ts_abs2)
plot_single_ts(figure_id, ts_diff)
plt.xlabel('Time [s]')
plt.ylabel('Voltage [kV]')
......@@ -43,6 +43,41 @@ def plot_dpsim_abs_diff(filename1, label1, node1, filename2, label2, node2):
plt.tight_layout()
plt.show()
def plot_dpsim_abs(filename1, label1, node1, filename2, label2, node2):
ts_dpsim1 = read_time_series_DPsim(filename1)
ts_dpsim2 = read_time_series_DPsim(filename2)
ts_dpsim1_length = len(ts_dpsim1)
im_offset1 = int(ts_dpsim1_length / 2)
if im_offset1 <= node1 or node1 < 0:
print('Node 1 not available')
exit()
ts_dpsim2_length = len(ts_dpsim2)
im_offset2 = int(ts_dpsim2_length / 2)
if im_offset2 <= node1 or node1 < 0:
print('Node 2 not available')
exit()
# this assumes same timestep for both simulations
ts_abs1 = complex_abs('node ' + str(node1) + 'abs', ts_dpsim1[node1], ts_dpsim1[node1 + im_offset1])
ts_abs1 = scale_ts(ts_abs1.name, ts_abs1, 0.001)
ts_abs1.label = label1
ts_abs2 = complex_abs('node ' + str(node2) + 'abs', ts_dpsim2[node1], ts_dpsim2[node1 + im_offset2])
ts_abs2 = scale_ts(ts_abs2.name, ts_abs2, 0.001)
ts_abs2.label = label2
figure_id = 1
# plt.figure(figure_id)
plt.figure(figure_id, figsize=(12 / 2.54, 6 / 2.54), facecolor='w', edgecolor='k')
plot_single_ts(figure_id, ts_abs1)
plot_single_ts(figure_id, ts_abs2)
plt.xlabel('Time [s]')
plt.ylabel('Voltage [kV]')
plt.grid(True)
plt.tight_layout()
plt.show()
def plot_dpsim_abs_single(filename, node):
ts_dpsim = read_time_series_DPsim(filename)
......
from dataprocessing.plotdpsim import *
path = 'C:\\Users\\mmi\\git\\PowerSystemSimulation\\gre\\step-dist-init\\'
plot_dpsim_abs(path + 'lvector-ref.csv', 'reference', 2,
path + 'lvector0-local_rm-first-row.csv', 'local', 2)
plot_dpsim_abs(path + 'lvector-ref.csv', 'reference', 2,
path + 'lvector0-netem.csv', 'netem', 2)
plot_dpsim_abs(path + 'lvector-ref.csv', 'reference', 2,
path + 'lvector0-dist.csv', 'dist', 2)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment