docs: rewrite README with correct structure, Docker deploy, v1.2.0
- Add frontend/ directory (was missing from structure) - Fix frontend path from core/frontend to ./frontend - Fix .env copy path from core/backend/.env to root .env - Add Docker deployment as primary method - Add hooks/ to customer config listing - Add version info referencing VERSIONS.json - Update subtree pull command with correct Gitea URL Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
147
README.md
147
README.md
@@ -1,40 +1,125 @@
|
|||||||
# 中关村医疗器械园 智慧能源管理平台 (zpark-ems)
|
# Z-Park Medical Device Hub EMS (zpark-ems)
|
||||||
|
|
||||||
## 项目说明
|
> Z-Park Medical Device Hub Smart Energy Management System
|
||||||
中关村医疗器械园EMS客户定制项目,基于 ems-core 标准产品。
|
|
||||||
|
|
||||||
## 园区特点
|
**Current Version: 1.2.0** | Core: 1.1.0 | See `VERSIONS.json`
|
||||||
- 光伏为主:4,561块太阳能板,分布在22+栋建筑
|
|
||||||
- 阳光电源组串式逆变器:AP101-AP208,10台
|
|
||||||
- 直流汇流箱:49台
|
|
||||||
- 数据采集:通过阳光电源 iSolarCloud API
|
|
||||||
|
|
||||||
## 目录结构
|
Customer project for Z-Park Medical Device Hub (中关村医疗器械园), built on [ems-core](http://100.69.143.96:3300/tianpu/ems-core).
|
||||||
- `core/` — EMS核心代码(通过git subtree引入,勿直接修改)
|
|
||||||
- `customers/zpark/` — Z-Park专属配置
|
|
||||||
- `config.yaml` — 品牌配置和功能开关
|
|
||||||
- `devices.json` — 阳光电源逆变器和汇流箱设备清单
|
|
||||||
- `pricing.json` — 北京工商业分时电价
|
|
||||||
- `scripts/` — Z-Park数据初始化脚本
|
|
||||||
- `.env.example` — 环境变量模板(含阳光电源API配置)
|
|
||||||
|
|
||||||
## 快速开始
|
---
|
||||||
1. 复制环境配置:`cp .env.example core/backend/.env`
|
|
||||||
2. 安装后端依赖:`cd core/backend && pip install -r requirements.txt`
|
|
||||||
3. 初始化数据库:`cd core/backend && python -m alembic upgrade head`
|
|
||||||
4. 导入种子数据:`python scripts/seed_zpark.py`
|
|
||||||
5. 启动后端:`cd core/backend && python -m uvicorn app.main:app --port 8000 --reload`
|
|
||||||
6. 启动前端:`cd core/frontend && npm install && npm run dev`
|
|
||||||
7. 访问:http://localhost:3000(admin / admin123)
|
|
||||||
|
|
||||||
## 阳光电源API配置
|
## Park Characteristics
|
||||||
在 `.env` 中填入阳光电源 iSolarCloud API 凭证后,设置 `USE_SIMULATOR=false` 即可接入真实数据。
|
|
||||||
|
- PV-focused: 4,561 solar panels across 22+ buildings
|
||||||
|
- Sungrow string inverters: AP101-AP208, 10 units
|
||||||
|
- DC combiner boxes: 49 units
|
||||||
|
- Data collection: Sungrow iSolarCloud API
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
|
||||||
## 更新核心代码
|
|
||||||
当 ems-core 发布新版本时:
|
|
||||||
```
|
```
|
||||||
git subtree pull --prefix=core http://192.168.1.77:3300/tianpu/ems-core.git v1.1.0 --squash
|
zpark-ems/
|
||||||
|
+-- core/ # EMS core (git subtree, DO NOT modify directly)
|
||||||
|
+-- frontend/ # Customer frontend (React/TypeScript)
|
||||||
|
| +-- src/ # React source code
|
||||||
|
| +-- Dockerfile # Frontend container
|
||||||
|
| +-- package.json
|
||||||
|
| +-- vite.config.ts
|
||||||
|
+-- customers/zpark/ # Customer configuration
|
||||||
|
| +-- config.yaml # Branding and feature flags
|
||||||
|
| +-- devices.json # Sungrow inverter & combiner box inventory
|
||||||
|
| +-- pricing.json # Beijing C&I time-of-use pricing
|
||||||
|
| +-- hooks/ # Customer hooks plugin (zpark_hooks.py)
|
||||||
|
+-- scripts/ # Data seeding scripts
|
||||||
|
| +-- seed_zpark.py # Z-Park seed data
|
||||||
|
+-- docker-compose.override.yml # Customer Docker overrides
|
||||||
|
+-- docker-compose.ports.yml # Port configuration
|
||||||
|
+-- VERSIONS.json # Version tracking
|
||||||
|
+-- .env.example # Environment variables template (incl. Sungrow API)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 当前核心版本
|
---
|
||||||
查看 `core/VERSION` 文件。
|
|
||||||
|
## Quick Start (Docker)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure environment
|
||||||
|
cp .env.example .env
|
||||||
|
# Edit .env — fill in Sungrow iSolarCloud API credentials
|
||||||
|
|
||||||
|
# Start all services
|
||||||
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml up -d
|
||||||
|
|
||||||
|
# Seed data
|
||||||
|
docker compose -f core/docker-compose.yml -f docker-compose.override.yml exec backend python scripts/seed_zpark.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### Access
|
||||||
|
|
||||||
|
| Service | URL |
|
||||||
|
|---------|-----|
|
||||||
|
| Frontend | http://localhost:3000 |
|
||||||
|
| Backend API | http://localhost:8000 |
|
||||||
|
| API Docs | http://localhost:8000/docs |
|
||||||
|
|
||||||
|
### Default Login
|
||||||
|
|
||||||
|
| Role | Username | Password |
|
||||||
|
|------|----------|----------|
|
||||||
|
| Admin | admin | admin123 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Local Development
|
||||||
|
|
||||||
|
### Backend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd core/backend
|
||||||
|
python -m venv venv
|
||||||
|
source venv/bin/activate # Windows: venv\Scripts\activate
|
||||||
|
pip install -r requirements.txt
|
||||||
|
python -m alembic upgrade head
|
||||||
|
uvicorn app.main:app --port 8000 --reload
|
||||||
|
```
|
||||||
|
|
||||||
|
### Frontend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd frontend
|
||||||
|
npm install
|
||||||
|
npm run dev
|
||||||
|
# Opens at http://localhost:3000, proxies /api to localhost:8000
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sungrow API Configuration
|
||||||
|
|
||||||
|
Fill in Sungrow iSolarCloud API credentials in `.env`, then set `USE_SIMULATOR=false` to connect to real data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Updating Core
|
||||||
|
|
||||||
|
When ems-core releases a new version:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git subtree pull --prefix=core ems-core main --squash
|
||||||
|
```
|
||||||
|
|
||||||
|
Make sure the `ems-core` remote is configured:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git remote add ems-core http://100.69.143.96:3300/tianpu/ems-core.git
|
||||||
|
```
|
||||||
|
|
||||||
|
After pulling, update `core_version` in `VERSIONS.json`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Copyright 2026. All rights reserved.
|
||||||
|
|||||||
Reference in New Issue
Block a user