30 表格 table

30 表格 table

用途

把参数表直接嵌进图里,论文里省一张表的位置。

示例(5 张)

30-1 主变压器技术参数表

主变压器技术参数表

30-2 三种降损方案的技术经济对比表

三种降损方案的技术经济对比表

30-3 各次谐波测量结果表

各次谐波测量结果表

30-4 储能配置方案容量表

储能配置方案容量表

30-5 典型日分时段负荷统计表

典型日分时段负荷统计表

代码

以下 5 个函数取自 code/第五批_版式与结构261107.py,直接调用即可出图。样式(宋体 + Times、10 磅、刻度朝内四边、留白自检)由 code/公共配置261107.py 的 setup_cn_style() 和 save() 统一提供,本节不再重复。

# 摘自 code/第五批_版式与结构261107.py

def tb_01():
    """主变压器技术参数表。"""
    fig, ax = new_fig(left=0.05, bottom=0.05, right=0.95, top=0.95)
    ax.axis("off")
    cols = ["参数", "数值", "单位"]
    rows = [["额定容量", "50", "MV·A"],
            ["电压比", "110/10.5", "kV"],
            ["空载损耗", "38.6", "kW"],
            ["负载损耗", "214", "kW"],
            ["阻抗电压", "10.5", "%"],
            ["联结组别", "YNd11", "—"]]
    t = ax.table(cellText=rows, colLabels=cols, loc="center", cellLoc="center",
                 colWidths=[0.36, 0.30, 0.24])
    t.auto_set_font_size(False)
    t.set_fontsize(FS + 1)
    t.scale(1.0, 2.1)
    for (r, c), cell in t.get_celld().items():
        cell.set_linewidth(0.5)
        if r == 0:
            cell.set_facecolor("#DCE7F3")
            cell.set_text_props(color="0.1")
    save(fig, "30_表格图", "30_表格图_变压器参数表")

def tb_02():
    """三种降损方案的技术经济对比表。"""
    fig, ax = new_fig(left=0.05, bottom=0.05, right=0.95, top=0.95)
    ax.axis("off")
    cols = ["指标", "方案一", "方案二", "方案三"]
    rows = [["年线损率 / %", "3.71", "3.24", "2.86"],
            ["投资 / 万元", "365", "318", "402"],
            ["年运行费 / 万元", "96", "112", "82"],
            ["回收期 / 年", "5.2", "4.1", "5.8"],
            ["综合评分", "82.4", "91.6", "88.2"]]
    t = ax.table(cellText=rows, colLabels=cols, loc="center", cellLoc="center",
                 colWidths=[0.34, 0.20, 0.20, 0.20])
    t.auto_set_font_size(False)
    t.set_fontsize(FS)
    t.scale(1.0, 2.0)
    for (r, c), cell in t.get_celld().items():
        cell.set_linewidth(0.5)
        if r == 0:
            cell.set_facecolor("#DCE7F3")
    save(fig, "30_表格图", "30_表格图_方案对比表")

def tb_03():
    """各次谐波测量结果表。"""
    fig, ax = new_fig(left=0.05, bottom=0.05, right=0.95, top=0.95)
    ax.axis("off")
    cols = ["次数", "幅值 / A", "相位 / (°)", "含有率 / %"]
    rows = [["3", "38.6", "112.4", "5.2"],
            ["5", "26.4", "68.1", "3.6"],
            ["7", "15.8", "24.7", "2.1"],
            ["9", "6.2", "187.3", "0.8"],
            ["11", "3.4", "295.6", "0.5"]]
    t = ax.table(cellText=rows, colLabels=cols, loc="center", cellLoc="center",
                 colWidths=[0.16, 0.24, 0.26, 0.24])
    t.auto_set_font_size(False)
    t.set_fontsize(FS + 1)
    t.scale(1.0, 2.2)
    for (r, c), cell in t.get_celld().items():
        cell.set_linewidth(0.5)
        if r == 0:
            cell.set_facecolor("#DCE7F3")
    save(fig, "30_表格图", "30_表格图_谐波测量结果")

def tb_04():
    """储能配置方案容量表。"""
    fig, ax = new_fig(left=0.05, bottom=0.05, right=0.95, top=0.95)
    ax.axis("off")
    cols = ["项目", "功率 / MW", "容量 / (MW·h)", "时长 / h"]
    rows = [["方案 A", "10", "20", "2.0"],
            ["方案 B", "10", "40", "4.0"],
            ["方案 C", "15", "30", "2.0"],
            ["方案 D", "15", "60", "4.0"]]
    t = ax.table(cellText=rows, colLabels=cols, loc="center", cellLoc="center",
                 colWidths=[0.22, 0.24, 0.28, 0.20])
    t.auto_set_font_size(False)
    t.set_fontsize(FS + 1)
    t.scale(1.0, 2.3)
    for (r, c), cell in t.get_celld().items():
        cell.set_linewidth(0.5)
        if r == 0:
            cell.set_facecolor("#DCE7F3")
    save(fig, "30_表格图", "30_表格图_储能配置方案")

def tb_05():
    """典型日分时段负荷统计表。"""
    fig, ax = new_fig(left=0.05, bottom=0.05, right=0.95, top=0.95)
    ax.axis("off")
    cols = ["时段", "最大负荷 / kW", "最小负荷 / kW", "负荷率"]
    rows = [["0-6 时", "382", "296", "0.84"],
            ["6-12 时", "628", "402", "0.71"],
            ["12-18 时", "712", "486", "0.66"],
            ["18-24 时", "596", "364", "0.72"]]
    t = ax.table(cellText=rows, colLabels=cols, loc="center", cellLoc="center",
                 colWidths=[0.20, 0.30, 0.30, 0.20])
    t.auto_set_font_size(False)
    t.set_fontsize(FS + 1)
    t.scale(1.0, 2.3)
    for (r, c), cell in t.get_celld().items():
        cell.set_linewidth(0.5)
        if r == 0:
            cell.set_facecolor("#DCE7F3")
    save(fig, "30_表格图", "30_表格图_分时段负荷统计")

说明

  • 图片尺寸 1181×944 px(100 mm × 80 mm @ 300 dpi),三维图为 1181×1122 px。
  • 图内不放标题,图题由本文件的二级/三级标题承担。
  • 数据为贴近广东实际量级的仿真算例,随机种子固定,重跑结果一致。
posted @ 2026-11-08 00:11  小青蛙电气  阅读(3)  评论(0)    收藏  举报