forked from bbartling/open-fdd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfc11.py
83 lines (64 loc) · 1.99 KB
/
fc11.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
import argparse
import os
import pandas as pd
from faults import FaultConditionEleven
from reports import FaultCodeElevenReport
# python 3.10 on Windows 10
# py .\fc11.py -i ./ahu_data/hvac_random_fake_data/fc11_fake_data1.csv -o fake1_ahu_fc11_report
parser = argparse.ArgumentParser(add_help=False)
args = parser.add_argument_group("Options")
args.add_argument(
"-h", "--help", action="help", help="Show this help message and exit."
)
args.add_argument("-i", "--input", required=True, type=str, help="CSV File Input")
args.add_argument(
"-o", "--output", required=True, type=str, help="Word File Output Name"
)
"""
FUTURE
* incorporate an arg for SI units
* °C on temp sensors
* piping pressure sensor PSI conversion
* air flow CFM conversion
* AHU duct static pressure "WC
args.add_argument('--use-SI-units', default=False, action='store_true')
args.add_argument('--no-SI-units', dest='use-SI-units', action='store_false')
"""
args = parser.parse_args()
# G36 params shouldnt need adjusting
# error threshold parameters
DELTA_SUPPLY_FAN = 2
OAT_DEGF_ERR_THRES = 5
SUPPLY_DEGF_ERR_THRES = 2
_fc11 = FaultConditionEleven(
DELTA_SUPPLY_FAN,
OAT_DEGF_ERR_THRES,
SUPPLY_DEGF_ERR_THRES,
"satsp",
"oat",
"clg",
"economizer_sig"
)
_fc11_report = FaultCodeElevenReport(
"satsp",
"oat",
"clg",
"economizer_sig",
"supply_vfd_speed"
)
df = pd.read_csv(args.input, index_col="Date", parse_dates=True).rolling("5T").mean()
start = df.head(1).index.date
print("Dataset start: ", start)
end = df.tail(1).index.date
print("Dataset end: ", end)
for col in df.columns:
print("df column: ", col, "- max len: ", df[col].size)
# return a whole new dataframe with fault flag as new col
df2 = _fc11.apply(df)
print(df2.head())
print(df2.describe())
document = _fc11_report.create_report(args.output, df2)
path = os.path.join(os.path.curdir, "final_report")
if not os.path.exists(path):
os.makedirs(path)
document.save(os.path.join(path, f"{args.output}.docx"))