open-fdd 0.1.0__tar.gz

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.
Files changed (85) hide show
  1. open_fdd-0.1.0/LICENSE +21 -0
  2. open_fdd-0.1.0/MANIFEST.in +2 -0
  3. open_fdd-0.1.0/PKG-INFO +65 -0
  4. open_fdd-0.1.0/README.md +48 -0
  5. open_fdd-0.1.0/open_fdd/__init__.py +39 -0
  6. open_fdd-0.1.0/open_fdd/air_handling_unit/__init__.py +0 -0
  7. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/__init__.py +0 -0
  8. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition.py +49 -0
  9. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_eight.py +67 -0
  10. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_eleven.py +68 -0
  11. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_fifteen.py +90 -0
  12. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_five.py +68 -0
  13. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_four.py +93 -0
  14. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_fourteen.py +80 -0
  15. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_nine.py +68 -0
  16. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_one.py +60 -0
  17. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_seven.py +55 -0
  18. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_six.py +120 -0
  19. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_ten.py +62 -0
  20. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_thirteen.py +66 -0
  21. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_three.py +58 -0
  22. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_twelve.py +71 -0
  23. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/fault_condition_two.py +61 -0
  24. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/helper_utils.py +191 -0
  25. open_fdd-0.1.0/open_fdd/air_handling_unit/faults/shared_utils.py +75 -0
  26. open_fdd-0.1.0/open_fdd/air_handling_unit/images/example1.jpg +0 -0
  27. open_fdd-0.1.0/open_fdd/air_handling_unit/images/example2.jpg +0 -0
  28. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc10_definition.png +0 -0
  29. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc11_definition.png +0 -0
  30. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc12_definition.png +0 -0
  31. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc13_definition.png +0 -0
  32. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc1_definition.png +0 -0
  33. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc1_report_screenshot_all.png +0 -0
  34. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc2_definition.png +0 -0
  35. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc3_definition.png +0 -0
  36. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc4_definition.png +0 -0
  37. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc5_definition.png +0 -0
  38. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc6_definition.png +0 -0
  39. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc7_definition.png +0 -0
  40. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc8_definition.png +0 -0
  41. open_fdd-0.1.0/open_fdd/air_handling_unit/images/fc9_definition.png +0 -0
  42. open_fdd-0.1.0/open_fdd/air_handling_unit/images/latex_generator.py +208 -0
  43. open_fdd-0.1.0/open_fdd/air_handling_unit/images/params.docx +0 -0
  44. open_fdd-0.1.0/open_fdd/air_handling_unit/images/params.pdf +0 -0
  45. open_fdd-0.1.0/open_fdd/air_handling_unit/images/plot_for_repo.png +0 -0
  46. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/__init__.py +0 -0
  47. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc1.py +115 -0
  48. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc10.py +126 -0
  49. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc11.py +128 -0
  50. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc12.py +126 -0
  51. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc13.py +126 -0
  52. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc14.py +124 -0
  53. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc15.py +124 -0
  54. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc2.py +119 -0
  55. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc3.py +119 -0
  56. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc4.py +148 -0
  57. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc5.py +132 -0
  58. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc6.py +156 -0
  59. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc7.py +124 -0
  60. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc8.py +118 -0
  61. open_fdd-0.1.0/open_fdd/air_handling_unit/reports/report_fc9.py +120 -0
  62. open_fdd-0.1.0/open_fdd/tests/__init__.py +0 -0
  63. open_fdd-0.1.0/open_fdd/tests/ahu/__init__.py +0 -0
  64. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc1.py +159 -0
  65. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc10.py +132 -0
  66. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc11.py +136 -0
  67. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc12.py +167 -0
  68. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc13.py +163 -0
  69. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc14.py +197 -0
  70. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc15.py +183 -0
  71. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc2.py +132 -0
  72. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc3.py +131 -0
  73. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc4.py +200 -0
  74. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc5.py +180 -0
  75. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc6.py +246 -0
  76. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc7.py +71 -0
  77. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc8.py +131 -0
  78. open_fdd-0.1.0/open_fdd/tests/ahu/test_ahu_fc9.py +136 -0
  79. open_fdd-0.1.0/open_fdd.egg-info/PKG-INFO +65 -0
  80. open_fdd-0.1.0/open_fdd.egg-info/SOURCES.txt +83 -0
  81. open_fdd-0.1.0/open_fdd.egg-info/dependency_links.txt +1 -0
  82. open_fdd-0.1.0/open_fdd.egg-info/requires.txt +3 -0
  83. open_fdd-0.1.0/open_fdd.egg-info/top_level.txt +1 -0
  84. open_fdd-0.1.0/setup.cfg +4 -0
  85. open_fdd-0.1.0/setup.py +28 -0
open_fdd-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 bbartling
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include README.md
2
+ include LICENSE
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.1
2
+ Name: open_fdd
3
+ Version: 0.1.0
4
+ Summary: A package for fault detection and diagnosis in HVAC systems
5
+ Home-page: https://github.com/bbartling/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
+
18
+ # open-fdd
19
+
20
+ ![CI](https://github.com/bbartling/open-fdd/actions/workflows/ci.yml/badge.svg?branch=master)
21
+ ![MIT License](https://img.shields.io/badge/license-MIT-green.svg)
22
+ ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
23
+
24
+
25
+ ![Alt text](open_fdd/air_handling_unit/images/plot_for_repo.png)
26
+
27
+ This is a Python-based Fault Detection and Diagnostics (FDD) tool for running fault equations inspired by ASHRAE and NIST standards for HVAC systems across historical datasets using the Pandas computing library. The tool evaluates various fault conditions and outputs fault flags as boolean columns within typical Pandas DataFrames. These fault flags indicate the presence (True) or absence (False) of specific issues identified by the fault equations. This approach integrates seamlessly into standard data science and computer science workflows, allowing for efficient analysis, visualization, and further processing of fault conditions within familiar data structures like DataFrames.
28
+
29
+
30
+ ## Getting Setup
31
+ * Some features may be broken or not work as expected while the project is undergoing a significant makeover to become installable from PyPI. The aim is to streamline the reporting processes and make them much easier to use. I appreciate your patience during this transition.
32
+
33
+ ```bash
34
+ git clone https://github.com/bbartling/open-fdd
35
+ cd open-fdd
36
+ ```
37
+ For now until this project is on PyPI as a Python library install `open-fdd` as a local python library.
38
+
39
+ ```bash
40
+ pip install .
41
+ ```
42
+ I am on Windows, using a version of Python 3.12, and run this project on SharePoint drives to make reports. Future examples could be Linux OS on a cloud machine for a more AFDD approach but in Windows OS world.
43
+
44
+ ```bash
45
+ py -m pip install .
46
+ ```
47
+
48
+ See the examples directory for Jupyter notebook tutorials as well as the `README` inside the `air_handling_unit` directory for parameter definitions. Coming soon more faults and reports for `vav_system` and `central_plants` and examples getting data from SQL databases.
49
+
50
+ ## Contribute
51
+ This project is a community-driven initiative, focusing on the development of free and open-source tools. I believe that Fault Detection and Diagnostics (FDD) should be free and accessible to anyone who wants to try it out, embodying the spirit of open-source philosophy. Additionally, this project aims to serve as an educational resource, empowering individuals to learn about and implement FDD in their own systems. As someone wisely said, `"Knowledge should be shared, not hoarded,"` and this project strives to put that wisdom into practice.
52
+
53
+ Got any ideas or questions? Submit a Git issue or start a Discussion...
54
+
55
+ ## License
56
+
57
+ 【MIT License】
58
+
59
+ Copyright 2024 Ben Bartling
60
+
61
+ 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:
62
+
63
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
64
+
65
+ 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,48 @@
1
+ # open-fdd
2
+
3
+ ![CI](https://github.com/bbartling/open-fdd/actions/workflows/ci.yml/badge.svg?branch=master)
4
+ ![MIT License](https://img.shields.io/badge/license-MIT-green.svg)
5
+ ![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
6
+
7
+
8
+ ![Alt text](open_fdd/air_handling_unit/images/plot_for_repo.png)
9
+
10
+ This is a Python-based Fault Detection and Diagnostics (FDD) tool for running fault equations inspired by ASHRAE and NIST standards for HVAC systems across historical datasets using the Pandas computing library. The tool evaluates various fault conditions and outputs fault flags as boolean columns within typical Pandas DataFrames. These fault flags indicate the presence (True) or absence (False) of specific issues identified by the fault equations. This approach integrates seamlessly into standard data science and computer science workflows, allowing for efficient analysis, visualization, and further processing of fault conditions within familiar data structures like DataFrames.
11
+
12
+
13
+ ## Getting Setup
14
+ * Some features may be broken or not work as expected while the project is undergoing a significant makeover to become installable from PyPI. The aim is to streamline the reporting processes and make them much easier to use. I appreciate your patience during this transition.
15
+
16
+ ```bash
17
+ git clone https://github.com/bbartling/open-fdd
18
+ cd open-fdd
19
+ ```
20
+ For now until this project is on PyPI as a Python library install `open-fdd` as a local python library.
21
+
22
+ ```bash
23
+ pip install .
24
+ ```
25
+ I am on Windows, using a version of Python 3.12, and run this project on SharePoint drives to make reports. Future examples could be Linux OS on a cloud machine for a more AFDD approach but in Windows OS world.
26
+
27
+ ```bash
28
+ py -m pip install .
29
+ ```
30
+
31
+ See the examples directory for Jupyter notebook tutorials as well as the `README` inside the `air_handling_unit` directory for parameter definitions. Coming soon more faults and reports for `vav_system` and `central_plants` and examples getting data from SQL databases.
32
+
33
+ ## Contribute
34
+ This project is a community-driven initiative, focusing on the development of free and open-source tools. I believe that Fault Detection and Diagnostics (FDD) should be free and accessible to anyone who wants to try it out, embodying the spirit of open-source philosophy. Additionally, this project aims to serve as an educational resource, empowering individuals to learn about and implement FDD in their own systems. As someone wisely said, `"Knowledge should be shared, not hoarded,"` and this project strives to put that wisdom into practice.
35
+
36
+ Got any ideas or questions? Submit a Git issue or start a Discussion...
37
+
38
+ ## License
39
+
40
+ 【MIT License】
41
+
42
+ Copyright 2024 Ben Bartling
43
+
44
+ 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:
45
+
46
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
47
+
48
+ 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,39 @@
1
+ """
2
+ open-fdd/ # Repository root
3
+ ├── open_fdd/ # Python package root
4
+ │ ├── __init__.py
5
+ │ ├── air_handling_unit/
6
+ │ │ ├── __init__.py
7
+ │ │ ├── faults/
8
+ │ │ │ ├── __init__.py
9
+ │ │ │ ├── helper_utils.pya
10
+ │ │ │ ├── fault_condition.py
11
+ │ │ │ ├── fault_condition_one.py
12
+ │ │ │ ├── fault_condition_two.py
13
+ │ │ │ └── ... # other fault conditions
14
+ │ │ ├── examples/
15
+ │ │ ├── reports/
16
+ │ │ │ ├── __init__.py
17
+ │ │ │ ├── base_report.py
18
+ │ │ │ ├── report_fc1.py
19
+ │ │ │ ├── report_fc2.py
20
+ │ │ │ └── ... # other reports
21
+ │ │ └── images/
22
+ │ │ ├── fc1_definition.png
23
+ │ │ ├── fc2_definition.png
24
+ │ │ └── ... # other images
25
+ │ ├── black_box/
26
+ │ │ └── ... # subject to change being experimental
27
+ ├── tests/
28
+ │ ├── __init__.py
29
+ │ ├── air_handling_unit/
30
+ │ │ ├── __init__.py
31
+ │ │ ├── test_ahu_fc1.py
32
+ │ │ ├── test_ahu_fc2.py
33
+ │ │ └── ... # other tests
34
+ ├── setup.py
35
+ ├── README.md
36
+ ├── LICENSE
37
+ └── requirements.txt
38
+
39
+ """
File without changes
@@ -0,0 +1,49 @@
1
+ import pandas.api.types as pdtypes
2
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
3
+ import sys
4
+
5
+
6
+ class FaultCondition:
7
+ """Parent class for Fault Conditions. Methods are inherited to all children."""
8
+
9
+ def set_attributes(self, dict_):
10
+ """Passes dictionary into initialization of class instance, then uses the attributes called out below in
11
+ attributes_dict to set only the attributes that match from dict_.
12
+
13
+ :param dict_: dictionary of all possible class attributes (loaded from config file)
14
+ """
15
+ for attribute in self.__dict__:
16
+ upper = attribute.upper()
17
+ value = dict_[upper]
18
+ self.__setattr__(attribute, value)
19
+
20
+ def troubleshoot_cols(self, df):
21
+ """print troubleshoot columns mapping
22
+
23
+ :param df:
24
+ :return:
25
+ """
26
+ print("Troubleshoot mode enabled - not removing helper columns")
27
+ for col in df.columns:
28
+ print(
29
+ "df column: ",
30
+ col,
31
+ "- max: ",
32
+ df[col].max(),
33
+ "- col type: ",
34
+ df[col].dtypes,
35
+ )
36
+ sys.stdout.flush()
37
+
38
+ def check_analog_pct(self, df, columns):
39
+ """check analog outputs [data with units of %] are floats only
40
+
41
+ :param columns:
42
+ :return:
43
+ """
44
+ helper = HelperUtils()
45
+ for col in columns:
46
+ if not pdtypes.is_float_dtype(df[col]):
47
+ df = helper.convert_to_float(df, col)
48
+ if df[col].max() > 1.0:
49
+ raise TypeError(helper.float_max_check_err(col))
@@ -0,0 +1,67 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ from open_fdd.air_handling_unit.faults.fault_condition import FaultCondition
4
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
5
+ import sys
6
+
7
+
8
+ class FaultConditionEight(FaultCondition):
9
+ """Class provides the definitions for Fault Condition 8.
10
+ Supply air temperature and mix air temperature should
11
+ be approx equal in economizer mode.
12
+ """
13
+
14
+ def __init__(self, dict_):
15
+ self.delta_t_supply_fan = float
16
+ self.mix_degf_err_thres = float
17
+ self.supply_degf_err_thres = float
18
+ self.ahu_min_oa_dpr = float
19
+ self.mat_col = str
20
+ self.sat_col = str
21
+ self.economizer_sig_col = str
22
+ self.cooling_sig_col = str
23
+ self.troubleshoot_mode = bool # default should be False
24
+ self.rolling_window_size = int
25
+
26
+ self.set_attributes(dict_)
27
+
28
+ def apply(self, df: pd.DataFrame) -> pd.DataFrame:
29
+ if self.troubleshoot_mode:
30
+ self.troubleshoot_cols(df)
31
+
32
+ # Check analog outputs [data with units of %] are floats only
33
+ columns_to_check = [
34
+ self.economizer_sig_col,
35
+ self.cooling_sig_col,
36
+ ]
37
+
38
+ self.check_analog_pct(df, columns_to_check)
39
+
40
+ df["sat_fan_mat"] = abs(
41
+ df[self.sat_col] - self.delta_t_supply_fan - df[self.mat_col]
42
+ )
43
+ df["sat_mat_sqrted"] = np.sqrt(
44
+ self.supply_degf_err_thres**2 + self.mix_degf_err_thres**2
45
+ )
46
+
47
+ df["combined_check"] = (
48
+ (df["sat_fan_mat"] > df["sat_mat_sqrted"])
49
+ & (df[self.economizer_sig_col] > self.ahu_min_oa_dpr)
50
+ & (df[self.cooling_sig_col] < 0.1)
51
+ )
52
+
53
+ # Rolling sum to count consecutive trues
54
+ rolling_sum = (
55
+ df["combined_check"].rolling(window=self.rolling_window_size).sum()
56
+ )
57
+ # Set flag to 1 if rolling sum equals the window size
58
+ df["fc8_flag"] = (rolling_sum >= self.rolling_window_size).astype(int)
59
+
60
+ if self.troubleshoot_mode:
61
+ print("Troubleshoot mode enabled - not removing helper columns")
62
+ sys.stdout.flush()
63
+ del df["sat_fan_mat"]
64
+ del df["sat_mat_sqrted"]
65
+ del df["combined_check"]
66
+
67
+ return df
@@ -0,0 +1,68 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ from open_fdd.air_handling_unit.faults.fault_condition import FaultCondition
4
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
5
+ import sys
6
+
7
+
8
+ class FaultConditionEleven(FaultCondition):
9
+ """Class provides the definitions for Fault Condition 11.
10
+ Outside air temperature too low for 100% outdoor
11
+ air cooling in economizer cooling mode.
12
+
13
+ Economizer performance fault
14
+ """
15
+
16
+ def __init__(self, dict_):
17
+ self.delta_t_supply_fan = float
18
+ self.outdoor_degf_err_thres = float
19
+ self.supply_degf_err_thres = float
20
+ self.sat_setpoint_col = str
21
+ self.oat_col = str
22
+ self.cooling_sig_col = str
23
+ self.economizer_sig_col = str
24
+ self.troubleshoot_mode = bool # default False
25
+ self.rolling_window_size = int
26
+
27
+ self.set_attributes(dict_)
28
+
29
+ def apply(self, df: pd.DataFrame) -> pd.DataFrame:
30
+ if self.troubleshoot_mode:
31
+ self.troubleshoot_cols(df)
32
+
33
+ # Check analog outputs [data with units of %] are floats only
34
+ columns_to_check = [
35
+ self.economizer_sig_col,
36
+ self.cooling_sig_col,
37
+ ]
38
+ self.check_analog_pct(df, columns_to_check)
39
+
40
+ df["oat_plus_oaterror"] = df[self.oat_col] + self.outdoor_degf_err_thres
41
+ df["satsp_delta_saterr"] = (
42
+ df[self.sat_setpoint_col]
43
+ - self.delta_t_supply_fan
44
+ - self.supply_degf_err_thres
45
+ )
46
+
47
+ df["combined_check"] = (
48
+ (df["oat_plus_oaterror"] < df["satsp_delta_saterr"])
49
+ # verify ahu is running in OS 3 clg mode in 100 OA
50
+ & (df[self.cooling_sig_col] > 0.01)
51
+ & (df[self.economizer_sig_col] > 0.9)
52
+ )
53
+
54
+ # Rolling sum to count consecutive trues
55
+ rolling_sum = (
56
+ df["combined_check"].rolling(window=self.rolling_window_size).sum()
57
+ )
58
+ # Set flag to 1 if rolling sum equals the window size
59
+ df["fc11_flag"] = (rolling_sum >= self.rolling_window_size).astype(int)
60
+
61
+ if self.troubleshoot_mode:
62
+ print("Troubleshoot mode enabled - not removing helper columns")
63
+ sys.stdout.flush()
64
+ del df["oat_plus_oaterror"]
65
+ del df["satsp_delta_saterr"]
66
+ del df["combined_check"]
67
+
68
+ return df
@@ -0,0 +1,90 @@
1
+ import pandas as pd
2
+ import numpy as np
3
+ from open_fdd.air_handling_unit.faults.fault_condition import FaultCondition
4
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
5
+ import sys
6
+
7
+
8
+ class FaultConditionFifteen(FaultCondition):
9
+ """Class provides the definitions for Fault Condition 15.
10
+ Temperature rise across inactive heating coi.
11
+ Requires coil leaving temp sensor.
12
+ """
13
+
14
+ def __init__(self, dict_):
15
+ self.delta_supply_fan = float
16
+ self.coil_temp_enter_err_thres = float
17
+ self.coil_temp_leav_err_thres = float
18
+ self.htg_coil_enter_temp_col = str
19
+ self.htg_coil_leave_temp_col = str
20
+ self.ahu_min_oa_dpr = float
21
+ self.cooling_sig_col = str
22
+ self.heating_sig_col = str
23
+ self.economizer_sig_col = str
24
+ self.supply_vfd_speed_col = str
25
+ self.troubleshoot_mode = bool # default to False
26
+ self.rolling_window_size = int
27
+
28
+ self.set_attributes(dict_)
29
+
30
+ def apply(self, df: pd.DataFrame) -> pd.DataFrame:
31
+ if self.troubleshoot_mode:
32
+ self.troubleshoot_cols(df)
33
+
34
+ # Check analog outputs [data with units of %] are floats only
35
+ columns_to_check = [
36
+ self.economizer_sig_col,
37
+ self.cooling_sig_col,
38
+ self.heating_sig_col,
39
+ self.supply_vfd_speed_col,
40
+ ]
41
+ self.check_analog_pct(df, columns_to_check)
42
+
43
+ # Create helper columns
44
+ df["htg_delta_temp"] = (
45
+ df[self.htg_coil_leave_temp_col] - df[self.htg_coil_enter_temp_col]
46
+ )
47
+
48
+ df["htg_delta_sqrted"] = (
49
+ np.sqrt(
50
+ self.coil_temp_enter_err_thres**2 + self.coil_temp_leav_err_thres**2
51
+ )
52
+ + self.delta_supply_fan
53
+ )
54
+
55
+ df["combined_check"] = (
56
+ (
57
+ (df["htg_delta_temp"] >= df["htg_delta_sqrted"])
58
+ # verify AHU is in OS2 only free cooling mode
59
+ & (df[self.economizer_sig_col] > self.ahu_min_oa_dpr)
60
+ & (df[self.cooling_sig_col] < 0.1)
61
+ )
62
+ | (
63
+ (df["htg_delta_temp"] >= df["htg_delta_sqrted"])
64
+ # OS4 AHU state clg @ min OA
65
+ & (df[self.cooling_sig_col] > 0.01)
66
+ & (df[self.economizer_sig_col] == self.ahu_min_oa_dpr)
67
+ )
68
+ | (
69
+ (df["htg_delta_temp"] >= df["htg_delta_sqrted"])
70
+ # verify AHU is running in OS 3 clg mode in 100 OA
71
+ & (df[self.cooling_sig_col] > 0.01)
72
+ & (df[self.economizer_sig_col] > 0.9)
73
+ )
74
+ )
75
+
76
+ # Rolling sum to count consecutive trues
77
+ rolling_sum = (
78
+ df["combined_check"].rolling(window=self.rolling_window_size).sum()
79
+ )
80
+ # Set flag to 1 if rolling sum equals the window size
81
+ df["fc15_flag"] = (rolling_sum >= self.rolling_window_size).astype(int)
82
+
83
+ if self.troubleshoot_mode:
84
+ print("Troubleshoot mode enabled - not removing helper columns")
85
+ sys.stdout.flush()
86
+ del df["htg_delta_temp"]
87
+ del df["htg_delta_sqrted"]
88
+ del df["combined_check"]
89
+
90
+ return df
@@ -0,0 +1,68 @@
1
+ import pandas as pd
2
+ import pandas.api.types as pdtypes
3
+ from open_fdd.air_handling_unit.faults.fault_condition import FaultCondition
4
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
5
+ import sys
6
+
7
+
8
+ class FaultConditionFive(FaultCondition):
9
+ """Class provides the definitions for Fault Condition 5.
10
+ SAT too low; should be higher than MAT in HTG MODE
11
+ --Broken heating valve or other mechanical issue
12
+ related to heat valve not working as designed
13
+ """
14
+
15
+ def __init__(self, dict_):
16
+ self.mix_degf_err_thres = float
17
+ self.supply_degf_err_thres = float
18
+ self.delta_t_supply_fan = float
19
+ self.mat_col = str
20
+ self.sat_col = str
21
+ self.heating_sig_col = str
22
+ self.supply_vfd_speed_col = str
23
+ self.troubleshoot_mode = bool # default to False
24
+ self.rolling_window_size = int
25
+
26
+ self.set_attributes(dict_)
27
+
28
+ # fault only active if fan is running and htg vlv is modulating
29
+ # OS 1 is heating mode only fault
30
+ def apply(self, df: pd.DataFrame) -> pd.DataFrame:
31
+ if self.troubleshoot_mode:
32
+ self.troubleshoot_cols(df)
33
+
34
+ # check analog outputs [data with units of %] are floats only
35
+ columns_to_check = [self.supply_vfd_speed_col, self.heating_sig_col]
36
+
37
+ for col in columns_to_check:
38
+ self.check_analog_pct(df, [col])
39
+
40
+ df["sat_check"] = df[self.sat_col] + self.supply_degf_err_thres
41
+ df["mat_check"] = (
42
+ df[self.mat_col] - self.mix_degf_err_thres + self.delta_t_supply_fan
43
+ )
44
+
45
+ df["combined_check"] = (
46
+ (df["sat_check"] <= df["mat_check"])
47
+ # this is to make fault only active in OS1 for htg mode only
48
+ # and fan is running. Some control programming may use htg
49
+ # vlv when AHU is off to prevent low limit freeze alarms
50
+ & (df[self.heating_sig_col] > 0.01)
51
+ & (df[self.supply_vfd_speed_col] > 0.01)
52
+ )
53
+
54
+ # Rolling sum to count consecutive trues
55
+ rolling_sum = (
56
+ df["combined_check"].rolling(window=self.rolling_window_size).sum()
57
+ )
58
+ # Set flag to 1 if rolling sum equals the window size
59
+ df["fc5_flag"] = (rolling_sum == self.rolling_window_size).astype(int)
60
+
61
+ if self.troubleshoot_mode:
62
+ print("Troubleshoot mode enabled - not removing helper columns")
63
+ sys.stdout.flush()
64
+ del df["mat_check"]
65
+ del df["sat_check"]
66
+ del df["combined_check"]
67
+
68
+ return df
@@ -0,0 +1,93 @@
1
+ import pandas as pd
2
+ from open_fdd.air_handling_unit.faults.fault_condition import FaultCondition
3
+ from open_fdd.air_handling_unit.faults.helper_utils import HelperUtils
4
+ import sys
5
+
6
+
7
+ class FaultConditionFour(FaultCondition):
8
+ """Class provides the definitions for Fault Condition 4.
9
+
10
+ This fault flags excessive operating states on the AHU
11
+ if its hunting between heating, econ, econ+mech, and
12
+ a mech clg modes. The code counts how many operating
13
+ changes in an hour and will throw a fault if there is
14
+ excessive OS changes to flag control sys hunting.
15
+
16
+ """
17
+
18
+ def __init__(self, dict_):
19
+ self.delta_os_max = float
20
+ self.ahu_min_oa_dpr = float
21
+ self.economizer_sig_col = str
22
+ self.heating_sig_col = str
23
+ self.cooling_sig_col = str
24
+ self.supply_vfd_speed_col = str
25
+ self.troubleshoot_mode = bool # default to False
26
+
27
+ self.set_attributes(dict_)
28
+
29
+ # adds in these boolean columns to the dataframe
30
+ def apply(self, df: pd.DataFrame) -> pd.DataFrame:
31
+ if self.troubleshoot_mode:
32
+ self.troubleshoot_cols(df)
33
+
34
+ # check analog outputs [data with units of %] are floats only
35
+ columns_to_check = [
36
+ self.economizer_sig_col,
37
+ self.heating_sig_col,
38
+ self.cooling_sig_col,
39
+ self.supply_vfd_speed_col,
40
+ ]
41
+
42
+ for col in columns_to_check:
43
+ self.check_analog_pct(df, [col])
44
+
45
+ print("=" * 50)
46
+ print("Warning: The program is in FC4 and resampling the data")
47
+ print("to compute AHU OS state changes per hour")
48
+ print("to flag any hunting issue")
49
+ print("and this usually takes a while to run...")
50
+ print("=" * 50)
51
+
52
+ sys.stdout.flush()
53
+
54
+ # AHU htg only mode based on OA damper @ min oa and only htg pid/vlv modulating
55
+ df["heating_mode"] = (
56
+ (df[self.heating_sig_col] > 0)
57
+ & (df[self.cooling_sig_col] == 0)
58
+ & (df[self.supply_vfd_speed_col] > 0)
59
+ & (df[self.economizer_sig_col] == self.ahu_min_oa_dpr)
60
+ )
61
+
62
+ # AHU econ only mode based on OA damper modulating and clg htg = zero
63
+ df["econ_only_cooling_mode"] = (
64
+ (df[self.heating_sig_col] == 0)
65
+ & (df[self.cooling_sig_col] == 0)
66
+ & (df[self.supply_vfd_speed_col] > 0)
67
+ & (df[self.economizer_sig_col] > self.ahu_min_oa_dpr)
68
+ )
69
+
70
+ # AHU econ+mech clg mode based on OA damper modulating for cooling and clg pid/vlv modulating
71
+ df["econ_plus_mech_cooling_mode"] = (
72
+ (df[self.heating_sig_col] == 0)
73
+ & (df[self.cooling_sig_col] > 0)
74
+ & (df[self.supply_vfd_speed_col] > 0)
75
+ & (df[self.economizer_sig_col] > self.ahu_min_oa_dpr)
76
+ )
77
+
78
+ # AHU mech mode based on OA damper @ min OA and clg pid/vlv modulating
79
+ df["mech_cooling_only_mode"] = (
80
+ (df[self.heating_sig_col] == 0)
81
+ & (df[self.cooling_sig_col] > 0)
82
+ & (df[self.supply_vfd_speed_col] > 0)
83
+ & (df[self.economizer_sig_col] == self.ahu_min_oa_dpr)
84
+ )
85
+
86
+ # Fill non-finite values with zero or drop them
87
+ df = df.fillna(0)
88
+
89
+ df = df.astype(int)
90
+ df = df.resample("60min").apply(lambda x: (x.eq(1) & x.shift().ne(1)).sum())
91
+
92
+ df["fc4_flag"] = df[df.columns].gt(self.delta_os_max).any(axis=1).astype(int)
93
+ return df