@@ -412,6 +412,27 @@ function get_analysis_variable(var, name, iv; perturb = true)
412
412
return pvar, default
413
413
end
414
414
415
+ function with_analysis_point_ignored (sys:: AbstractSystem , ap:: AnalysisPoint )
416
+ has_ignored_connections (sys) || return sys
417
+ ignored = get_ignored_connections (sys)
418
+ if ignored === nothing
419
+ ignored = (ODESystem[], BasicSymbolic[])
420
+ else
421
+ ignored = copy .(ignored)
422
+ end
423
+ if ap. outputs === nothing
424
+ error (" Empty analysis point" )
425
+ end
426
+ for x in ap. outputs
427
+ if x isa ODESystem
428
+ push! (ignored[1 ], x)
429
+ else
430
+ push! (ignored[2 ], unwrap (x))
431
+ end
432
+ end
433
+ return @set sys. ignored_connections = ignored
434
+ end
435
+
415
436
# ### PRIMITIVE TRANSFORMATIONS
416
437
417
438
const DOC_WILL_REMOVE_AP = """
@@ -469,7 +490,9 @@ function apply_transformation(tf::Break, sys::AbstractSystem)
469
490
ap = breaksys_eqs[ap_idx]. rhs
470
491
deleteat! (breaksys_eqs, ap_idx)
471
492
472
- tf. add_input || return sys, ()
493
+ breaksys = with_analysis_point_ignored (breaksys, ap)
494
+
495
+ tf. add_input || return breaksys, ()
473
496
474
497
ap_ivar = ap_var (ap. input)
475
498
new_var, new_def = get_analysis_variable (ap_ivar, nameof (ap), get_iv (sys))
@@ -511,7 +534,7 @@ function apply_transformation(tf::GetInput, sys::AbstractSystem)
511
534
ap_idx === nothing &&
512
535
error (" Analysis point $(nameof (tf. ap)) not found in system $(nameof (sys)) ." )
513
536
# get the anlysis point
514
- ap_sys_eqs = copy ( get_eqs (ap_sys) )
537
+ ap_sys_eqs = get_eqs (ap_sys)
515
538
ap = ap_sys_eqs[ap_idx]. rhs
516
539
517
540
# input variable
@@ -570,6 +593,7 @@ function apply_transformation(tf::PerturbOutput, sys::AbstractSystem)
570
593
ap = ap_sys_eqs[ap_idx]. rhs
571
594
# remove analysis point
572
595
deleteat! (ap_sys_eqs, ap_idx)
596
+ ap_sys = with_analysis_point_ignored (ap_sys, ap)
573
597
574
598
# add equations involving new variable
575
599
ap_ivar = ap_var (ap. input)
@@ -634,7 +658,7 @@ function apply_transformation(tf::AddVariable, sys::AbstractSystem)
634
658
ap_idx = analysis_point_index (ap_sys, tf. ap)
635
659
ap_idx === nothing &&
636
660
error (" Analysis point $(nameof (tf. ap)) not found in system $(nameof (sys)) ." )
637
- ap_sys_eqs = copy ( get_eqs (ap_sys) )
661
+ ap_sys_eqs = get_eqs (ap_sys)
638
662
ap = ap_sys_eqs[ap_idx]. rhs
639
663
640
664
# add equations involving new variable
0 commit comments