v0 · Demo 已就绪v0 · Demo ready

用物理仿真 + AI Agent,把热力站做成 AI 原生平台。

Physics-grounded AI control for district heating substations.

Modelica 提供可信的物理世界,FMI/FMU 打通 Python 控制层,MPC / RL Agent 在仿真里学策略——像 BOPTEST 之于建筑,HeatStationGym 之于热力站。

Modelica gives a trustworthy physical world, FMI/FMU bridges Python control, MPC / RL Agents learn policies in simulation — BOPTEST for buildings, HeatStationGym for substations.

把物理世界变成 AI 能用的世界

Turn the physical world into something AI can use

像 Tesla 的视觉系统把摄像头画面变成点云、可行驶区域、3D 障碍物——同一时刻三种视角:左边是现实里的换热站,中间是 AI 看到的物理抽象(带方程的世界模型),右边是 AI 做出的预测与控制决策。这就是世界模型干的事。

Like Tesla's vision stack turns camera frames into point clouds, drivable surfaces, 3D obstacles — three lenses on the same instant: left = the physical station, middle = the AI's abstraction with equations, right = the AI's prediction and control. That's what a world model is.

实时同步 · 同一时刻三种视角Live sync · same instant, three lenses
t = 0.0 h · 0 s
① REALITY · 物理设备① REALITY · physical equipment
换热站房里实际在跑的东西:阀门、泵、换热器、管路、流体温度What's actually running inside the station: valves, pumps, HX, pipes, fluid temps
SOURCE热源一次侧供水 · primary supplyT_pri_in95.0°C调节阀VALVE50 %HX换热器ε = 0.70Q_hx · 换热504 kW一次侧回水 · primary return二次侧供水 · to usersT_sec_sup55.0°C用户USERS循环泵PUMPLIVE TELEMETRY · 实时遥测T_oa · 室外-9.0°CQ_load · 用户负荷150 kWm_pri · 一次流量4.00 kg/s跟踪误差 · err0.00°CSTATION● ALPHA-7
② ABSTRACTION · 世界模型② ABSTRACTION · world model
AI 把设备变成节点 + 变量 + 守恒方程——这才是 AI 真正看见的物理AI distills the equipment into nodes + variables + conservation equations — what the AI actually sees
SOURCET_pri_in95.0°Cu_valve50%HXQ_hx504 kWT_sec_sup55.00°Csetpoint55.00°Cerror0.000°CQ_hx = ε · min(C_pri, C_sec) · (T_pri_in − T_sec_ret)C_sec · dT_sec_sup/dt = Q_hx − Q_load
③ PREDICTION · 预测与控制③ PREDICTION · forecast & control
基于世界模型推理:未来温度走向、MPC 决策、与 PI 的差距Reasoning from the world model: predicted temps, MPC decisions, gap vs PI
5055657585setpoint0h6h12h18h24h← past · future →MPC T_sec_sup55.00°CPI55.00°CΔ vs setpointMPCPI

热力站的三个真实痛点

Three real pains in substation operations

调控靠经验

Tuning lives in the head of a senior operator

每个站的策略依赖老师傅;节能空间大但难复用,新站从零开始。

Each station depends on tribal knowledge; savings exist but don't scale to new stations.

数字化止于看板

Dashboards, not decisions

SCADA 收了大量数据,但没人用得起来;AI 落不进控制环。

SCADA collects everything, but data rarely closes the control loop.

建模门槛高

Physical modeling is expensive

Modelica/CFD 是专业工具,每个站建一遍要几周到几个月。

Modelica/CFD is expert tooling; modeling a station can take weeks to months.

五层架构

Five-layer architecture

L5
应用层Application调度 / 运维 / 节能 / 报告Dispatch / O&M / energy / reports
L4
Agent 层(LLM)Agent Layer (LLM)建模 / 实验 / 运维 / 边缘 AgentModeling / experiment / operator / edge agents
L3
策略层Policy LayerMPC · RL · 模仿学习MPC · RL · imitation learning
L2
仿真内核Simulation KernelOpenModelica · AixLib · FMU · HeatStationGymOpenModelica · AixLib · FMU · HeatStationGym
L1
数据层Data LayerSCADA · 历史运行 · 设备台账 · 气象SCADA · history · equipment · weather

v0 模型:一个最简换热站

v0 model: a minimal heat substation

一次侧热水经控制阀进入板式换热器,把热量传给二次侧;二次侧循环泵把热水送到末端用户。控制变量是一次侧阀门开度 u_valve,扰动是室外温度 T_oa 与用户负荷 Q_load。

Primary hot water enters a plate HX through a control valve and transfers heat to the secondary loop; a circulation pump delivers heat to building loads. Control = primary valve opening u_valve; disturbances = outdoor temp T_oa and load Q_load.

现实 · RealityReality照片Photo

在 web/public/station-photo.jpg 放入真实换热站照片

Drop a real station photo at web/public/station-photo.jpg

(建议 4:3,至少 1200px 宽)

(4:3, at least 1200px wide)

抽象 · ModelAbstract ModelModelica · v0Modelica · v0
PRIMARY · 一次侧SECONDARY · 二次侧T_pri_in = 95°Cu_valveHXε = 0.70Q_hxT_pri_outT_sec_supQ_loadT_sec_retPpumpdisturbance · T_oa, Q_load(t)
一次侧热水Primary hot water 换热(受控变量)Heat transfer (control target) 二次侧供水Secondary supply 二次侧回水Secondary return

现实里有阀门、泵、管网、换热器、保温层;模型里只保留控制和能量平衡决定的部分。AI 不需要看见钢铁,但需要一个可信的能量账本。

Reality has valves, pumps, piping, exchangers, insulation. The model keeps only what control and energy balance need. AI doesn't need to see the steel — it needs a trustworthy energy ledger.

查看 Modelica 源码核心方程View core Modelica equations
m_dot_pri = u_valve * m_dot_pri_max;
C_min     = min(m_dot_pri * cp, m_dot_sec * cp);
Q_hx      = eps_hx * C_min * (T_pri_in - T_sec_ret);
T_sec_ret = T_sec_sup - Q_load / (m_dot_sec * cp);
C_sec * der(T_sec_sup) = Q_hx - Q_load;

v1 路线:用 AixLib 组件级重建

v1 roadmap: rebuild with AixLib at component level

v0 是集总参数模型,够 demo 但不够工程。v1 把每个组件——阀门、泵、传感器、换热器——换成 AixLib 的工业级实现,保留同样的 FMI 接口,控制器代码零改动。

v0 is a lumped model — enough for demo, not engineering. v1 swaps every component (valve, pump, sensors, HX) for AixLib's industrial implementations, keeping the same FMI surface; controller code is unchanged.

v1 · AixLib component-level wiring (planned)PRIMARY · 一次侧Boundary_pTSourcesport_bsenT_priSensors.Temp...valveActuators.Valves.TwoWayLinearhxHeatExchangers.ConstantEffectivenesssink_priSources.Boundary_pTu_valveSECONDARY · 二次侧load (radiator)HeatExchangers.Radiators...port_bsenT_retSensors.Temp...pumpMovers.SpeedControlled_yport_a2port_b2senT_supSensors.Temp...boundary T_oaSources.Boundary_pTMPC (Python ext.)FMI co-simT_sec_sup (measured)
v1 计划:把 v0 的集总参数模型替换为 AixLib 组件级(一次/二次回路 + 真实组件包),保留同样的 FMI 接口;MPC 不变,物理精度提升。v1 plan: replace the lumped model with AixLib component-level wiring (primary/secondary loops, real component packages) while keeping the same FMI surface; MPC unchanged, physics fidelity up.

v0 Demo:MPC vs PI,24 小时

v0 Demo: MPC vs PI, 24 hours

把上面的模型导出为 FMU,从 Python 控制;MPC 与带 feedforward 的工业 PI 对比。

Export the model above as an FMU and control it from Python; MPC vs industrial PI with feedforward.

24 小时回放24-hour playback
t = 0.0 h
4050556070setpoint 55°C0h6h12h18h24h
PI 当前PI now
55.00 °C
MPC 当前MPC now
55.00 °C
PI 偏差PI error
0.00 °C
MPC 偏差MPC error
0.00 °C
PI MPC设定点 55°Csetpoint 55°C
PI vs MPC, 24h
KPIKPIPIMPC
跟踪 RMSTracking RMS10.30 °C0.008 °C
满足率 (±1°C)Setpoint hit rate (±1°C)71.3 %100 %
未满足负荷Unmet load+0.034 MWh−0.003 MWh
阀门总变化Valve total variation8.81.1

PI 在头 7 小时出现冷启动极限环(典型 PI 现场调参痛点),MPC 开机即稳。这不是把 PI 调烂——是 MPC 真实的工程价值:不需要逐站手调。

PI shows a cold-start limit cycle in the first 7 hours (a real on-site tuning pain). MPC stays steady from start — that's MPC's actual value: no per-station tuning required.

v1.5:从单站走向源-网-站

v1.5: from single station to source-network-station

真正的供热价值在网级:冷水波传播、N-1 工况、安全约束触发的策略协同。下面是一个源 + 一次网 + 两站的耦合模型——上面所有的反事实、故障、Agent 工具,都可以无缝挂上来。

The real value in district heating lives at the network level: cold-water plug propagation, N-1 contingencies, safety-driven coordinated control. Below: a coupled source + primary network + 2-station model. All the what-if / fault / agent tooling above generalizes to this.

SOURCE热源T_sourcecontrollableprimary supply · 一次网供水τ_A ≈ 8 minτ_B ≈ 18 minSTATION A近端 · close→ users Ap_ASTATION B远端 · far→ users Bp_Bprimary return · 一次网回水Ppressure monitor
冷水波Cold-water plug

源温变化要走过 τ_A / τ_B 才能到达对应站

Source temp changes propagate to A/B with delays τ_A / τ_B

水力耦合Hydraulic coupling

任一站开度变化通过一次网影响另一站可用流量与压力

Any station's valve change shifts flow / pressure available to the other

安全约束Safety constraint

p_A / p_B 低于 0.3 MPa 触发协同回退(A 优先保供,B 退让)

If p_A or p_B drops below 0.3 MPa, coordinated back-off (A prioritized, B yields)

网络级 sandbox(源 + 两站 + 一次网)

Network sandbox (source + two stations + primary network)

12 点起,热源出水温度从 95°C 下降到 80°C,持续 4 小时。看冷水波先到 A 后到 B。At 12:00, source supply drops 95→80°C for 4h. Watch the cold-water plug reach A first, B later.
温度 · °CTemperature · °C
5055708595setpoint 55°C0h6h12h18h24h
T_source T_pri_in (A) T_pri_in (B) T_sec_sup (A) T_sec_sup (B)
站点入口压力 · barStation inlet pressure · bar
357911safety floor 3 bar0h6h12h18h24h
p_A · 近端 p_B · 远端 安全报警时段safety alarm window
A 站跟踪 RMSA tracking RMS
10.31 °C
B 站跟踪 RMSB tracking RMS
11.09 °C
最低 p_Amin p_A
5.94 bar
最低 p_Bmin p_B
5.06 bar

把模型当 sandbox:反事实、故障、预报

Use the model as a sandbox: what-if, fault, forecast

物理仿真和世界模型的区别在这里:它不只是跑出结果,还能回答 '如果……会怎样' '哪个设备坏了' '未来 24 小时怎么走'。下面是三个互动模式,全部在浏览器里实时算。

This is where physical simulation becomes a world model: it answers 'what-if', 'which fault matches these symptoms', 'how will the next 24h play out'. All three modes run live in your browser.

405055607080setpoint 55°C0h6h12h18h24h
跟踪 RMSTracking RMS
基线base 10.30 °C10.30 °C
±1°C 满足率Hit rate ±1°C
基线base 71 %71 %
平均偏差Mean |err|
基线base 4.81 °C4.81 °C
正常基线Baseline情景Scenario

让 AI Agent 用这个模型

Let an AI agent use the model

同样的物理模型,挂上 Claude Sonnet 4.6,给它 3 个工具(反事实仿真、故障注入、未来预报)。问一个自然语言问题,Agent 自己决定调哪个工具、怎么解读结果。这就是 '世界模型' 真正的差异。

Same physics model, behind Claude Sonnet 4.6 with 3 tools (counterfactual sim, fault injection, forecast). Ask in natural language; the agent picks tools and interprets results. This is what makes it a world model, not just a simulator.

问问这个世界模型

Ask the world model

gpt-5.1 · 5 tools
点下面任一问题,或自己问。模型会调用仿真器返回结果——你能看到它每一步在算什么。Click any suggestion or ask your own. The model will call the simulator and you'll see each step it takes.

v2 · Modeling Agent:从点表自动生成模型

v2 · Modeling Agent: SCADA point list → Modelica model

一个站房从图纸/点表到可仿真的 Modelica 模型,传统做法需要 1-2 周工程师手工建模。这里换一个思路:LLM 不直接写 Modelica(容易幻觉),而是把点表抽取成一个有类型约束的拓扑(YAML),由确定性 JS 做 DOF / 量纲 / 接线预检查,再由模板生成 .mo 文件。下面试试看——粘贴一个点表,几秒钟出模型。

Traditionally, going from a point list / P&ID to a runnable Modelica model takes engineers 1–2 weeks. New approach: the LLM never writes Modelica directly (hallucinates), it fills a typed topology (YAML). Deterministic JS runs DOF / unit / connectivity checks, then a template renders the .mo file. Paste a point list below — model in seconds.

SCADA 点表(每行一个点)SCADA point list (one per line)
示例:Examples:

为什么这个 v0 已经是真护城河(不是 demo 装饰)

Why this v0 is already a real moat (not just a demo)

① LLM 输出受 Zod schema 约束 → tag 必须出现在原始点表里,不能幻觉新名字;② JS 做的预检查(DOF / 量纲 / 连接)覆盖了 LLM 最容易出错的物理一致性环节;③ 同一 schema 接入 AixLib 或更精细模板就能产生组件级模型;④ 校准是下一步——接 SCADA 历史数据做参数辨识,把 eps_hx、C_sec 这些默认值变成站特异值。① LLM output is Zod-constrained → every tag must exist verbatim in the original list, no invented names; ② JS pre-checks (DOF / units / connectivity) cover the physics-consistency failure modes LLMs are worst at; ③ Same schema can drive AixLib component-level templates; ④ Calibration is next — fit eps_hx and C_sec from SCADA history to make defaults station-specific.

路线图

Roadmap

  1. v0HeatStationGym 雏形 · FMU + MPC + 对比 KPIHeatStationGym v0 · FMU + MPC + comparison KPIs已完成done
  2. v1接入真实 SCADA · 参数辨识 · 残差对比Real SCADA · parameter identification · residual analysis
  3. v2Modeling Agent · 点表→YAML→Modelica 自动生成Modeling Agent · point-list → YAML → Modelica auto-gen
  4. v3RL baseline · 多回路 · 一次网拓扑RL baseline · multi-loop · primary network topology
  5. v4多站示范部署 · 商业闭环Multi-station pilot deployment · commercial close

联系我们

Contact

GitHub

GitHub

(待发布)

微信

WeChat

二维码 (替换 /public/wechat-qr.png)QR (replace /public/wechat-qr.png)