-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
70 lines (60 loc) · 2.28 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import data_extract
import file_creating
import calc_criteria
import os
print("Hello. Let`s calculate maximum power flow (MPF)")
# State variables
flowgate_lines = None
trajectory_nodes = None
faults_lines = None
p_fluctuations = 0
# Select path to flowgate .json
try:
flowgate_lines = data_extract.json_to_dic(input("Select path to "
"flowgate .json: "))
except:
print("Unknown path, type of file or folder does not contain a file")
exit()
# Select path to faults .json
try:
faults_lines = data_extract.json_to_dic(input("Select path to "
"faults .json: "))
except:
print("Unknown path, type of file or folder does not contain a file")
exit()
# Select path to trajectory .csv
try:
trajectory_nodes = data_extract.csv_to_list(input("Select path to "
"trajectory .csv: "))
except:
print("Unknown path, type of file or folder does not contain a file")
exit()
# Input power fluctuation
try:
p_fluctuations = int(input("Input positive power fluctuations: "))
except:
print("Input positive number")
exit()
# Creating RastrWin3 files
file_creating.create_file_sch(flowgate_lines, 'new')
file_creating.create_file_ut2(trajectory_nodes)
# Calculation of criteria
print(f"MPF in normal regime (0.8*Pmax): "
f"{calc_criteria.criteria1(p_fluctuations)}")
print(f"MPF by the acceptable voltage level "
f"in the pre-emergency regime (1,15*Ucr): "
f"{calc_criteria.criteria2(p_fluctuations)}")
print(f"MPF in the post-emergency regime after fault (0.92*Pmax): "
f"{calc_criteria.criteria3(p_fluctuations, faults_lines)}")
print(f"MPF by the acceptable voltage level "
f"in the post-emergency regime after fault (1.1*Ucr): "
f"{calc_criteria.criteria4(p_fluctuations, faults_lines)}")
print(f"MPF by acceptable current in normal regime (Iacc): "
f"{calc_criteria.criteria5(p_fluctuations)}")
print(f"MPF by acceptable current "
f"in the post-emergency regime after fault (Iem_acc): "
f"{calc_criteria.criteria6(p_fluctuations, faults_lines)}")
# Delete temporary files
for item in os.listdir('.'):
if item.endswith(".sch") or item.endswith(".ut2"):
os.remove(item)