Skip to content

Getting Started

EnerOS Bot edited this page Jul 5, 2026 · 1 revision

中文 | English

Getting Started / 快速开始

维护版本:v0.51.2 | 最后更新:2026-07-06

5 分钟跑通 EnerOS:从克隆到第一个 /health 200 OK。


前置条件

  • Rust 1.75+(推荐 rustup 管理)
  • Cargo(随 Rust 安装)
  • Linux/macOS/Windows 均可(生产部署推荐 Linux)
rustc --version    # 需要 1.75.0 以上
cargo --version

详见 CONTRIBUTING.md §2


1. 克隆与构建

git clone https://github.com/Gawg-AI/EnerOS.git
cd EnerOS
cargo build --release

首次编译约 5-10 分钟(依赖较多)。后续增量编译 < 30 秒。


2. 运行测试(可选但推荐)

cargo test --workspace

预期:~7700+ 测试通过 / 0 失败 / ~78 ignored(ignored 均有归因)。


3. 启动 API 服务

cargo run --release --bin eneros -- run --host 0.0.0.0 --port 8080

预期输出:Listening on 0.0.0.0:8080


4. 验证运行

curl http://127.0.0.1:8080/health
# 预期返回:OK(200)

5. 执行潮流计算(示例)

cargo run --release --bin eneros -- power-flow --case ieee14

预期:输出 IEEE 14-bus 系统潮流解(电压幅值/相角、支路功率)。


下一步


常见问题

问题 解决
cargo build 报 libseccomp 缺失 Linux:sudo apt install -y libseccomp-dev libssl-dev;非 Linux 跳过 eneros-os 的 HAL 部分
编译警告 不应出现。若出现请执行 cargo clippy --workspace --all-targets -- -D warnings 定位
端口被占用 改用 --port 8090 等其他端口
Windows 上 deploy/scripts/*.sh 无法运行 使用 Git Bash 或 WSL;或直接 cargo run 替代

更多问题见 FAQ

Clone this wiki locally