11 阶梯图 step

用途

分段常量,如分时电价、变压器分接头档位、无功投切状态。

示例(5 张)

11-1 分时电价阶梯曲线

分时电价阶梯曲线

11-2 变压器分接头档位日调节过程

变压器分接头档位日调节过程

11-3 储能功率指令阶梯化与荷电状态响应

储能功率指令阶梯化与荷电状态响应

11-4 无功补偿装置投切档位(累计投入容量)

无功补偿装置投切档位(累计投入容量)

11-5 负荷分级投切:可中断负荷容量阶梯变化

负荷分级投切:可中断负荷容量阶梯变化

代码

以下 5 个函数取自 code/第三批_面积与场261106.py,直接调用即可出图。版式(宋体 + Times、10 磅、刻度朝内四边、图内无标题、留白自检)由 code/公共配置261106.py 的 setup_cn_style() 与 save() 统一提供。

# 摘自 code/第三批_面积与场261106.py

def step_01():
    """分时电价阶梯曲线。"""
    fig, ax = new_fig()
    h = np.arange(0, 25)
    price = np.select(
        [(h >= 8) & (h < 11), (h >= 11) & (h < 18), (h >= 18) & (h < 23)],
        [0.86, 0.58, 0.92], default=0.32)
    ax.step(h, price, where="post", color=C1, lw=1.2, label="分时电价")
    ax.fill_between(h, 0, price, step="post", color=C5, alpha=0.35, linewidth=0)
    ax.set_xlabel("时刻 " + IT["t"] + " / h")
    ax.set_ylabel("电价 / (元/(kW·h))")
    ax.set_xlim(0, 24)
    ax.set_ylim(0, 1.12)
    legend(ax, "upper left", ncol=1)
    save(fig, "11_阶梯", "11_阶梯_分时电价曲线")

def step_02():
    """变压器分接头档位日调节过程。"""
    fig, ax = new_fig()
    h = np.arange(0, 25)
    tap = np.select([(h >= 6) & (h < 9), (h >= 9) & (h < 17), (h >= 17) & (h < 21)],
                    [1, 2, 3], default=0)
    ax.step(h, tap, where="post", color=C1, lw=1.2, marker="o", ms=3,
            label="分接头档位")
    ax.set_xlabel("时刻 " + IT["t"] + " / h")
    ax.set_ylabel("档位")
    ax.set_xlim(0, 24)
    ax.set_yticks([0, 1, 2, 3])
    ax.set_ylim(-0.4, 3.8)
    legend(ax, "upper left", ncol=1)
    save(fig, "11_阶梯", "11_阶梯_变压器分接头档位")

def step_03():
    """储能功率指令阶梯化与荷电状态响应。"""
    fig, ax = new_fig()
    h = np.arange(0, 25)
    p = np.select([(h >= 1) & (h < 7), (h >= 18) & (h < 22)], [-200, 160], default=0)
    ax.step(h, p, where="post", color=C1, lw=1.2, label="功率指令")
    ax.axhline(0, color=C4, lw=0.5)
    ax.set_xlabel("时刻 " + IT["t"] + " / h")
    ax.set_ylabel("有功功率 " + IT["P"] + " / kW")
    ax.set_xlim(0, 24)
    ax.set_ylim(-260, 230)
    legend(ax, "lower left", ncol=1)
    save(fig, "11_阶梯", "11_阶梯_储能功率指令")

def step_04():
    """无功补偿装置投切档位(累计投入容量)。"""
    fig, ax = new_fig()
    h = np.arange(0, 25)
    q = np.select([(h >= 8) & (h < 12), (h >= 12) & (h < 17), (h >= 17) & (h < 21)],
                  [200, 400, 300], default=100)
    ax.step(h, q, where="post", color=C3, lw=1.2, label="投入容量")
    ax.fill_between(h, 0, q, step="post", color=C3, alpha=0.25, linewidth=0)
    ax.set_xlabel("时刻 " + IT["t"] + " / h")
    ax.set_ylabel("无功补偿容量 " + IT["Q"] + " / kvar")
    ax.set_xlim(0, 24)
    ax.set_ylim(0, 520)
    legend(ax, "upper left", ncol=1)
    save(fig, "11_阶梯", "11_阶梯_无功补偿投切")

def step_05():
    """负荷分级投切:可中断负荷容量阶梯变化。"""
    fig, ax = new_fig(right=0.86)
    t = np.arange(0, 120)
    shed = np.select([(t >= 30) & (t < 55), (t >= 55) & (t < 80), (t >= 80) & (t < 100)],
                     [80, 140, 60], default=0)
    ax.step(t, shed, where="post", color=C2, lw=1.2, label="切除负荷")
    ax2 = ax.twinx()
    ax2.plot(t, 620 - 0.85 * t + 26 * np.sin(t / 6), color=C1, lw=1.0,
             label="母线负荷")
    ax2.set_ylabel("母线负荷 " + IT["P"] + " / kW")
    ax2.tick_params(direction="in", length=3, width=0.5)
    ax2.spines["right"].set_linewidth(0.5)
    ax2.set_ylim(400, 700)
    ax.set_xlabel("时间 " + IT["t"] + " / min")
    ax.set_ylabel("切除负荷 " + IT["P"] + "shed / kW")
    ax.set_xlim(0, 120)
    ax.set_ylim(-10, 180)
    h1, l1 = ax.get_legend_handles_labels()
    h2, l2 = ax2.get_legend_handles_labels()
    lg = ax.legend(h1 + h2, l1 + l2, loc="upper left", ncol=1, fontsize=FS - 1,
                   framealpha=0.60, edgecolor="0.6", borderpad=0.3)
    save(fig, "11_阶梯", "11_阶梯_可中断负荷投切")

说明

  • 图片 1181×944 px(100 mm × 80 mm @ 300 dpi),三维图为 1181×1122 px。
  • 图内不放标题,图题由本文件的标题承担。
  • 数据为 10 kV 配网、380 V 低压、50 Hz 量级的仿真算例,随机种子固定,重跑结果一致。
posted on 2026-11-07 01:03  小青蛙电气  阅读(2)  评论(0)    收藏  举报