read_NEPLAN_example.py 1.63 KB
Newer Older
Bichen Li's avatar
Bichen Li committed
1
2
3
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import re
4
from dataprocessing.readtools import *
Bichen Li's avatar
Bichen Li committed
5

6

7
file = r"C:\Users\admin\Desktop\Load_read\Load_flow_WCSS.rlf"
8

Bichen Li's avatar
Bichen Li committed
9
10

# Example 1: Read in all variable
11
print('************************ Test for read in all variable start ****************')
12
13
result = read_timeseries_NEPLAN_loadflow(file)
print(result[24].values)
14
for i in range(len(result)):
15
    print('%s is %s' % (result[i].name, result[i].values)) # result as list of TimeSeries
16
17
18
19
20
print('************************ Test for read in all variable end ****************')

print('\n')


Bichen Li's avatar
Bichen Li committed
21
22

# Example 2: Read in specific variable
23
24
print('************************ Test for read in specific variable start ****************')
print('************************ Read in specific Voltage ****************')
25
result2 = read_timeseries_NEPLAN_loadflow(file, 'FOUR.U')
26
27
for i in range(len(result2)):
    print('%s is %s' % (result2[i].name, result2[i].values))
28
29

print('************************ Read in specific Current ****************')
30
result3 = read_timeseries_NEPLAN_loadflow(file, 'LINE89.I')
31
32
for i in range(len(result3)):
    print('%s is %s' % (result3[i].name, result3[i].values))
33
34
35
36
37
38
39
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 ****************')
40
result4 = read_timeseries_NEPLAN_loadflow(file, '^.*\.I$', True)
41
42
for i in range(len(result4)):
    print('%s is %s' % (result4[i].name, result4[i].values))
43
print('************************ Test for read in using Regular Expression end ****************')
44
print('\n')