-
Notifications
You must be signed in to change notification settings - Fork 3
Fix warning about assets commissioned before simulation start #1259
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
base: main
Are you sure you want to change the base?
Changes from all commits
649935a
e26e686
2eccf45
9d58c11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -340,8 +340,8 @@ impl Asset { | |
| let max_decommission_year = | ||
| max_decommission_year.unwrap_or(commission_year + process_parameter.lifetime); | ||
| ensure!( | ||
| max_decommission_year >= commission_year, | ||
| "Max decommission year must be after/same as commission year" | ||
| max_decommission_year > commission_year, | ||
| "Max decommission year must be greater than commission year" | ||
| ); | ||
|
Comment on lines
340
to
345
|
||
|
|
||
| Ok(Self { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,11 +35,11 @@ impl AssetPool { | |||||||||||||||||||
| // Ignore assets that have already been decommissioned | ||||||||||||||||||||
| if asset.max_decommission_year() <= year { | ||||||||||||||||||||
| warn!( | ||||||||||||||||||||
| "Asset '{}' with commission year {} and lifetime {} was decommissioned before \ | ||||||||||||||||||||
| "User asset '{}' with commission year {} was decommissioned in {}, before \ | ||||||||||||||||||||
| the start of the simulation", | ||||||||||||||||||||
| asset.process_id(), | ||||||||||||||||||||
|
Comment on lines
+38
to
40
|
||||||||||||||||||||
| asset.commission_year, | ||||||||||||||||||||
|
Comment on lines
+38
to
41
|
||||||||||||||||||||
| "User asset '{}' with commission year {} was decommissioned in {}, before \ | |
| the start of the simulation", | |
| asset.process_id(), | |
| asset.commission_year, | |
| "Skipping user asset '{}' with commission year {} in milestone year {} \ | |
| because its max decommission year is {}", | |
| asset.process_id(), | |
| asset.commission_year, | |
| year, |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses direct field access (asset.max_decommission_year) while nearby code uses the getter max_decommission_year(). For consistency (and to avoid bypassing any future logic in the accessor), use the method in the warning args as well.
| asset.max_decommission_year | |
| asset.max_decommission_year() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release notes mention the warning-message change, but this PR also tightens validation by rejecting assets where
max_decommission_year == commission_year. Since that can cause previously accepted inputs to error, consider noting it explicitly here (and potentially under "Breaking changes" if you consider it a breaking input change).