read_NEPLAN_example.py 3.09 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
14
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
15
16
17
18
print('************************ Test for read in all variable end ****************')
print('\n')


Bichen Li's avatar
Bichen Li committed
19
# Example 2: Read in specific variable
20
print('************************ Test for read in specific variable start ****************')
21

22
print('************************ Read in specific Voltage ****************')
23
24
25
26
27
28
29
30
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))
31
32

print('************************ Read in specific Current ****************')
33
34
35
36
37
38
39
40
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))
41
42
43
44
45
46
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 ****************')
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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 ****************')