@@ -701,10 +701,34 @@ function get_or_construct_tearing_state(sys)
701
701
state
702
702
end
703
703
704
+ # TODO : what about inputs?
705
+ function count_unexpanded_flows (sys:: AbstractSystem )
706
+ nflows = 0
707
+ for m in PreOrderDFS (Tree (sys))
708
+ isconnector (m) || continue
709
+ nflows += count (x-> get_connection_type (x) === Flow, get_states (m))
710
+ end
711
+ nflows
712
+ end
713
+
714
+ function n_extra_equations (sys:: AbstractSystem )
715
+ isconnector (sys) && return length (get_states (sys))
716
+ nextras = count_unexpanded_flows (sys)
717
+ end
718
+
704
719
function Base. show (io:: IO , :: MIME"text/plain" , sys:: AbstractSystem )
705
720
eqs = equations (sys)
721
+ vars = states (sys); nvars = length (vars)
706
722
if eqs isa AbstractArray
707
- Base. printstyled (io, " Model $(nameof (sys)) with $(length (eqs)) equations\n " ; bold= true )
723
+ neqs = count (eq-> ! (eq. lhs isa Connection), eqs)
724
+ Base. printstyled (io, " Model $(nameof (sys)) with $neqs " ; bold= true )
725
+ nextras = n_extra_equations (sys)
726
+ if nextras > 0
727
+ Base. printstyled (io, " (" ; bold= true )
728
+ Base. printstyled (io, neqs + nextras; bold= true , color= :magenta )
729
+ Base. printstyled (io, " ) " ; bold= true )
730
+ end
731
+ Base. printstyled (io, " equations\n " ; bold= true )
708
732
else
709
733
Base. printstyled (io, " Model $(nameof (sys)) \n " ; bold= true )
710
734
end
@@ -716,7 +740,6 @@ function Base.show(io::IO, ::MIME"text/plain", sys::AbstractSystem)
716
740
rows = first (displaysize (io)) ÷ 5
717
741
limit = get (io, :limit , false )
718
742
719
- vars = states (sys); nvars = length (vars)
720
743
Base. printstyled (io, " States ($nvars ):" ; bold= true )
721
744
nrows = min (nvars, limit ? rows : nvars)
722
745
limited = nrows < length (vars)
0 commit comments