Skip to content

add a biomass supply chain that is not an asset in the base year (mis…#643

Merged
alexdewar merged 2 commits intomainfrom
add_example_model_with_missing_commodity
Jun 23, 2025
Merged

add a biomass supply chain that is not an asset in the base year (mis…#643
alexdewar merged 2 commits intomainfrom
add_example_model_with_missing_commodity

Conversation

@ahawkes
Copy link
Copy Markdown
Contributor

@ahawkes ahawkes commented Jun 20, 2025

Description

Adds a new simple model in the examples directory that has a biomass supply chain in it. This supply chain has no capacity in the base year. It is for testing of (a) price generation for commodities that are not utilised in a year, but could be utilised in the next milestone year (so we need a price for it to consider investment), and (b) investment in a milestone year, as I think this process will be competitive to meet the end-use demand in the simple model.

Fixes # none

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

  • [x ] All tests pass: $ cargo test
  • The documentation builds and looks OK: $ cargo doc

Further checks

n/a

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

@ahawkes ahawkes assigned ahawkes and alexdewar and unassigned ahawkes Jun 20, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.46%. Comparing base (c47a3c8) to head (abd98c3).
Report is 29 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
- Coverage   88.79%   88.46%   -0.33%     
==========================================
  Files          38       39       +1     
  Lines        3391     3555     +164     
  Branches     3391     3555     +164     
==========================================
+ Hits         3011     3145     +134     
- Misses        188      219      +31     
+ Partials      192      191       -1     

☔ View full report in Codecov by Sentry.
📢 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.

@alexdewar alexdewar requested review from alexdewar and tsmbland June 20, 2025 12:59
Copy link
Copy Markdown
Collaborator

@alexdewar alexdewar left a comment

Choose a reason for hiding this comment

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

Looks good! And it makes sense to have examples that test these cases.

I guess it probably makes sense for us to add some documentation saying what the different examples are for at some point -- maybe we could add a description field to model.toml.

We should add a regression test for this, in the same form as in tests/regression_simple.rs. We can do that for you.

What does the MC stand for in the name?

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.

Note there's a PR open to remove settings.toml files from model dirs: #637

We can fix it up though

@ahawkes
Copy link
Copy Markdown
Contributor Author

ahawkes commented Jun 20, 2025 via email

@alexdewar
Copy link
Copy Markdown
Collaborator

MC = missing commodity! Thanks.

Ah ok. I might rename it to something slightly more verbose to make it clearer.

BTW, noticed when I tested this that model is very sensitive to minor typos like a leading space in a field “ sed” instead of “sed”, and to missing fields (ie lack of commas even though there’s no data to input). Though on the bright side error messages were helpful in tracking these down!

Yeah it should be quite pendantic (one benefit of using a strongly typed language like Rust 😄). Good that the error messages were helpful, at least!

Maybe we should trim whitespace from headers and fields by default though. Looks like there is an option for it: https://docs.rs/csv/latest/csv/struct.ReaderBuilder.html#method.trim

@ahawkes
Copy link
Copy Markdown
Contributor Author

ahawkes commented Jun 20, 2025

Trimming white space would be good. But obvs not urgent.

@alexdewar
Copy link
Copy Markdown
Collaborator

I've opened an issue to track it (#648). We can do it sometime down the line

@alexdewar alexdewar added this to MUSE Jun 23, 2025
@alexdewar alexdewar moved this to 👀 In review in MUSE Jun 23, 2025
@tsmbland
Copy link
Copy Markdown
Collaborator

Looks good. @alexdewar are you happy to make the suggested changes?

At some point, if we're going to have lots of example models (which I think we should), it would be worth building these models from a script - especially if they're all variations on the same base model with a few extra processes/commodities/agents included. I've done this for MUSE1 and it's been a life saver.

@ahawkes
Copy link
Copy Markdown
Contributor Author

ahawkes commented Jun 23, 2025 via email

@alexdewar
Copy link
Copy Markdown
Collaborator

Looks good. @alexdewar are you happy to make the suggested changes?

Sure.

At some point, if we're going to have lots of example models (which I think we should), it would be worth building these models from a script - especially if they're all variations on the same base model with a few extra processes/commodities/agents included. I've done this for MUSE1 and it's been a life saver.

Good idea! Wanna open an issue for it 😄? We could even generate them on the fly in build.rs, so we don't forget to add new ones.

@alexdewar alexdewar merged commit 7d69c7d into main Jun 23, 2025
7 checks passed
@alexdewar alexdewar deleted the add_example_model_with_missing_commodity branch June 23, 2025 16:37
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in MUSE Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants