Commit 4f262493 authored by Bichen Li's avatar Bichen Li

Merge branch 'validation' of...

Merge branch 'validation' of git.rwth-aachen.de:acs/public/simulation/data-processing into validation
parents 4b7b91b6 ddc79611
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from .timeseries import * from dataprocessing.timeseries import *
import re import re
import cmath import cmath
...@@ -31,6 +30,9 @@ def read_timeseries_Modelica(filename, timeseries_names=None, is_regex=False): ...@@ -31,6 +30,9 @@ def read_timeseries_Modelica(filename, timeseries_names=None, is_regex=False):
for name in timeseries_names: for name in timeseries_names:
timeseries.append(TimeSeries(name, sim(name).times(), sim(name).values())) timeseries.append(TimeSeries(name, sim(name).times(), sim(name).values()))
#print('Modelica results column names: ' + str(timeseries_names))
#print('Modelica results number: ' + str(len(timeseries_names)))
return timeseries return timeseries
...@@ -183,8 +185,10 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F ...@@ -183,8 +185,10 @@ 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 Read in NEPLAN loadflow result from result file, the result is in angle notation, amplitude and angle are stored
separately 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: path of the mat file for the loadflow result from neplan :param file_name: name of the mat file for the loadflow result from neplan
:param timeseries_names: column name to be read :param timeseries_names: column name to be read
:param is_regex: flag for using regular expression :param is_regex: flag for using regular expression
:return: list of Timeseries objects :return: list of Timeseries objects
...@@ -199,13 +203,13 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F ...@@ -199,13 +203,13 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
value = [] # list for data value = [] # list for data
namelist = ['U', 'ANGLEU', 'P', 'Q','I', 'ANGLEI'] namelist = ['U', 'ANGLEU', 'P', 'Q', 'I', 'ANGLEI'] # Suffix of the data name
timeseries = [] timeseries = []
line_del = [] # a list for the value to be deleted line_del = [] # a list for the value to be deleted
isfloat = re.compile(r'^[-+]?[0-9]+\.[0-9]+$') # regular expression to find float values isfloat = re.compile(r'^[-+]?[0-9]+\.[0-9]+$') # regular expression to find float values
# Transfer ',' in the floats in result file to '.' # Transfer ',' in the floats in result file to '.'
for line in str_tmp.readlines(): for line in str_tmp.readlines(): # Check the data to find out floats with ','
line = line.replace(",", ".") line = line.replace(",", ".")
high -= high high -= high
low -= low low -= low
...@@ -268,6 +272,7 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F ...@@ -268,6 +272,7 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
del timeseries[line_del[len(line_del) - num_to_del - 1]] del timeseries[line_del[len(line_del) - num_to_del - 1]]
return timeseries return timeseries
def read_timeseries_simulink_loadflow(file_name, timeseries_names=None, is_regex=False): 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 Read in simulink load-flow result from result file(.rep), the result is in angle notation, amplitude and angle are stored
...@@ -332,6 +337,4 @@ def read_timeseries_simulink_loadflow(file_name, timeseries_names=None, is_regex ...@@ -332,6 +337,4 @@ def read_timeseries_simulink_loadflow(file_name, timeseries_names=None, is_regex
for num_to_del in range(len(line_del)): for num_to_del in range(len(line_del)):
del timeseries[line_del[len(line_del) - num_to_del - 1]] del timeseries[line_del[len(line_del) - num_to_del - 1]]
return timeseries return timeseries
\ No newline at end of file
...@@ -2,7 +2,7 @@ import re ...@@ -2,7 +2,7 @@ import re
import os import os
import sys import sys
from dataprocessing.Validationtools import * from dataprocessing.validationtools import *
from dataprocessing.readtools import * from dataprocessing.readtools import *
print("Test Start") print("Test Start")
# We need to extract all the result files from git now # We need to extract all the result files from git now
......
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