Conversation
And clean up the power sector policies
Logical intermediate names, and remove wrapper function in favour of more explicit calling of functions
And add comparisons in all three sectors
For easier comparison
There was a problem hiding this comment.
Pull Request Overview
This PR refactors regulatory policies across FTT modules to improve performance (30x faster) and code maintainability by centralizing common regulatory policy logic. The refactor also aligns regulation correction behavior with E3ME by only applying corrections when demand is growing, and makes capacity approach MWKA more smoothly.
- Centralizes regulatory policy logic into a new shared module
ftt_regulatory_policies.py - Updates Transport, Power, and Heat modules to use the new centralized functions
- Adds performance timing and comparison checks between old and new implementations
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.ini | Disables most modules for testing, enabling only FTT-P |
| SourceCode/model_class.py | Adds performance timing measurement starting from 2011 |
| SourceCode/ftt_core/ftt_regulatory_policies.py | New module containing centralized regulatory policy functions |
| SourceCode/Transport/ftt_tr_main.py | Refactors to use new regulatory policy functions with comparison logic |
| SourceCode/Power/ftt_p_main.py | Updates documentation and implements new regulatory policy approach |
| SourceCode/Power/fft_p_regulatory_policies.py | Simplifies old policy implementation for comparison purposes |
| SourceCode/Heat/ftt_h_main.py | Integrates new regulatory policy functions with comparison checks |
|
Me and Pim have discussed and agree with the current simplified implementation. Testing still left to be done. |
|
This is a good first pull request. A bit more context: FTT has two types of policies, regulatory policies such as phase-outs, and price policies such as subsidies. In this bit of code, we're refactoring the regulatory policies so that all the different FTT models use the same code. An important element of reviewing is to say whether the code is understandable on sight. I've kept in some of the code to compare with the old implementation. Once you're happy with the code, it's my job to clean everything up and to resolve the merge conflicts. |
More explicit in mewl_dt naming (as this is still last timestep). No need for slow copying here.
|
@fciscoamsler: what's the latest on this one? |
Refactor regulatory policies. New code is more DRY and 30x faster than before.
There are two logical changes:
I've kept the code to compare outputs, but will of course tidy up after review. For testing:
MWKA is reverted back to its old consistent behaviour, so that there's no guessing what the policy does (there were 3 complicated conditions, which broke the logic of using exogenous capacity for partial data).
Pim, feel free to delegate to someone else at CE!