跳到主内容

v0.38.0 版本说明

EnerOS v0.38.0

发布日期:2026-06-06
版本代号:Sim
Git Tag:v0.38.0
支持状态:稳定(Stable)
Crate 总数:96(新增 6 个)
测试用例数:12100+(新增 700)

概述

EnerOS v0.38.0「Sim」是实时仿真专题版本,将电力系统全场景仿真能力集成进 EnerOS 内核。本版本使 EnerOS 能够在内核侧直接运行电磁暂态、机电暂态、中长期动态三类仿真,覆盖从微秒级电力电子开关动态到分钟级系统级动态的全时间尺度。

Sim 版本的核心设计哲学是「仿真即系统调用」——仿真不再是独立的外部工具,而是内核一等公民。Agent 通过系统调用触发仿真,仿真结果直接回灌给决策链路,实现「仿真验证 - 决策 - 执行」的闭环。这使得任何调度操作在执行前都可在内核侧完成秒级仿真预校验,将「试错」从物理空间转移到数字空间。

本版本引入五大核心能力:电磁暂态仿真(EMTP)机电暂态仿真中长期动态仿真仿真加速引擎仿真场景管理。所有能力均通过 eneros-simeneros-sim-emteneros-sim-tseneros-sim-lteneros-sim-accel 五个新 crate 实现。

关键数据

指标数值说明
EMT 仿真步长50μs电磁暂态
机电暂态步长2ms暂态稳定
中长期动态步长1s长期动态
仿真加速比8.5x实时倍率
新增 Crate6仿真相关
新增测试700+含 90 个端到端

新特性

1. 电磁暂态仿真(EMT)

新增 eneros-sim-emt crate,提供电磁暂态仿真引擎,支持微秒级电力电子器件开关动态、雷电过电压、操作过电压等快速电磁暂态过程。

EMT 仿真配置

use eneros_sim_emt::{EmtSimulator, EmtConfig, Solver};

let simulator = EmtSimulator::new(&network)
    .config(EmtConfig {
        time_step: Duration::microseconds(50),
        total_time: Duration::milliseconds(100),
        solver: Solver::Trapezoidal,
        interpolation: true,
        snubber_circuit: true,
    })
    .build().await?;

// 配置故障场景
let fault = FaultScenario::new()
    .type(FaultType::ThreePhaseToGround)
    .location(BusId::from(5))
    .resistance(0.5)
    .onset(Duration::milliseconds(10))
    .duration(Duration::milliseconds(50));

simulator.apply_fault(fault)?;

// 运行仿真
let result = simulator.run().await?;

// 提取结果
let voltage = result.bus_voltage(BusId::from(5))?;
let current = result.branch_current(BranchId::from("L-3"))?;

println!("故障期间最大电压: {:.2} kV", voltage.max_abs() / 1000.0);
println!("故障电流峰值: {:.2} kA", current.max_abs() / 1000.0);

EMT 元件模型

元件模型说明
输电线路分布参数 / PI 集中多段级联
变压器考虑饱和特性铁芯非线性
发电机dq0 坐标系7 阶模型
电力电子详细开关模型IGBT/Diode
避雷器V-I 特性金属氧化物
故障电阻/电弧模型时变阻抗

仿真精度验证

测试场景EnerOS Sim商业软件偏差
IEEE 39 雷电过电压812.3 kV815.1 kV0.34%
操作过电压2.8 pu2.82 pu0.71%
故障恢复过电压1.35 pu1.36 pu0.74%
谐振过电压1.12 pu1.13 pu0.89%

2. 机电暂态仿真

新增 eneros-sim-ts crate,提供机电暂态仿真引擎,支持暂态稳定分析、功角稳定、电压稳定、频率稳定等系统级动态分析。

暂态稳定仿真

use eneros_sim_ts::{TransientSimulator, TsConfig};

let simulator = TransientSimulator::new(&network)
    .config(TsConfig {
        time_step: Duration::milliseconds(2),
        total_time: Duration::seconds(10),
        generator_model: GeneratorModel::Detailed {
            order: 6,  // 6 阶同步电机
            avr: true, // 励磁系统
            governor: true, // 调速器
            pss: true, // 电力系统稳定器
        },
        load_model: LoadModel::Composite {
            static_ratio: 0.7,
            dynamic_ratio: 0.3,
        },
    })
    .build().await?;

// 模拟三相短路故障
let disturbance = Disturbance::three_phase_fault(BusId::from(8))
    .duration(Duration::milliseconds(80))
    .cleared_by_opening(BranchId::from("L-5"));

let result = simulator.run(disturbance).await?;

// 检查暂态稳定性
let stable = result.is_transient_stable()?;
println!("暂态稳定: {}", if stable { "是" } else { "否" });

// 功角曲线
for gen in result.generators() {
    let max_angle = gen.max_rotor_angle();
    println!("发电机 {} 最大功角: {:.1} 度", gen.id, max_angle.to_degrees());
}

稳定分析能力

分析类型方法输出计算耗时
暂态稳定时域仿真功角/电压/频率曲线2-10s
电压稳定CPF / 连续潮流PV/QV 曲线5-30s
频率稳定SFR 模型频率响应曲线1-5s
小信号稳定特征值分析振荡模式/阻尼比5-20s

临界故障清除时间

// 计算临界故障清除时间(CCT)
let cct = simulator.critical_clearing_time(
    FaultType::ThreePhase,
    BusId::from(8),
).await?;

println!("临界故障清除时间: {:.0} ms", cct.as_millis());
// 输出示例:临界故障清除时间: 145 ms

3. 中长期动态仿真

新增 eneros-sim-lt crate,提供中长期动态仿真引擎,支持分钟到小时级的慢动态过程分析。

长期动态场景

use eneros_sim_lt::{LongTermSimulator, LtConfig};

let simulator = LongTermSimulator::new(&network)
    .config(LtConfig {
        time_step: Duration::seconds(1),
        total_time: Duration::hours(2),
        models: LongTermModels {
            boiler_dynamics: true,     // 锅炉慢动态
            load_frequency: true,      // 负荷频率特性
            agc: true,                 // 自动发电控制
            oltc: true,                // 有载调压
            thermostat: true,          // 恒温负荷
        },
    })
    .build().await?;

// 模拟大容量新能源切除场景
let scenario = LtScenario::new()
    .event(Event::generator_loss(BusId::from(1), 500.0).at("00:00:00"))
    .event(Event::renewable_curtailment(0.3).at("00:05:00"));

let result = simulator.run(scenario).await?;

// 频率响应分析
let freq = result.system_frequency();
println!("最低频率: {:.3} Hz", freq.min());
println!("稳态频率: {:.3f} Hz", freq.steady_state());
println!("恢复时间: {:?}", freq.recovery_time());

中长期动态元件

元件时间常数说明
锅炉100-500s燃煤/燃气锅炉动态
核反应堆10-100s核功率跟踪
AGC4-30s区域控制偏差
OLTC10-60s分接头调节
恒温负荷5-30min温度控制
抽水蓄能60-300s工况转换

4. 仿真加速引擎

新增 eneros-sim-accel crate,提供多级仿真加速能力,使大规模仿真能够在实用时间尺度内完成。

加速技术

技术加速比适用场景说明
多线程并行4-8x大电网节点级并行
GPU 加速8-20xEMT矩阵运算
解耦计算2-5x暂态子系统分块
简化模型5-50x初步分析降阶模型
实时数字仿真1x (实时)HIL硬件在环

加速配置

use eneros_sim_accel::{Acceleration, AccelerationConfig};

let accel = Acceleration::new(AccelerationConfig {
    parallelism: Parallelism::MultiThread { threads: 8 },
    gpu: Some(GpuConfig {
        device: 0,
        batch_size: 1024,
    }),
    decoupling: Decoupling::Coefficient,
    cache: CacheStrategy::Adaptive,
});

// 将加速器应用到仿真器
let simulator = EmtSimulator::new(&network)
    .acceleration(accel)
    .build().await?;

// 100ms 仿真时间,实时倍率
let result = simulator.run().await?;
println!("仿真耗时: {:?}", result.wall_time);
println!("模拟时间: {:?}", result.simulated_time);
println!("加速比: {:.1}x", result.speedup());

5. 仿真场景管理

新增 eneros-sim crate(仿真核心),提供统一的仿真场景管理、批量仿真、结果对比能力。

批量仿真

use eneros_sim::{SimulationManager, BatchScenario, SweepParam};

let manager = SimulationManager::new(&ctx);

// 参数扫描:故障位置 × 故障类型
let batch = BatchScenario::new("N-1-analysis")
    .sweep(SweepParam::fault_location, vec![5, 8, 12, 15, 20])
    .sweep(SweepParam::fault_type, vec![FaultType::ThreePhase, FaultType::SinglePhase])
    .simulator(SimulatorType::Transient)
    .parallelism(8)
    .build();

let results = manager.run_batch(batch).await?;

// 汇总结果
let summary = results.summary();
println!("共 {} 个场景:", summary.count);
println!("  稳定: {}", summary.stable_count);
println!("  不稳定: {}", summary.unstable_count);
println!("  临界: {}", summary.critical_count);

// 识别最严重场景
let worst = results.worst_case();
println!("最严重场景: {:?} @ Bus {}", worst.fault_type, worst.fault_bus);

仿真结果对比

// 对比不同运行方式下的稳定性
let comparison = manager.compare(
    Scenario::from_mode(OperationMode::Normal),
    Scenario::from_mode(OperationMode::N_1),
    Scenario::from_mode(OperationMode::Maintenance),
).await?;

println!("{:<15} {:<10} {:<10} {:<10}", "指标", "正常", "N-1", "检修");
for metric in &comparison.metrics {
    println!("{:<15} {:<10.2} {:<10.2} {:<10.2}",
        metric.name, metric.normal, metric.n1, metric.maintenance);
}

仿真与决策闭环

// 调度前自动仿真预校验
scheduler.on_before_dispatch(|schedule| {
    let scenario = Scenario::from_schedule(schedule);
    let result = manager.quick_check(scenario, Duration::seconds(5)).await?;

    if !result.is_stable() {
        // 仿真不通过,拒绝调度方案
        return Err(RejectReason::Unstable(result.worst_violation));
    }
    Ok(())
}).await?;

改进

  • 潮流计算:新增 PQ 分解法与直流潮流,满足不同精度需求
  • 约束引擎:新增动态安全约束,支持仿真驱动的约束校验
  • 时序引擎:仿真结果可直接写入时序数据库供查询
  • Agent 运行时:仿真 Agent 支持优先级调度,紧急仿真可抢占
  • 可观测性:仿真过程支持全量数据录制与回放

Bug 修复

  • 修复 eneros-sim-emt 在含大量电力电子器件时数值振荡的问题(#3803)
  • 修复 eneros-sim-ts 发电机 6 阶模型参数加载错误的问题(#3810)
  • 修复 eneros-sim-lt AGC 模型在区域间联络线功率计算偏差的问题(#3816)
  • 修复 eneros-sim-accel GPU 加速在双精度场景下结果不一致的问题(#3822)
  • 修复 eneros-sim 批量仿真在中途取消时资源未释放的问题(#3828)

破坏性变更

  • EmtSimulator::new:参数从 &str 改为 &NetworkGraph
  • TransientSimulator::run:参数从 () 改为 Disturbance
  • SimulationManager:所有方法改为异步(async

升级指南

  1. 更新 Cargo.toml 中的 eneros 依赖至 0.38.0
  2. 运行 eneros sim init 初始化仿真引擎
  3. eneros.toml 中配置仿真参数与加速策略
  4. 运行 eneros sim validate 验证模型参数

致谢

感谢 38 位贡献者提交的 580+ 个 commit,以及电力系统仿真专家提供的模型验证。