Skip to content

Commit fec5b00

Browse files
committed
add name of sys in show method
1 parent f19a5bf commit fec5b00

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/systems/abstractsystem.jl

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,15 +1908,16 @@ function Base.show(
19081908

19091909
# Print name and description
19101910
desc = description(sys)
1911-
printstyled(io, "Model ", nameof(sys), ":"; bold)
1911+
name = nameof(sys)
1912+
printstyled(io, "Model ", name, ":"; bold)
19121913
!isempty(desc) && print(io, " ", desc)
19131914

19141915
# Print subsystems
19151916
subs = get_systems(sys)
19161917
nsubs = length(subs)
19171918
nrows = min(nsubs, limit ? rows : nsubs)
19181919
nrows > 0 && printstyled(io, "\nSubsystems ($(nsubs)):"; bold)
1919-
nrows > 0 && hint && print(io, " see hierarchy(sys)")
1920+
nrows > 0 && hint && print(io, " see hierarchy($name)")
19201921
for i in 1:nrows
19211922
sub = subs[i]
19221923
name = String(nameof(sub))
@@ -1940,9 +1941,9 @@ function Base.show(
19401941
next = n_expanded_connection_equations(sys)
19411942
ntot = neqs + next
19421943
ntot > 0 && printstyled(io, "\nEquations ($ntot):"; bold)
1943-
neqs > 0 && print(io, "\n $neqs standard", hint ? ": see equations(sys)" : "")
1944+
neqs > 0 && print(io, "\n $neqs standard", hint ? ": see equations($name)" : "")
19441945
next > 0 && print(io, "\n $next connecting",
1945-
hint ? ": see equations(expand_connections(sys))" : "")
1946+
hint ? ": see equations(expand_connections($name))" : "")
19461947
#Base.print_matrix(io, eqs) # usually too long and not useful to print all equations
19471948
end
19481949

@@ -1953,7 +1954,7 @@ function Base.show(
19531954
nvars == 0 && continue # skip
19541955
header = titlecase(String(nameof(varfunc))) # e.g. "Unknowns"
19551956
printstyled(io, "\n$header ($nvars):"; bold)
1956-
hint && print(io, " see $(nameof(varfunc))(sys)")
1957+
hint && print(io, " see $(nameof(varfunc))($name)")
19571958
nrows = min(nvars, limit ? rows : nvars)
19581959
defs = has_defaults(sys) ? defaults(sys) : nothing
19591960
for i in 1:nrows
@@ -1982,7 +1983,7 @@ function Base.show(
19821983
# Print observed
19831984
nobs = has_observed(sys) ? length(observed(sys)) : 0
19841985
nobs > 0 && printstyled(io, "\nObserved ($nobs):"; bold)
1985-
nobs > 0 && hint && print(io, " see observed(sys)")
1986+
nobs > 0 && hint && print(io, " see observed($name)")
19861987

19871988
return nothing
19881989
end

0 commit comments

Comments
 (0)