04 事件图 eventplot
用途
多路离散事件的发生时刻,适合保护动作时序、开关操作序列。
示例(5 张)
04-1 继电保护动作时序(四路信号)

04-2 断路器分合闸操作序列

04-3 六条馈线的故障发生时刻分布

04-4 储能充放电状态切换时刻(一年)

04-5 SCADA 报文到达时刻(三个通道)

代码
以下 5 个函数取自 code/第一批_分布与矩阵261107.py,直接调用即可出图。样式(宋体 + Times、10 磅、刻度朝内四边、留白自检)由 code/公共配置261107.py 的 setup_cn_style() 和 save() 统一提供,本节不再重复。
# 摘自 code/第一批_分布与矩阵261107.py
def ev_01():
"""继电保护动作时序(四路信号)。"""
fig, ax = new_fig(left=0.24)
rng = np.random.default_rng(401)
rows = [np.sort(rng.uniform(0, 200, 28)), np.sort(rng.uniform(40, 210, 18)),
np.sort(rng.uniform(80, 230, 12)), np.sort(rng.uniform(120, 250, 7))]
names = ["过流 Ⅰ 段", "过流 Ⅱ 段", "距离保护", "重合闸"]
ax.eventplot(rows, colors=COLORS, lineoffsets=[0, 1, 2, 3],
linelengths=0.62, linewidths=0.9)
ax.set_yticks([0, 1, 2, 3])
ax.set_yticklabels(names)
ax.set_ylim(-0.7, 3.7)
ax.set_xlabel("时间 " + IT["t"] + " / ms")
ax.set_ylabel("保护装置")
save(fig, "04_事件图", "04_事件图_继电保护动作时序")
def ev_02():
"""断路器分合闸操作序列。"""
fig, ax = new_fig(left=0.31)
rng = np.random.default_rng(402)
rows = [rng.uniform(0, 24, 16), rng.uniform(0, 24, 11), rng.uniform(0, 24, 7)]
ax.eventplot(rows, colors=[C1, C3, C5], lineoffsets=[0, 1, 2],
linelengths=0.58, linewidths=1.0)
ax.set_yticks([0, 1, 2])
ax.set_yticklabels(["断路器 QF1", "断路器 QF2", "隔离开关 QS"])
ax.set_ylim(-0.7, 2.7)
ax.set_xlabel("时刻 " + IT["t"] + " / h")
ax.set_ylabel("开关设备")
ax.set_xlim(0, 24)
save(fig, "04_事件图", "04_事件图_断路器操作序列")
def ev_03():
"""六条馈线的故障发生时刻分布。"""
fig, ax = new_fig(left=0.20)
rng = np.random.default_rng(403)
rows = [np.sort(rng.uniform(0, 365, n)) for n in (14, 9, 21, 6, 17, 11)]
ax.eventplot(rows, colors=[C1] * 6, lineoffsets=range(6),
linelengths=0.55, linewidths=0.9)
ax.set_yticks(range(6))
ax.set_yticklabels([f"L{i + 1}" for i in range(6)])
ax.set_ylim(-0.7, 5.7)
ax.set_xlabel("一年中的日序 " + IT["t"] + " / d")
ax.set_ylabel("馈线")
ax.set_xlim(0, 365)
save(fig, "04_事件图", "04_事件图_馈线故障时刻")
def ev_04():
"""储能充放电状态切换时刻(一年)。"""
fig, ax = new_fig(left=0.24)
rng = np.random.default_rng(404)
chg = np.sort(rng.uniform(0, 365, 52))
dis = np.sort(rng.uniform(0, 365, 48))
ax.eventplot([chg, dis], colors=[C1, C3], lineoffsets=[0, 1],
linelengths=0.6, linewidths=0.9)
ax.set_yticks([0, 1])
ax.set_yticklabels(["充电起始", "放电起始"])
ax.set_ylim(-0.7, 1.7)
ax.set_xlabel("一年中的日序 " + IT["t"] + " / d")
ax.set_ylabel("工况切换")
ax.set_xlim(0, 365)
save(fig, "04_事件图", "04_事件图_储能工况切换")
def ev_05():
"""SCADA 报文到达时刻(三个通道)。"""
fig, ax = new_fig(left=0.24)
rng = np.random.default_rng(405)
rows = [np.cumsum(rng.exponential(0.9, 26)), np.cumsum(rng.exponential(1.5, 18)),
np.cumsum(rng.exponential(2.4, 12))]
ax.eventplot(rows, colors=[C1, C5, C3], lineoffsets=[0, 1, 2],
linelengths=0.58, linewidths=0.9)
ax.set_yticks([0, 1, 2])
ax.set_yticklabels(["通道 1", "通道 2", "通道 3"])
ax.set_ylim(-0.7, 2.7)
ax.set_xlabel("时间 " + IT["t"] + " / s")
ax.set_ylabel("通信通道")
save(fig, "04_事件图", "04_事件图_报文到达时刻")
说明
- 图片尺寸 1181×944 px(100 mm × 80 mm @ 300 dpi),三维图为 1181×1122 px。
- 图内不放标题,图题由本文件的二级/三级标题承担。
- 数据为贴近广东实际量级的仿真算例,随机种子固定,重跑结果一致。
浙公网安备 33010602011771号