Skip to content

Enable capacity growth constraints#1424

Open
dc2917 wants to merge 4 commits into
mainfrom
add-capacity-growth-constraint
Open

Enable capacity growth constraints#1424
dc2917 wants to merge 4 commits into
mainfrom
add-capacity-growth-constraint

Conversation

@dc2917

@dc2917 dc2917 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR enables the option to provide capacity growth constraints.

  • The csv reader looks for an optional capacity_growth_limit column
  • If present, these values are then stored in a new capacity_growth_limit field of the ProcessInvestmentConstraintRaw struct.
  • Simple input validation takes place to check that the values, if not None, are non-negative and finite. I've also added a check during validation that logs a warning if a fraction greater than 1 (i.e. a percentage greater than 100%) is provided.
    • Tests have been added for this validation
  • Capacity growth constraints for the MUSE1 default example have been added to examples/muse1_default/process_investment_constraints.csv
  • The schema for process_investment_constraints.csv input files has been updated with details of this new column

Fixes #1415

Type of change

  • Bug fix (non-breaking change to fix an issue)
  • New feature (non-breaking change to add functionality)
  • Refactoring (non-breaking, non-functional change to improve maintainability)
  • Optimization (non-breaking change to speed up the code)
  • Breaking change (whatever its nature)
  • Documentation (improve or add documentation)

Key checklist

  • All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc
  • Update release notes for the latest release if this PR adds a new feature or fixes a bug
    present in the previous release

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.90%. Comparing base (e598605) to head (ef971c4).

Additional details and impacted files
@@                        Coverage Diff                        @@
##           add-total-capacity-constraint    #1424      +/-   ##
=================================================================
+ Coverage                          86.79%   86.90%   +0.10%     
=================================================================
  Files                                 59       59              
  Lines                               8375     8391      +16     
  Branches                            8375     8391      +16     
=================================================================
+ Hits                                7269     7292      +23     
+ Misses                               790      783       -7     
  Partials                             316      316              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dc2917 dc2917 linked an issue Jul 17, 2026 that may be closed by this pull request
Base automatically changed from add-total-capacity-constraint to main July 17, 2026 10:23
@dc2917
dc2917 requested a review from tsmbland July 17, 2026 10:24

@tsmbland tsmbland left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. Note that without a seed parameter (like we have in MUSE1), the growth constraint is pretty useless as it completely blocks investment in processes that aren't already invested in (e.g. 50% growth on 0 is 0). Could you add that next? I think it should be optional and default to 1. It's likely that once these are all implemented the Investments section of the docs will be fleshed out to explain it all, so the schema can be kept minimal

let mut logger = Logger::start();
let _ = validate_raw_constraint(CapacityPerYear(10.0), Some(Dimensionless(5.0)), None);
assert_eq!(
logger.pop().unwrap().args(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm surprised we've never tested log messages before. This seems like a reasonable way to do it

@dc2917

dc2917 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Note that without a seed parameter (like we have in MUSE1), the growth constraint is pretty useless as it completely blocks investment in processes that aren't already invested in (e.g. 50% growth on 0 is 0). Could you add that next?

Yep, have created issue #1425 and will tackle that now.

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 capacity growth constraint

2 participants