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

update toml file #122

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DataFrames = "1"
DataStructures = "0.18"
InfrastructureSystems = "2"
Plots = "1"
PowerAnalytics = "^0.7"
PowerAnalytics = "^0.8"
PowerSystems = "4"
Reexport = "1"
Requires = "1"
Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
GLPK = "60bf3e95-4087-53dc-ae20-288a0d20c6a6"
HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
HydroPowerSimulations = "fc1677e0-6ad7-4515-bf3a-bd6bf20a0b1b"
InfrastructureSystems = "2cd47ed4-ca9b-11e9-27f2-ab636a7671f1"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using PowerAnalytics
using PlotlyJS
using PowerSimulations
using StorageSystemsSimulations
using GLPK
using HiGHS
using Weave
using TimeSeries
using HydroPowerSimulations
Expand Down
80 changes: 48 additions & 32 deletions test/test_data/results_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,39 @@ function add_re!(sys)
copy_time_series!(fx, get_component(PowerLoad, sys, "bus2"))

for g in get_components(HydroEnergyReservoir, sys)
tpc = get_operation_cost(g)
smc = StorageManagementCost(;
variable = get_variable(tpc),
fixed = get_fixed(tpc),
start_up = 0.0,
shut_down = 0.0,
smc = StorageCost(;
charge_variable_cost = CostCurve(LinearCurve(0.1)),
discharge_variable_cost = CostCurve(LinearCurve(0.2)),
energy_shortage_cost = 10.0,
energy_surplus_cost = 10.0,
)
set_operation_cost!(g, smc)
end

batt = GenericBattery(
"test_batt",
true,
get_component(Bus, sys, "bus4"),
PrimeMovers.BA,
0.0,
(min = 0.0, max = 1.0),
1.0,
0.0,
(min = 0.0, max = 1.0),
(min = 0.0, max = 1.0),
(in = 1.0, out = 1.0),
0.0,
nothing,
10.0,
batt = EnergyReservoirStorage(;
name = "test_batt",
available = true,
bus = get_component(Bus, sys, "bus4"),
prime_mover_type = PrimeMovers.BA,
storage_technology_type = StorageTech.OTHER_CHEM,
storage_capacity = 2.0,
storage_level_limits = (min = 0.0, max = 1.0),
initial_storage_capacity_level = 0.7,
rating = 1.0,
active_power = 0.1,
input_active_power_limits = (min = 0.0, max = 1.0),
output_active_power_limits = (min = 0.0, max = 1.0),
efficiency = (in = 0.9, out = 0.9),
reactive_power = 0.0,
reactive_power_limits = (min = -1.0, max = 1.0),
base_power = 15.0,
operation_cost = StorageCost(;
charge_variable_cost = CostCurve(LinearCurve(0.1)),
discharge_variable_cost = CostCurve(LinearCurve(0.2)),
),
conversion_factor = 1,
storage_target = 0.0,
cycle_limits = 5000,
)
add_component!(sys, batt)
end
Expand Down Expand Up @@ -93,8 +99,8 @@ function run_test_sim(result_dir::String)
to_json(c_sys5_hy_ed, joinpath(sim_path, "..", "c_sys5_hy_ed.json"); force = true)

mkpath(result_dir)
GLPK_optimizer =
optimizer_with_attributes(GLPK.Optimizer, "msg_lev" => GLPK.GLP_MSG_OFF)
HiGHS_optimizer =
optimizer_with_attributes(HiGHS.Optimizer)

template_hydro_st_uc = template_unit_commitment()
set_device_model!(template_hydro_st_uc, HydroDispatch, FixedOutput)
Expand All @@ -103,7 +109,11 @@ function run_test_sim(result_dir::String)
HydroEnergyReservoir,
HydroDispatchReservoirStorage,
)
set_device_model!(template_hydro_st_uc, GenericBattery, StorageDispatchWithReserves)
set_device_model!(
template_hydro_st_uc,
EnergyReservoirStorage,
StorageDispatchWithReserves,
)

template_hydro_st_ed = template_economic_dispatch(;
network = CopperPlatePowerModel,
Expand All @@ -116,23 +126,29 @@ function run_test_sim(result_dir::String)
HydroEnergyReservoir,
HydroDispatchReservoirStorage,
)
set_device_model!(template_hydro_st_ed, GenericBattery, StorageDispatchWithReserves)
set_device_model!(
template_hydro_st_ed,
EnergyReservoirStorage,
StorageDispatchWithReserves,
)
template_hydro_st_ed.services = Dict() #remove ed services
models = SimulationModels(;
decision_models = [
DecisionModel(
template_hydro_st_uc,
c_sys5_hy_uc;
optimizer = GLPK_optimizer,
optimizer = HiGHS_optimizer,
name = "UC",
system_to_file = false,
calculate_conflict = true,
),
DecisionModel(
template_hydro_st_ed,
c_sys5_hy_ed;
optimizer = GLPK_optimizer,
optimizer = HiGHS_optimizer,
name = "ED",
system_to_file = false,
calculate_conflict = true,
),
],
)
Expand Down Expand Up @@ -173,8 +189,8 @@ end
function run_test_prob()
c_sys5_hy_uc = PSB.build_system(PSB.PSISystems, "5_bus_hydro_uc_sys")
add_re!(c_sys5_hy_uc)
GLPK_optimizer =
optimizer_with_attributes(GLPK.Optimizer, "msg_lev" => GLPK.GLP_MSG_OFF)
HiGHS_optimizer =
optimizer_with_attributes(HiGHS.Optimizer)

template_hydro_st_uc = template_unit_commitment()
set_device_model!(template_hydro_st_uc, HydroDispatch, FixedOutput)
Expand All @@ -187,11 +203,11 @@ function run_test_prob()
prob = DecisionModel(
template_hydro_st_uc,
c_sys5_hy_uc;
optimizer = GLPK_optimizer,
horizon = 12,
optimizer = HiGHS_optimizer,
horizon = Hour(12),
)
build!(prob; output_dir = mktempdir())
solve!(prob)
res = ProblemResults(prob)
res = OptimizationProblemResults(prob)
return res
end
Loading