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

Move some of the active checks earlier in the workflow #962

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

abelsiqueira
Copy link
Member

@abelsiqueira abelsiqueira commented Dec 12, 2024

This doesn't remove the active as proposed in #960, but it moves the check to earlier in the workflow - to the highest and lowest resolution.

Relates to #960

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.45%. Comparing base (f96f8c5) to head (28cdeb5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #962   +/-   ##
=======================================
  Coverage   95.45%   95.45%           
=======================================
  Files          29       29           
  Lines        1034     1034           
=======================================
  Hits          987      987           
  Misses         47       47           

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

@abelsiqueira abelsiqueira marked this pull request as ready for review December 12, 2024 13:13
Comment on lines +449 to +456
LEFT JOIN asset_both
ON asset_both.asset = t_union.asset
AND asset_both.milestone_year = t_union.year
AND asset_both.commission_year = t_union.year
LEFT JOIN rep_periods_data
ON t_union.year = rep_periods_data.year
AND t_union.rep_period = rep_periods_data.rep_period
ORDER BY asset, t_union.year, t_union.rep_period, time_block_start
WHERE asset_both.active = true
Copy link
Member

Choose a reason for hiding this comment

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

Just for my understanding, the JOIN here is to have available in the table the active parameter. So, when we take out active from the Tulipa files in #960 we don't have to do this JOIN. Is that correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

The stored table itself won't have the active parameter because I haven't selected it, but the intermediary table resulting from the join will, which is then filtered in this WHERE. So the JOIN is only so that we have active available for filtering.

Copy link
Member

Choose a reason for hiding this comment

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

So, deleting the active also will also delete this extra join and make the code more simple 😄

Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

During #960, this will also be removed as there will be no mention of active anywhere. I was thinking about where the removal of active will happen, and the earliest point would be not having active at all in the input of TulipaEnergyModel. That means that during the workflow processing, at some point we check for active and remove. In the current workflow, it would be at the read_csv_folder function in TulipaIO. It's not clear yet the implications, and it's not urgent, so I'm not actively thinking about it.
For this PR, I noticed the constraint creations had a bunch of active checks, and the constraints could look a bit simpler if they didn't, so I shifted left.

src/tmp.jl Show resolved Hide resolved
Copy link
Member

@datejada datejada left a comment

Choose a reason for hiding this comment

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

Hi, @abelsiqueira; it looks cleaner and simpler to have it in the calculation of the highest-resolution table. Thanks! This will also simplify the work in #960

@abelsiqueira
Copy link
Member Author

Thanks for the review!

@abelsiqueira abelsiqueira merged commit c05fe7d into main Dec 12, 2024
6 of 7 checks passed
@abelsiqueira abelsiqueira deleted the shift-left-active branch December 12, 2024 15:07
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