Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomha committed Jan 4, 2025
1 parent daa2ae7 commit 8c4d68b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function add_linear_ramp_constraints!(
-1 * ramp_limits.down * minutes_per_period
)
for t in time_steps[2:end]
sl_ub, sl_lb = _get_ramp_slack_vals(model, name, t)
sl_ub, sl_lb = _get_ramp_slack_vars(container, model, name, t)
con_up[name, t] = JuMP.@constraint(
get_jump_model(container),
expr_up[name, t] - variable[name, t - 1] - sl_ub <=
Expand Down
38 changes: 38 additions & 0 deletions test/test_device_thermal_generation_constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1084,3 +1084,41 @@ end
JuMP.QuadExpr,
)
end

@testset "Thermal UC With Slack on Ramps" begin
bin_variable_keys = [
PSI.VariableKey(OnVariable, PSY.ThermalStandard),
PSI.VariableKey(StartVariable, PSY.ThermalStandard),
PSI.VariableKey(StopVariable, PSY.ThermalStandard),
]

uc_constraint_keys = [
PSI.ConstraintKey(RampConstraint, PSY.ThermalStandard, "up"),
PSI.ConstraintKey(RampConstraint, PSY.ThermalStandard, "dn"),
PSI.ConstraintKey(DurationConstraint, PSY.ThermalStandard, "up"),
PSI.ConstraintKey(DurationConstraint, PSY.ThermalStandard, "dn"),
]

aux_variables_keys = [
PSI.AuxVarKey(PSI.TimeDurationOff, ThermalStandard),
PSI.AuxVarKey(PSI.TimeDurationOn, ThermalStandard),
]
device_model =
DeviceModel(ThermalStandard, ThermalStandardUnitCommitment; use_slacks = true)

c_sys5_uc = PSB.build_system(PSITestSystems, "c_sys5_uc")
model = DecisionModel(MockOperationProblem, DCPPowerModel, c_sys5_uc)
mock_construct_device!(model, device_model)
moi_tests(model, 720, 0, 480, 120, 120, true)
psi_constraint_test(model, uc_constraint_keys)
psi_checkbinvar_test(model, bin_variable_keys)
psi_checkobjfun_test(model, GAEVF)
psi_aux_variable_test(model, aux_variables_keys)

c_sys14 = PSB.build_system(PSITestSystems, "c_sys14")
model = DecisionModel(MockOperationProblem, DCPPowerModel, c_sys14)
mock_construct_device!(model, device_model)
moi_tests(model, 720, 0, 240, 120, 120, true)
psi_checkbinvar_test(model, bin_variable_keys)
psi_checkobjfun_test(model, GQEVF)
end

0 comments on commit 8c4d68b

Please sign in to comment.