Commit cda742b5 authored by Bichen Li's avatar Bichen Li

Rename Validationtools, add some comments, add more specific examples to read_NEPLAN_example

parent 56b13e0c
......@@ -32,4 +32,6 @@ dymosim*
__pycache__
# ignore jupyter notebook files
.ipynb_checkpoints
\ No newline at end of file
.ipynb_checkpoints
Test.py
\ No newline at end of file
......@@ -208,7 +208,7 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
line_del = [] # a list for the value to be deleted
isfloat = re.compile(r'^[-+]?[0-9]+\.[0-9]+$') # regular expression to find float values
# the ',' in the floats in result file to '.'
# Transfer ',' in the floats in result file to '.'
for line in str_tmp.readlines():
line = line.replace(",", ".")
high -= high
......@@ -235,7 +235,7 @@ def read_timeseries_NEPLAN_loadflow(file_name, timeseries_names=None, is_regex=F
with the assumption that the topology of the gird should be correct with which we can validate the
current by comparing the voltage of the nodes connected to the ends of the line
"""
if flag is not True:
if flag is not True: # flag is true when it's the first line
if value[3] is not '#':
for m in range(6):
timeseries.append(TimeSeries(value[3] + '.' + namelist[m],
......
......@@ -9,36 +9,58 @@ file = r"C:\Users\admin\Desktop\Load_read\Load_flow_WCSS.rlf"
# Example 1: Read in all variable
print('************************ Test for read in all variable start ****************')
result = read_timeseries_NEPLAN_loadflow(file)
print(result[24].values)
for i in range(len(result)):
print('%s is %s' % (result[i].name, result[i].values)) # result as list of TimeSeries
result_ALL = read_timeseries_NEPLAN_loadflow(file)
for i in range(len(result_ALL)):
print('%s is %s' % (result_ALL[i].name, result_ALL[i].values)) # result as list of TimeSeries
print('************************ Test for read in all variable end ****************')
print('\n')
# Example 2: Read in specific variable
print('************************ Test for read in specific variable start ****************')
print('************************ Read in specific Voltage ****************')
result2 = read_timeseries_NEPLAN_loadflow(file, 'FOUR.U')
for i in range(len(result2)):
print('%s is %s' % (result2[i].name, result2[i].values))
result_U = read_timeseries_NEPLAN_loadflow(file, 'FOUR.U')
for i in range(len(result_U)):
print('%s is %s' % (result_U[i].name, result_U[i].values))
print('************************ Read in specific Voltage Angel ****************')
result_ANGELU = read_timeseries_NEPLAN_loadflow(file, 'FOUR.ANGELU')
for i in range(len(result_ANGELU)):
print('%s is %s' % (result_ANGELU[i].name, result_ANGELU[i].values))
print('************************ Read in specific Current ****************')
result3 = read_timeseries_NEPLAN_loadflow(file, 'LINE89.I')
for i in range(len(result3)):
print('%s is %s' % (result3[i].name, result3[i].values))
result_I = read_timeseries_NEPLAN_loadflow(file, 'LINE89.I')
for i in range(len(result_I)):
print('%s is %s' % (result_I[i].name, result_I[i].values))
print('************************ Read in specific Current Angel ****************')
result_ANGELI = read_timeseries_NEPLAN_loadflow(file, 'LINE89.ANGELI')
for i in range(len(result_ANGELI)):
print('%s is %s' % (result_ANGELI[i].name, result_ANGELI[i].values))
print('************************ Test for read in specific variable end ****************')
print('\n')
# Example 3: Read in using regular expression
print('************************ Test for read in using Regular Expression start ****************')
result4 = read_timeseries_NEPLAN_loadflow(file, '^.*\.I$', True)
for i in range(len(result4)):
print('%s is %s' % (result4[i].name, result4[i].values))
print('************************ Test for read in using Regular Expression end ****************')
print('\n')
\ No newline at end of file
print('************************ Read in Current using Regular Expression ****************')
result_I_REG = read_timeseries_NEPLAN_loadflow(file, '^.*\.I$', True)
for i in range(len(result_I_REG)):
print('%s is %s' % (result_I_REG[i].name, result_I_REG[i].values))
print('************************ Read in Current Angel using Regular Expression ****************')
result_ANGERLI_REG = read_timeseries_NEPLAN_loadflow(file, '^.*\.ANGELI$', True)
for i in range(len(result_ANGERLI_REG)):
print('%s is %s' % (result_ANGERLI_REG[i].name, result_ANGERLI_REG[i].values))
print('************************ Read in Voltage using Regular Expression ****************')
result_U_REG = read_timeseries_NEPLAN_loadflow(file, '^.*\.U$', True)
for i in range(len(result_U_REG)):
print('%s is %s' % (result_U_REG[i].name, result_U_REG[i].values))
print('************************ Read in Voltage Angel using Regular Expression ****************')
result_ANGELU_REG = read_timeseries_NEPLAN_loadflow(file, '^.*\.ANGELU$', True)
for i in range(len(result_ANGELU_REG)):
print('%s is %s' % (result_ANGELU_REG[i].name, result_ANGELU_REG[i].values))
print('************************ Test for read in using Regular Expression end ****************')
\ No newline at end of file
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