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

improving dpsim read function

parent bb192aa8
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ def get_node_voltage_phasors(dpsim_timeseries_list):
:return:
"""
voltage_phasor_list = {}
for ts in dpsim_timeseries_list:
for name, ts in dpsim_timeseries_list.items():
ts_abs = ts.abs(ts.name + '_abs')
ts_phase = ts.phase(ts.name + '_phase')
ts_phasor = {}
......@@ -23,7 +23,7 @@ def get_node_emt_voltages(timeseries_list, freq):
:return:
"""
voltages_list = {}
for ts in timeseries_list:
for name, ts in timeseries_list.items():
ts_emt = ts.dynphasor_shift_to_emt(ts.name, freq)
voltages_list[ts.name] = ts_emt
......
......@@ -81,7 +81,7 @@ def read_timeseries_dpsim(filename, timeseries_names=None):
:return: list of Timeseries objects
"""
pd_df = pd.read_csv(filename)
timeseries_list = []
timeseries_list = {}
cmpl_result_columns = []
real_result_columns = []
......@@ -107,14 +107,12 @@ def read_timeseries_dpsim(filename, timeseries_names=None):
#print("Found real variable: " + column)
for column in real_result_columns:
timeseries_list.append(
TimeSeries(column, timestamps, pd_df[column]))
timeseries_list[column] = TimeSeries(column, timestamps, pd_df[column])
for column in cmpl_result_columns:
timeseries_list.append(
TimeSeries(column, timestamps,
np.vectorize(complex)(pd_df[column + real_string],
pd_df[column + imaginary_string])))
timeseries_list[column] = TimeSeries(column, timestamps,
np.vectorize(complex)(pd_df[column + real_string],
pd_df[column + imaginary_string]))
else:
# Read in specified time series
......
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