增加在excel中设置参数的功能。

This commit is contained in:
dmy
2025-12-26 00:28:07 +08:00
parent 1dad2ff220
commit 2177a86c28
2 changed files with 248 additions and 15 deletions

View File

@@ -109,15 +109,26 @@ def create_comprehensive_plot(solar_output, wind_output, thermal_output, load_de
total_curtailed = sum(curtailed_wind) + sum(curtailed_solar)
total_grid = sum(result['grid_feed_in'])
# 能量分配
energy_data = [total_load, total_curtailed, total_grid]
energy_labels = [f'负荷\n({total_load:.1f} MWh)',
f'弃风弃光\n({total_curtailed:.1f} MWh)',
f'上网电量\n({total_grid:.1f} MWh)']
colors = ['red', 'orange', 'green']
ax5.pie(energy_data, labels=energy_labels, colors=colors, autopct='%1.1f%%', startangle=90)
ax5.set_title('能量分配')
# 处理上网电量为负的情况(购电)
if total_grid >= 0:
# 有上网电量
energy_data = [total_load, total_curtailed, total_grid]
energy_labels = [f'负荷\n({total_load:.1f} MWh)',
f'弃风弃光\n({total_curtailed:.1f} MWh)',
f'上网电量\n({total_grid:.1f} MWh)']
colors = ['red', 'orange', 'green']
ax5.pie(energy_data, labels=energy_labels, colors=colors, autopct='%1.1f%%', startangle=90)
ax5.set_title('能量分配')
else:
# 从电网购电
grid_purchase = -total_grid # 转为正值
energy_data = [total_load, total_curtailed, grid_purchase]
energy_labels = [f'负荷\n({total_load:.1f} MWh)',
f'弃风弃光\n({total_curtailed:.1f} MWh)',
f'购电量\n({grid_purchase:.1f} MWh)']
colors = ['red', 'orange', 'blue'] # 购电用蓝色
ax5.pie(energy_data, labels=energy_labels, colors=colors, autopct='%1.1f%%', startangle=90)
ax5.set_title('能量分配(含购电)')
# === 发电构成饼图 ===
ax6 = fig.add_subplot(gs[2, 1])
@@ -146,7 +157,7 @@ def create_comprehensive_plot(solar_output, wind_output, thermal_output, load_de
弃光率: {result['total_curtailment_solar_ratio']:.1%}
上网电量比例: {result['total_grid_feed_in_ratio']:.1%}
能量平衡: {'' if result['energy_balance_check'] else ''}
能量平衡: {'通过' if result['energy_balance_check'] else '未通过'}
最大储能状态: {max(storage_soc):.1f} MWh
最小储能状态: {min(storage_soc):.1f} MWh