增加储能损耗电量。

This commit is contained in:
dmy
2025-12-26 18:27:22 +08:00
parent c888719839
commit 4be9c74f42

20
main.py
View File

@@ -21,7 +21,7 @@ plt.rcParams['font.sans-serif'] = ['SimHei', 'Microsoft YaHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False plt.rcParams['axes.unicode_minus'] = False
def plot_system_curves(solar_output, wind_output, thermal_output, load_demand, result, show_window=False, display_only=False): def plot_system_curves(solar_output, wind_output, thermal_output, load_demand, result, storage_efficiency=0.9, show_window=False, display_only=False):
""" """
绘制系统运行曲线 绘制系统运行曲线
@@ -216,6 +216,22 @@ def plot_system_curves(solar_output, wind_output, thermal_output, load_demand, r
print(f" - 风电实际发电量: {total_wind_potential - total_curtail_wind:.2f} MWh") print(f" - 风电实际发电量: {total_wind_potential - total_curtail_wind:.2f} MWh")
print(f"新能源利用率: {renewable_utilization_rate:.2f}%") print(f"新能源利用率: {renewable_utilization_rate:.2f}%")
print(f"新能源消纳电量占比: {renewable_consumption_ratio:.2f}%") print(f"新能源消纳电量占比: {renewable_consumption_ratio:.2f}%")
# 计算储能损耗统计信息
total_charge = sum(result['charge_profile'])
total_discharge = sum(result['discharge_profile'])
# 储能损耗 = 充电量 - (放电量 / 效率)
storage_loss = total_charge - (total_discharge / storage_efficiency if storage_efficiency > 0 else 1)
storage_efficiency_actual = (total_discharge / total_charge * 100) if total_charge > 0 else 0
print(f"\n=== 储能损耗统计 ===")
print(f"总充电量: {total_charge:.2f} MWh")
print(f"总放电量: {total_discharge:.2f} MWh")
print(f"储能效率: {storage_efficiency:.2f}")
print(f"实际充放电效率: {storage_efficiency_actual:.2f}%")
print(f"储能损耗电量: {storage_loss:.2f} MWh")
print(f"储能损耗率: {(storage_loss/total_charge*100) if total_charge > 0 else 0:.2f}%")
def export_results_to_excel(solar_output, wind_output, thermal_output, load_demand, result, params, filename=None): def export_results_to_excel(solar_output, wind_output, thermal_output, load_demand, result, params, filename=None):
@@ -599,7 +615,7 @@ def main():
# 绘制曲线 # 绘制曲线
print("正在绘制系统运行曲线...") print("正在绘制系统运行曲线...")
plot_system_curves(solar_output, wind_output, thermal_output, load_demand, result, show_window, display_only) plot_system_curves(solar_output, wind_output, thermal_output, load_demand, result, params.storage_efficiency, show_window, display_only)
# 导出结果到Excel # 导出结果到Excel
try: try: