Skip to main content

cps-twin — 确定性数字孪生仿真内核(标准版)

可嵌入的确定性仿真内核:仓储(AMR/提升机/输送线)与产线(工位/输送带/返修/AMR)双域引擎、 布局权威校验器、headless CLI。同 seed 同输入 → 逐位一致的结果,可直接用于 容量验证、what-if 对比、CI 管道内的回归仿真。

标准版 vs 专业版:本包只含可嵌入内核(无 UI / 无服务 / 无 LLM)。 3D 设计器、AI Copilot(HITL 审批)、多租户、OPC UA/Modbus/MQTT 网关、TimescaleDB 属专业版(Docker 镜像 + docker compose 本地部署),见 仓库。

安装

pip install cps-twin

快速开始

# 仓储引擎:内置样例布局,推 3600 拍(= 6 分钟仿真时长)
cps-twin simulate-warehouse --ticks 3600 --seed 42

# 产线引擎:参数样例见仓库 config/simulation_parameters.yaml
cps-twin simulate-factory --params simulation_parameters.yaml --ticks 3600

# 布局权威校验(越界/重叠/接入点被封/不连通)
cps-twin validate --layout warehouse_layout.json

作为库使用

from warehouse_twin.sim.engine import SimEngine
from warehouse_twin.sim.navgrid import load_layout

eng = SimEngine(load_layout("warehouse_layout.json"), seed=42)
for _ in range(3600):
    eng.step()
print(eng.state["kpi"]["operation"]["throughput_per_min"])
from domain_factory.engine import FactoryEngine
from domain_factory.params import load_params

eng = FactoryEngine(run_id="R1", seed=42, params=load_params())
eng.run_ticks(3600)
print(eng.kpis()["oee"]["oee"])

确定性的机制(为什么可以信)

  • 固定 tick(100ms)驱动,墙钟只出现在 generated_at;
  • 具名 RNG 流(RngService),dump_state/load_state 覆盖内部态——what-if 分支靠复制状态而非 re-seed;
  • state_hash / parameter_hash 进 provenance,运行数据可溯源到精确引擎+参数组合;
  • 引擎行为由多 seed 分域哈希对拍基线(黄金快照)持续验证,比对失败可定位到子系统。

详见仓库 docs/adr/0001(确定性内核)、0008(物料守恒)、0009(参数指纹)。

License

MIT

Metadata

Release files for cps-twin 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for cps-twin 0.1.1
File Interpreter ABI Platform
cps_twin-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / cps_twin-0.1.1-py3-none-any.whl

Download URL cps_twin-0.1.1-py3-none-any.whl
Size 210.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e31bde5086d7235b83dee30bda5081f892b5bf94621ee4019ac5a14125e1a73a
BLAKE2b-256 checksum
How to use checksums
e90dc2534a22463775879ced1c6c71d4b65c36227ab145d0b52b5f3365a3ed36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

0.1.3

1 release file

0.1.2

1 release file

This release

0.1.1 This release

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page