Skip to content

Commit 4bc771b

Browse files
committed
changed: using nameof instead of .name.name in show
1 parent 2d61f88 commit 4bc771b

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/controller/explicitmpc.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ function Base.show(io::IO, mpc::ExplicitMPC)
181181
nu, nd = mpc.estim.model.nu, mpc.estim.model.nd
182182
nx̂, nym, nyu = mpc.estim.nx̂, mpc.estim.nym, mpc.estim.nyu
183183
n = maximum(ndigits.((Hp, Hc, nu, nx̂, nym, nyu, nd))) + 1
184-
println(io, "$(typeof(mpc).name.name) controller with a sample time Ts = "*
184+
println(io, "$(nameof(typeof(mpc))) controller with a sample time Ts = "*
185185
"$(mpc.estim.model.Ts) s, "*
186-
"$(typeof(mpc.estim).name.name) estimator and:")
186+
"$(nameof(typeof(mpc.estim))) estimator and:")
187187
println(io, "$(lpad(Hp, n)) prediction steps Hp")
188188
println(io, "$(lpad(Hc, n)) control steps Hc")
189189
print_estim_dim(io, mpc.estim, n)

src/estimator/mhe.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ function Base.show(io::IO, estim::MovingHorizonEstimator)
55
nu, nd = estim.model.nu, estim.model.nd
66
nx̂, nym, nyu = estim.nx̂, estim.nym, estim.nyu
77
n = maximum(ndigits.((nu, nx̂, nym, nyu, nd))) + 1
8-
println(io, "$(typeof(estim).name.name) estimator with a sample time "*
8+
println(io, "$(nameof(typeof(estim))) estimator with a sample time "*
99
"Ts = $(estim.model.Ts) s, $(JuMP.solver_name(estim.optim)) optimizer, "*
10-
"$(typeof(estim.model).name.name) and:")
10+
"$(nameof(typeof(estim.model))) and:")
1111
print_estim_dim(io, estim, n)
1212
end
1313

src/plot_sim.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ get_nx̂(mpc::PredictiveController) = mpc.estim.nx̂
101101

102102
function Base.show(io::IO, res::SimResult)
103103
N = length(res.T_data)
104-
print(io, "Simulation results of $(typeof(res.obj).name.name) with $N time steps.")
104+
print(io, "Simulation results of $(nameof(typeof(res.obj))) with $N time steps.")
105105
end
106106

107107

@@ -137,7 +137,7 @@ function sim!(
137137
D_data = Matrix{NT}(undef, plant.nd, N)
138138
X_data = Matrix{NT}(undef, plant.nx, N)
139139
setstate!(plant, x_0)
140-
@progress name="$(typeof(plant).name.name) simulation" for i=1:N
140+
@progress name="$(nameof(typeof(plant))) simulation" for i=1:N
141141
y = evaloutput(plant, d)
142142
Y_data[:, i] .= y
143143
U_data[:, i] .= u
@@ -282,7 +282,7 @@ function sim_closedloop!(
282282
lastd, lasty = d, evaloutput(plant, d)
283283
initstate!(est_mpc, lastu, lasty[estim.i_ym], lastd)
284284
isnothing(x̂_0) || setstate!(est_mpc, x̂_0)
285-
@progress name="$(typeof(est_mpc).name.name) simulation" for i=1:N
285+
@progress name="$(nameof(typeof(est_mpc))) simulation" for i=1:N
286286
d = lastd + d_step + d_noise.*randn(plant.nd)
287287
y = evaloutput(plant, d) + y_step + y_noise.*randn(plant.ny)
288288
ym = y[estim.i_ym]

src/predictive_control.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ function Base.show(io::IO, mpc::PredictiveController)
3131
nu, nd = mpc.estim.model.nu, mpc.estim.model.nd
3232
nx̂, nym, nyu = mpc.estim.nx̂, mpc.estim.nym, mpc.estim.nyu
3333
n = maximum(ndigits.((Hp, Hc, nu, nx̂, nym, nyu, nd))) + 1
34-
println(io, "$(typeof(mpc).name.name) controller with a sample time Ts = "*
34+
println(io, "$(nameof(typeof(mpc))) controller with a sample time Ts = "*
3535
"$(mpc.estim.model.Ts) s, $(JuMP.solver_name(mpc.optim)) optimizer, "*
36-
"$(typeof(mpc.transcription).name.name) transcription, "*
37-
"$(typeof(mpc.estim).name.name) estimator and:")
36+
"$(nameof(typeof(mpc.transcription))) transcription, "*
37+
"$(nameof(typeof(mpc.estim))) estimator and:")
3838
println(io, "$(lpad(Hp, n)) prediction steps Hp")
3939
println(io, "$(lpad(Hc, n)) control steps Hc")
4040
println(io, "$(lpad(nϵ, n)) slack variable ϵ (control constraints)")

src/sim_model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ function Base.show(io::IO, model::SimModel)
372372
nu, nd = model.nu, model.nd
373373
nx, ny = model.nx, model.ny
374374
n = maximum(ndigits.((nu, nx, ny, nd))) + 1
375-
println(io, "$(typeof(model).name.name) with a sample time Ts = $(model.Ts) s"*
375+
println(io, "$(nameof(typeof(model))) with a sample time Ts = $(model.Ts) s"*
376376
"$(detailstr(model)) and:")
377377
println(io, "$(lpad(nu, n)) manipulated inputs u")
378378
println(io, "$(lpad(nx, n)) states x")

src/state_estim.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ function Base.show(io::IO, estim::StateEstimator)
3232
nu, nd = estim.model.nu, estim.model.nd
3333
nx̂, nym, nyu = estim.nx̂, estim.nym, estim.nyu
3434
n = maximum(ndigits.((nu, nx̂, nym, nyu, nd))) + 1
35-
println(io, "$(typeof(estim).name.name) estimator with a sample time "*
36-
"Ts = $(estim.model.Ts) s, $(typeof(estim.model).name.name) and:")
35+
println(io, "$(nameof(typeof(estim))) estimator with a sample time "*
36+
"Ts = $(estim.model.Ts) s, $(nameof(typeof(estim.model))) and:")
3737
print_estim_dim(io, estim, n)
3838
end
3939

0 commit comments

Comments
 (0)