sme-ocpp-sim 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sme_ocpp_sim-0.1.0/LICENSE +21 -0
- sme_ocpp_sim-0.1.0/PKG-INFO +147 -0
- sme_ocpp_sim-0.1.0/README.md +114 -0
- sme_ocpp_sim-0.1.0/THIRD-PARTY-NOTICES +68 -0
- sme_ocpp_sim-0.1.0/configs/demo-site.yaml +46 -0
- sme_ocpp_sim-0.1.0/pyproject.toml +68 -0
- sme_ocpp_sim-0.1.0/setup.cfg +4 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/__init__.py +3 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/__main__.py +65 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/charging/__init__.py +5 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/charging/composite.py +293 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/charging/ev.py +99 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/charging/power.py +143 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/charging/profiles.py +216 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/config.py +314 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/engine.py +485 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/framelog.py +92 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/__init__.py +1 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/base.py +439 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/registry.py +50 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/__init__.py +1 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/adapter.py +322 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/codec.py +171 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/config_keys.py +98 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/enums.py +255 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/protocol/v16/models.py +398 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/rpc/__init__.py +11 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/rpc/connection.py +222 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/rpc/errors.py +58 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/rpc/framer.py +102 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/rpc/transport.py +216 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/runtime/__init__.py +1 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/runtime/charger.py +1234 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/runtime/config_store.py +128 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/runtime/state.py +107 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/app.js +967 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/favicon.svg +5 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/i18n/en.js +147 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/i18n/ja.js +147 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/i18n/zh.js +147 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/index.html +237 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/static/style.css +118 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim/web.py +573 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/PKG-INFO +147 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/SOURCES.txt +71 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/dependency_links.txt +1 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/entry_points.txt +2 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/requires.txt +15 -0
- sme_ocpp_sim-0.1.0/sme_ocpp_sim.egg-info/top_level.txt +1 -0
- sme_ocpp_sim-0.1.0/tests/test_adapter16.py +327 -0
- sme_ocpp_sim-0.1.0/tests/test_composite.py +485 -0
- sme_ocpp_sim-0.1.0/tests/test_config.py +144 -0
- sme_ocpp_sim-0.1.0/tests/test_config_keys.py +135 -0
- sme_ocpp_sim-0.1.0/tests/test_config_writeback.py +81 -0
- sme_ocpp_sim-0.1.0/tests/test_engine.py +284 -0
- sme_ocpp_sim-0.1.0/tests/test_ev.py +60 -0
- sme_ocpp_sim-0.1.0/tests/test_framelog.py +48 -0
- sme_ocpp_sim-0.1.0/tests/test_i18n.py +23 -0
- sme_ocpp_sim-0.1.0/tests/test_load.py +78 -0
- sme_ocpp_sim-0.1.0/tests/test_packaging.py +39 -0
- sme_ocpp_sim-0.1.0/tests/test_power.py +176 -0
- sme_ocpp_sim-0.1.0/tests/test_protocol_registry.py +37 -0
- sme_ocpp_sim-0.1.0/tests/test_rpc_connection.py +221 -0
- sme_ocpp_sim-0.1.0/tests/test_rpc_framer.py +47 -0
- sme_ocpp_sim-0.1.0/tests/test_rpc_integration.py +137 -0
- sme_ocpp_sim-0.1.0/tests/test_rpc_transport.py +149 -0
- sme_ocpp_sim-0.1.0/tests/test_runtime_charger.py +528 -0
- sme_ocpp_sim-0.1.0/tests/test_runtime_smart_charging.py +220 -0
- sme_ocpp_sim-0.1.0/tests/test_runtime_state.py +64 -0
- sme_ocpp_sim-0.1.0/tests/test_static.py +91 -0
- sme_ocpp_sim-0.1.0/tests/test_v16_models.py +153 -0
- sme_ocpp_sim-0.1.0/tests/test_v16_schema_conformance.py +151 -0
- sme_ocpp_sim-0.1.0/tests/test_web.py +576 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 smartedge-tech-dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sme-ocpp-sim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: SME OCPPSim: Free OCPP charging station simulator (OCPP 1.6J; 2.0.1 / 2.1 planned) for CSMS and EMS testing, including Smart Charging.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/smartedge-tech-dev/sme-ocpp-sim
|
|
7
|
+
Project-URL: Documentation, https://smartedge-tech-dev.github.io/sme-ocpp-sim/
|
|
8
|
+
Project-URL: Issues, https://github.com/smartedge-tech-dev/sme-ocpp-sim/issues
|
|
9
|
+
Keywords: simulator,ocpp,ocpp16,ev-charging,charge-point,csms,smart-charging
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
License-File: THIRD-PARTY-NOTICES
|
|
18
|
+
Requires-Dist: sme-sim-common<2,>=1.1
|
|
19
|
+
Requires-Dist: fastapi>=0.110
|
|
20
|
+
Requires-Dist: uvicorn[standard]
|
|
21
|
+
Requires-Dist: pydantic>=2
|
|
22
|
+
Requires-Dist: pyyaml
|
|
23
|
+
Requires-Dist: websockets<18,>=17
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest; extra == "dev"
|
|
26
|
+
Requires-Dist: httpx; extra == "dev"
|
|
27
|
+
Requires-Dist: ocpp==2.1.0; extra == "dev"
|
|
28
|
+
Requires-Dist: jsonschema; extra == "dev"
|
|
29
|
+
Requires-Dist: cryptography; extra == "dev"
|
|
30
|
+
Requires-Dist: playwright; extra == "dev"
|
|
31
|
+
Requires-Dist: pillow; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
<p align="center"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/logo.svg" width="112" alt="SME OCPPSim logo"></p>
|
|
35
|
+
|
|
36
|
+
<h1 align="center">SME OCPPSim</h1>
|
|
37
|
+
|
|
38
|
+
<p align="center"><strong>Simulate a car park full of EV chargers on your laptop.</strong> OCPP 1.6J charge points with Smart Charging,<br>for CSMS and EMS testing, with a live web UI.</p>
|
|
39
|
+
|
|
40
|
+
<p align="center"><a href="https://smartedge-tech.com/open-source/#ocpp-sim"><b>Website</b></a> · <a href="https://smartedge-tech-dev.github.io/sme-ocpp-sim/"><b>Docs</b></a> · <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest"><b>Download</b></a></p>
|
|
41
|
+
|
|
42
|
+
<p align="center"><a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/actions/workflows/ci.yml"><img src="https://github.com/smartedge-tech-dev/sme-ocpp-sim/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest"><img src="https://img.shields.io/github/v/release/smartedge-tech-dev/sme-ocpp-sim" alt="release"></a> <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-5b5bd6" alt="license MIT"></a> <img src="https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20Docker-0a7bbb" alt="platform"> <img src="https://img.shields.io/badge/python-3.11%2B-3776ab" alt="python 3.11+"> <img src="https://img.shields.io/badge/OCPP-1.6J-2e8b57" alt="OCPP 1.6J"></p>
|
|
43
|
+
|
|
44
|
+
<p align="center"><strong>English</strong> | <a href="README.ja.md">日本語</a> | <a href="README.zh-CN.md">简体中文</a></p>
|
|
45
|
+
|
|
46
|
+
<p align="center"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/live.gif" alt="Live charging power following a Smart Charging profile" width="100%"></p>
|
|
47
|
+
|
|
48
|
+
An OCPP charging station simulator with a live web UI. Simulate dozens to hundreds of AC chargers, plug in
|
|
49
|
+
virtual EVs, start and stop transactions, and watch the charging power follow the Smart Charging profiles your
|
|
50
|
+
CSMS (SteVe, your own CSMS, an EMS...) sends.
|
|
51
|
+
|
|
52
|
+
- **OCPP 1.6J charge points.** Boot, heartbeat, status, authorize, transactions and meter values; remote
|
|
53
|
+
start / stop, configuration, reset, trigger message, availability, unlock and data transfer. OCPP 2.0.1 / 2.1
|
|
54
|
+
are planned for v0.2 / v0.3.
|
|
55
|
+
- **Smart Charging with a closed power loop.** SetChargingProfile, ClearChargingProfile and
|
|
56
|
+
GetCompositeSchedule. The power limit is computed by the same function that answers GetCompositeSchedule,
|
|
57
|
+
so the schedule and the meter values cannot diverge. Every point the specification leaves open is documented.
|
|
58
|
+
- **EV and power model.** Battery, SoC, charging curve, phases, ramps, Japanese 200 V single-phase and
|
|
59
|
+
3-phase delta supplies; Charging / SuspendedEV / SuspendedEVSE follow from the model.
|
|
60
|
+
- **200+ chargers in one process**, connected individually or in bulk.
|
|
61
|
+
- **Security profiles 0 / 1 / 2**: `ws://`, HTTP Basic, `wss://` with Basic.
|
|
62
|
+
- **Frame log** of every OCPP frame with filters and JSON Lines export; HTTP API and WebSocket for test scripts.
|
|
63
|
+
- **YAML configuration**, edited in the browser and saved back to the file.
|
|
64
|
+
- **English, Japanese and Simplified Chinese.** The UI follows the browser language.
|
|
65
|
+
|
|
66
|
+
SME OCPPSim is free and MIT-licensed, developed by [smart-edge (智届科技)](https://smartedge-tech.com) —
|
|
67
|
+
custom development is available, see [Commercial support & custom development](#commercial-support--custom-development).
|
|
68
|
+
|
|
69
|
+
## Screenshots
|
|
70
|
+
|
|
71
|
+
<table>
|
|
72
|
+
<tr>
|
|
73
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview.png" alt="Charger list: connection, OCPP version, connectors and total power"></a><br><sub>Charger list: connection, OCPP version, connectors and total power</sub></td>
|
|
74
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/charger.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/charger.png" alt="Connector cards: plug, swipe, start, stop and fault"></a><br><sub>Connector cards: plug, swipe, start, stop and fault</sub></td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/smart-charging.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/smart-charging.png" alt="Smart Charging panel: limit, power and SoC on one time axis"></a><br><sub>Smart Charging panel: limit, power and SoC on one time axis</sub></td>
|
|
78
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/frames.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/frames.png" alt="OCPP frame log with filters and JSON detail"></a><br><sub>OCPP frame log with filters and JSON detail</sub></td>
|
|
79
|
+
</tr>
|
|
80
|
+
<tr>
|
|
81
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/settings.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/settings.png" alt="Settings: CSMS URL, OCPP version and security profile"></a><br><sub>Settings: CSMS URL, OCPP version and security profile</sub></td>
|
|
82
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview-dark.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview-dark.png" alt="Dark theme"></a><br><sub>Dark theme</sub></td>
|
|
83
|
+
</tr>
|
|
84
|
+
</table>
|
|
85
|
+
|
|
86
|
+
## Quick start
|
|
87
|
+
|
|
88
|
+
Download the Windows executable from the [latest release](https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest), or install with pip
|
|
89
|
+
(Python 3.11+):
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
python -m venv .venv
|
|
93
|
+
.venv\Scripts\pip install sme-ocpp-sim
|
|
94
|
+
.venv\Scripts\sme-ocpp-sim -c configs/demo-site.yaml
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
or run the Docker image (linux/amd64, linux/arm64):
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
docker run --rm -p 8082:8082 --add-host=host.docker.internal:host-gateway ghcr.io/smartedge-tech-dev/sme-ocpp-sim
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Open <http://127.0.0.1:8082/>. The demo configuration connects three chargers to a SteVe CSMS at
|
|
104
|
+
`ws://localhost:8180/steve/websocket/CentralSystemService`; from Docker use `host.docker.internal` instead of
|
|
105
|
+
`localhost`. See the [quick start](https://smartedge-tech-dev.github.io/sme-ocpp-sim/quick-start/) for SteVe setup and all options.
|
|
106
|
+
|
|
107
|
+
## Documentation
|
|
108
|
+
|
|
109
|
+
- [Configuration](https://smartedge-tech-dev.github.io/sme-ocpp-sim/configuration/) — every YAML field. Saving from the UI rewrites the whole `chargers:`
|
|
110
|
+
block, so don't put comments inside individual charger entries.
|
|
111
|
+
- [OCPP 1.6J messages](https://smartedge-tech-dev.github.io/sme-ocpp-sim/messages/) — supported and unsupported actions
|
|
112
|
+
- [Smart Charging](https://smartedge-tech-dev.github.io/sme-ocpp-sim/smart-charging/) — rules and the interpretations in this implementation
|
|
113
|
+
- [Security profiles](https://smartedge-tech-dev.github.io/sme-ocpp-sim/security-profiles/)
|
|
114
|
+
- [HTTP API](https://smartedge-tech-dev.github.io/sme-ocpp-sim/http-api/) — REST routes and the `/ws` contract
|
|
115
|
+
- [Development](https://smartedge-tech-dev.github.io/sme-ocpp-sim/development/)
|
|
116
|
+
- [Changelog](CHANGELOG.md)
|
|
117
|
+
|
|
118
|
+
SME OCPPSim implements the publicly available OCPP specification of the Open Charge Alliance. It is not OCA
|
|
119
|
+
certified and has not been tested with OCTT.
|
|
120
|
+
|
|
121
|
+
## Commercial support & custom development
|
|
122
|
+
|
|
123
|
+
SME OCPPSim is developed by **smart-edge** — Nanjing Smart-Edge Technology Co., Ltd. (南京智届科技有限公司, 智届科技).
|
|
124
|
+
Since its founding in 2023 the company has developed end-to-end software for distributed energy resources
|
|
125
|
+
such as solar, batteries and EVs, from equipment control to the cloud and electricity markets. Its products
|
|
126
|
+
include the AERIS RA platform (リソースアグリゲーター向け) and an AC system (アグリゲーションコーディネーター) for
|
|
127
|
+
the Japanese electricity markets. The team supports projects in Japanese, from requirements definition
|
|
128
|
+
through design, implementation, operation and maintenance.
|
|
129
|
+
|
|
130
|
+
Services:
|
|
131
|
+
|
|
132
|
+
- Energy management systems (EMS), cloud and on-site
|
|
133
|
+
- RA / AC systems for electricity markets (JEPX, EPRX, OCCTO)
|
|
134
|
+
- Edge IoT and equipment-control software
|
|
135
|
+
- Equipment integration: Modbus, MQTT, BACnet, ECHONET Lite, OpenADR 2.0b
|
|
136
|
+
- Energy forecasting and data analytics
|
|
137
|
+
- Cloud infrastructure design, build and operation
|
|
138
|
+
|
|
139
|
+
Need a feature added to SME OCPPSim, or help integrating your devices or EMS? Get in touch:
|
|
140
|
+
|
|
141
|
+
- Website: <https://smartedge-tech.com>
|
|
142
|
+
- Contact page: <https://smartedge-tech.com/contact/>
|
|
143
|
+
- E-mail: [business@smartedge-tech.com](mailto:business@smartedge-tech.com)
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/logo.svg" width="112" alt="SME OCPPSim logo"></p>
|
|
2
|
+
|
|
3
|
+
<h1 align="center">SME OCPPSim</h1>
|
|
4
|
+
|
|
5
|
+
<p align="center"><strong>Simulate a car park full of EV chargers on your laptop.</strong> OCPP 1.6J charge points with Smart Charging,<br>for CSMS and EMS testing, with a live web UI.</p>
|
|
6
|
+
|
|
7
|
+
<p align="center"><a href="https://smartedge-tech.com/open-source/#ocpp-sim"><b>Website</b></a> · <a href="https://smartedge-tech-dev.github.io/sme-ocpp-sim/"><b>Docs</b></a> · <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest"><b>Download</b></a></p>
|
|
8
|
+
|
|
9
|
+
<p align="center"><a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/actions/workflows/ci.yml"><img src="https://github.com/smartedge-tech-dev/sme-ocpp-sim/actions/workflows/ci.yml/badge.svg" alt="CI"></a> <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest"><img src="https://img.shields.io/github/v/release/smartedge-tech-dev/sme-ocpp-sim" alt="release"></a> <a href="https://github.com/smartedge-tech-dev/sme-ocpp-sim/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-5b5bd6" alt="license MIT"></a> <img src="https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20Docker-0a7bbb" alt="platform"> <img src="https://img.shields.io/badge/python-3.11%2B-3776ab" alt="python 3.11+"> <img src="https://img.shields.io/badge/OCPP-1.6J-2e8b57" alt="OCPP 1.6J"></p>
|
|
10
|
+
|
|
11
|
+
<p align="center"><strong>English</strong> | <a href="README.ja.md">日本語</a> | <a href="README.zh-CN.md">简体中文</a></p>
|
|
12
|
+
|
|
13
|
+
<p align="center"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/live.gif" alt="Live charging power following a Smart Charging profile" width="100%"></p>
|
|
14
|
+
|
|
15
|
+
An OCPP charging station simulator with a live web UI. Simulate dozens to hundreds of AC chargers, plug in
|
|
16
|
+
virtual EVs, start and stop transactions, and watch the charging power follow the Smart Charging profiles your
|
|
17
|
+
CSMS (SteVe, your own CSMS, an EMS...) sends.
|
|
18
|
+
|
|
19
|
+
- **OCPP 1.6J charge points.** Boot, heartbeat, status, authorize, transactions and meter values; remote
|
|
20
|
+
start / stop, configuration, reset, trigger message, availability, unlock and data transfer. OCPP 2.0.1 / 2.1
|
|
21
|
+
are planned for v0.2 / v0.3.
|
|
22
|
+
- **Smart Charging with a closed power loop.** SetChargingProfile, ClearChargingProfile and
|
|
23
|
+
GetCompositeSchedule. The power limit is computed by the same function that answers GetCompositeSchedule,
|
|
24
|
+
so the schedule and the meter values cannot diverge. Every point the specification leaves open is documented.
|
|
25
|
+
- **EV and power model.** Battery, SoC, charging curve, phases, ramps, Japanese 200 V single-phase and
|
|
26
|
+
3-phase delta supplies; Charging / SuspendedEV / SuspendedEVSE follow from the model.
|
|
27
|
+
- **200+ chargers in one process**, connected individually or in bulk.
|
|
28
|
+
- **Security profiles 0 / 1 / 2**: `ws://`, HTTP Basic, `wss://` with Basic.
|
|
29
|
+
- **Frame log** of every OCPP frame with filters and JSON Lines export; HTTP API and WebSocket for test scripts.
|
|
30
|
+
- **YAML configuration**, edited in the browser and saved back to the file.
|
|
31
|
+
- **English, Japanese and Simplified Chinese.** The UI follows the browser language.
|
|
32
|
+
|
|
33
|
+
SME OCPPSim is free and MIT-licensed, developed by [smart-edge (智届科技)](https://smartedge-tech.com) —
|
|
34
|
+
custom development is available, see [Commercial support & custom development](#commercial-support--custom-development).
|
|
35
|
+
|
|
36
|
+
## Screenshots
|
|
37
|
+
|
|
38
|
+
<table>
|
|
39
|
+
<tr>
|
|
40
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview.png" alt="Charger list: connection, OCPP version, connectors and total power"></a><br><sub>Charger list: connection, OCPP version, connectors and total power</sub></td>
|
|
41
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/charger.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/charger.png" alt="Connector cards: plug, swipe, start, stop and fault"></a><br><sub>Connector cards: plug, swipe, start, stop and fault</sub></td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/smart-charging.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/smart-charging.png" alt="Smart Charging panel: limit, power and SoC on one time axis"></a><br><sub>Smart Charging panel: limit, power and SoC on one time axis</sub></td>
|
|
45
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/frames.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/frames.png" alt="OCPP frame log with filters and JSON detail"></a><br><sub>OCPP frame log with filters and JSON detail</sub></td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/settings.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/settings.png" alt="Settings: CSMS URL, OCPP version and security profile"></a><br><sub>Settings: CSMS URL, OCPP version and security profile</sub></td>
|
|
49
|
+
<td width="50%"><a href="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview-dark.png"><img src="https://raw.githubusercontent.com/smartedge-tech-dev/sme-ocpp-sim/main/docs/assets/screenshots/en/overview-dark.png" alt="Dark theme"></a><br><sub>Dark theme</sub></td>
|
|
50
|
+
</tr>
|
|
51
|
+
</table>
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
Download the Windows executable from the [latest release](https://github.com/smartedge-tech-dev/sme-ocpp-sim/releases/latest), or install with pip
|
|
56
|
+
(Python 3.11+):
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
.venv\Scripts\pip install sme-ocpp-sim
|
|
61
|
+
.venv\Scripts\sme-ocpp-sim -c configs/demo-site.yaml
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
or run the Docker image (linux/amd64, linux/arm64):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
docker run --rm -p 8082:8082 --add-host=host.docker.internal:host-gateway ghcr.io/smartedge-tech-dev/sme-ocpp-sim
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Open <http://127.0.0.1:8082/>. The demo configuration connects three chargers to a SteVe CSMS at
|
|
71
|
+
`ws://localhost:8180/steve/websocket/CentralSystemService`; from Docker use `host.docker.internal` instead of
|
|
72
|
+
`localhost`. See the [quick start](https://smartedge-tech-dev.github.io/sme-ocpp-sim/quick-start/) for SteVe setup and all options.
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
- [Configuration](https://smartedge-tech-dev.github.io/sme-ocpp-sim/configuration/) — every YAML field. Saving from the UI rewrites the whole `chargers:`
|
|
77
|
+
block, so don't put comments inside individual charger entries.
|
|
78
|
+
- [OCPP 1.6J messages](https://smartedge-tech-dev.github.io/sme-ocpp-sim/messages/) — supported and unsupported actions
|
|
79
|
+
- [Smart Charging](https://smartedge-tech-dev.github.io/sme-ocpp-sim/smart-charging/) — rules and the interpretations in this implementation
|
|
80
|
+
- [Security profiles](https://smartedge-tech-dev.github.io/sme-ocpp-sim/security-profiles/)
|
|
81
|
+
- [HTTP API](https://smartedge-tech-dev.github.io/sme-ocpp-sim/http-api/) — REST routes and the `/ws` contract
|
|
82
|
+
- [Development](https://smartedge-tech-dev.github.io/sme-ocpp-sim/development/)
|
|
83
|
+
- [Changelog](CHANGELOG.md)
|
|
84
|
+
|
|
85
|
+
SME OCPPSim implements the publicly available OCPP specification of the Open Charge Alliance. It is not OCA
|
|
86
|
+
certified and has not been tested with OCTT.
|
|
87
|
+
|
|
88
|
+
## Commercial support & custom development
|
|
89
|
+
|
|
90
|
+
SME OCPPSim is developed by **smart-edge** — Nanjing Smart-Edge Technology Co., Ltd. (南京智届科技有限公司, 智届科技).
|
|
91
|
+
Since its founding in 2023 the company has developed end-to-end software for distributed energy resources
|
|
92
|
+
such as solar, batteries and EVs, from equipment control to the cloud and electricity markets. Its products
|
|
93
|
+
include the AERIS RA platform (リソースアグリゲーター向け) and an AC system (アグリゲーションコーディネーター) for
|
|
94
|
+
the Japanese electricity markets. The team supports projects in Japanese, from requirements definition
|
|
95
|
+
through design, implementation, operation and maintenance.
|
|
96
|
+
|
|
97
|
+
Services:
|
|
98
|
+
|
|
99
|
+
- Energy management systems (EMS), cloud and on-site
|
|
100
|
+
- RA / AC systems for electricity markets (JEPX, EPRX, OCCTO)
|
|
101
|
+
- Edge IoT and equipment-control software
|
|
102
|
+
- Equipment integration: Modbus, MQTT, BACnet, ECHONET Lite, OpenADR 2.0b
|
|
103
|
+
- Energy forecasting and data analytics
|
|
104
|
+
- Cloud infrastructure design, build and operation
|
|
105
|
+
|
|
106
|
+
Need a feature added to SME OCPPSim, or help integrating your devices or EMS? Get in touch:
|
|
107
|
+
|
|
108
|
+
- Website: <https://smartedge-tech.com>
|
|
109
|
+
- Contact page: <https://smartedge-tech.com/contact/>
|
|
110
|
+
- E-mail: [business@smartedge-tech.com](mailto:business@smartedge-tech.com)
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
SME OCPPSim - Third-party notices
|
|
2
|
+
=================================
|
|
3
|
+
|
|
4
|
+
SME OCPPSim is licensed under the MIT License (see LICENSE). The PyPI package depends on, and the
|
|
5
|
+
Windows executable (PyInstaller) and the Docker image bundle, the third-party components below.
|
|
6
|
+
Licenses are taken from each package's own metadata (License-Expression / License / classifiers).
|
|
7
|
+
Versions are the ones used for development of this release; other versions installed by pip may
|
|
8
|
+
apply instead. The full license texts ship inside each package's *.dist-info directory and at the
|
|
9
|
+
project home pages listed here.
|
|
10
|
+
|
|
11
|
+
Direct runtime dependencies
|
|
12
|
+
---------------------------
|
|
13
|
+
|
|
14
|
+
Component License Home page
|
|
15
|
+
------------------- ------------- ---------------------------------------------------------------
|
|
16
|
+
sme-sim-common MIT https://github.com/smartedge-tech-dev/sme-sim-common
|
|
17
|
+
fastapi MIT https://github.com/fastapi/fastapi
|
|
18
|
+
uvicorn BSD-3-Clause https://github.com/Kludex/uvicorn
|
|
19
|
+
pydantic MIT https://github.com/pydantic/pydantic
|
|
20
|
+
PyYAML MIT https://pyyaml.org/
|
|
21
|
+
websockets BSD-3-Clause https://github.com/python-websockets/websockets
|
|
22
|
+
|
|
23
|
+
Transitive runtime dependencies
|
|
24
|
+
-------------------------------
|
|
25
|
+
|
|
26
|
+
Component License Home page
|
|
27
|
+
------------------- ------------- ---------------------------------------------------------------
|
|
28
|
+
starlette BSD-3-Clause https://github.com/Kludex/starlette
|
|
29
|
+
pydantic-core MIT https://github.com/pydantic/pydantic
|
|
30
|
+
typing-extensions PSF-2.0 https://github.com/python/typing_extensions
|
|
31
|
+
typing-inspection MIT https://github.com/pydantic/typing-inspection
|
|
32
|
+
annotated-types MIT https://github.com/annotated-types/annotated-types
|
|
33
|
+
annotated-doc MIT https://github.com/fastapi/annotated-doc
|
|
34
|
+
anyio MIT https://github.com/agronholm/anyio
|
|
35
|
+
idna BSD-3-Clause https://github.com/kjd/idna
|
|
36
|
+
opentelemetry-api Apache-2.0 https://github.com/open-telemetry/opentelemetry-python
|
|
37
|
+
python-multipart Apache-2.0 https://github.com/Kludex/python-multipart
|
|
38
|
+
click BSD-3-Clause https://github.com/pallets/click
|
|
39
|
+
h11 MIT https://github.com/python-hyper/h11
|
|
40
|
+
httptools MIT https://github.com/MagicStack/httptools
|
|
41
|
+
watchfiles MIT https://github.com/samuelcolvin/watchfiles
|
|
42
|
+
python-dotenv BSD-3-Clause https://github.com/theskumar/python-dotenv
|
|
43
|
+
|
|
44
|
+
Platform-specific (installed only on some platforms)
|
|
45
|
+
----------------------------------------------------
|
|
46
|
+
|
|
47
|
+
Component License Where
|
|
48
|
+
------------------- ---------------------- ------------------------------------------------------
|
|
49
|
+
colorama BSD-3-Clause Windows (via click); https://github.com/tartley/colorama
|
|
50
|
+
uvloop MIT OR Apache-2.0 Linux / macOS, incl. the Docker image (via uvicorn[standard]);
|
|
51
|
+
https://github.com/MagicStack/uvloop
|
|
52
|
+
|
|
53
|
+
Runtime environment
|
|
54
|
+
-------------------
|
|
55
|
+
|
|
56
|
+
Python PSF-2.0 Bundled in the Windows executable; the base of the
|
|
57
|
+
Docker image (python:3.12-slim, Debian packages under
|
|
58
|
+
their own licenses, see /usr/share/doc/*/copyright).
|
|
59
|
+
PyInstaller GPL-2.0-or-later Windows executable only: its bootloader and runtime hooks
|
|
60
|
+
WITH Bootloader- are embedded in the exe. The bootloader exception allows
|
|
61
|
+
exception distributing programs built with it under any license.
|
|
62
|
+
https://pyinstaller.org/
|
|
63
|
+
|
|
64
|
+
Not distributed
|
|
65
|
+
---------------
|
|
66
|
+
|
|
67
|
+
The `ocpp` package (MIT), jsonschema, pytest, httpx, playwright and the other `dev` extras are used
|
|
68
|
+
only for tests and tooling; they are not runtime dependencies and are not bundled.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# SME OCPPSim demo site: three AC chargers against a local SteVe.
|
|
2
|
+
#
|
|
3
|
+
# Always quote ids, id tags and passwords ("0123", "ON" and "1e5" are not strings in unquoted YAML).
|
|
4
|
+
# Saving from the web UI rewrites whole top-level blocks: comments outside a changed block stay,
|
|
5
|
+
# comments inside it (e.g. next to a single charger) are lost.
|
|
6
|
+
|
|
7
|
+
simulation:
|
|
8
|
+
tick_seconds: 1
|
|
9
|
+
time_scale: 1 # speeds up the power model (ramp, energy, SoC) only
|
|
10
|
+
running: true
|
|
11
|
+
|
|
12
|
+
frame_log:
|
|
13
|
+
size: 20000 # frames kept in memory (all chargers)
|
|
14
|
+
|
|
15
|
+
csms_defaults:
|
|
16
|
+
url: "ws://localhost:8180/steve/websocket/CentralSystemService"
|
|
17
|
+
ocpp_version: "1.6"
|
|
18
|
+
security_profile: 0 # 0 = ws:// without password
|
|
19
|
+
reconnect: { min_s: 1, max_s: 60, jitter: 0.2 }
|
|
20
|
+
|
|
21
|
+
ev_models:
|
|
22
|
+
- id: "demo-60kwh"
|
|
23
|
+
capacity_kwh: 60
|
|
24
|
+
max_ac_kw: 11
|
|
25
|
+
max_current_a: 16
|
|
26
|
+
phases: 3
|
|
27
|
+
|
|
28
|
+
chargers:
|
|
29
|
+
- id: "CP-0001"
|
|
30
|
+
model: "SIM-AC6"
|
|
31
|
+
max_power_w: 6000
|
|
32
|
+
id_tags: ["04A1B2C3", "TAG-0002"]
|
|
33
|
+
config_keys:
|
|
34
|
+
HeartbeatInterval: 300
|
|
35
|
+
MeterValueSampleInterval: 60
|
|
36
|
+
- id: "CP-0002"
|
|
37
|
+
connectors: 2
|
|
38
|
+
max_power_w: 6000
|
|
39
|
+
auth_mode: accept_all
|
|
40
|
+
- id: "CP-0003"
|
|
41
|
+
model: "SIM-AC11"
|
|
42
|
+
max_power_w: 11000
|
|
43
|
+
voltage_v: 200
|
|
44
|
+
phases: 3
|
|
45
|
+
line_to_line: true
|
|
46
|
+
session: { ev_model: "demo-60kwh", initial_soc: 20, target_soc: 80 }
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sme-ocpp-sim"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "SME OCPPSim: Free OCPP charging station simulator (OCPP 1.6J; 2.0.1 / 2.1 planned) for CSMS and EMS testing, including Smart Charging."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
keywords = ["simulator", "ocpp", "ocpp16", "ev-charging", "charge-point", "csms", "smart-charging"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
# Web shell, standard routes, config / engine / CLI helpers. 1.x only adds compatible features.
|
|
21
|
+
"sme-sim-common>=1.1,<2",
|
|
22
|
+
"fastapi>=0.110",
|
|
23
|
+
"uvicorn[standard]",
|
|
24
|
+
"pydantic>=2",
|
|
25
|
+
"pyyaml",
|
|
26
|
+
# OCPP-J transport (WebSocket client); the RPC layer and message models are written in-house.
|
|
27
|
+
"websockets>=17,<18",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.optional-dependencies]
|
|
31
|
+
# ocpp: dev-only CSMS peer for integration tests and screenshots; jsonschema: checks against the OCA schemas.
|
|
32
|
+
dev = ["pytest", "httpx", "ocpp==2.1.0", "jsonschema", "cryptography", "playwright", "pillow"]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/smartedge-tech-dev/sme-ocpp-sim"
|
|
36
|
+
Documentation = "https://smartedge-tech-dev.github.io/sme-ocpp-sim/"
|
|
37
|
+
Issues = "https://github.com/smartedge-tech-dev/sme-ocpp-sim/issues"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
sme-ocpp-sim = "sme_ocpp_sim.__main__:main"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.dynamic]
|
|
43
|
+
version = { attr = "sme_ocpp_sim.__version__" }
|
|
44
|
+
|
|
45
|
+
[tool.setuptools]
|
|
46
|
+
# configs/ ships inside the wheel as sme_ocpp_sim/configs so that a pip / pipx install has the demo config
|
|
47
|
+
# (source tree, Docker image and Windows exe: configs/ beside the package). List new subpackages here.
|
|
48
|
+
packages = [
|
|
49
|
+
"sme_ocpp_sim",
|
|
50
|
+
"sme_ocpp_sim.charging",
|
|
51
|
+
"sme_ocpp_sim.protocol",
|
|
52
|
+
"sme_ocpp_sim.protocol.v16",
|
|
53
|
+
"sme_ocpp_sim.rpc",
|
|
54
|
+
"sme_ocpp_sim.runtime",
|
|
55
|
+
"sme_ocpp_sim.configs",
|
|
56
|
+
]
|
|
57
|
+
package-dir = { "sme_ocpp_sim.configs" = "configs" }
|
|
58
|
+
license-files = ["LICENSE", "THIRD-PARTY-NOTICES"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
sme_ocpp_sim = ["static/**/*"]
|
|
62
|
+
"sme_ocpp_sim.configs" = ["*.yaml"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
testpaths = ["tests"]
|
|
66
|
+
# The load test (plan §6.4) runs only on request: pytest -m load
|
|
67
|
+
addopts = "-m 'not load'"
|
|
68
|
+
markers = ["load: long-running multi-charger load test (excluded by default; run with -m load)"]
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Command line entry point.
|
|
2
|
+
|
|
3
|
+
sme-ocpp-sim [run] [-c CONFIG] [--host 127.0.0.1] [--http-port 8082] [--no-browser]
|
|
4
|
+
sme-ocpp-sim --version
|
|
5
|
+
|
|
6
|
+
The common options and the web server start come from ``sme_sim_common.cli``.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import logging
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from sme_sim_common.cli import add_common_args, run_web
|
|
17
|
+
|
|
18
|
+
from . import __version__
|
|
19
|
+
|
|
20
|
+
APP_NAME = "sme-ocpp-sim"
|
|
21
|
+
DEFAULT_HTTP_PORT = 8082 # series port table (sme-sim-common README)
|
|
22
|
+
_PKG = Path(__file__).resolve().parent
|
|
23
|
+
# Default config when started without -c (as sme-modbus-sim / sme-bac-sim).
|
|
24
|
+
# Installed wheel: sme_ocpp_sim/configs; source tree, Docker image and Windows exe (PyInstaller puts the
|
|
25
|
+
# package under sys._MEIPASS, so __file__ resolves there): configs/ beside the package.
|
|
26
|
+
DEFAULT_CONFIG = next((p for p in (_PKG / "configs" / "demo-site.yaml", _PKG.parent / "configs" / "demo-site.yaml")
|
|
27
|
+
if p.exists()), _PKG.parent / "configs" / "demo-site.yaml")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main(argv=None) -> int:
|
|
31
|
+
rest = sys.argv[1:] if argv is None else list(argv)
|
|
32
|
+
if rest[:1] == ["run"]:
|
|
33
|
+
rest = rest[1:]
|
|
34
|
+
ap = argparse.ArgumentParser(prog=APP_NAME,
|
|
35
|
+
description="OCPP charging station simulator with a web UI; "
|
|
36
|
+
"default config: the bundled configs/demo-site.yaml")
|
|
37
|
+
add_common_args(ap, default_http_port=DEFAULT_HTTP_PORT, app_name=APP_NAME, version=__version__,
|
|
38
|
+
templates=False)
|
|
39
|
+
args = ap.parse_args(rest)
|
|
40
|
+
|
|
41
|
+
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG if args.verbose else logging.INFO,
|
|
42
|
+
format="%(asctime)s %(levelname)s %(name)s: %(message)s")
|
|
43
|
+
|
|
44
|
+
from .config import SimConfig, load_file
|
|
45
|
+
from .engine import OcppEngine
|
|
46
|
+
|
|
47
|
+
path = args.config
|
|
48
|
+
if path is None and DEFAULT_CONFIG.exists():
|
|
49
|
+
path = str(DEFAULT_CONFIG)
|
|
50
|
+
try:
|
|
51
|
+
cfg = load_file(path) if path else SimConfig()
|
|
52
|
+
text = Path(path).read_text(encoding="utf-8") if path else None
|
|
53
|
+
engine = OcppEngine(cfg, config_text=text, config_path=path)
|
|
54
|
+
except Exception as e: # noqa: BLE001
|
|
55
|
+
print(f"config error: {e}", file=sys.stderr)
|
|
56
|
+
return 2
|
|
57
|
+
|
|
58
|
+
from .web import create_app
|
|
59
|
+
|
|
60
|
+
run_web(create_app(engine, path), args, name=f"SME OCPPSim v{__version__}")
|
|
61
|
+
return 0
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if __name__ == "__main__":
|
|
65
|
+
sys.exit(main())
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"""Version-neutral smart charging and power model (plan §5 M4).
|
|
2
|
+
|
|
3
|
+
``profiles`` holds installed charging profiles, ``composite`` evaluates them into a composite schedule and the
|
|
4
|
+
live power limit. Nothing here imports a protocol package; version adapters convert into these domain types.
|
|
5
|
+
"""
|