Commit 6eb2b345 authored by Markus Mirz's avatar Markus Mirz

improving dpsim read function

parent bb192aa8
...@@ -7,7 +7,7 @@ def get_node_voltage_phasors(dpsim_timeseries_list): ...@@ -7,7 +7,7 @@ def get_node_voltage_phasors(dpsim_timeseries_list):
:return: :return:
""" """
voltage_phasor_list = {} 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_abs = ts.abs(ts.name + '_abs')
ts_phase = ts.phase(ts.name + '_phase') ts_phase = ts.phase(ts.name + '_phase')
ts_phasor = {} ts_phasor = {}
...@@ -23,7 +23,7 @@ def get_node_emt_voltages(timeseries_list, freq): ...@@ -23,7 +23,7 @@ def get_node_emt_voltages(timeseries_list, freq):
:return: :return:
""" """
voltages_list = {} voltages_list = {}
for ts in timeseries_list: for name, ts in timeseries_list.items():
ts_emt = ts.dynphasor_shift_to_emt(ts.name, freq) ts_emt = ts.dynphasor_shift_to_emt(ts.name, freq)
voltages_list[ts.name] = ts_emt voltages_list[ts.name] = ts_emt
......
...@@ -81,7 +81,7 @@ def read_timeseries_dpsim(filename, timeseries_names=None): ...@@ -81,7 +81,7 @@ def read_timeseries_dpsim(filename, timeseries_names=None):
:return: list of Timeseries objects :return: list of Timeseries objects
""" """
pd_df = pd.read_csv(filename) pd_df = pd.read_csv(filename)
timeseries_list = [] timeseries_list = {}
cmpl_result_columns = [] cmpl_result_columns = []
real_result_columns = [] real_result_columns = []
...@@ -107,14 +107,12 @@ def read_timeseries_dpsim(filename, timeseries_names=None): ...@@ -107,14 +107,12 @@ def read_timeseries_dpsim(filename, timeseries_names=None):
#print("Found real variable: " + column) #print("Found real variable: " + column)
for column in real_result_columns: for column in real_result_columns:
timeseries_list.append( timeseries_list[column] = TimeSeries(column, timestamps, pd_df[column])
TimeSeries(column, timestamps, pd_df[column]))
for column in cmpl_result_columns: for column in cmpl_result_columns:
timeseries_list.append( timeseries_list[column] = TimeSeries(column, timestamps,
TimeSeries(column, timestamps, np.vectorize(complex)(pd_df[column + real_string],
np.vectorize(complex)(pd_df[column + real_string], pd_df[column + imaginary_string]))
pd_df[column + imaginary_string])))
else: else:
# Read in specified time series # Read in specified time series
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment