-
Notifications
You must be signed in to change notification settings - Fork 21
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
Remove graph dependency from src/constraints/consumer.jl #944
Conversation
97fc644
to
6206bbf
Compare
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #944 +/- ##
==========================================
- Coverage 94.95% 94.88% -0.07%
==========================================
Files 29 29
Lines 1070 1075 +5
==========================================
+ Hits 1016 1020 +4
- Misses 54 55 +1 ☔ View full report in Codecov by Sentry. |
6206bbf
to
0dc168c
Compare
@datejada, I've updated this to follow the new strategy. The code is still slow, though, so we might want to wait until all rep_periods_profiles are removed to see if it's possible to make it better. |
f6e89c8
to
e9ff4c1
Compare
0792027
to
f15890d
Compare
f15890d
to
c97bdcd
Compare
@datejada and I evaluated the 3 options with DuckDB 1.1.2 locally (1-Using graph, 2-Using full DuckDB, which is the version from 2 weeks ago, and 3-Using the new profiles object). Here are the results:
Option 3 was a bit faster, and should be reasonable to maintain, so we're using it for now |
For future reference, this is the DuckDB query to join and aggregate the profiles (option 2): SELECT
cons.*,
ANY_VALUE(asset.type) AS type,
ANY_VALUE(asset.consumer_balance_sense) AS consumer_balance_sense,
ANY_VALUE(asset_milestone.peak_demand) AS peak_demand,
COALESCE(MEAN(profile.value), 1) AS demand_agg
FROM $cons AS cons
LEFT JOIN asset
ON cons.asset = asset.asset
LEFT JOIN asset_milestone
ON cons.asset = asset_milestone.asset
AND cons.year = asset_milestone.milestone_year
LEFT JOIN assets_profiles
ON cons.asset = assets_profiles.asset
AND cons.year = assets_profiles.commission_year
AND assets_profiles.profile_type = 'demand'
LEFT JOIN profiles_rep_periods AS profile
ON profile.profile_name = assets_profiles.profile_name
AND cons.year = profile.year
AND cons.rep_period = profile.rep_period
AND cons.time_block_start <= profile.timestep
AND profile.timestep <= cons.time_block_end
GROUP BY cons.*
ORDER BY cons.index -- order is important
|
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.
Reviewed during an online meeting
Part of #942
Closes #943