Repository navigation
Single Stage Model Tutorial Doc #69
Copy link
Copy link
Closed
Description
The example code in https://nrel-sienna.github.io/StorageSystemsSimulations.jl/stable/tutorials/single_stage_model/ is not feasible due to high reserve requirements.
We need to either remove the
set_service_model!(template_uc, ServiceModel(VariableReserve{ReserveUp}, RangeReserve))
set_service_model!(template_uc, ServiceModel(VariableReserve{ReserveDown}, RangeReserve))Or add below snippets to make it feasible,
res_up = get_component(VariableReserve{ReserveUp}, sys, "Reserve3")
set_requirement!(res_up, 2.0)
res_down = get_component(VariableReserve{ReserveDown}, sys, "Reserve4")
set_requirement!(res_down, 1.0)Then the complete code became,
using PowerSystems
using PowerSimulations
using StorageSystemsSimulations
using PowerSystemCaseBuilder
using HiGHS # solver
sys = build_system(
PSITestSystems,
"c_sys5_bat_ems";
add_single_time_series=true,
add_reserves=true,
)
orcd = get_component(ReserveDemandCurve, sys, "ORDC1")
set_available!(orcd, false)
res_up = get_component(VariableReserve{ReserveUp}, sys, "Reserve3")
set_requirement!(res_up, 2.0)
res_down = get_component(VariableReserve{ReserveDown}, sys, "Reserve4")
set_requirement!(res_down, 1.0)
batt = get_component(EnergyReservoirStorage, sys, "Bat2")
operation_cost = get_operation_cost(batt)
template_uc = ProblemTemplate(PTDFPowerModel)
set_device_model!(template_uc, ThermalStandard, ThermalStandardUnitCommitment)
set_device_model!(template_uc, RenewableDispatch, RenewableFullDispatch)
set_device_model!(template_uc, PowerLoad, StaticPowerLoad)
set_device_model!(template_uc, Line, StaticBranch)
storage_model = DeviceModel(
EnergyReservoirStorage,
StorageDispatchWithReserves;
attributes=Dict(
"reservation" => true,
"energy_target" => false,
"cycling_limits" => false,
"regularization" => true,
),
)
set_device_model!(template_uc, storage_model)
set_service_model!(template_uc, ServiceModel(VariableReserve{ReserveUp}, RangeReserve))
set_service_model!(template_uc, ServiceModel(VariableReserve{ReserveDown}, RangeReserve))
solver = optimizer_with_attributes(HiGHS.Optimizer, "mip_rel_gap" => 0.01)
decision_model = DecisionModel(template_uc, sys; optimizer = solver, name = "UC")
using Dates
horizon = Hour(get_forecast_horizon(sys)) # 24 hours
interval = Hour(get_forecast_interval(sys)) # 24 hours
build!(decision_model; output_dir=mktempdir())
solve!(decision_model)Reactions are currently unavailable
Activity
yasirroni commentedon Dec 3, 2025
Related to #57
yasirroni commentedon Dec 3, 2025
Will you guys accept if I make a PR that changes the reserve requirement?
yasirroni commentedon Dec 4, 2025
I checked the "energy_target" parameter, why it is not respected based on the tutorial? Without the battery, the problem can be solved (no slack). Below I attached the code.
yasirroni commentedon Jan 20, 2026
The
energy_targetis not respected due to cheapenergy_shortage_cost. Unfortunately, this component is not seen when we print the storage. See thatoperation_costdidn't show constants cost,But it is visible with
get_operation_cost,operation_costshould print:StorageCost composed of charge_variable_cost: CostCurve{LinearCurve}, discharge_variable_cost: CostCurve{LinearCurve}, fixed: 0.0, start_up: 0.0, shut_down: 0.0, energy_shortage_cost: 50.0, energy_surplus_cost: 40.0. or at leastStorageCost composed of charge_variable_cost: CostCurve{LinearCurve}, discharge_variable_cost: CostCurve{LinearCurve}, energy_shortage_cost: 50.0, energy_surplus_cost: 40.0.