Skip to content

Commit 8567949

Browse files
committed
compress printing for very large statespace models
1 parent 9b90f41 commit 8567949

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

lib/ControlSystemsBase/src/types/StateSpace.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,18 @@ end
564564
Base.print(io::IO, sys::AbstractStateSpace) = show(io, sys)
565565

566566
function Base.show(io::IO, sys::AbstractStateSpace)
567-
# Compose the name vectors
568-
#inputs = format_names(s.inputnames, "u", "?")
569-
#outputs = format_names(s.outputnames, "y", "?")
570-
#println(io, "StateSpace:")
571567
println(io, typeof(sys))
568+
A, B, C, D = ssdata(sys)
572569
if nstates(sys) > 0
573-
#states = format_names(s.statenames, "x", "?")
574-
println(io, "A = \n", _string_mat_with_headers(sys.A))
575-
println(io, "B = \n", _string_mat_with_headers(sys.B))
576-
println(io, "C = \n", _string_mat_with_headers(sys.C))
570+
length(A) < 200 ? println(io, "A = \n", _string_mat_with_headers(A)) :
571+
println(io, "A = $(typeof(A))$(size(A))")
572+
length(B) < 200 ? println(io, "B = \n", _string_mat_with_headers(B)) :
573+
println(io, "B = $(typeof(B))$(size(B))")
574+
length(C) < 200 ? println(io, "C = \n", _string_mat_with_headers(C)) :
575+
println(io, "C = $(typeof(C))$(size(C))")
576+
length(D) < 200 ? println(io, "D = \n", _string_mat_with_headers(D)) :
577+
println(io, "D = ", iszero(D) ? " 0" : "$(typeof(D))$(size(D))")
577578
end
578-
println(io, "D = \n", _string_mat_with_headers(sys.D), "\n")
579579
# Print sample time
580580
if isdiscrete(sys)
581581
println(io, "Sample Time: ", sys.Ts, " (seconds)")

0 commit comments

Comments
 (0)