Skip to content

Unit test not observable network passed through no perturbation#1322

Open
Jerry-Jinfeng-Guo wants to merge 12 commits intomainfrom
feature/unit-test-not-observable-network-passed-through-no-perturbation
Open

Unit test not observable network passed through no perturbation#1322
Jerry-Jinfeng-Guo wants to merge 12 commits intomainfrom
feature/unit-test-not-observable-network-passed-through-no-perturbation

Conversation

@Jerry-Jinfeng-Guo
Copy link
Copy Markdown
Member

@Jerry-Jinfeng-Guo Jerry-Jinfeng-Guo commented Mar 6, 2026

Added unit tests for checking the possibility to use perturbation due to observability check render .is_observable state without exception thrown.

PR comes from #1317

Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds C++ unit tests around math_solver::observability::ObservabilityResult::use_perturbation() to ensure non-observable networks don’t trigger perturbation, and to exercise the use_perturbation boolean logic.

Changes:

  • Added a new TEST_CASE covering use_perturbation() for a non-observable meshed network with multiple voltage phasor sensors.
  • Added additional subcases attempting to cover an observable case and direct ObservabilityResult logic combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Jerry-Jinfeng-Guo and others added 5 commits March 6, 2026 20:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Signed-off-by: Jerry Jinfeng Guo <jerry.jinfeng.guo@alliander.com>
Jerry-Jinfeng-Guo and others added 3 commits March 18, 2026 11:43
…sed-through-no-perturbation

Signed-off-by: Jerry Guo <6221579+Jerry-Jinfeng-Guo@users.noreply.github.com>
Signed-off-by: Santiago Figueroa Manrique <figueroa1395@gmail.com>
Comment on lines +2028 to +2034
topo.sources_per_bus = {from_sparse, {0, 1, 1, 1, 1}};
topo.shunts_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.load_gens_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.power_sensors_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.power_sensors_per_source = {from_sparse, {0, 0}};
topo.power_sensors_per_load_gen = {from_sparse, {0}};
topo.power_sensors_per_shunt = {from_sparse, {0}};
Copy link
Copy Markdown
Member

@mgovers mgovers Mar 30, 2026

Choose a reason for hiding this comment

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

why use from_sparse here instead of from_dense. To me, it reads much easier to just do

Suggested change
topo.sources_per_bus = {from_sparse, {0, 1, 1, 1, 1}};
topo.shunts_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.load_gens_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.power_sensors_per_bus = {from_sparse, {0, 0, 0, 0, 0}};
topo.power_sensors_per_source = {from_sparse, {0, 0}};
topo.power_sensors_per_load_gen = {from_sparse, {0}};
topo.power_sensors_per_shunt = {from_sparse, {0}};
topo.sources_per_bus = {from_dense, {0}, 5};
topo.shunts_per_bus = {from_dense, {}, 5};
topo.load_gens_per_bus = {from_dense, {}, 5};
topo.power_sensors_per_bus = {from_dense, {}, 5};
topo.power_sensors_per_source = {from_dense, {}, 1};
topo.power_sensors_per_load_gen = {from_dense, {}, 0};
topo.power_sensors_per_shunt = {from_dense, {}}, 0;

that is:

  • 1 source at node 0 (out of a total of 5 nodes)
  • no shunts (distributed over 5 nodes)
  • no load gens (distributed over 5 nodes)
  • no node injection power sensors (distributed over 5 nodes)
  • no power sensors on sources (out of 1 source)
  • no power sensors on load gens (there are no load gens)
  • no power sensors on shunts (there are no shunts)

idem below

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No particular reason. Addressed in 9cd1b61

Signed-off-by: Santiago Figueroa Manrique <figueroa1395@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants