Skip to content

Conversation

mgovers
Copy link
Member

@mgovers mgovers commented Mar 20, 2024

This creates the skeleton for #74

NOTE: This is still in draft. I still need to create stub functions for the automatic tap optimizer

NOTE: Unfortunately, I had to make a few shortcuts to make sure I can unblock other people:

  • For powerflow and state estimation calculations, it was easy to make prepare_*_input static. For short circuit calculations, that is where the topology is constructed for fault components, which means a little bit more refactoring is necessary to move that part out of MainModel as well. I considered that out of scope of this PR and added a TODO for follow-up due to the blocking nature of this PR.
  • MainModel is the object keeping track of the changes in state, which means I had to provide an update function to the optimizer.
    • The alternative would be to introduce a signaling-like functionality (in which main model registers to the optimizer a callback for state changes). With the current state of the main model (many responsibilities) that would cause future refactorings to be come more difficult.
    • Instead, I consider introducing signaling logic to be part of another future refactoring in which a state object owns the update logic, and in which MainModel registers an update_state(UpdateChange const&) callback. That is out of scope of this PR

Other design considerations:

  • I wanted to use a factory pattern to enable us to refactor at a later stage to at least keep the amount of calculate_* functions somewhat maintainable. If we would solve everything statically (like with MathSolver) the amount of overloads for calculate_* would grow indefinitely, or we would not be able to refactor at a later stage.
  • I had to work with inheritance because otherwise, the factory model would not work.
  • I had to use shared_ptr because otherwise, ownership would be lost unless I would implement rule-of-five. shared_ptr is actually able to use rule-of-zero without much overhead.

@mgovers mgovers marked this pull request as ready for review March 21, 2024 10:31
@mgovers mgovers requested a review from TonyXiang8787 March 21, 2024 10:31
mgovers added 5 commits March 21, 2024 13:08
Signed-off-by: Martijn Govers <[email protected]>
Signed-off-by: Martijn Govers <[email protected]>
Signed-off-by: Martijn Govers <[email protected]>
@mgovers
Copy link
Member Author

mgovers commented Mar 21, 2024

newly introduced sonar cloud issues are TODO's for follow-up tickets in this sprint

@mgovers
Copy link
Member Author

mgovers commented Mar 21, 2024

@TonyXiang8787 can you also review please?

@mgovers
Copy link
Member Author

mgovers commented Mar 22, 2024

@TonyXiang8787 can you also review please?

In a call, @TonyXiang8787 has approved the overall design choices. This PR can be merged after someone else does a regular review

Copy link

@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo added this pull request to the merge queue Mar 22, 2024
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo removed this pull request from the merge queue due to a manual request Mar 22, 2024
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo added this pull request to the merge queue Mar 22, 2024
Merged via the queue into main with commit 2f453dd Mar 22, 2024
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo deleted the feature/auto-tap-changer-skeleton branch March 22, 2024 15:06
@mgovers mgovers mentioned this pull request Jun 10, 2024
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo restored the feature/auto-tap-changer-skeleton branch February 12, 2025 11:10
@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo deleted the feature/auto-tap-changer-skeleton branch February 12, 2025 11:13
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