open-fdd 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- open_fdd/air_handling_unit/faults/__init__.py +29 -2283
- open_fdd/air_handling_unit/faults/fault_condition_eight.py +135 -0
- open_fdd/air_handling_unit/faults/fault_condition_eleven.py +108 -0
- open_fdd/air_handling_unit/faults/fault_condition_fifteen.py +189 -0
- open_fdd/air_handling_unit/faults/fault_condition_five.py +126 -0
- open_fdd/air_handling_unit/faults/fault_condition_four.py +128 -0
- open_fdd/air_handling_unit/faults/fault_condition_fourteen.py +177 -0
- open_fdd/air_handling_unit/faults/fault_condition_nine.py +140 -0
- open_fdd/air_handling_unit/faults/fault_condition_one.py +113 -0
- open_fdd/air_handling_unit/faults/fault_condition_seven.py +106 -0
- open_fdd/air_handling_unit/faults/fault_condition_six.py +228 -0
- open_fdd/air_handling_unit/faults/fault_condition_sixteen.py +196 -0
- open_fdd/air_handling_unit/faults/fault_condition_ten.py +119 -0
- open_fdd/air_handling_unit/faults/fault_condition_thirteen.py +139 -0
- open_fdd/air_handling_unit/faults/fault_condition_three.py +112 -0
- open_fdd/air_handling_unit/faults/fault_condition_twelve.py +164 -0
- open_fdd/air_handling_unit/faults/fault_condition_two.py +112 -0
- open_fdd/air_handling_unit/faults/helper_utils.py +29 -19
- open_fdd/air_handling_unit/reports/__init__.py +6 -4
- open_fdd/air_handling_unit/reports/fault_report.py +3 -2
- open_fdd/chiller_plant/__init__.py +0 -0
- open_fdd/chiller_plant/faults/__init__.py +7 -0
- open_fdd/chiller_plant/faults/fault_condition_one.py +113 -0
- open_fdd/chiller_plant/faults/fault_condition_two.py +100 -0
- open_fdd/tests/ahu/test_ahu_fc1.py +2 -2
- open_fdd/tests/ahu/test_ahu_fc10.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc11.py +24 -33
- open_fdd/tests/ahu/test_ahu_fc12.py +56 -18
- open_fdd/tests/ahu/test_ahu_fc13.py +15 -8
- open_fdd/tests/ahu/test_ahu_fc14.py +11 -3
- open_fdd/tests/ahu/test_ahu_fc15.py +15 -4
- open_fdd/tests/ahu/test_ahu_fc16.py +15 -6
- open_fdd/tests/ahu/test_ahu_fc2.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc3.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc4.py +3 -1
- open_fdd/tests/ahu/test_ahu_fc5.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc6.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc7.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc8.py +1 -0
- open_fdd/tests/ahu/test_ahu_fc9.py +1 -0
- open_fdd/tests/chiller/__init__.py +0 -0
- open_fdd/tests/chiller/test_chiller_fc1.py +122 -0
- open_fdd/tests/chiller/test_chiller_fc2.py +95 -0
- open_fdd-0.1.9.dist-info/METADATA +137 -0
- open_fdd-0.1.9.dist-info/RECORD +52 -0
- {open_fdd-0.1.7.dist-info → open_fdd-0.1.9.dist-info}/WHEEL +1 -1
- open_fdd/air_handling_unit/faults/fault_condition.py +0 -69
- open_fdd/air_handling_unit/faults/shared_utils.py +0 -90
- open_fdd-0.1.7.dist-info/METADATA +0 -95
- open_fdd-0.1.7.dist-info/RECORD +0 -31
- {open_fdd-0.1.7.dist-info → open_fdd-0.1.9.dist-info/licenses}/LICENSE +0 -0
- {open_fdd-0.1.7.dist-info → open_fdd-0.1.9.dist-info}/top_level.txt +0 -0
File without changes
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
import pytest
|
3
|
+
|
4
|
+
from open_fdd.chiller_plant.faults import FaultConditionOne
|
5
|
+
from open_fdd.core.exceptions import MissingColumnError
|
6
|
+
|
7
|
+
# Constants for test cases
|
8
|
+
TEST_PUMP_ERR_THRESHOLD = 0.05
|
9
|
+
TEST_PUMP_SPEED_MAX = 0.9
|
10
|
+
TEST_DIFF_PRESSURE_ERR_THRESHOLD = 0.1
|
11
|
+
TEST_DIFF_PRESSURE_COL = "diff_pressure"
|
12
|
+
TEST_DIFF_PRESSURE_SETPOINT_COL = "diff_pressure_setpoint"
|
13
|
+
TEST_PUMP_SPEED_COL = "pump_speed"
|
14
|
+
|
15
|
+
ROLLING_WINDOW_SIZE = 5
|
16
|
+
|
17
|
+
# Initialize FaultConditionPump with a dictionary
|
18
|
+
fault_condition_params = {
|
19
|
+
"PUMP_SPEED_PERCENT_ERR_THRES": TEST_PUMP_ERR_THRESHOLD,
|
20
|
+
"PUMP_SPEED_PERCENT_MAX": TEST_PUMP_SPEED_MAX,
|
21
|
+
"DIFF_PRESSURE_PSI_ERR_THRES": TEST_DIFF_PRESSURE_ERR_THRESHOLD,
|
22
|
+
"DIFF_PRESSURE_COL": TEST_DIFF_PRESSURE_COL,
|
23
|
+
"PUMP_SPEED_COL": TEST_PUMP_SPEED_COL,
|
24
|
+
"DIFF_PRESSURE_SETPOINT_COL": TEST_DIFF_PRESSURE_SETPOINT_COL,
|
25
|
+
"TROUBLESHOOT_MODE": False,
|
26
|
+
"ROLLING_WINDOW_SIZE": ROLLING_WINDOW_SIZE,
|
27
|
+
}
|
28
|
+
|
29
|
+
fc_pump = FaultConditionOne(fault_condition_params)
|
30
|
+
|
31
|
+
|
32
|
+
class TestMissingColumn:
|
33
|
+
def missing_col_df(self) -> pd.DataFrame:
|
34
|
+
data = {
|
35
|
+
TEST_DIFF_PRESSURE_COL: [8.0, 8.1, 8.2, 8.1, 8.0, 8.0],
|
36
|
+
# Missing TEST_PUMP_SPEED_COL
|
37
|
+
TEST_DIFF_PRESSURE_SETPOINT_COL: [10.0, 10.0, 10.0, 10.0, 10.0, 10.0],
|
38
|
+
}
|
39
|
+
return pd.DataFrame(data)
|
40
|
+
|
41
|
+
def test_missing_column(self):
|
42
|
+
with pytest.raises(MissingColumnError):
|
43
|
+
fc_pump.apply(self.missing_col_df())
|
44
|
+
|
45
|
+
|
46
|
+
class TestNoFault:
|
47
|
+
def no_fault_df(self) -> pd.DataFrame:
|
48
|
+
data = {
|
49
|
+
TEST_DIFF_PRESSURE_COL: [9.8, 9.9, 9.8, 9.8, 9.9, 9.8],
|
50
|
+
TEST_DIFF_PRESSURE_SETPOINT_COL: [10.0, 10.0, 10.0, 10.0, 10.0, 10.0],
|
51
|
+
TEST_PUMP_SPEED_COL: [0.7, 0.7, 0.7, 0.7, 0.7, 0.7],
|
52
|
+
}
|
53
|
+
return pd.DataFrame(data)
|
54
|
+
|
55
|
+
def test_no_fault(self):
|
56
|
+
results = fc_pump.apply(self.no_fault_df())
|
57
|
+
actual = results["fc_pump_flag"].sum()
|
58
|
+
expected = 0
|
59
|
+
message = f"FC Pump no_fault_df actual is {actual} and expected is {expected}"
|
60
|
+
assert actual == expected, message
|
61
|
+
|
62
|
+
|
63
|
+
class TestFault:
|
64
|
+
def fault_df(self) -> pd.DataFrame:
|
65
|
+
data = {
|
66
|
+
TEST_DIFF_PRESSURE_COL: [
|
67
|
+
8.0,
|
68
|
+
8.1,
|
69
|
+
8.0,
|
70
|
+
7.9,
|
71
|
+
8.0,
|
72
|
+
8.0,
|
73
|
+
9.9,
|
74
|
+
9.9,
|
75
|
+
8.0,
|
76
|
+
8.1,
|
77
|
+
8.0,
|
78
|
+
7.9,
|
79
|
+
8.0,
|
80
|
+
8.1,
|
81
|
+
],
|
82
|
+
TEST_DIFF_PRESSURE_SETPOINT_COL: [
|
83
|
+
10.0,
|
84
|
+
10.0,
|
85
|
+
10.0,
|
86
|
+
10.0,
|
87
|
+
10.0,
|
88
|
+
10.0,
|
89
|
+
10.0,
|
90
|
+
10.0,
|
91
|
+
10.0,
|
92
|
+
10.0,
|
93
|
+
10.0,
|
94
|
+
10.0,
|
95
|
+
10.0,
|
96
|
+
10.0,
|
97
|
+
],
|
98
|
+
TEST_PUMP_SPEED_COL: [
|
99
|
+
0.9,
|
100
|
+
0.9,
|
101
|
+
0.9,
|
102
|
+
0.9,
|
103
|
+
0.9,
|
104
|
+
0.9,
|
105
|
+
0.5,
|
106
|
+
0.55,
|
107
|
+
0.9,
|
108
|
+
0.9,
|
109
|
+
0.9,
|
110
|
+
0.9,
|
111
|
+
0.9,
|
112
|
+
0.9,
|
113
|
+
],
|
114
|
+
}
|
115
|
+
return pd.DataFrame(data)
|
116
|
+
|
117
|
+
def test_fault(self):
|
118
|
+
results = fc_pump.apply(self.fault_df())
|
119
|
+
actual = results["fc_pump_flag"].sum()
|
120
|
+
expected = 4 # Adjusted based on the rolling window and fault conditions
|
121
|
+
message = f"FC Pump fault_df actual is {actual} and expected is {expected}"
|
122
|
+
assert actual == expected, message
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
import pytest
|
3
|
+
|
4
|
+
from open_fdd.chiller_plant.faults import FaultConditionTwo
|
5
|
+
from open_fdd.core.exceptions import MissingColumnError
|
6
|
+
|
7
|
+
# Constants for test cases
|
8
|
+
TEST_FLOW_ERR_THRESHOLD = 10.0 # Error threshold for flow in GPM
|
9
|
+
TEST_PUMP_SPEED_MAX = 0.9 # Maximum pump speed percentage
|
10
|
+
TEST_PUMP_SPEED_ERR_THRESHOLD = 0.05 # Error threshold for pump speed percentage
|
11
|
+
TEST_FLOW_COL = "flow_gpm"
|
12
|
+
TEST_PUMP_SPEED_COL = "pump_speed"
|
13
|
+
|
14
|
+
ROLLING_WINDOW_SIZE = 5
|
15
|
+
|
16
|
+
# Initialize FaultConditionTwo with a dictionary
|
17
|
+
fault_condition_params = {
|
18
|
+
"FLOW_ERROR_THRESHOLD": TEST_FLOW_ERR_THRESHOLD,
|
19
|
+
"PUMP_SPEED_PERCENT_MAX": TEST_PUMP_SPEED_MAX,
|
20
|
+
"PUMP_SPEED_PERCENT_ERR_THRES": TEST_PUMP_SPEED_ERR_THRESHOLD,
|
21
|
+
"FLOW_COL": TEST_FLOW_COL,
|
22
|
+
"PUMP_SPEED_COL": TEST_PUMP_SPEED_COL,
|
23
|
+
"ROLLING_WINDOW_SIZE": ROLLING_WINDOW_SIZE,
|
24
|
+
}
|
25
|
+
|
26
|
+
fc_flow = FaultConditionTwo(fault_condition_params)
|
27
|
+
|
28
|
+
|
29
|
+
class TestMissingColumn:
|
30
|
+
def missing_col_df(self) -> pd.DataFrame:
|
31
|
+
data = {
|
32
|
+
TEST_FLOW_COL: [5.0, 8.0, 9.0, 15.0, 7.0],
|
33
|
+
# Missing pump speed column
|
34
|
+
}
|
35
|
+
return pd.DataFrame(data)
|
36
|
+
|
37
|
+
def test_missing_column(self):
|
38
|
+
with pytest.raises(MissingColumnError):
|
39
|
+
fc_flow.apply(self.missing_col_df())
|
40
|
+
|
41
|
+
|
42
|
+
class TestNoFault:
|
43
|
+
def no_fault_df(self) -> pd.DataFrame:
|
44
|
+
data = {
|
45
|
+
TEST_FLOW_COL: [11.0, 11.0, 12.0, 12.0, 12.5], # Flow above threshold
|
46
|
+
TEST_PUMP_SPEED_COL: [0.5, 0.45, 0.55, 0.45, 0.55], # Above threshold
|
47
|
+
}
|
48
|
+
return pd.DataFrame(data)
|
49
|
+
|
50
|
+
def test_no_fault(self):
|
51
|
+
results = fc_flow.apply(self.no_fault_df())
|
52
|
+
actual = results["fc2_flag"].sum()
|
53
|
+
expected = 0
|
54
|
+
message = f"FC2 no_fault_df actual is {actual} and expected is {expected}"
|
55
|
+
assert actual == expected, message
|
56
|
+
|
57
|
+
|
58
|
+
class TestFault:
|
59
|
+
def fault_df(self) -> pd.DataFrame:
|
60
|
+
data = {
|
61
|
+
TEST_FLOW_COL: [
|
62
|
+
6.0,
|
63
|
+
6.1,
|
64
|
+
6.2,
|
65
|
+
6.3,
|
66
|
+
6.4,
|
67
|
+
12.0,
|
68
|
+
6.0,
|
69
|
+
6.1,
|
70
|
+
6.2,
|
71
|
+
6.3,
|
72
|
+
6.4,
|
73
|
+
], # 6th row interrupts the fault condition
|
74
|
+
TEST_PUMP_SPEED_COL: [
|
75
|
+
0.97,
|
76
|
+
0.98,
|
77
|
+
0.98,
|
78
|
+
0.97,
|
79
|
+
0.99,
|
80
|
+
0.95,
|
81
|
+
0.97,
|
82
|
+
0.98,
|
83
|
+
0.98,
|
84
|
+
0.97,
|
85
|
+
0.99,
|
86
|
+
], # All above threshold
|
87
|
+
}
|
88
|
+
return pd.DataFrame(data)
|
89
|
+
|
90
|
+
def test_fault(self):
|
91
|
+
results = fc_flow.apply(self.fault_df())
|
92
|
+
actual = results["fc2_flag"].sum() # Fault flags counted
|
93
|
+
expected = 2 # 5 faults, interruption, then 5 more faults = 2 total flags
|
94
|
+
message = f"FC2 fault_df actual is {actual} and expected is {expected}"
|
95
|
+
assert actual == expected, message
|
@@ -0,0 +1,137 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: open_fdd
|
3
|
+
Version: 0.1.9
|
4
|
+
Summary: A package for fault detection and diagnosis in HVAC systems
|
5
|
+
Home-page: https://bbartling.github.io/open-fdd/
|
6
|
+
Author: Ben Bartling
|
7
|
+
Author-email: ben.bartling@gmail.com
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.6
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: pandas
|
15
|
+
Requires-Dist: matplotlib
|
16
|
+
Requires-Dist: pytest
|
17
|
+
Dynamic: author
|
18
|
+
Dynamic: author-email
|
19
|
+
Dynamic: classifier
|
20
|
+
Dynamic: description
|
21
|
+
Dynamic: description-content-type
|
22
|
+
Dynamic: home-page
|
23
|
+
Dynamic: license-file
|
24
|
+
Dynamic: requires-dist
|
25
|
+
Dynamic: requires-python
|
26
|
+
Dynamic: summary
|
27
|
+
|
28
|
+
# open-fdd
|
29
|
+
|
30
|
+

|
31
|
+

|
32
|
+

|
33
|
+

|
34
|
+
|
35
|
+

|
36
|
+
|
37
|
+
## 🔥 What is open-fdd?
|
38
|
+
**open-fdd** is an **open-source Fault Detection and Diagnostics (FDD) tool** designed for analysts and engineers using local toolsets like Jupyter notebooks. It is not necessarily an IoT tool for **Grafana**, which an MSI (Master Systems Integrator) might use, though it could be adapted for that purpose. Instead, it is tailored for **individual engineers analyzing historical HVAC system data** using the **Pandas computing library**. While it could potentially be integrated with a database, doing so may require additional effort. It leverages **ASHRAE** and **NIST**-inspired fault equations. Built on Python and **Pandas**, this library enables efficient detection of operational issues in HVAC systems with:
|
39
|
+
|
40
|
+
This version improves clarity and flow while keeping it professional and readable. 🚀 Let me know if you want any more refinements!
|
41
|
+
|
42
|
+
✅ **Pre-built fault equations** for detecting HVAC anomalies
|
43
|
+
✅ **Seamless Pandas integration** for time-series analysis
|
44
|
+
✅ **Extensible architecture** for custom fault conditions
|
45
|
+
✅ **Open-source & community-driven** development
|
46
|
+
|
47
|
+
|
48
|
+
📖 **See Online Documentation:**
|
49
|
+
[📚 Open-FDD Docs](https://bbartling.github.io/open-fdd/)
|
50
|
+
|
51
|
+
---
|
52
|
+
|
53
|
+
## 🚀 Getting Started
|
54
|
+
### Installation
|
55
|
+
Install `open-fdd` from PyPI with:
|
56
|
+
```bash
|
57
|
+
pip install open-fdd
|
58
|
+
```
|
59
|
+
|
60
|
+
### Quick Example
|
61
|
+
```python
|
62
|
+
import pandas as pd
|
63
|
+
from open_fdd.air_handling_unit.fault_condition_one import FaultConditionOne
|
64
|
+
|
65
|
+
# Sample data
|
66
|
+
data = {
|
67
|
+
"timestamp": pd.date_range(start="2023-01-01", periods=10, freq="15T"),
|
68
|
+
"supply_air_temp": [54, 55, 56, 57, 58, 59, 60, 61, 62, 63],
|
69
|
+
"return_air_temp": [70, 70, 70, 70, 70, 70, 70, 70, 70, 70],
|
70
|
+
}
|
71
|
+
df = pd.DataFrame(data)
|
72
|
+
|
73
|
+
# Run fault detection
|
74
|
+
fault_checker = FaultConditionOne(df)
|
75
|
+
df_faults = fault_checker.process()
|
76
|
+
print(df_faults)
|
77
|
+
```
|
78
|
+
|
79
|
+
---
|
80
|
+
|
81
|
+
## 📌 Project Goals
|
82
|
+
`open-fdd` aims to provide a full-featured **Fault Detection & Diagnostics (FDD) platform** with:
|
83
|
+
|
84
|
+
### ✅ Completed Features
|
85
|
+
- [x] Air handling unit (AHU) fault conditions & reports (aligned with ASHRAE/NIST)
|
86
|
+
- [x] PyPI distribution for easy installation
|
87
|
+
|
88
|
+
### 🔄 In Progress
|
89
|
+
- [ ] Jupyter notebook tutorials showcasing AHU FDD examples + BRICK metadata integration
|
90
|
+
- [ ] Expansion to **central plant** fault conditions (chillers, boilers, pumps)
|
91
|
+
- [ ] Jupyter notebook tutorials showcasing AHU FDD examples + BRICK metadata integration
|
92
|
+
|
93
|
+
### ⏳ Upcoming
|
94
|
+
- [ ] **Energy Efficiency** fault detection & reporting
|
95
|
+
- [ ] **Metering** fault analytics & data modeling
|
96
|
+
- [ ] **SQL Integration** for storing results & visualizing in Grafana
|
97
|
+
- [ ] Dedicated documentation site (`github.io` or ReadTheDocs)
|
98
|
+
|
99
|
+
---
|
100
|
+
|
101
|
+
## 🤝 How to Contribute
|
102
|
+
We welcome contributions from the community! To get started:
|
103
|
+
|
104
|
+
1. **Clone the repository:**
|
105
|
+
```bash
|
106
|
+
git clone https://github.com/bbartling/open-fdd.git && cd open-fdd
|
107
|
+
```
|
108
|
+
2. **Install dependencies:**
|
109
|
+
```bash
|
110
|
+
py -3.12 -m pip install -r requirements.txt
|
111
|
+
```
|
112
|
+
3. **Run tests:**
|
113
|
+
```bash
|
114
|
+
py -3.12 -m pytest
|
115
|
+
```
|
116
|
+
4. **Format with Black:**
|
117
|
+
```bash
|
118
|
+
py -3.12 -m black .
|
119
|
+
```
|
120
|
+
5. **Submit a Pull Request (PR)**
|
121
|
+
|
122
|
+
---
|
123
|
+
|
124
|
+
## 📜 License
|
125
|
+
`open-fdd` is released under the **MIT License**, ensuring it remains free and accessible for all.
|
126
|
+
|
127
|
+
```
|
128
|
+
|
129
|
+
【MIT License】
|
130
|
+
|
131
|
+
Copyright 2025 Ben Bartling
|
132
|
+
|
133
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
134
|
+
|
135
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
136
|
+
|
137
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,52 @@
|
|
1
|
+
open_fdd/__init__.py,sha256=iGj8QTOZJUTE4nNnBiCHXEXsOdV6YvKcGiLrnOusJCg,1411
|
2
|
+
open_fdd/air_handling_unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
open_fdd/air_handling_unit/faults/__init__.py,sha256=y4XUyFDNZthjhN37AWcKA8gowmi2Fm6zThI-IxYKFEU,1577
|
4
|
+
open_fdd/air_handling_unit/faults/fault_condition_eight.py,sha256=XNqWA0q-ogY9QwMHzLpDYxOobeDD13Ij7-s5vDh5PSU,4525
|
5
|
+
open_fdd/air_handling_unit/faults/fault_condition_eleven.py,sha256=cKhm6lKpRouWpof_ibVC9zywW9Tpq7ncJEeZcHEsb5U,3607
|
6
|
+
open_fdd/air_handling_unit/faults/fault_condition_fifteen.py,sha256=UtqZYUy57VEW6trUVER4r9sEyxnbIq8Ttufj0aUKWIY,6952
|
7
|
+
open_fdd/air_handling_unit/faults/fault_condition_five.py,sha256=sQFBpvvvNSQasCKJ9epqGSXk16btjjzRJitwEC8Os_Y,4245
|
8
|
+
open_fdd/air_handling_unit/faults/fault_condition_four.py,sha256=IRJH17I1_QkOEYwUmSsI5HtYp7_YXiaDxbcGud-5WJo,4547
|
9
|
+
open_fdd/air_handling_unit/faults/fault_condition_fourteen.py,sha256=FaSNp2dBHPD6T6um2RrqFj8Di7oK3surzFPyjzfQ6f8,6320
|
10
|
+
open_fdd/air_handling_unit/faults/fault_condition_nine.py,sha256=n0uB9JySxF6ga7QbiUnKiYbR2j7bFDLykM6LVgUTL_s,4708
|
11
|
+
open_fdd/air_handling_unit/faults/fault_condition_one.py,sha256=5SAu1MXzX3cVW9zyFH8wgRxXMnXBo_y9exuKfYkIuz8,3981
|
12
|
+
open_fdd/air_handling_unit/faults/fault_condition_seven.py,sha256=6gWEZhal0bWz0VppOzUOpl55_25qVEEkj75lWT9ImBM,3518
|
13
|
+
open_fdd/air_handling_unit/faults/fault_condition_six.py,sha256=-nIFl4BtV_AMfx4FI25cnxo5dukE6YXvlowVs7oxJcQ,7971
|
14
|
+
open_fdd/air_handling_unit/faults/fault_condition_sixteen.py,sha256=DutgmWyz3AMlF39G7ivIpL3tFV75QkvRs2FndW5n464,7231
|
15
|
+
open_fdd/air_handling_unit/faults/fault_condition_ten.py,sha256=TP9-bsiGUGyeNYYS1MQE3Lw7gDCssG2Um2-osKZNcAE,3999
|
16
|
+
open_fdd/air_handling_unit/faults/fault_condition_thirteen.py,sha256=CNteakiAxaDMFQynys9MK2pEokIlUJQhMI4StwBA4Gs,4841
|
17
|
+
open_fdd/air_handling_unit/faults/fault_condition_three.py,sha256=BiSQSlMqr8AI9IL06jdQsKyyjxDgTm7WmpPc1KtEDRw,3719
|
18
|
+
open_fdd/air_handling_unit/faults/fault_condition_twelve.py,sha256=snE1toPvqH9TDbT0Y54m8Dnji19a7s8erzFYTw5S40I,5684
|
19
|
+
open_fdd/air_handling_unit/faults/fault_condition_two.py,sha256=nPtrhex23TMI88AbGtzbUOq-wrY-qm9u1O4X8sGOXLo,3715
|
20
|
+
open_fdd/air_handling_unit/faults/helper_utils.py,sha256=4w_t9BvfbvNn-fip0zH3r3350W9oQIvDq_LdtY7W9uI,12732
|
21
|
+
open_fdd/air_handling_unit/reports/__init__.py,sha256=Stg1NcWYbNoV8Osk9-vUAiAfw5dJFUEWm2RuBTXeIWY,40745
|
22
|
+
open_fdd/air_handling_unit/reports/fault_report.py,sha256=lQ1RvhH_b--mT9VzWK6HESEsOmhlPF0sfVn6W7Ue_-8,1444
|
23
|
+
open_fdd/chiller_plant/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
+
open_fdd/chiller_plant/faults/__init__.py,sha256=b-nH3L0ijb2SY7TqRT_DCVEGn3TmF-WvaxemHjbAGsg,232
|
25
|
+
open_fdd/chiller_plant/faults/fault_condition_one.py,sha256=jwSmO4lKpXw7wnN6rEbdcICfv82ujqjErKneqMmGWCw,3784
|
26
|
+
open_fdd/chiller_plant/faults/fault_condition_two.py,sha256=IrsxFyPubOXJwPFFUQMEITcurAl7pLKakmP8lRBrRhM,3288
|
27
|
+
open_fdd/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
|
+
open_fdd/tests/ahu/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
|
+
open_fdd/tests/ahu/test_ahu_fc1.py,sha256=_zNavzKHam7kqxKT3tn0IxK0ofzP2RjPDWtgr_eU3-w,5414
|
30
|
+
open_fdd/tests/ahu/test_ahu_fc10.py,sha256=f1V2I5Ul9xyhhmQstdiFEO1AlIDsa_Y4HENRMNanyHM,4579
|
31
|
+
open_fdd/tests/ahu/test_ahu_fc11.py,sha256=TIhvGVUJGGjQSW7PRdffRyL2sL9bJhLkDMCFt3UVHEc,4143
|
32
|
+
open_fdd/tests/ahu/test_ahu_fc12.py,sha256=Wn1rxqSxy6aNBTfUaHi9Q7mr3gLLEirLKw6XVREbwOc,7197
|
33
|
+
open_fdd/tests/ahu/test_ahu_fc13.py,sha256=U-BG6trhK-xmqoU9DzvCCiUd1jqgKAffaO-oq7xVTUw,6055
|
34
|
+
open_fdd/tests/ahu/test_ahu_fc14.py,sha256=GpH2ftTlh9YHktFuRaMmWRNjktGd8h2fVogbJjdumSg,8400
|
35
|
+
open_fdd/tests/ahu/test_ahu_fc15.py,sha256=eL3nYiBD3gp3SXsiKAsAUGOT9GVnNm_gJ0pFdz6Faws,8149
|
36
|
+
open_fdd/tests/ahu/test_ahu_fc16.py,sha256=z873OSK0TyKbq2XkhKw4uAdBZ5d4BaFd5qD0iVppMTY,9451
|
37
|
+
open_fdd/tests/ahu/test_ahu_fc2.py,sha256=hpenWlBmfQSaGCh06iUbg4otmbG0w4COZ4FtVuohgP0,4738
|
38
|
+
open_fdd/tests/ahu/test_ahu_fc3.py,sha256=rdW7Omd6mDaUfDauxfXiWa5k0suTtDp8hcruQulsHPk,4660
|
39
|
+
open_fdd/tests/ahu/test_ahu_fc4.py,sha256=7CBkJMStdnIGWoeHnR1uSiRZ2bOEn2QuYwK_xxcM75I,6308
|
40
|
+
open_fdd/tests/ahu/test_ahu_fc5.py,sha256=mQLDP_1QqnkFx5Dy08iU9h_zMhsF5JEFJX0-JL1MDQc,6540
|
41
|
+
open_fdd/tests/ahu/test_ahu_fc6.py,sha256=JtcLEKWUD9nnYNbVtpf-qzayIdL9e4QVwRmtIsY8GBQ,10353
|
42
|
+
open_fdd/tests/ahu/test_ahu_fc7.py,sha256=iGyBtHhOuL-1ldNTzXbXESL39YHPF_DW3XZ65IEk1q4,2471
|
43
|
+
open_fdd/tests/ahu/test_ahu_fc8.py,sha256=f_DI_7gne81uVzZO0URG5J1sOE1Np2AidYKhdWmRvSE,4665
|
44
|
+
open_fdd/tests/ahu/test_ahu_fc9.py,sha256=8ELH0XUcsQqqNjW94C0r4Q6EYldYgNqjWl8QyLhev74,4798
|
45
|
+
open_fdd/tests/chiller/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
46
|
+
open_fdd/tests/chiller/test_chiller_fc1.py,sha256=MTggFcfLUCvMQ_vc_sVAWv-VRqscg1mAcWDHmyBM_QM,3705
|
47
|
+
open_fdd/tests/chiller/test_chiller_fc2.py,sha256=rWVRrFSZ_wHh-KsDdNeNgs5MTdB-di_UayfhgZ6HcYc,3019
|
48
|
+
open_fdd-0.1.9.dist-info/licenses/LICENSE,sha256=eghao_GGx_0gB2Sll3x2vV29knONEzUQKrkaXpX1F7w,1087
|
49
|
+
open_fdd-0.1.9.dist-info/METADATA,sha256=di_1orLR5AEe1T5HDyqpQ7FHYOs_iS62Ne-07aKounU,5636
|
50
|
+
open_fdd-0.1.9.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
51
|
+
open_fdd-0.1.9.dist-info/top_level.txt,sha256=Q7sB6UB2d8Ch1v_xIsTiNegmgcCXPkwkrxK3ug6VEOs,9
|
52
|
+
open_fdd-0.1.9.dist-info/RECORD,,
|
@@ -1,69 +0,0 @@
|
|
1
|
-
import pandas as pd
|
2
|
-
import pandas.api.types as pdtypes
|
3
|
-
from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
|
4
|
-
import sys
|
5
|
-
|
6
|
-
"""see __init__.py for fault classes"""
|
7
|
-
|
8
|
-
|
9
|
-
class MissingColumnError(Exception):
|
10
|
-
"""Custom exception raised when a required column is missing or None."""
|
11
|
-
|
12
|
-
def __init__(self, message):
|
13
|
-
self.message = message
|
14
|
-
super().__init__(self.message)
|
15
|
-
|
16
|
-
|
17
|
-
class InvalidParameterError(Exception):
|
18
|
-
"""Custom exception raised when a parameter is not valid (e.g., not a float)."""
|
19
|
-
|
20
|
-
def __init__(self, message):
|
21
|
-
self.message = message
|
22
|
-
super().__init__(self.message)
|
23
|
-
|
24
|
-
|
25
|
-
class FaultCondition:
|
26
|
-
"""Parent class for Fault Conditions. Methods are inherited to all children."""
|
27
|
-
|
28
|
-
def __init__(self):
|
29
|
-
self.required_columns = []
|
30
|
-
|
31
|
-
def set_attributes(self, dict_):
|
32
|
-
"""Passes dictionary into initialization of class instance"""
|
33
|
-
for attribute in self.__dict__.keys():
|
34
|
-
upper = attribute.upper()
|
35
|
-
if upper in dict_:
|
36
|
-
value = dict_[upper]
|
37
|
-
self.__setattr__(attribute, value)
|
38
|
-
|
39
|
-
def check_required_columns(self, df: pd.DataFrame):
|
40
|
-
"""Checks if required columns are present in the DataFrame."""
|
41
|
-
missing_columns = [
|
42
|
-
col for col in self.required_columns if col is None or col not in df.columns
|
43
|
-
]
|
44
|
-
|
45
|
-
if missing_columns:
|
46
|
-
raise MissingColumnError(f"Missing required columns: {missing_columns}")
|
47
|
-
|
48
|
-
def troubleshoot_cols(self, df):
|
49
|
-
"""Print troubleshoot columns mapping."""
|
50
|
-
print("Troubleshoot mode enabled - not removing helper columns")
|
51
|
-
for col in df.columns:
|
52
|
-
print(
|
53
|
-
"df column: ",
|
54
|
-
col,
|
55
|
-
"- max: ",
|
56
|
-
df[col].max(),
|
57
|
-
"- col type: ",
|
58
|
-
df[col].dtypes,
|
59
|
-
)
|
60
|
-
sys.stdout.flush()
|
61
|
-
|
62
|
-
def check_analog_pct(self, df, columns):
|
63
|
-
"""Check analog outputs [data with units of %] are floats only."""
|
64
|
-
helper = HelperUtils()
|
65
|
-
for col in columns:
|
66
|
-
if not pdtypes.is_float_dtype(df[col]):
|
67
|
-
df = helper.convert_to_float(df, col)
|
68
|
-
if df[col].max() > 1.0:
|
69
|
-
raise TypeError(helper.float_max_check_err(col))
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import pandas as pd
|
2
|
-
import pandas.api.types as pdtypes
|
3
|
-
import sys
|
4
|
-
|
5
|
-
|
6
|
-
class SharedUtils:
|
7
|
-
@staticmethod
|
8
|
-
def float_int_check_err(col):
|
9
|
-
err_str = " column failed with a check that the data is a float"
|
10
|
-
return str(col) + err_str
|
11
|
-
|
12
|
-
@staticmethod
|
13
|
-
def float_max_check_err(col):
|
14
|
-
err_str = (
|
15
|
-
" column failed with a check that the data is a float between 0.0 and 1.0"
|
16
|
-
)
|
17
|
-
return str(col) + err_str
|
18
|
-
|
19
|
-
@staticmethod
|
20
|
-
def isfloat(num):
|
21
|
-
try:
|
22
|
-
float(num)
|
23
|
-
return True
|
24
|
-
except:
|
25
|
-
return False
|
26
|
-
|
27
|
-
@staticmethod
|
28
|
-
def isLessThanOnePointOne(num):
|
29
|
-
try:
|
30
|
-
if num <= 1.0:
|
31
|
-
return True
|
32
|
-
except:
|
33
|
-
return False
|
34
|
-
|
35
|
-
@staticmethod
|
36
|
-
def convert_to_float(df, col):
|
37
|
-
if not pdtypes.is_float_dtype(df[col]):
|
38
|
-
try:
|
39
|
-
df[col] = df[col].astype(float)
|
40
|
-
except ValueError:
|
41
|
-
raise TypeError(SharedUtils.float_int_check_err(col))
|
42
|
-
return df
|
43
|
-
|
44
|
-
@staticmethod
|
45
|
-
def apply_rolling_average_if_needed(df, freq="1min", rolling_window="5min"):
|
46
|
-
"""Apply rolling average if time difference between consecutive
|
47
|
-
timestamps is not greater than the specified frequency.
|
48
|
-
"""
|
49
|
-
|
50
|
-
print(
|
51
|
-
"Warning: If data has a one minute or less sampling \n"
|
52
|
-
"frequency a rolling average will be automatically applied"
|
53
|
-
)
|
54
|
-
|
55
|
-
sys.stdout.flush()
|
56
|
-
|
57
|
-
time_diff = df.index.to_series().diff().iloc[1:]
|
58
|
-
|
59
|
-
# Calculate median time difference to avoid being affected by outliers
|
60
|
-
median_diff = time_diff.median()
|
61
|
-
|
62
|
-
print(
|
63
|
-
f"Warning: Median time difference between consecutive timestamps is {median_diff}."
|
64
|
-
)
|
65
|
-
sys.stdout.flush()
|
66
|
-
|
67
|
-
if median_diff > pd.Timedelta(freq):
|
68
|
-
print(f"Warning: Skipping any rolling averaging...")
|
69
|
-
sys.stdout.flush()
|
70
|
-
|
71
|
-
else:
|
72
|
-
df = df.rolling(rolling_window).mean()
|
73
|
-
print(
|
74
|
-
f"Warning: A {rolling_window} rolling average has been applied to the data."
|
75
|
-
)
|
76
|
-
sys.stdout.flush()
|
77
|
-
return df
|
78
|
-
|
79
|
-
@staticmethod
|
80
|
-
def clean_nan_values(df: pd.DataFrame) -> pd.DataFrame:
|
81
|
-
for col in df.columns:
|
82
|
-
if df[col].isnull().any():
|
83
|
-
print(f"NaN values found in column: {col}")
|
84
|
-
|
85
|
-
# Remove rows with any NaN values, then forward and backfill
|
86
|
-
df = df.dropna().ffill().bfill()
|
87
|
-
print("DataFrame has been cleaned for NaNs")
|
88
|
-
print("and has also been forward and backfilled.")
|
89
|
-
sys.stdout.flush()
|
90
|
-
return df
|