Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DreamSeed 种梦计划参赛作品


🏗️ AI 建筑设备故障预测系统

Building Predictive Maintenance System

Building Predictive Maintenance Banner

AI 驱动的建筑设备健康监测与故障预测系统
AI-Powered Equipment Health Monitoring & Fault Prediction System

Python 3.10+ License MIT Status Beta PRs Welcome


📖 项目简介 | Introduction

AI 建筑设备故障预测系统 是一个面向建筑智能化行业(BA 系统、DDC 控制器、设备运维)的开源预测性维护解决方案。系统通过机器学习算法分析设备传感器数据,实现异常检测、故障诊断和剩余寿命预测,帮助运维团队实现从"被动维修"到"主动维护"的转变。

English: Building Predictive Maintenance is an open-source predictive maintenance solution for the building automation industry. It analyzes equipment sensor data using machine learning to detect anomalies, diagnose faults, and predict remaining useful life (RUL), helping facility teams shift from reactive repairs to proactive maintenance.

✨ 核心功能 | Features

功能 描述
📊 设备健康度仪表盘 红黄绿灯状态直观展示,多设备概览
🔍 异常检测 Isolation Forest + 规则引擎双重检测
🔧 故障类型分类 基于专家规则的故障模式匹配
剩余寿命预测 Weibull + ML 混合方法预测 RUL
💡 维护策略推荐 根据 RUL 自动推荐维护动作

🏭 支持的设备类型 | Supported Equipment

设备 英文 传感器 故障模式
❄️ 冷水机组 Chiller 温度、振动、压力、电流、流量 压缩机故障、冷凝器脏堵、制冷剂泄漏、蒸发器结垢
💧 水泵 Pump 同上 轴承磨损、叶轮腐蚀、机械密封泄漏、电机过热
🌀 风机 Fan 同上 皮带磨损、轴承过热、叶轮不平衡、电机故障
🏭 冷却塔 Cooling Tower 同上 风扇故障、填料老化、水位异常、布水器堵塞
🌬️ AHU Air Handling Unit 同上 过滤器堵塞、盘管结垢、风阀卡滞、加湿器故障

🚀 快速开始 | Quick Start

环境要求 | Prerequisites

  • Python 3.9+
  • pip / conda

安装 | Installation

# 克隆仓库
git clone https://github.com/c50346867/building-predictive-maintenance.git
cd building-predictive-maintenance

# 创建虚拟环境(推荐)
python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

# 安装依赖
pip install -r requirements.txt

运行演示 | Run Demo

# 运行控制台演示
python examples/demo.py

# 启动 Streamlit 仪表盘
streamlit run frontend/app.py

# 启动 FastAPI 后端(可选)
uvicorn backend.api.main:app --reload

📁 项目结构 | Project Structure

building-predictive-maintenance/
├── backend/
│   ├── api/
│   │   └── main.py              # FastAPI 后端服务
│   └── core/
│       ├── anomaly_detector.py  # 异常检测器 (Isolation Forest)
│       ├── rul_predictor.py     # 剩余寿命预测器
│       ├── fault_classifier.py  # 故障类型分类器
│       └── simulator.py         # 设备传感器数据模拟器
├── frontend/
│   └── app.py                   # Streamlit 仪表盘
├── examples/
│   └── demo.py                  # 使用示例
├── data/
│   └── sample_sensor_data.csv   # 示例传感器数据
├── docs/
│   └── banner.svg               # 项目头图
├── tests/
│   └── test_core.py             # 单元测试
├── pyproject.toml               # 项目配置
├── requirements.txt             # Python 依赖
├── LICENSE                      # MIT 许可证
└── README.md                    # 项目文档

🧠 核心算法 | Core Algorithms

🔍 异常检测 (Anomaly Detection)

基于 Isolation Forest 算法的无监督异常检测,配合基于阈值的规则引擎:

from backend.core.anomaly_detector import AnomalyDetector

detector = AnomalyDetector(contamination=0.1)
detector.fit(sensor_data)
result = detector.analyze(sensor_data)

⏳ 剩余寿命预测 (RUL Prediction)

Weibull + ML 混合方法,支持三种退化模型:

from backend.core.rul_predictor import RULPredictor

predictor = RULPredictor(model_type="exponential")
predictor.fit_degradation_model(timestamps, sensor_values)
rul = predictor.predict_rul_with_confidence()

🔧 故障分类 (Fault Classification)

基于专家知识库的规则匹配系统,覆盖 5 类设备 20 种故障模式:

from backend.core.fault_classifier import FaultClassifier

classifier = FaultClassifier()
faults = classifier.classify("冷水机组", sensor_readings)

🖥️ API 文档 | API Reference

启动后端服务后访问 http://localhost:8000/docs 查看完整的 Swagger 文档。

端点 方法 说明
/health GET 健康检查
/api/v1/equipment/types GET 设备类型列表
/api/v1/equipment/thresholds/{type} GET 设备阈值
/api/v1/simulate POST 模拟数据生成
/api/v1/detect/anomaly POST 异常检测
/api/v1/detect/anomaly/rule-based POST 规则检测
/api/v1/predict/rul POST RUL 预测
/api/v1/classify/fault POST 故障分类
/api/v1/diagnose POST 完整诊断

📊 仪表盘功�� | Dashboard Features

Streamlit 仪表盘提供:

  • 💚 设备健康度仪表盘 — 红黄绿灯 + 趋势图
  • 📡 实时传感器监测 — 5 种传感器时序数据 + 阈值标注
  • 🚨 故障预警列表 — 提前 7-14 天告警
  • RUL 剩余寿命倒计时 — 带置信区间
  • 💡 维护策略推荐 — 根据 RUL 自动生成

🧪 测试 | Testing

# 运行所有测试
python -m pytest tests/ -v

# 带覆盖率报告
python -m pytest tests/ --cov=backend --cov-report=term-missing

# 直接运行测试文件
python tests/test_core.py

🤝 贡献指南 | Contributing

欢迎贡献代码、提交 Issue 或改进文档!

  1. Fork 本仓库
  2. 创建特性分支 (git checkout -b feature/amazing-feature)
  3. 提交修改 (git commit -m 'Add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

开发规范 | Development Standards

  • 所有 Python 文件要求 UTF-8 编码 (# -*- coding: utf-8 -*-)
  • 遵循 PEP 8 编码规范
  • 新功能需包含单元测试
  • 文档需提供中英文双语

📈 路线图 | Roadmap

  • 数据模拟器(5 类设备)
  • Isolation Forest 异常检测
  • 专家规则故障分类
  • RUL 预测(3 种退化模型)
  • Streamlit 仪表盘
  • FastAPI 后端服务
  • 深度学习异常检测(AutoEncoder / LSTM)
  • 多设备关联分析
  • 实时数据接入(MQTT / BACnet)
  • 移动端适配
  • 历史数据导入导出

📄 许可证 | License

本项目采用 MIT 许可证 — 详见 LICENSE 文件。


📬 联系方式 | Contact

  • 项目维护者:大虾 🦐
  • 技术交流:欢迎提交 Issue 和 Discussion

Built with ❤️ for the building automation industry
为建筑智能化行业打造的故障预测系统

About

AI building equipment predictive maintenance - AI 建筑设备故障预测与运维系统

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages