Skip to content

Commit

Permalink
Accommodate FunctionData move to InfrastructureSystems
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielKS committed Feb 22, 2024
1 parent cac43e0 commit 09447d5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 18 deletions.
74 changes: 57 additions & 17 deletions src/library/psitest_library.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function build_c_sys5_re(; kwargs...)
)
end
for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_re))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = TimeSeries.timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -467,7 +467,7 @@ function build_c_sys5_hyd(; kwargs...)
)
end
for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_hyd))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = TimeSeries.timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -636,7 +636,7 @@ function build_c_sys5_hyd_ems(; kwargs...)
)
end
for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_hyd))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = TimeSeries.timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -750,7 +750,7 @@ function build_c_sys5_bat(; kwargs...)
)
end
for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_bat))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = TimeSeries.timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -841,7 +841,7 @@ function build_c_sys5_il(; kwargs...)
)
end
for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_il))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = TimeSeries.timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -1179,7 +1179,7 @@ function build_c_sys5_uc(; kwargs...)
end

for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_uc))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -1291,7 +1291,7 @@ function build_c_sys5_uc_non_spin(; kwargs...)
end

for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_uc))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -1431,7 +1431,7 @@ function build_c_sys5_uc_re(; kwargs...)
end

for (ix, serv) in enumerate(PSY.get_components(PSY.ReserveDemandCurve, c_sys5_uc))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down Expand Up @@ -2586,12 +2586,32 @@ function build_pwl_marketbid_sys(; kwargs...)
DA_load_forecast = Dict{Dates.DateTime, TimeSeries.TimeArray}()
market_bid_gen1_data = Dict(
ini_time => [
[(589.99, 22.0), (884.99, 33.0), (1210.04, 44.0), (1543.44, 55.0)],
[(589.99, 22.0), (884.99, 33.0), (1210.04, 44.0), (1543.44, 55.0)],
PiecewiseLinearPointData([
(22.0, 589.99),
(33.0, 884.99),
(44.0, 1210.04),
(55.0, 1543.44),
]),
PiecewiseLinearPointData([
(22.0, 589.99),
(33.0, 884.99),
(44.0, 1210.04),
(55.0, 1543.44),
]),
],
ini_time + Hour(1) => [
[(589.99, 22.0), (884.99, 33.0), (1210.04, 44.0), (1543.44, 55.0)],
[(589.99, 22.0), (884.99, 33.0), (1210.04, 44.0), (1543.44, 55.0)],
PiecewiseLinearPointData([
(22.0, 589.99),
(33.0, 884.99),
(44.0, 1210.04),
(55.0, 1543.44),
]),
PiecewiseLinearPointData([
(22.0, 589.99),
(33.0, 884.99),
(44.0, 1210.04),
(55.0, 1543.44),
]),
],
)
market_bid_gen1 = PSY.Deterministic(;
Expand All @@ -2601,12 +2621,32 @@ function build_pwl_marketbid_sys(; kwargs...)
)
market_bid_gen2_data = Dict(
ini_time => [
[(0.0, 5.0), (290.1, 7.33), (582.72, 9.67), (894.1, 12.0)],
[(0.0, 5.0), (300.1, 7.33), (600.72, 9.67), (900.1, 12.0)],
PiecewiseLinearPointData([
(5.0, 0.0),
(7.33, 290.1),
(9.67, 582.72),
(12.0, 894.1),
]),
PiecewiseLinearPointData([
(5.0, 0.0),
(7.33, 300.1),
(9.67, 600.72),
(12.0, 900.1),
]),
],
ini_time + Hour(1) => [
[(0.0, 5.0), (290.1, 7.33), (582.72, 9.67), (894.1, 12.0)],
[(0.0, 5.0), (300.1, 7.33), (600.72, 9.67), (900.1, 12.0)],
PiecewiseLinearPointData([
(5.0, 0.0),
(7.33, 290.1),
(9.67, 582.72),
(12.0, 894.1),
]),
PiecewiseLinearPointData([
(5.0, 0.0),
(7.33, 300.1),
(9.67, 600.72),
(12.0, 900.1),
]),
],
)
market_bid_gen2 = PSY.Deterministic(;
Expand Down Expand Up @@ -2845,7 +2885,7 @@ function build_c_sys5_bat_ems(; kwargs...)
add_time_series!(c_sys5_bat, serv, Deterministic("requirement", forecast_data))
end
for (ix, serv) in enumerate(get_components(ReserveDemandCurve, c_sys5_bat))
forecast_data = SortedDict{Dates.DateTime, Vector{IS.PWL}}()
forecast_data = SortedDict{Dates.DateTime, Vector{PiecewiseLinearPointData}}()
for t in 1:2
ini_time = timestamp(ORDC_cost_ts[t])[1]
forecast_data[ini_time] = TimeSeries.values(ORDC_cost_ts[t])
Expand Down
1 change: 0 additions & 1 deletion test/test_psitestsystems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ end
@test length(PSY.get_components(PSY.StaticLoad, sys)) >= 2
@test length(PSY.get_components(PSY.PowerLoad, sys)) >= 1
@test length(PSY.get_components(PSY.StandardLoad, sys)) >= 1
println((PSY.get_components(PSY.StaticLoad, sys)))
end
test_c_sys5_all_components()
end

0 comments on commit 09447d5

Please sign in to comment.