Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jd/rename storage #92

Merged
merged 9 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library/psi_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ function _duplicate_system(main_sys::PSY.System, twin_sys::PSY.System, HVDC_line
PSY.add_component!(main_sys, new_ACLine)
end

for bat in get_components(GenericBattery, main_sys)
for bat in get_components(EnergyReservoirStorage, main_sys)
set_base_power!(bat, get_base_power(bat) * 10)
end

Expand Down
154 changes: 36 additions & 118 deletions src/library/psitest_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -747,18 +747,18 @@ function build_c_sys5_bat(;
PSY.add_service!(
c_sys5_bat,
reserve_bat[1],
PSY.get_components(PSY.GenericBattery, c_sys5_bat),
PSY.get_components(PSY.EnergyReservoirStorage, c_sys5_bat),
)
PSY.add_service!(
c_sys5_bat,
reserve_bat[2],
PSY.get_components(PSY.GenericBattery, c_sys5_bat),
PSY.get_components(PSY.EnergyReservoirStorage, c_sys5_bat),
)
# ORDC
PSY.add_service!(
c_sys5_bat,
reserve_bat[3],
PSY.get_components(PSY.GenericBattery, c_sys5_bat),
PSY.get_components(PSY.EnergyReservoirStorage, c_sys5_bat),
)
for (ix, serv) in enumerate(PSY.get_components(PSY.VariableReserve, c_sys5_bat))
forecast_data = SortedDict{Dates.DateTime, TimeSeries.TimeArray}()
Expand Down Expand Up @@ -2403,107 +2403,6 @@ function build_duration_test_sys(; raw_data, kwargs...)
return duration_test_sys
end

function build_pwl_marketbid_sys(; raw_data, kwargs...)
sys_kwargs = filter_kwargs(; kwargs...)
node =
PSY.ACBus(1, "nodeA", "REF", 0, 1.0, (min = 0.9, max = 1.05), 230, nothing, nothing)
load = PSY.PowerLoad("Bus1", true, node, 0.4, 0.9861, 100.0, 1.0, 2.0)
gens_cost = [
PSY.ThermalStandard(;
name = "Alta",
available = true,
status = true,
bus = node,
active_power = 0.52,
reactive_power = 0.010,
rating = 0.5,
prime_mover_type = PSY.PrimeMovers.ST,
fuel = PSY.ThermalFuels.COAL,
active_power_limits = (min = 0.22, max = 0.55),
reactive_power_limits = nothing,
time_limits = nothing,
ramp_limits = nothing,
operation_cost = PSY.MarketBidCost(;
no_load_cost = 0.0,
start_up = (hot = 0.0, warm = 0.0, cold = 0.0),
shut_down = 0.0,
),
base_power = 100.0,
),
PSY.ThermalMultiStart(;
name = "115_STEAM_1",
available = true,
status = true,
bus = node,
active_power = 0.05,
reactive_power = 0.010,
rating = 0.12,
prime_mover_type = PSY.PrimeMovers.ST,
fuel = PSY.ThermalFuels.COAL,
active_power_limits = (min = 0.05, max = 0.12),
reactive_power_limits = (min = -0.30, max = 0.30),
ramp_limits = (up = 0.2 * 0.12, down = 0.2 * 0.12),
power_trajectory = (startup = 0.05, shutdown = 0.05),
time_limits = (up = 4.0, down = 2.0),
start_time_limits = (hot = 2.0, warm = 4.0, cold = 12.0),
start_types = 3,
operation_cost = PSY.MarketBidCost(;
no_load_cost = 0.0,
start_up = (hot = 393.28, warm = 455.37, cold = 703.76),
shut_down = 0.0,
),
base_power = 100.0,
),
]
ini_time = DateTime("1/1/2024 0:00:00", "d/m/y H:M:S")
DA_load_forecast = Dict{Dates.DateTime, TimeSeries.TimeArray}()
market_bid_gen1_data = Dict(
ini_time => [
PiecewiseStepData([22.0, 33.0, 44.0, 55.0], [26.82, 29.55, 30.31]),
PiecewiseStepData([22.0, 33.0, 44.0, 55.0], [26.82, 29.55, 30.31]),
],
ini_time + Hour(1) => [
PiecewiseStepData([22.0, 33.0, 44.0, 55.0], [26.82, 29.55, 30.31]),
PiecewiseStepData([22.0, 33.0, 44.0, 55.0], [26.82, 29.55, 30.31]),
],
)
market_bid_gen1 = PSY.Deterministic(;
name = "variable_cost",
data = market_bid_gen1_data,
resolution = Hour(1),
)
market_bid_gen2_data = Dict(
ini_time => [
PiecewiseStepData([5.0, 7.33, 9.67, 12.0], [124.51, 125.05, 133.64]),
PiecewiseStepData([5.0, 7.33, 9.67, 12.0], [128.80, 128.47, 128.49]),
],
ini_time + Hour(1) => [
PiecewiseStepData([5.0, 7.33, 9.67, 12.0], [124.51, 125.05, 133.64]),
PiecewiseStepData([5.0, 7.33, 9.67, 12.0], [128.80, 128.47, 128.49]),
],
)
market_bid_gen2 = PSY.Deterministic(;
name = "variable_cost",
data = market_bid_gen2_data,
resolution = Hour(1),
)
market_bid_load = [[0.5, 0.6], [0.5, 0.6]]
for (ix, date) in enumerate(range(ini_time; length = 2, step = Hour(1)))
DA_load_forecast[date] =
TimeSeries.TimeArray([date, date + Hour(1)], market_bid_load[ix])
end
load_forecast_cost_market_bid = PSY.Deterministic("max_active_power", DA_load_forecast)
cost_test_sys = PSY.System(100.0; sys_kwargs...)
PSY.add_component!(cost_test_sys, node)
PSY.add_component!(cost_test_sys, load)
PSY.add_component!(cost_test_sys, gens_cost[1])
PSY.add_component!(cost_test_sys, gens_cost[2])
PSY.add_time_series!(cost_test_sys, load, load_forecast_cost_market_bid)
PSY.set_variable_cost!(cost_test_sys, gens_cost[1], market_bid_gen1)
PSY.set_variable_cost!(cost_test_sys, gens_cost[2], market_bid_gen2)
return cost_test_sys
end

function build_5_bus_matpower_DA(; raw_data, kwargs...)
sys_kwargs = filter_kwargs(; kwargs...)
data_dir = dirname(dirname(raw_data))
Expand Down Expand Up @@ -2597,7 +2496,7 @@ function build_test_RTS_GMLC_sys_with_hybrid(; raw_data, add_forecasts, kwargs..
thermal_unit = first(get_components(ThermalStandard, sys))
bus = get_bus(thermal_unit)
electric_load = first(get_components(PowerLoad, sys))
storage = first(get_components(GenericBattery, sys))
storage = first(get_components(EnergyReservoirStorage, sys))
renewable_unit = first(get_components(RenewableDispatch, sys))

name = "Test H"
Expand Down Expand Up @@ -2664,7 +2563,7 @@ function build_c_sys5_bat_ems(;
Deterministic("max_active_power", forecast_data),
)
end
for (ix, r) in enumerate(get_components(PSY.BatteryEMS, c_sys5_bat))
for (ix, r) in enumerate(get_components(PSY.EnergyReservoirStorage, c_sys5_bat))
forecast_data = SortedDict{Dates.DateTime, TimeArray}()
for t in 1:2
ini_time = timestamp(storage_target_DA[t][1])[1]
Expand Down Expand Up @@ -2694,7 +2593,7 @@ function build_c_sys5_bat_ems(;
),
)
end
for (ix, b) in enumerate(PSY.get_components(PSY.BatteryEMS, c_sys5_bat))
for (ix, b) in enumerate(PSY.get_components(PSY.EnergyReservoirStorage, c_sys5_bat))
PSY.add_time_series!(
c_sys5_bat,
b,
Expand All @@ -2707,10 +2606,10 @@ function build_c_sys5_bat_ems(;
end
if add_reserves
reserve_bat = reserve5_re(get_components(RenewableDispatch, c_sys5_bat))
add_service!(c_sys5_bat, reserve_bat[1], get_components(PSY.BatteryEMS, c_sys5_bat))
add_service!(c_sys5_bat, reserve_bat[2], get_components(PSY.BatteryEMS, c_sys5_bat))
add_service!(c_sys5_bat, reserve_bat[1], get_components(PSY.EnergyReservoirStorage, c_sys5_bat))
add_service!(c_sys5_bat, reserve_bat[2], get_components(PSY.EnergyReservoirStorage, c_sys5_bat))
jd-lara marked this conversation as resolved.
Show resolved Hide resolved
# ORDC
add_service!(c_sys5_bat, reserve_bat[3], get_components(PSY.BatteryEMS, c_sys5_bat))
add_service!(c_sys5_bat, reserve_bat[3], get_components(PSY.EnergyReservoirStorage, c_sys5_bat))
jd-lara marked this conversation as resolved.
Show resolved Hide resolved
for (ix, serv) in enumerate(get_components(VariableReserve, c_sys5_bat))
forecast_data = SortedDict{Dates.DateTime, TimeArray}()
for t in 1:2
Expand Down Expand Up @@ -2785,9 +2684,10 @@ function build_c_sys5_hybrid(; add_forecasts, raw_data, kwargs...)
thermals = thermal_generators5(nodes)
loads = loads5(nodes)
renewables = renewable_generators5(nodes)
_battery(nodes, bus, name) = PSY.BatteryEMS(;
_battery(nodes, bus, name) = PSY.EnergyReservoirStorage(;
name = name,
prime_mover_type = PrimeMovers.BA,
storage_technology_type = StorageTech.OTHER_CHEM,
available = true,
bus = nodes[bus],
initial_energy = 5.0,
Expand Down Expand Up @@ -2969,7 +2869,7 @@ function build_c_sys5_hybrid_uc(; add_forecasts, raw_data, kwargs...)
loads = loads5(nodes)
renewables = renewable_generators5(nodes)
branches = branches5(nodes)
_battery(nodes, bus, name) = PSY.BatteryEMS(;
_battery(nodes, bus, name) = PSY.EnergyReservoirStorage(;
name = name,
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3098,7 +2998,7 @@ function build_c_sys5_hybrid_ed(; add_forecasts, raw_data, kwargs...)
loads = loads5(nodes)
branches = branches5(nodes)
renewables = renewable_generators5(nodes)
_battery(nodes, bus, name) = PSY.BatteryEMS(;
_battery(nodes, bus, name) = PSY.EnergyReservoirStorage(;
name = name,
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3546,7 +3446,7 @@ function build_batt_test_case_b_sys(; raw_data, kwargs...)
100.0,
)

batt = PSY.BatteryEMS(;
batt = PSY.EnergyReservoirStorage(;
name = "Bat2",
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3622,7 +3522,7 @@ function build_batt_test_case_c_sys(; raw_data, kwargs...)
100.0,
)

batt = PSY.BatteryEMS(;
batt = PSY.EnergyReservoirStorage(;
name = "Bat2",
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3698,7 +3598,7 @@ function build_batt_test_case_d_sys(; raw_data, kwargs...)
100.0,
)

batt = PSY.BatteryEMS(;
batt = PSY.EnergyReservoirStorage(;
name = "Bat2",
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3774,7 +3674,7 @@ function build_batt_test_case_e_sys(; raw_data, kwargs...)
100.0,
)

batt = PSY.BatteryEMS(;
batt = PSY.EnergyReservoirStorage(;
name = "Bat2",
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -3850,7 +3750,7 @@ function build_batt_test_case_f_sys(; raw_data, kwargs...)
100.0,
)

batt = PSY.BatteryEMS(;
batt = PSY.EnergyReservoirStorage(;
name = "Bat2",
prime_mover_type = PrimeMovers.BA,
available = true,
Expand Down Expand Up @@ -4280,3 +4180,21 @@ function build_pwl_incremental_fuel_test_sys_ts(; kwargs...)
thermal_generator_pwl_incremental_fuel_ts(base_sys, node)
return base_sys
end

### Systems with fixed market bid cost

function build_fixed_market_bid_cost_test_sys(; kwargs...)
base_sys = _build_cost_base_test_sys(; kwargs...)
node = PSY.get_component(ACBus, base_sys, "nodeA")
test_gens = thermal_generators_market_bid(node)
PSY.add_component!(base_sys, test_gens[1])
PSY.add_component!(base_sys, test_gens[2])
return base_sys
end

function build_pwl_marketbid_sys_ts(; kwargs...)
base_sys = _build_cost_base_test_sys(; kwargs...)
node = PSY.get_component(ACBus, base_sys, "nodeA")
thermal_generators_market_bid_ts(base_sys, node)
return base_sys
end
3 changes: 2 additions & 1 deletion src/library/psytest_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ function build_dynamic_inverter_sys(; kwargs...)
),
]

battery = PSY.GenericBattery(;
battery = PSY.EnergyReservoirStorage(;
name = "Battery",
prime_mover_type = PSY.PrimeMovers.BA,
storage_technology_type = StorageTech.OTHER_CHEM,
available = true,
bus = nodes_OMIB[2],
initial_energy = 5.0,
Expand Down
8 changes: 7 additions & 1 deletion src/system_descriptor_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,17 @@ const SYSTEM_CATALOG = [
category = PSITestSystems,
build_function = build_pwl_incremental_fuel_test_sys_ts,
),
SystemDescriptor(;
name = "c_fixed_market_bid_cost",
description = "1 bus system with a Fixed MarketBidCost Model",
category = PSITestSystems,
build_function = build_fixed_market_bid_cost_test_sys,
),
SystemDescriptor(;
name = "c_market_bid_cost",
description = "1 bus system with MarketBidCost Model",
category = PSITestSystems,
build_function = build_pwl_marketbid_sys,
build_function = build_pwl_marketbid_sys_ts,
),
SystemDescriptor(;
name = "5_bus_hydro_uc_sys",
Expand Down
Loading