@@ -198,10 +198,36 @@ TEST_CASE("Test source") {
198198 changed = source.update (SourceUpdate{.id = 1 , .status = 0 , .u_ref = nan, .u_ref_angle = nan});
199199 CHECK (!changed.topo );
200200 CHECK (!changed.param );
201+
202+ // test updating sk, rx_ratio, z01_ratio (status remains 0)
203+ changed = source.update (SourceUpdate{
204+ .id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan, .sk = 20e6 , .rx_ratio = nan, .z01_ratio = nan});
205+ CHECK (!changed.topo );
206+ CHECK (changed.param );
207+
208+ // verify the new impedance affects math_param
209+ DoubleComplex const y_ref_sym_updated = source.math_param <symmetric_t >().template y_ref <symmetric_t >();
210+ CHECK (cabs (y_ref_sym_updated - y_ref_sym) > numerical_tolerance); // should be different
211+
212+ changed = source.update (SourceUpdate{
213+ .id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan, .sk = nan, .rx_ratio = 0.2 , .z01_ratio = nan});
214+ CHECK (!changed.topo );
215+ CHECK (changed.param );
216+
217+ changed = source.update (SourceUpdate{
218+ .id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan, .sk = nan, .rx_ratio = nan, .z01_ratio = 4.0 });
219+ CHECK (!changed.topo );
220+ CHECK (changed.param );
221+
222+ changed = source.update (SourceUpdate{
223+ .id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan, .sk = nan, .rx_ratio = nan, .z01_ratio = nan});
224+ CHECK (!changed.topo );
225+ CHECK (!changed.param );
201226 }
202227
203228 SUBCASE (" Update inverse" ) {
204- SourceUpdate source_update{.id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan};
229+ SourceUpdate source_update{
230+ .id = 1 , .status = na_IntS, .u_ref = nan, .u_ref_angle = nan, .sk = nan, .rx_ratio = nan, .z01_ratio = nan};
205231 auto expected = source_update;
206232
207233 SUBCASE (" Identical" ) {
@@ -225,13 +251,37 @@ TEST_CASE("Test source") {
225251 expected.u_ref_angle = nan;
226252 }
227253
254+ SUBCASE (" sk" ) {
255+ SUBCASE (" same" ) { source_update.sk = sk; }
256+ SUBCASE (" different" ) { source_update.sk = 20e6 ; }
257+ expected.sk = sk;
258+ }
259+
260+ SUBCASE (" rx_ratio" ) {
261+ SUBCASE (" same" ) { source_update.rx_ratio = rx_ratio; }
262+ SUBCASE (" different" ) { source_update.rx_ratio = 0.2 ; }
263+ expected.rx_ratio = rx_ratio;
264+ }
265+
266+ SUBCASE (" z01_ratio" ) {
267+ SUBCASE (" same" ) { source_update.z01_ratio = z01_ratio; }
268+ SUBCASE (" different" ) { source_update.z01_ratio = 4.0 ; }
269+ expected.z01_ratio = z01_ratio;
270+ }
271+
228272 SUBCASE (" multiple" ) {
229273 source_update.status = IntS{0 };
230274 source_update.u_ref = 0.0 ;
231275 source_update.u_ref_angle = 0.1 ;
276+ source_update.sk = 20e6 ;
277+ source_update.rx_ratio = 0.2 ;
278+ source_update.z01_ratio = 4.0 ;
232279 expected.status = status_to_int (source.status ());
233280 expected.u_ref = u_input;
234281 expected.u_ref_angle = nan;
282+ expected.sk = sk;
283+ expected.rx_ratio = rx_ratio;
284+ expected.z01_ratio = z01_ratio;
235285 }
236286
237287 auto const inv = source.inverse (source_update);
@@ -240,6 +290,9 @@ TEST_CASE("Test source") {
240290 CHECK (inv.status == expected.status );
241291 check_nan_preserving_equality (inv.u_ref , expected.u_ref );
242292 check_nan_preserving_equality (inv.u_ref_angle , expected.u_ref_angle );
293+ check_nan_preserving_equality (inv.sk , expected.sk );
294+ check_nan_preserving_equality (inv.rx_ratio , expected.rx_ratio );
295+ check_nan_preserving_equality (inv.z01_ratio , expected.z01_ratio );
243296 }
244297}
245298
0 commit comments