Commit 6626eb4d authored by Bichen Li's avatar Bichen Li

- Add covert_simulink_to_modelica_timeseries function.

- Add some comments for read_timeseries_simulink_loadflow funciton
parent f18964ac
......@@ -114,7 +114,20 @@ def assert_modelia_neplan_results(net_name, modelica_res, neplan_res): # Assert
raise ValueError('Test on %s is not passed!' % net_name)
def convert_simulink_to_modelica_timeseries(simseri):
for check in range(len(simseri)):
simseri[check].name = simseri[check].name.replace('U CA:', '')
simseri[check].name = simseri[check].name.replace('Vrms', 'Vpp')
simseri[check].name = simseri[check].name.replace('VDegree', 'Vangle')
simseri[check].name = simseri[check].name.replace(' ', '')
for check in range(len(simseri)):
if 'Vpp' in simseri[check].name:
simseri[check].values = simseri[check].values * 0.577350
if 'Vangle' in simseri[check].name:
simseri[check].values = simseri[check].values - 30
return simseri
......@@ -186,10 +186,8 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
"""
Read in NEPLAN loadflow result from result file, the result is in angle notation, amplitude and angle are stored
separately
To keep consistent with the names of voltage in most cases, the name of voltage variables are changed into '.V*'
instead of '.U*' as in the result file
:param file_name: name of the mat file for the loadflow result from neplan
:param file_name: path of the mat file for the loadflow result from neplan
:param timeseries_names: column name to be read
:param is_regex: flag for using regular expression
:return: list of Timeseries objects
......@@ -274,6 +272,18 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
return timeseries
def read_timeseries_simulink_loadflow(file_name, timeseries_names=None, is_regex=False):
"""
Read in simulink load-flow result from result file(.rep), the result is in angle notation, amplitude and angle are stored
separately.
A suffix is used to tag different data for a component:
.Arms/.IDegree for current/current angle,
.Vrms/.VDegree for voltage/voltage angle.
:param file_name:path of the .rep file for the loadflow result from simulink
:param timeseries_names: specific values to be read
:param is_regex: flag for using regular expression
:return: list of Timeseries objects
"""
str_tmp = open(file_name, 'r', encoding='latin-1') # Read in files, using latin-1 to decode /xb0
# Read in data from result file of neplan
......
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