Skip to content

Commit cf7cdf6

Browse files
authored
Merge pull request #833 from PowerGridModel/feature/only-important-integration-tests
Keep only important integration tests
2 parents 99509fd + 7edccc1 commit cf7cdf6

22 files changed

+526
-380
lines changed

tests/cpp_integration_tests/test_main_model.cpp

Lines changed: 64 additions & 353 deletions
Large diffs are not rendered by default.

tests/cpp_integration_tests/test_main_model_sc.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ using enum CalculationSymmetry;
1717
TEST_CASE("Test main model - short circuit") {
1818
MainModel main_model{50.0, meta_data::meta_data_gen::meta_data};
1919

20-
SUBCASE("Single node + source") {
20+
SUBCASE("Single node + source") { // TODO(mgovers): existing validation case for this is too difficult. we may want
21+
// to keep this. Also should not live here but in SC solver
2122
double const u_rated = 10e3;
2223
double const u_ref = 1.0;
2324
double const sk = 100e6;
@@ -127,7 +128,8 @@ TEST_CASE("Test main model - short circuit") {
127128
}
128129
}
129130

130-
SUBCASE("Two nodes + branch + source") {
131+
SUBCASE("Two nodes + branch + source") { // TODO(mgovers): existing validation case for this is too difficult. we
132+
// may want to keep this
131133
ShortCircuitVoltageScaling const voltage_scaling = ShortCircuitVoltageScaling::maximum;
132134
constexpr double voltage_scaling_c = 1.1;
133135

@@ -163,7 +165,9 @@ TEST_CASE("Test main model - short circuit") {
163165
}
164166
}
165167

166-
TEST_CASE("Test main model - short circuit - Dataset input") {
168+
TEST_CASE("Test main model - short circuit - Dataset input") { // TODO(mgovers): same logic as above but different input
169+
// type. maybe make a validation case for this; otherwise
170+
// may be removed
167171
SUBCASE("Two nodes + branch + source") {
168172
std::vector<NodeInput> node_input{{1, 10e4}, {2, 10e4}};
169173
std::vector<LineInput> line_input{{3, 1, 2, 1, 1, 10.0, 0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 1e3}};

tests/cpp_integration_tests/test_main_model_se.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ TEST_CASE_TEMPLATE("Test main model - state estimation", CalcMethod, IterativeLi
3535
.max_iter = 20};
3636

3737
SUBCASE("State Estimation") {
38-
SUBCASE("Single Node + Source") {
38+
SUBCASE("Single Node + Source") { // TODO(mgovers): these are so simple, they may be API tests, but that would
39+
// just be moving the problem around.
3940
main_model.add_component<Node>({{1, 10e3}});
4041
main_model.add_component<Source>({{2, 1, 1, 1.0, nan, nan, nan, nan}});
4142
SUBCASE("Symmetric Voltage Sensor") {
@@ -141,7 +142,8 @@ TEST_CASE_TEMPLATE("Test main model - state estimation", CalcMethod, IterativeLi
141142
}
142143
}
143144

144-
SUBCASE("Node Injection") {
145+
SUBCASE("Node Injection") { // TODO(mgovers): these are so simple, they may be API tests, but that would just be
146+
// moving the problem around.
145147
main_model.add_component<Node>({{1, 10e3}, {2, 10e3}});
146148
main_model.add_component<Link>({{3, 1, 2, 1, 1}});
147149
main_model.add_component<Source>({{4, 1, 1, 1.0, nan, nan, nan, nan}});
@@ -220,7 +222,8 @@ TEST_CASE_TEMPLATE("Test main model - state estimation", CalcMethod, IterativeLi
220222
}
221223
}
222224
}
223-
SUBCASE("Line power sensor") {
225+
SUBCASE("Line power sensor") { // TODO(mgovers): these are so simple, they may be API tests, but that would just
226+
// be moving the problem around.
224227
main_model.add_component<Node>({{1, 10e3}, {2, 10e3}});
225228
main_model.add_component<Line>({{3, 1, 2, 1, 1, 0.01, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1e3}});
226229
main_model.add_component<Source>({{4, 1, 1, 1.0, nan, nan, nan, nan}});
@@ -265,7 +268,8 @@ TEST_CASE_TEMPLATE("Test main model - state estimation", CalcMethod, IterativeLi
265268
}
266269
}
267270
}
268-
SUBCASE("Forbid Link Power Measurements") {
271+
SUBCASE("Forbid Link Power Measurements") { // TODO(mgovers): This should be tested. maybe API test or in an
272+
// isolated environment
269273
main_model.add_component<Node>({{1, 10e3}, {2, 10e3}});
270274
main_model.add_component<Link>({{3, 1, 2, 1, 1}});
271275
CHECK_THROWS_AS(main_model.add_component<SymPowerSensor>(
@@ -298,7 +302,8 @@ TEST_CASE_TEMPLATE("Test main model - state estimation", CalcMethod, IterativeLi
298302
}
299303
}
300304

301-
SUBCASE("Test incomplete input but complete update dataset") {
305+
SUBCASE(
306+
"Test incomplete input but complete update dataset") { // TODO(mgovers): this tests the same as the PF version
302307
std::vector<NodeInput> node_input{{1, 10e3}};
303308

304309
std::vector<SourceInput> incomplete_source_input{{2, 1, 1, nan, nan, nan, nan, nan}};

tests/cpp_integration_tests/test_math_solver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ void assert_sc_output(ShortCircuitSolverOutput<sym> const& output, ShortCircuitS
122122

123123
} // namespace
124124

125-
TEST_CASE("Test math solver") {
125+
TEST_CASE(
126+
"Test math solver") { // most of these should be template test cases with instantiations for the individual solvers
126127
/*
127128
network, v means voltage measured, p means power measured, pp means double measured
128129
variance always 1.0
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
2-
"calculation_method": "linear",
2+
"calculation_method": [
3+
"linear",
4+
"newton_raphson",
5+
"iterative_current",
6+
"linear_current"
7+
],
38
"rtol": 1e-5,
49
"atol": 1e-5
510
}

tests/data/power_flow/dummy-test-batch-independent-cacheable/update_batch.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,29 @@
77
{
88
"sym_load": [
99
{
10-
"id": 7,
1110
"q_specified": 2.5
1211
},
1312
{
14-
"id": 8,
1513
"q_specified": 7.5
1614
}
1715
]
1816
},
1917
{
2018
"sym_load": [
2119
{
22-
"id": 7,
2320
"q_specified": 15.0
2421
},
2522
{
26-
"id": 8,
2723
"q_specified": 5.0
2824
}
2925
]
3026
},
3127
{
3228
"sym_load": [
3329
{
34-
"id": 7,
3530
"q_specified": 21.0
3631
},
3732
{
38-
"id": 8,
3933
"q_specified": 9.0
4034
}
4135
]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"version": "1.0",
3+
"type": "input",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node": [
8+
{
9+
"id": 1,
10+
"u_rated": 10.0
11+
},
12+
{
13+
"id": 2,
14+
"u_rated": 10.0
15+
}
16+
],
17+
"line": [
18+
{
19+
"id": 4,
20+
"from_node": 1,
21+
"to_node": 2,
22+
"from_status": 1,
23+
"to_status": 1,
24+
"r1": 0.0,
25+
"x1": 1.0,
26+
"c1": 0.0,
27+
"tan1": 0.0,
28+
"i_n": 1e3
29+
}
30+
],
31+
"source": [
32+
{
33+
"id": 6,
34+
"node": 1,
35+
"status": 1,
36+
"u_ref": 1.0,
37+
"sk": 100.0,
38+
"rx_ratio": 0.0
39+
}
40+
],
41+
"sym_load": [
42+
{
43+
"id": 7,
44+
"node": 2,
45+
"status": 1,
46+
"type": 2,
47+
"p_specified": 0.0,
48+
"q_specified": 0.0
49+
},
50+
{
51+
"id": 8,
52+
"node": 2,
53+
"status": 1,
54+
"type": 2,
55+
"p_specified": 0.0,
56+
"q_specified": 0.0
57+
}
58+
]
59+
}
60+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"calculation_method": ["newton_raphson", "iterative_current"],
3+
"rtol": 1e-5,
4+
"atol": 1e-5
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
2+
3+
SPDX-License-Identifier: MPL-2.0

0 commit comments

Comments
 (0)