Skip to content

Commit c4d6d64

Browse files
committed
print instances with lpad instead of rpad
1 parent eb37227 commit c4d6d64

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/predictive_control.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,16 +1002,16 @@ function Base.show(io::IO, mpc::PredictiveController)
10021002
Hp, Hc = mpc.Hp, mpc.Hc
10031003
nu, nd = mpc.estim.model.nu, mpc.estim.model.nd
10041004
nx̂, nym, nyu = mpc.estim.nx̂, mpc.estim.nym, mpc.estim.nyu
1005-
n = maximum(ndigits.((Hp, Hc, nu, nx̂, nym, nyu, nd)))
1005+
n = maximum(ndigits.((Hp, Hc, nu, nx̂, nym, nyu, nd))) + 1
10061006
println(io, "$(typeof(mpc).name.name) controller with a sample time Ts = "*
10071007
"$(mpc.estim.model.Ts) s, $(typeof(mpc.estim).name.name) estimator and:")
1008-
println(io, " $(rpad(Hp, n)) prediction steps Hp")
1009-
println(io, " $(rpad(Hc, n)) control steps Hc")
1010-
println(io, " $(rpad(nu, n)) manipulated inputs u")
1011-
println(io, " $(rpad(nx̂, n)) states x̂")
1012-
println(io, " $(rpad(nym, n)) measured outputs ym")
1013-
println(io, " $(rpad(nyu, n)) unmeasured outputs yu")
1014-
print(io, " $(rpad(nd, n)) measured disturbances d")
1008+
println(io, "$(lpad(Hp, n)) prediction steps Hp")
1009+
println(io, "$(lpad(Hc, n)) control steps Hc")
1010+
println(io, "$(lpad(nu, n)) manipulated inputs u")
1011+
println(io, "$(lpad(nx̂, n)) states x̂")
1012+
println(io, "$(lpad(nym, n)) measured outputs ym")
1013+
println(io, "$(lpad(nyu, n)) unmeasured outputs yu")
1014+
print(io, "$(lpad(nd, n)) measured disturbances d")
10151015
end
10161016

10171017
"Verify that the solver termination status means 'no solution available'."

src/sim_model.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ end
8989
function Base.show(io::IO, model::SimModel)
9090
nu, nd = model.nu, model.nd
9191
nx, ny = model.nx, model.ny
92-
n = maximum(ndigits.((nu, nx, ny, nd)))
92+
n = maximum(ndigits.((nu, nx, ny, nd))) + 1
9393
println(io, "Discrete-time $(typestr(model)) model with "*
9494
"a sample time Ts = $(model.Ts) s and:")
95-
println(io, " $(rpad(nu, n)) manipulated inputs u")
96-
println(io, " $(rpad(nx, n)) states x")
97-
println(io, " $(rpad(ny, n)) outputs y")
98-
print(io, " $(rpad(nd, n)) measured disturbances d")
95+
println(io, "$(lpad(nu, n)) manipulated inputs u")
96+
println(io, "$(lpad(nx, n)) states x")
97+
println(io, "$(lpad(ny, n)) outputs y")
98+
print(io, "$(lpad(nd, n)) measured disturbances d")
9999
end
100100

101101
"""

src/state_estim.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ end
3636
function Base.show(io::IO, estim::StateEstimator)
3737
nu, nd = estim.model.nu, estim.model.nd
3838
nx̂, nym, nyu = estim.nx̂, estim.nym, estim.nyu
39-
n = maximum(ndigits.((nu, nx̂, nym, nyu, nd)))
39+
n = maximum(ndigits.((nu, nx̂, nym, nyu, nd))) + 1
4040
println(io, "$(typeof(estim).name.name) estimator with a sample time "*
4141
"Ts = $(estim.model.Ts) s, $(typeof(estim.model).name.name) and:")
42-
println(io, " $(rpad(nu, n)) manipulated inputs u")
43-
println(io, " $(rpad(nx̂, n)) states x̂")
44-
println(io, " $(rpad(nym, n)) measured outputs ym")
45-
println(io, " $(rpad(nyu, n)) unmeasured outputs yu")
46-
print(io, " $(rpad(nd, n)) measured disturbances d")
42+
println(io, "$(lpad(nu, n)) manipulated inputs u")
43+
println(io, "$(lpad(nx̂, n)) states x̂")
44+
println(io, "$(lpad(nym, n)) measured outputs ym")
45+
println(io, "$(lpad(nyu, n)) unmeasured outputs yu")
46+
print(io, "$(lpad(nd, n)) measured disturbances d")
4747
end
4848

4949
"""

0 commit comments

Comments
 (0)