@@ -486,14 +486,19 @@ struct Break <: AnalysisPointTransformation
486
486
Whether to add a new input variable connected to all the outputs of `ap`.
487
487
"""
488
488
add_input:: Bool
489
+ """
490
+ Whether the default of the added input variable should be the input of `ap`. Only
491
+ applicable if `add_input == true`.
492
+ """
493
+ default_outputs_to_input:: Bool
489
494
end
490
495
491
496
"""
492
497
$(TYPEDSIGNATURES)
493
498
494
- `Break` the given analysis point `ap` without adding an input .
499
+ `Break` the given analysis point `ap`.
495
500
"""
496
- Break (ap:: AnalysisPoint ) = Break (ap, false )
501
+ Break (ap:: AnalysisPoint , add_input :: Bool = false ) = Break (ap, add_input , false )
497
502
498
503
function apply_transformation (tf:: Break , sys:: AbstractSystem )
499
504
modify_nested_subsystem (sys, tf. ap) do breaksys
@@ -517,7 +522,11 @@ function apply_transformation(tf::Break, sys::AbstractSystem)
517
522
push! (breaksys_eqs, ap_var (outsys) ~ new_var)
518
523
end
519
524
defs = copy (get_defaults (breaksys))
520
- defs[new_var] = new_def
525
+ defs[new_var] = if ap. default_outputs_to_input
526
+ ap_ivar
527
+ else
528
+ new_def
529
+ end
521
530
@set! breaksys. defaults = defs
522
531
unks = copy (get_unknowns (breaksys))
523
532
push! (unks, new_var)
@@ -803,7 +812,7 @@ Given a list of analysis points, break the connection for each and set the outpu
803
812
"""
804
813
function handle_loop_openings (sys:: AbstractSystem , aps)
805
814
for ap in canonicalize_ap (sys, aps)
806
- sys, (outvar,) = apply_transformation (Break (ap, true ), sys)
815
+ sys, (outvar,) = apply_transformation (Break (ap, true , true ), sys)
807
816
if Symbolics. isarraysymbolic (outvar)
808
817
push! (get_eqs (sys), outvar ~ zeros (size (outvar)))
809
818
else
815
824
816
825
const DOC_LOOP_OPENINGS = """
817
826
- `loop_openings`: A list of analysis points whose connections should be removed and
818
- the outputs set to zero as a part of the linear analysis.
827
+ the outputs set to the input as a part of the linear analysis.
819
828
"""
820
829
821
830
const DOC_SYS_MODIFIER = """
0 commit comments