Skip to content

Conversation

@Bill-Becker
Copy link
Collaborator

This pull request refactors how the CHP (Combined Heat and Power) binary variable (binCHPIsOnInTS) is created and used in the constraints, making its creation conditional on whether it is actually needed. It also adds a comprehensive test suite to ensure the binary variable is only created when required. The changes improve model efficiency and maintainability by avoiding unnecessary integer variables when possible.

Conditional creation of CHP binary variable and refactoring of constraints:

  • The logic for determining if the binCHPIsOnInTS binary variable is needed has been centralized in add_chp_constraints, based on whether certain intercepts or parameters are non-zero (fuel burn intercept, thermal production intercept, minimum turn down fraction, or hourly O&M cost). The binary variable and related constraints are only added if necessary, which can significantly speed up solves for compatible scenarios. [1] [2]
  • The CHP constraint functions (add_chp_fuel_burn_constraints, add_chp_thermal_production_constraints, and add_chp_supplementary_firing_constraints) have been refactored to accept precomputed slope and intercept values and a binary_created flag, instead of recalculating or assuming the binary variable always exists. This ensures constraints are only as complex as needed. [1] [2] [3]

Testing improvements:

  • A new test file, test/test_avoid_chp_binary.jl, has been added with multiple test cases to verify that the binary variable is created only when required (i.e., when intercepts or certain parameters are non-zero) and not otherwise. Each test manipulates scenario parameters and checks the model structure and solution.

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.

2 participants