program/README.md

141 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 神东煤炭综采工作面数据管理与AI分析系统
## 系统概述
本系统是针对神东煤炭集团综采工作面设计的数据采集、管理和AI智能分析平台。系统通过工业以太网实时采集采煤机、三机、泵站、开关等设备运行数据存储到MySQL数据库并利用AI大模型进行故障诊断和趋势分析最终生成专业的Word运维报告。
## 功能特性
- **数据采集**:从工业以太网批量采集综采工作面各设备运行参数
- **实时监测**:查看工作面设备实时运行数据,支持设备筛选和搜索
- **AI故障诊断**利用AI大模型对实时数据进行故障识别、原因分析和维修建议
- **AI趋势分析**:对历史数据进行趋势分析,预测设备状态变化
- **报告生成**生成Word格式的运维分析报告支持数据报告、AI分析报告和完整报告
- **多模型支持**支持Qwen、GLM、DeepSeek、GPT、通义千问等多种AI模型
## 技术架构
```
├── app.py # Flask应用入口
├── config.py # 配置文件
├── database.py # MySQL数据库操作
├── collector.py # 数据采集模块
├── ai_analyzer.py # AI分析模块
├── reports.py # Word报告生成
├── routes.py # RESTful API路由
├── requirements.txt # Python依赖
├── static/ # 前端静态文件
│ ├── index.html # 主页面
│ ├── css/
│ │ └── style.css # 样式文件
│ └── js/
│ └── app.js # 前端逻辑
└── outputs/ # 报告输出目录
```
## 环境要求
- Python 3.8+
- MySQL 5.7+
- 网络访问AI大模型API可选
## 安装部署
### 1. 安装依赖
```bash
pip install -r requirements.txt
```
### 2. 配置数据库
修改 `config.py` 中的数据库配置:
```python
MYSQL_HOST = 'your_mysql_host'
MYSQL_PORT = 3306
MYSQL_USER = 'your_mysql_user'
MYSQL_PASSWORD = 'your_mysql_password'
MYSQL_DATABASE = 'mining_data'
```
### 3. 初始化数据库
系统首次启动时会自动创建数据库表结构。
### 4. 配置AI模型可选
`config.py` 中配置AI模型API
```python
AI_MODELS = [
{
'key': 'qwen',
'name': '通义千问',
'api_url': 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions',
'api_key': 'your_api_key'
},
# 更多模型配置...
]
```
### 5. 配置工业以太网接口
```python
INDUSTRIAL_NET_API = {
'api_url': 'http://your_api_host:port/api',
'user_handle': 'your_user_handle'
}
```
## 启动服务
```bash
python app.py
```
服务默认运行在 `http://localhost:5000`
## API接口
### 单位管理
- `GET /api/units` - 获取所有工作面列表
- `GET /api/units/<code>` - 获取指定工作面信息
- `GET /api/units/<code>/tags` - 获取标签列表
### 数据采集
- `POST /api/collect` - 单工作面采集
- `POST /api/collect/all` - 全量采集
### 数据查询
- `GET /api/snapshot/<code>` - 最新快照
- `GET /api/realtime/<code>` - 实时数据
- `GET /api/history` - 历史数据
### AI分析
- `POST /api/ai/fault` - 故障诊断
- `POST /api/ai/trend` - 趋势分析
- `GET /api/ai/models` - 可用模型列表
### 报告生成
- `POST /api/report/word` - 生成Word报告
- `GET /api/report/download/<filename>` - 下载报告
## 数据库设计
### 主要表结构
- **mine_units** - 工作面单位信息
- **tag_registry** - 标签注册表
- **data_snapshots** - 数据快照
- **data_snapshot_items** - 快照数据项
- **ai_analysis_history** - AI分析记录
## 开发团队
神东煤炭集团 | 大柳塔煤矿