18 极坐标 polar

用途

角度相关量,如三相相量图、功率因数圆图、风向玫瑰图。

示例(5 张)

18-1 三相电压相量图

三相电压相量图

18-2 功率因数随负荷变化的极坐标圆图

功率因数随负荷变化的极坐标圆图

18-3 风向玫瑰图(16 方位风速频率)

风向玫瑰图(16 方位风速频率)

18-4 变电站局部放电超声阵列方向响应

变电站局部放电超声阵列方向响应

18-5 谐波电流极坐标分布(次数—幅值)

谐波电流极坐标分布(次数—幅值)

代码

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

# 摘自 code/第四批_信号与三维261106.py

def polar_01():
    """三相电压相量图。"""
    fig, ax = new_fig_polar()
    amps = [10.12, 10.06, 10.15]
    angs = [np.pi / 2, np.pi / 2 - 2 * np.pi / 3, np.pi / 2 + 2 * np.pi / 3]
    names = ["A 相", "B 相", "C 相"]
    for i, (a, th, nm) in enumerate(zip(amps, angs, names)):
        ax.annotate("", xy=(th, a), xytext=(0, 0),
                    arrowprops={"arrowstyle": "-|>", "color": COLORS[i],
                                "lw": 1.2})
        ax.text(th, a + 1.15, nm, ha="center", va="center", fontsize=FS - 1,
                color=COLORS[i])
    ax.set_ylim(0, 13.2)
    ax.set_yticks([2, 4, 6, 8, 10, 12])
    ax.set_yticklabels(["2", "4", "6", "8", "10", "12"])
    ax.set_rlabel_position(22)
    ax.set_xlabel("径向:电压幅值 " + IT["U"] + " / kV")
    save(fig, "18_极坐标", "18_极坐标_三相电压相量")

def polar_02():
    """功率因数随负荷变化的极坐标圆图。"""
    fig, ax = new_fig_polar()
    th = np.linspace(0, np.pi / 2, 120)
    for i, (pf, nm) in enumerate([(0.85, "cos φ = 0.85"), (0.90, "0.90"),
                                  (0.95, "0.95")]):
        ang = np.arccos(pf)
        r = 100 * np.cos(ang) / np.maximum(np.cos(th), 1e-6)
        r = np.clip(r, 0, 140)
        ax.plot(np.full_like(th, ang), np.linspace(0, 140, th.size),
                color=COLORS[i], lw=1.0, ls=LINES[i], label=nm)
    ax.set_ylim(0, 150)
    ax.set_thetamin(0)
    ax.set_thetamax(90)
    ax.set_xlabel("有功功率 " + IT["P"] + " / kW")
    legend(ax, "upper right", ncol=1, fontsize=FS - 2)
    save(fig, "18_极坐标", "18_极坐标_功率因数圆图")

def polar_03():
    """风向玫瑰图(16 方位风速频率)。"""
    fig, ax = new_fig_polar()
    n = 16
    theta = np.arange(n) * 2 * np.pi / n
    freq = np.array([4.2, 3.1, 2.4, 2.8, 3.6, 5.2, 7.8, 9.6,
                     11.4, 8.9, 6.4, 5.1, 4.6, 3.9, 3.4, 3.8])
    width = 2 * np.pi / n * 0.92
    bars = ax.bar(theta, freq, width=width, bottom=0, color=C5,
                  edgecolor="0.35", linewidth=0.5, label="风频")
    for b, f in zip(bars, freq):
        if f >= 9.0:
            b.set_facecolor(C3)
    ax.set_theta_zero_location("N")
    ax.set_theta_direction(-1)
    ax.set_rlabel_position(112)
    ax.set_ylim(0, 13)
    ax.set_xlabel("径向:风频 / %")
    save(fig, "18_极坐标", "18_极坐标_风向玫瑰图")

def polar_04():
    """变电站局部放电超声阵列方向响应。"""
    fig, ax = new_fig_polar()
    th = np.linspace(0, 2 * np.pi, 720)
    main = np.exp(-((th - np.pi / 2) / 0.16) ** 2)
    side1 = 0.28 * np.exp(-((th - np.pi / 2 - 0.85) / 0.13) ** 2)
    side2 = 0.28 * np.exp(-((th - np.pi / 2 + 0.85) / 0.13) ** 2)
    back = 0.10 * np.exp(-((th + np.pi / 2) / 0.35) ** 2)
    r = 10 * np.log10(main + side1 + side2 + back + 1e-3) + 26
    ax.plot(th, np.clip(r, 0, 30), color=C1, lw=1.0, label="归一化响应")
    ax.fill_between(th, 0, np.clip(r, 0, 30), color=C5, alpha=0.35, linewidth=0)
    ax.set_theta_zero_location("N")
    ax.set_theta_direction(-1)
    ax.set_rlabel_position(135)
    ax.set_ylim(0, 34)
    ax.set_xlabel("径向:增益 / dB")
    save(fig, "18_极坐标", "18_极坐标_声阵列方向响应")

def polar_05():
    """谐波电流极坐标分布(次数—幅值)。"""
    fig, ax = new_fig_polar()
    orders = np.array([2, 3, 4, 5, 6, 7, 9, 11, 13])
    amp = np.array([4.2, 38.6, 2.1, 26.4, 1.3, 15.8, 6.2, 3.4, 1.8])
    th = orders / orders.max() * 2 * np.pi
    bars = ax.bar(th, amp, width=0.24, bottom=0, color=C5, edgecolor="0.35",
                  linewidth=0.5, label="谐波幅值")
    for b, a in zip(bars, amp):
        if a > 20:
            b.set_facecolor(C2)
    ax.set_theta_zero_location("E")
    ax.set_rlabel_position(112)
    ax.set_ylim(0, 44)
    ax.set_xlabel("径向:谐波电流 " + IT["I"] + SUB["h"] + " / A")
    save(fig, "18_极坐标", "18_极坐标_谐波电流分布")

说明

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