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

Add Thermal Slacks for UB and LB constraints (including ramps) #1207

Merged
merged 15 commits into from
Jan 7, 2025

Conversation

rodrigomha
Copy link
Contributor

@rodrigomha rodrigomha commented Jan 1, 2025

Closes #1204

Add slacks for UB and LB constraints for thermal units. It uses the use_slacks of the device model, so to enable, using:

thermal_device_model = DeviceModel(
    ThermalStandard,
    ThermalStandardUnitCommitment;
    use_slacks = true,
)
set_device_model!(template_uc, thermal_device_model)

will enable the slacks.

The slack variables are added to the objective function with a cost of 2e5, using the constraint violation cost.

Here is how it looks for a RampConstraint UB:

-ActivePowerVariable_ThermalStandard_{107_CC_1, 1} + ActivePowerVariable_ThermalStandard_{107_CC_1, 2} - 1.6999999999999997 StartVariable_ThermalStandard_{107_CC_1, 2} - PowerSimulations.ActivePowerVariableSlackUB_ThermalStandard_{107_CC_1, 2} + ActivePowerReserveVariable_VariableReserve{ReserveUp}_Spin_Up_R1_{107_CC_1, 2} + ActivePowerReserveVariable_VariableReserve{ReserveUp}_Reg_Up_{107_CC_1, 2} ≤ 0.20699999999999996

and for a RampConstraint LB:

ActivePowerVariable_ThermalStandard_{107_CC_1, 1} - ActivePowerVariable_ThermalStandard_{107_CC_1, 2} - 1.6999999999999997 StopVariable_ThermalStandard_{107_CC_1, 2} - PowerSimulations.ActivePowerVariableSlackLB_ThermalStandard_{107_CC_1, 2} + ActivePowerReserveVariable_VariableReserve{ReserveDown}_Reg_Down_{107_CC_1, 2} ≤ 0.20699999999999996

TODO:

  • Tests

@rodrigomha rodrigomha requested a review from jd-lara January 1, 2025 00:16
@rodrigomha rodrigomha self-assigned this Jan 1, 2025
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

Attention: Patch coverage is 50.57471% with 43 lines in your changes missing coverage. Please review.

Project coverage is 76.98%. Comparing base (5772e25) to head (016ac22).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
...vice_constructors/thermalgeneration_constructor.jl 41.66% 28 Missing ⚠️
src/devices_models/devices/thermal_generation.jl 45.00% 11 Missing ⚠️
src/core/variables.jl 50.00% 2 Missing ⚠️
..._models/devices/common/rateofchange_constraints.jl 86.66% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1207      +/-   ##
==========================================
- Coverage   77.24%   76.98%   -0.27%     
==========================================
  Files         121      121              
  Lines       13446    13533      +87     
==========================================
+ Hits        10387    10418      +31     
- Misses       3059     3115      +56     
Flag Coverage Δ
unittests 76.98% <50.57%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/PowerSimulations.jl 100.00% <ø> (ø)
src/core/variables.jl 55.07% <50.00%> (-0.32%) ⬇️
..._models/devices/common/rateofchange_constraints.jl 74.01% <86.66%> (+1.69%) ⬆️
src/devices_models/devices/thermal_generation.jl 82.75% <45.00%> (-2.42%) ⬇️
...vice_constructors/thermalgeneration_constructor.jl 90.63% <41.66%> (-4.54%) ⬇️

... and 3 files with indirect coverage changes

Copy link
Contributor

github-actions bot commented Jan 1, 2025

Performance Results

Version Precompile Time
Main 4.041930556
This Branch 3.982810806
Version Build Time
Main-Build Time Precompile 63.102307178
Main-Build Time Postcompile 0.976893673
This Branch-Build Time Precompile 65.546369378
This Branch-Build Time Postcompile 1.21647003
Version Build Time
Main-Solve Time Precompile 614.953060839
Main-Solve Time Postcompile 586.366344707
This Branch-Solve Time Precompile 409.935498605
This Branch-Solve Time Postcompile 368.617931491

@@ -150,6 +150,8 @@ For a list of variables for each device refer to its Formulations page.
ActivePowerVariable
ReactivePowerVariable
PieceWiseLinearCostVariable
ActivePowerVariableSlackUp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ActivePowerVariableSlackUp
RateofChangeConstraintSlackUp

@@ -150,6 +150,8 @@ For a list of variables for each device refer to its Formulations page.
ActivePowerVariable
ReactivePowerVariable
PieceWiseLinearCostVariable
ActivePowerVariableSlackUp
ActivePowerVariableSlackDown
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ActivePowerVariableSlackDown
RateofChangeConstraintSlackDown


Docs abbreviation: ``p^\\text{x,ubsl}``
"""
struct ActivePowerVariableSlackUp <: VariableType end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

return
end

function objective_function!(
container::OptimizationContainer,
devices::IS.FlattenIteratorWrapper{T},
::DeviceModel{T, U},
model::DeviceModel{T, U},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model::DeviceModel{T, U},
device_model::DeviceModel{T, U},

@rodrigomha rodrigomha marked this pull request as ready for review January 6, 2025 18:13
@jd-lara jd-lara self-requested a review January 7, 2025 16:53
@jd-lara jd-lara merged commit 59d10f3 into main Jan 7, 2025
10 of 11 checks passed
@jd-lara jd-lara deleted the rh/add_thermal_slacks branch January 7, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add use_slacks option to Thermal generation models
2 participants