@@ -734,17 +734,15 @@ function isinitial(p)
734734end
735735
736736"""
737- $(TYPEDSIGNATURES)
738-
739- Mark a system as completed. A completed system is a system which is done being
740- defined/modified and is ready for structural analysis or other transformations.
741- This allows for analyses and optimizations to be performed which require knowing
742- the global structure of the system.
737+ Allow systems to dispatch `complete` but still get at the underlying functionality it
738+ implements in a uniform way.
743739
744- One property to note is that if a system is complete, the system will no longer
745- namespace its subsystems or variables, i.e. `isequal(complete(sys).v.i, v.i)`.
740+ Notes:
741+ - `allow_additional_ps = true` is used to allow additional parameters to be added to the
742+ system during completion (such as initial conditions).
746743"""
747- function complete (sys:: AbstractSystem ; split = true , flatten = true )
744+ function _complete (sys:: AbstractSystem ; split = true , flatten = true ,
745+ allow_additional_ps = true )
748746 newunknowns = OrderedSet ()
749747 newparams = OrderedSet ()
750748 iv = has_iv (sys) ? get_iv (sys) : nothing
@@ -765,7 +763,9 @@ function complete(sys::AbstractSystem; split = true, flatten = true)
765763 @set! newsys. parent = complete (sys; split = false , flatten = false )
766764 end
767765 sys = newsys
768- sys = add_initialization_parameters (sys)
766+ if allow_additional_ps
767+ sys = add_initialization_parameters (sys)
768+ end
769769 end
770770 if split && has_index_cache (sys)
771771 @set! sys. index_cache = IndexCache (sys)
@@ -801,6 +801,21 @@ function complete(sys::AbstractSystem; split = true, flatten = true)
801801 isdefined (sys, :complete ) ? (@set! sys. complete = true ) : sys
802802end
803803
804+ """
805+ $(TYPEDSIGNATURES)
806+
807+ Mark a system as completed. A completed system is a system which is done being
808+ defined/modified and is ready for structural analysis or other transformations.
809+ This allows for analyses and optimizations to be performed which require knowing
810+ the global structure of the system.
811+
812+ One property to note is that if a system is complete, the system will no longer
813+ namespace its subsystems or variables, i.e. `isequal(complete(sys).v.i, v.i)`.
814+ """
815+ function complete (sys:: AbstractSystem ; split = true , flatten = true )
816+ _complete (sys; split, flatten)
817+ end
818+
804819"""
805820 $(TYPEDSIGNATURES)
806821
0 commit comments