2026-04-06 08:55:27 +08:00
|
|
|
# Tianpu Daxing Park EMS (tp-ems)
|
|
|
|
|
|
|
|
|
|
> Tianpu Daxing Zero-Carbon Park Smart Energy Management System
|
|
|
|
|
|
|
|
|
|
**Current Version: 1.2.0** | Core: 1.1.0 | See `VERSIONS.json`
|
|
|
|
|
|
|
|
|
|
Customer project for Tianpu Daxing Zero-Carbon Park, built on [ems-core](http://100.69.143.96:3300/tianpu/ems-core).
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Directory Structure
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
tp-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/tianpu/ # Customer configuration
|
|
|
|
|
| +-- config.yaml # Branding and feature flags
|
|
|
|
|
| +-- devices.json # Device inventory
|
|
|
|
|
| +-- pricing.json # Electricity pricing
|
|
|
|
|
| +-- hooks/ # Customer hooks plugin
|
|
|
|
|
+-- backend/ # Backend customer overrides
|
|
|
|
|
+-- scripts/ # Data seeding scripts
|
|
|
|
|
| +-- seed_data.py # Tianpu seed data
|
|
|
|
|
+-- docker-compose.override.yml # Customer Docker overrides
|
|
|
|
|
+-- docker-compose.ports.yml # Port configuration
|
|
|
|
|
+-- VERSIONS.json # Version tracking
|
|
|
|
|
+-- .env.example # Environment variables template
|
2026-04-04 18:18:48 +08:00
|
|
|
```
|
2026-04-06 08:55:27 +08:00
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Quick Start (Docker)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Configure environment
|
|
|
|
|
cp .env.example .env
|
|
|
|
|
# Edit .env with your settings
|
|
|
|
|
|
|
|
|
|
# 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_data.py
|
2026-04-04 18:18:48 +08:00
|
|
|
```
|
|
|
|
|
|
2026-04-06 08:55:27 +08:00
|
|
|
### 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
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## 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.
|