-
Notifications
You must be signed in to change notification settings - Fork 65
Node injection sensor deprecation: future behavior if experimental #1434
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
Open
mgovers
wants to merge
1
commit into
main
Choose a base branch
from
pgm/feature/node-injection-sensor-experimental-cpp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -409,6 +409,18 @@ class MainModelImpl { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| void check_no_future_deprecations(Options const& /*options*/, ConstDataset const* /*batch_dataset*/) const { | ||||||
| ModelType::run_functor_with_all_component_types_return_void([this]<typename CT>() { | ||||||
| if constexpr (requires(CT c) { c.get_terminal_type(); }) { | ||||||
| if (std::ranges::any_of(state_.components.template citer<CT>(), [](auto const& sensor) { | ||||||
| return sensor.get_terminal_type() == MeasuredTerminalType::node; | ||||||
| })) { | ||||||
| throw InvalidMeasuredTerminalType{MeasuredTerminalType::node, CT::name}; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's abusing the notation, but would it make sense to do something like
Suggested change
Just to further distinguish it a bit more without introducing anything else? Like a small convention for these rare deprecation errors. |
||||||
| } | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| private: | ||||||
| template <solver_output_type SolverOutputType> | ||||||
| void output_result(MathOutput<std::vector<SolverOutputType>> const& math_output, MutableDataset const& result_data, | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/data/state_estimation/node-injection-sensor-and-zero-injection-deprecated/input.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "input", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": { | ||
| "node": [ | ||
| { | ||
| "id": 1, | ||
| "u_rated": 100.0 | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "u_rated": 100.0 | ||
| } | ||
| ], | ||
| "line": [ | ||
| { | ||
| "id": 4, | ||
| "from_node": 1, | ||
| "to_node": 2, | ||
| "from_status": 1, | ||
| "to_status": 1, | ||
| "r1": 0.1, | ||
| "x1": 0.0, | ||
| "c1": 0.0, | ||
| "tan1": 0.0, | ||
| "i_n": 1000.0 | ||
| } | ||
| ], | ||
| "source": [ | ||
| { | ||
| "id": 6, | ||
| "node": 1, | ||
| "status": 1, | ||
| "u_ref": 1.0 | ||
| } | ||
| ], | ||
| "sym_voltage_sensor": [ | ||
| { | ||
| "id": 101, | ||
| "measured_object": 1, | ||
| "u_measured": 100.0, | ||
| "u_sigma": 1.0 | ||
| } | ||
| ], | ||
| "sym_power_sensor": [ | ||
| { | ||
| "id": 401, | ||
| "measured_object": 2, | ||
| "measured_terminal_type": 9, | ||
| "p_measured": 100e3, | ||
| "q_measured": 100e3, | ||
| "power_sigma": 1e3 | ||
| } | ||
| ] | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...a/state_estimation/node-injection-sensor-and-zero-injection-deprecated/input.json.license
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
10 changes: 10 additions & 0 deletions
10
tests/data/state_estimation/node-injection-sensor-and-zero-injection-deprecated/params.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "calculation_method": ["iterative_linear", "newton_raphson"], | ||
| "rtol": 1e-8, | ||
| "atol": 1e-8, | ||
| "experimental_features": "enabled", | ||
| "raises": { | ||
| "raises": "InvalidMeasuredObject", | ||
| "reason": "Node injection sensors are no longer supported starting with version 2.0." | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
.../state_estimation/node-injection-sensor-and-zero-injection-deprecated/params.json.license
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
7 changes: 7 additions & 0 deletions
7
...data/state_estimation/node-injection-sensor-and-zero-injection-deprecated/sym_output.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "version": "1.0", | ||
| "type": "sym_output", | ||
| "is_batch": false, | ||
| "attributes": {}, | ||
| "data": {} | ||
| } |
3 changes: 3 additions & 0 deletions
3
...te_estimation/node-injection-sensor-and-zero-injection-deprecated/sym_output.json.license
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org> | ||
|
|
||
| SPDX-License-Identifier: MPL-2.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
At first I didn't realize how would this check distinguish flow sensors from voltage sensors and realized that
get_terminal_typeis only part of the former. Can you add a short comment for easy pinpoint?