@@ -486,14 +486,19 @@ struct Break <: AnalysisPointTransformation
486486    Whether to add a new input variable connected to all the outputs of `ap`. 
487487    """  
488488    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 
489494end 
490495
491496""" 
492497    $(TYPEDSIGNATURES)  
493498
494- `Break` the given analysis point `ap` without adding an input . 
499+ `Break` the given analysis point `ap`. 
495500""" 
496- Break (ap:: AnalysisPoint ) =  Break (ap, false )
501+ Break (ap:: AnalysisPoint , add_input :: Bool   =   false ) =  Break (ap, add_input , false )
497502
498503function  apply_transformation (tf:: Break , sys:: AbstractSystem )
499504    modify_nested_subsystem (sys, tf. ap) do  breaksys
@@ -517,7 +522,11 @@ function apply_transformation(tf::Break, sys::AbstractSystem)
517522            push! (breaksys_eqs, ap_var (outsys) ~  new_var)
518523        end 
519524        defs =  copy (get_defaults (breaksys))
520-         defs[new_var] =  new_def
525+         defs[new_var] =  if  tf. default_outputs_to_input
526+             ap_ivar
527+         else 
528+             new_def
529+         end 
521530        @set!  breaksys. defaults =  defs
522531        unks =  copy (get_unknowns (breaksys))
523532        push! (unks, new_var)
@@ -803,7 +812,7 @@ Given a list of analysis points, break the connection for each and set the outpu
803812""" 
804813function  handle_loop_openings (sys:: AbstractSystem , aps)
805814    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)
807816        if  Symbolics. isarraysymbolic (outvar)
808817            push! (get_eqs (sys), outvar ~  zeros (size (outvar)))
809818        else 
815824
816825const  DOC_LOOP_OPENINGS =  """ 
817826    - `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. 
819828""" 
820829
821830const  DOC_SYS_MODIFIER =  """ 
@@ -952,7 +961,7 @@ function linearization_ap_transform(sys,
952961    for  input in  inputs
953962        if  nameof (input) in  loop_openings
954963            delete! (loop_openings, nameof (input))
955-             sys, (input_var,) =  apply_transformation (Break (input, true ), sys)
964+             sys, (input_var,) =  apply_transformation (Break (input, true ,  true ), sys)
956965        else 
957966            sys, (input_var,) =  apply_transformation (PerturbOutput (input), sys)
958967        end 
0 commit comments