MyEMS Architecture Design Document
Download: MyEMS开源能源管理系统架构设计文档.pdf
| Item | Content |
|---|---|
| Document | MyEMS Open-Source Energy Management System Architecture Design |
| Document version | 6.9.0 |
| System version | Community Edition v6.9.0 |
| Prepared by | Beijing Haisoft Software Co., Ltd. |
| Date | October 2026 |
This document describes the overall architecture, component boundaries, data organization, interface conventions, and deployment shape of MyEMS Community Edition, based on the actual code layout and database structure. Where this document disagrees with the source code or the official docs, the source code and the official docs prevail.
1 Introduction
1.1 Purpose
The document is a shared technical baseline for architecture review, implementation, operations, and extension. It does two things:
- It pulls the website feature notes, component READMEs, and the database design into one architecture view, so implementers do not have to reconstruct the system only by reading source code.
- It states the trade-offs, so readers know which boundaries can be extended and which ones, once broken, ripple across many components.
This document does not replace the installation guide or the API manual.
1.2 Scope and readers
The document covers all 11 Community Edition components (including the database) and the 13 business databases. It does not describe Enterprise Edition features in implementation detail.
| Reader | Suggested chapters |
|---|---|
| Technical leads and architects | Chapters 3, 4, 6, and 11, for technology choices and extension boundaries |
| Implementation and operations engineers | Chapters 5, 7, 9, and 10, for deployment, troubleshooting, and capacity |
| Developers extending the system | Chapters 5, 6, 8, and 12, for integration and new features |
Performance and capacity figures are estimates from the data structures and service shape. They have not been measured under production load. Those paragraphs are marked as estimates.
1.3 Terms
| Term | Meaning in the system |
|---|---|
| Energy category | A metered energy type, such as electricity, water, natural gas, chilled/hot water, or steam. It carries the unit of measure plus kgce and kgCO2e factors. Table: tbl_energy_categories |
| Energy item | Use-based breakdown under a category, such as HVAC, power, or lighting. Table: tbl_energy_items |
| Space | The hierarchy that organizes energy data (campus, building, floor, room). A self-reference on parent_space_id forms the tree, which is the usual filter for reports |
| Meter | The smallest business unit of metering. It binds one energy category; its points hold the readings. Offline meters (manual entry) and virtual meters (expression) are derived forms |
| Point | The smallest collected value. Types are analog, digital, energy, and text. object_type and object_id attach a point to a meter or equipment |
| Data source | A group of targets that share a protocol and connection. The connection field stores address and interval as JSON |
| Combined equipment | A system made of several pieces of equipment and meters (for example a chiller plant), used to account for input and output energy |
| 8760 model | An annual hourly model (8,760 hours). Table names end with _8760. Used for forecasting and budgeting |
| kgce / kgco2e | Kilograms of coal equivalent and kilograms of CO2 equivalent, the common conversion basis for energy and carbon |
This table is a reading aid, not a data dictionary. Field-level definitions are in Chapter 6 and the database design document.
1.4 References
- MyEMS website: https://myems.cn
- MyEMS repository (Gitee): https://gitee.com/myems/myems
- Community Edition feature list
- Introduction and compatibility list
- Database design document
- API manual
- Docker Compose installation guide
- Administrator manual
- GB/T 23331-2020, Energy management systems — Requirements with guidance for use (identical to ISO 50001:2018). Published 2020-11-19, effective 2021-06-01.
2 System overview
2.1 Positioning
MyEMS is an open-source energy management system for energy-using organizations. It follows GB/T 23331-2020 (ISO 50001:2018) and covers collection, analysis, and reporting of electricity, water, gas, cooling, and heat for buildings, factories, malls, hospitals, campuses, and energy-carbon centers. It keeps three accounting lines: energy, cost, and carbon. Public materials cite more than a thousand project cases and CMA testing. The code is MIT-licensed. The Community Edition requires the copyright notice and logo to be kept.
Compared with a generic SCADA package or a plain data platform, MyEMS centers on modeling metering relationships. Spaces, meters, equipment, tenants, stores, shopfloors, and combined equipment share one set of aggregated results, so the same energy figures can be opened along organizational, physical, and commercial dimensions. That choice makes the data model heavier than a typical monitoring system, and it drives most of the architecture decisions below.
2.2 Functional domains
- Collection. Modbus TCP, BACnet/IP, Siemens S7, and OPC UA connect field instruments and controllers. Offline meters and Excel import cover points that cannot be networked or must be read by hand.
- Monitoring and analysis. Meter trends, master/sub-meter balance, batch and comparison analysis, power quality, and category, item, load, efficiency, and statistics for spaces and equipment. Intensity can be per area or per product.
- Accounting. Energy is priced into cost and factored into carbon. Reports compare a reporting period with a baseline period. Plans, baselines, and forecasts are supported.
- Reporting. Analysis pages export real xlsx files with tables and line, bar, and pie charts, not CSV text. Advanced reports add templates, schedules, and email delivery.
- Configuration. Spaces, meters, points, data sources, protocols, equipment, combined equipment, cost centers, tariffs, working calendars, users, and privileges.
- Extensions. The Community Edition includes AI conclusions and saving advice through DeepSeek and the OpenAI API. Photovoltaics, storage, EV chargers, microgrids, virtual power plants, control, fault diagnosis, and work orders are Enterprise Edition capabilities.
2.3 System boundary
Upstream are meters, PLCs, building automation, and PV/storage monitoring interfaces. Downstream are browsers, mobile clients, large screens, and third-party systems on the REST API. Inside the boundary the system fetches numbers, calculates them, displays them, and emits reports. It does not provide SCADA graphics, trade-settlement metrology, a message bus, or a stream processor.
A direct consequence: freshness is defined by the collection interval (configured per data source; the sample is 60 seconds). Components exchange data only through database tables. There is no event bus. That fact is the premise of the runtime shape in Chapter 4 and the decisions in Chapter 11.
2.4 Version and license
The current release is v6.9.0, the 49th release. The cadence is one minor version per month and one major version per year. Upgrades must apply the schema changes in the CHANGELOG and the upgrade document.
The license is MIT. Commercial use and modification are allowed, but the Community Edition requires MyEMS copyright text and the logo to remain. Renaming or replacing the brand is explicitly unsupported. That compliance boundary must be confirmed before white-label delivery.
3 Goals and principles
3.1 Design goals
- One model for many protocols and energy types. Heterogeneous instruments are normalized onto the same point model. A new protocol must not pull upper layers with it.
- Traceable accounting. Every energy, cost, and carbon figure can be traced to a meter, a point, and a time range, and keeps a data-quality flag.
- Many dimensions. The same energy supports space, equipment, tenant, store, shopfloor, and combined-equipment views, including recursive hierarchy queries.
- Low-friction delivery. A single host can be deployed with docker-compose, on several Chinese operating systems and MySQL-family databases, including private and offline sites.
- Extension and integration. The external surface is the REST API plus JSON import/export. The internal surface is the table structure. New protocols and reports can be added without changing the core services.
3.2 Design principles
- One source of truth. Each measurement is produced by one point. Every derived value can be recomputed from it. There is no second raw series that must be maintained by hand.
- Compute and storage are split by purpose. Raw series, normalized energy, multi-dimensional aggregates, and derived accounting values live in different databases, so one database does not have to absorb every workload.
- Dimensions are materialized ahead of time. Aggregates are stored as object × direction × classification × grain. Storage is spent so report pages do not scan at request time.
- Time is UTC. Every timestamp is stored in UTC and converted to local time in the presentation layer.
- Configuration-driven. Targets, intervals, point addresses, and aggregation scope come from the database. Service processes stay as stateless as practical, so they can be containerized and restarted.
- Recomputable. Any calculation stage can be rerun for a time range.
is_publishedandis_baddecide whether a value reaches an external report, so a wrong factor does not require rebuilding the whole database.