02 散点图 scatter

用途

两个量的关系与相关性,如负载率—效率、电压—电流,可叠加拟合曲线或等值参考线。

示例(5 张)

02-1 配电变压器负载率与效率

配电变压器负载率与效率

02-2 光伏逆变器直流侧电压与输出功率

光伏逆变器直流侧电压与输出功率

02-3 异步电机转速—电磁转矩特性散点

异步电机转速—电磁转矩特性散点

02-4 负荷有功—无功散点与功率因数参考线

负荷有功—无功散点与功率因数参考线

02-5 锂电池荷电状态与开路电压

锂电池荷电状态与开路电压

代码

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

# 摘自 code/第一批_基础图型261106.py

def scatter_01():
    """配电变压器负载率与效率。"""
    fig, ax = new_fig()
    rng = np.random.default_rng(11)
    beta = np.concatenate([np.linspace(0.05, 1.0, 26), np.linspace(0.05, 1.0, 26)])
    eff = 98.72 - 0.62 * (1 / (0.32 + beta) - 0.75) - 0.42 * beta ** 2 + rng.normal(0, 0.035, 52)
    ax.scatter(beta, eff, s=16, color=C1, edgecolors="white", linewidths=0.3, label="实测样本")
    xx = np.linspace(0.05, 1.0, 200)
    yy = 98.72 - 0.62 * (1 / (0.32 + xx) - 0.75) - 0.42 * xx ** 2
    ax.plot(xx, yy, color=C2, ls="--", lw=1.0, label="拟合曲线")
    ax.set_xlabel("负载率 " + IT["beta"])
    ax.set_ylabel("效率 " + IT["eta"] + " / %")
    ax.set_xlim(0, 1.05)
    ax.margins(y=0.20)
    legend(ax, "lower right", ncol=1)
    save(fig, "02_散点", "02_散点_变压器负载率与效率")

def scatter_02():
    """光伏逆变器直流侧电压与输出功率。"""
    fig, ax = new_fig()
    rng = np.random.default_rng(22)
    u = rng.uniform(560, 820, 90)
    p = 500 * np.clip(1 - ((u - 700) / 130) ** 2, 0.15, 1) + rng.normal(0, 18, 90)
    sc = ax.scatter(u, p, c=p, cmap="Blues", s=22, edgecolors="0.4", linewidths=0.3)
    cb = fig.colorbar(sc, ax=ax, pad=0.02, fraction=0.05)
    cb.set_label("输出功率 " + IT["P"] + " / kW")
    cb.ax.tick_params(direction="in", labelsize=FS - 2)
    cb.outline.set_linewidth(0.5)
    ax.set_xlabel("直流母线电压 " + IT["U"] + "dc / V")
    ax.set_ylabel("交流输出功率 " + IT["P"] + " / kW")
    ax.set_xlim(540, 840)
    ax.margins(y=0.16)
    fig.subplots_adjust(right=0.90)
    save(fig, "02_散点", "02_散点_逆变器电压与功率")

def scatter_03():
    """异步电机转速—电磁转矩特性散点。"""
    fig, ax = new_fig()
    rng = np.random.default_rng(33)
    n = np.linspace(400, 1480, 40)
    tq = 2.1 * (1 - ((n - 1450) / 700) ** 2)
    for i, (off, nm) in enumerate([(0, "额定电压"), (-0.18, "0.9 倍电压"), (-0.34, "0.8 倍电压")]):
        ax.scatter(n, tq + off + rng.normal(0, 0.03, 40), s=14, marker=MARKERS[i],
                   color=COLORS[i], label=nm, linewidths=0.3, edgecolors="white")
    ax.set_xlabel("转速 " + IT["n"] + " / (r/min)")
    ax.set_ylabel("电磁转矩 " + IT["T"] + " / (N·m)")
    ax.set_xlim(350, 1550)
    ax.margins(y=0.24)
    legend(ax, "lower left", ncol=1)
    save(fig, "02_散点", "02_散点_电机转速转矩特性")

def scatter_04():
    """负荷有功—无功散点与功率因数参考线。"""
    fig, ax = new_fig()
    rng = np.random.default_rng(44)
    p = rng.uniform(120, 900, 80)
    q = p * rng.uniform(0.25, 0.55, 80) + rng.normal(0, 22, 80)
    ax.scatter(p, q, s=16, color=C1, alpha=0.85, edgecolors="white", linewidths=0.3,
               label="采样点")
    xx = np.linspace(100, 950, 50)
    for i, (npf, ls) in enumerate([(0.90, "-"), (0.95, "--")]):
        ax.plot(xx, xx * np.tan(np.arccos(npf)), color=[C2, C3][i], ls=ls, lw=0.8,
                label="功率因数 " + f"{npf:.2f}")
    ax.set_xlabel("有功功率 " + IT["P"] + " / kW")
    ax.set_ylabel("无功功率 " + IT["Q"] + " / kvar")
    ax.set_xlim(100, 950)
    ax.margins(y=0.16)
    legend(ax, "upper left", ncol=1)
    save(fig, "02_散点", "02_散点_有功无功与功率因数")

def scatter_05():
    """锂电池荷电状态与开路电压。"""
    fig, ax = new_fig()
    soc = np.linspace(0, 100, 60)
    ocv = 3.05 + 0.22 * (soc / 100) + 0.42 / (1 + np.exp(-(soc - 62) / 8))
    rng = np.random.default_rng(55)
    for i, (cur, nm) in enumerate([(0.0, "静置"), (0.5, "充电 0.5C"), (-0.5, "放电 0.5C")]):
        ax.scatter(soc, ocv + cur * 0.09 + rng.normal(0, 0.006, 60), s=13,
                   marker=MARKERS[i], color=COLORS[i], label=nm,
                   linewidths=0.3, edgecolors="white")
    ax.set_xlabel("荷电状态 SOC / %")
    ax.set_ylabel("开路电压 " + IT["U"] + "oc / V")
    ax.set_xlim(0, 100)
    ax.margins(y=0.22)
    legend(ax, "upper left", ncol=1)
    save(fig, "02_散点", "02_散点_锂电池SOC与开路电压")

说明

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