87 lines
3.5 KiB
Python
87 lines
3.5 KiB
Python
"""测试储能容量计算"""
|
||
import sys
|
||
sys.path.append('src')
|
||
from storage_optimization import calculate_energy_balance, SystemParameters
|
||
|
||
# 使用简单的示例数据
|
||
solar_output = [0.0] * 6 + [10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 50.0, 40.0, 30.0, 20.0, 10.0, 0.0] + [0.0] * 6
|
||
wind_output = [20.0, 30.0, 40.0, 30.0, 20.0, 10.0] * 4
|
||
thermal_output = [50.0] * 24
|
||
load_demand = [30.0, 40.0, 50.0, 60.0, 80.0, 100.0, 120.0, 140.0, 160.0, 180.0, 200.0, 180.0,
|
||
160.0, 140.0, 120.0, 100.0, 80.0, 60.0, 50.0, 40.0, 30.0, 20.0, 10.0, 20.0]
|
||
|
||
# 系统参数
|
||
params = SystemParameters(
|
||
max_curtailment_wind=0.1,
|
||
max_curtailment_solar=0.1,
|
||
max_grid_ratio=0.2,
|
||
storage_efficiency=0.9,
|
||
discharge_rate=1.0,
|
||
charge_rate=1.0,
|
||
max_storage_capacity=200.0 # 设置储能容量上限
|
||
)
|
||
|
||
# 测试不同储能容量下的储能状态
|
||
test_capacities = [50.0, 100.0, 150.0, 200.0]
|
||
|
||
print("="*70)
|
||
print("测试不同储能容量下的实际最大储能状态")
|
||
print("="*70)
|
||
print(f"储能容量上限: {params.max_storage_capacity} MWh")
|
||
print(f"充放电倍率: {params.charge_rate} C\n")
|
||
|
||
for capacity in test_capacities:
|
||
result = calculate_energy_balance(
|
||
solar_output, wind_output, thermal_output, load_demand,
|
||
params, capacity, initial_soc=0.0
|
||
)
|
||
|
||
storage_profile = result['storage_profile']
|
||
max_storage_state = max(storage_profile)
|
||
min_storage_state = min(storage_profile)
|
||
total_curtailed = sum(result['curtailed_wind']) + sum(result['curtailed_solar'])
|
||
|
||
print(f"储能容量: {capacity:.1f} MWh")
|
||
print(f" 实际最大储能状态: {max_storage_state:.2f} MWh ({max_storage_state/capacity*100:.1f}%)")
|
||
print(f" 实际最小储能状态: {min_storage_state:.2f} MWh")
|
||
print(f" 总弃电量: {total_curtailed:.2f} MWh")
|
||
|
||
# 检查是否有充电受限的情况
|
||
charge_profile = result['charge_profile']
|
||
discharge_profile = result['discharge_profile']
|
||
|
||
max_possible_charge = capacity * params.charge_rate # 最大充电功率
|
||
max_possible_discharge = capacity * params.discharge_rate # 最大放电功率
|
||
|
||
max_actual_charge = max(charge_profile)
|
||
max_actual_discharge = max(discharge_profile)
|
||
|
||
print(f" 最大充电功率: {max_actual_charge:.2f} MW (限制: {max_possible_charge:.2f} MW)")
|
||
print(f" 最大放电功率: {max_actual_discharge:.2f} MW (限制: {max_possible_discharge:.2f} MW)")
|
||
|
||
# 检查是否达到功率限制
|
||
charge_limited = any(c >= max_possible_charge * 0.99 for c in charge_profile)
|
||
discharge_limited = any(d >= max_possible_discharge * 0.99 for d in discharge_profile)
|
||
|
||
if charge_limited:
|
||
print(f" ⚠ 充电功率受限")
|
||
if discharge_limited:
|
||
print(f" ⚠ 放电功率受限")
|
||
|
||
# 检查储能容量利用率
|
||
utilization = max_storage_state / capacity * 100
|
||
if utilization < 90:
|
||
print(f" ⚠ 储能容量利用率低 ({utilization:.1f}%)")
|
||
|
||
print()
|
||
|
||
print("="*70)
|
||
print("分析:为什么实际储能状态达不到设定的储能容量上限?")
|
||
print("="*70)
|
||
print("可能的原因:")
|
||
print("1. 电力供需平衡:如果发电量和负荷基本平衡,不需要大量储能")
|
||
print("2. 充放电倍率限制:充放电功率受限,无法快速填满储能")
|
||
print("3. 约束条件限制:弃风弃光率、上网电量比例等约束限制了储能使用")
|
||
print("4. 周期性平衡要求:储能需要在周期结束时回到接近初始状态")
|
||
print("5. 初始SOC设置:初始SOC从0开始,可能需要多周期才能稳定")
|