-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain_chemnitz.py
105 lines (83 loc) · 3.73 KB
/
main_chemnitz.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
########################################################################
# Author(s): D. Knowles
# Date: 09 Aug 2021
# Desc: runs the FDE on the Chemnitz dataset
########################################################################
import os
import time
import numpy as np
from src.fde_chemnitz import EKF
def main():
total_time = 0.0
####################################################################
# parameter sensitivity test
####################################################################
error_addition = 50.
fde_parameters = {
# threshold value for residual FDE
"residual" : np.logspace(-2, 2, num = 41),
# threshold value for EDM FDE
"edm" : np.logspace(-2, 2, num = 41),
# threshold value for solution separation FDE
"solution" : np.logspace(-2, 2, num = 21),
}
fault_hypothesis = 1
log_names = ["chemnitz","fde","detailed"]
time0 = time.time()
ekf = EKF(error_addition, fde_parameters, fault_hypothesis,
log_names.copy(), True)
test_path = ekf.run()
trace_time = time.time() - time0
total_time += trace_time
print("parameter analysis took ", round(trace_time,3), " sec.")
print("total time of ", round(total_time/60.,2), " minutes.")
####################################################################
# chemnitz FDE tests
####################################################################
error_additions = [10.,20.,50.,100.,200.]
fde_parameters = {
# threshold value for residual FDE
"residual" : np.logspace(-2, 2, num = 21),
# threshold value for EDM FDE
"edm" : np.logspace(-2, 2, num = 21),
# threshold value for solution separation FDE
"solution" : np.logspace(-2, 2, num = 6),
}
fault_hypothesis = 1
log_names = ["chemnitz","fde"]
for ii, error_addition in enumerate(error_additions):
time0 = time.time()
ekf = EKF(error_addition, fde_parameters, fault_hypothesis,
log_names.copy(), True)
test_path = ekf.run()
trace_time = time.time() - time0
total_time += trace_time
print("fde analysis ",ii+1,"/",len(error_additions),
" took ", round(trace_time,3), " sec.")
print("total time of ", round(total_time/60.,2), " minutes.")
####################################################################
# fault hypothesis timing tests using TU Chemnitz dataset
####################################################################
error_addition = 50.
fde_parameters = {
# threshold value for residual FDE
"residual" : [15.848931924611142],
# threshold value for EDM FDE
"edm" : [1.584893192461114],
# threshold value for solution separation FDE
"solution" : [15.848931924611142],
}
log_names = ["chemnitz","timing"]
fault_hypotheses = [1, 2, 3]
for ii, fault_hypothesis in enumerate(fault_hypotheses):
time0 = time.time()
ekf = EKF(error_addition, fde_parameters, fault_hypothesis,
log_names.copy(), True)
test_path = ekf.run()
trace_time = time.time() - time0
total_time += trace_time
print("timing analysis ",ii+1,"/",len(fault_hypotheses),
" took ", round(trace_time,3), " sec.")
print("total time of ", round(total_time/60.,2), " minutes.")
if __name__ == "__main__":
main()