Skip to content

Commit 025d847

Browse files
committed
changed: replace an Union with AbstractVector{Int}
1 parent 1187b82 commit 025d847

File tree

9 files changed

+12
-14
lines changed

9 files changed

+12
-14
lines changed

docs/src/public/predictive_control.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ in which ``\mathbf{U}`` and ``\mathbf{R̂_u}`` are both vectors of `nu*Hp` eleme
4949
the manipulated input increment as ``\mathbf{Δu}(k+j) = \mathbf{u}(k+j) - \mathbf{u}(k+j-1)``,
5050
the control horizon ``H_c`` enforces that ``\mathbf{Δu}(k+j) = \mathbf{0}`` for ``j ≥ H_c``.
5151
For this reason, the vector that collects them is truncated up to ``k+H_c-1`` (without
52-
custom move blocking):
52+
any custom move blocking):
5353

5454
```math
5555
\mathbf{ΔU} =

src/estimator/construct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function init_integrators(nint::IntVectorOrInt, ny, varname::String)
116116
nint = fill(0, ny)
117117
end
118118
if length(nint) ny
119-
error("nint_$(varname) size ($(length(nint))) ≠ n$(varname) ($ny)")
119+
error("nint_$(varname) length ($(length(nint))) ≠ n$(varname) ($ny)")
120120
end
121121
any(nint .< 0) && error("nint_$(varname) values should be ≥ 0")
122122
nx = sum(nint)

src/estimator/internal_model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ InternalModel estimator with a sample time Ts = 0.5 s, LinModel and:
104104
"""
105105
function InternalModel(
106106
model::SM;
107-
i_ym::IntRangeOrVector = 1:model.ny,
107+
i_ym::AbstractVector{Int} = 1:model.ny,
108108
stoch_ym::LTISystem = (In = I(length(i_ym)); ss(In, In, In, In, model.Ts))
109109
) where {NT<:Real, SM<:SimModel{NT}}
110110
stoch_ym = minreal(ss(stoch_ym))

src/estimator/kalman.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ SteadyKalmanFilter estimator with a sample time Ts = 0.5 s, LinModel and:
166166
"""
167167
function SteadyKalmanFilter(
168168
model::SM;
169-
i_ym::IntRangeOrVector = 1:model.ny,
169+
i_ym::AbstractVector{Int} = 1:model.ny,
170170
sigmaQ = fill(1/model.nx, model.nx),
171171
sigmaR = fill(1, length(i_ym)),
172172
nint_u ::IntVectorOrInt = 0,
@@ -397,7 +397,7 @@ KalmanFilter estimator with a sample time Ts = 0.5 s, LinModel and:
397397
"""
398398
function KalmanFilter(
399399
model::SM;
400-
i_ym::IntRangeOrVector = 1:model.ny,
400+
i_ym::AbstractVector{Int} = 1:model.ny,
401401
sigmaP_0 = fill(1/model.nx, model.nx),
402402
sigmaQ = fill(1/model.nx, model.nx),
403403
sigmaR = fill(1, length(i_ym)),
@@ -654,7 +654,7 @@ UnscentedKalmanFilter estimator with a sample time Ts = 10.0 s, NonLinModel and:
654654
"""
655655
function UnscentedKalmanFilter(
656656
model::SM;
657-
i_ym::IntRangeOrVector = 1:model.ny,
657+
i_ym::AbstractVector{Int} = 1:model.ny,
658658
sigmaP_0 = fill(1/model.nx, model.nx),
659659
sigmaQ = fill(1/model.nx, model.nx),
660660
sigmaR = fill(1, length(i_ym)),
@@ -1009,7 +1009,7 @@ ExtendedKalmanFilter estimator with a sample time Ts = 5.0 s, NonLinModel and:
10091009
"""
10101010
function ExtendedKalmanFilter(
10111011
model::SM;
1012-
i_ym::IntRangeOrVector = 1:model.ny,
1012+
i_ym::AbstractVector{Int} = 1:model.ny,
10131013
sigmaP_0 = fill(1/model.nx, model.nx),
10141014
sigmaQ = fill(1/model.nx, model.nx),
10151015
sigmaR = fill(1, length(i_ym)),

src/estimator/luenberger.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Luenberger estimator with a sample time Ts = 0.5 s, LinModel and:
9595
"""
9696
function Luenberger(
9797
model::SM;
98-
i_ym::IntRangeOrVector = 1:model.ny,
98+
i_ym::AbstractVector{Int} = 1:model.ny,
9999
nint_u ::IntVectorOrInt = 0,
100100
nint_ym::IntVectorOrInt = default_nint(model, i_ym, nint_u),
101101
poles = 1e-3*(1:(model.nx + sum(nint_u) + sum(nint_ym))) .+ 0.5,

src/estimator/mhe/construct.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ MovingHorizonEstimator estimator with a sample time Ts = 10.0 s, Ipopt optimizer
376376
function MovingHorizonEstimator(
377377
model::SM;
378378
He::Union{Int, Nothing} = nothing,
379-
i_ym::IntRangeOrVector = 1:model.ny,
379+
i_ym::AbstractVector{Int} = 1:model.ny,
380380
sigmaP_0 = fill(1/model.nx, model.nx),
381381
sigmaQ = fill(1/model.nx, model.nx),
382382
sigmaR = fill(1, length(i_ym)),

src/model/linmodel.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ LinModel with a sample time Ts = 0.1 s and:
136136
function LinModel(
137137
sys::StateSpace{E, NT},
138138
Ts::Union{Real,Nothing} = nothing;
139-
i_u::IntRangeOrVector = 1:size(sys,2),
140-
i_d::IntRangeOrVector = Int[]
139+
i_u::AbstractVector{Int} = 1:size(sys,2),
140+
i_d::AbstractVector{Int} = Int[]
141141
) where {E, NT<:Real}
142142
if !isempty(i_d)
143143
# common indexes in i_u and i_d are interpreted as measured disturbances d :

src/plot_sim.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ end
319319
"Keep manipulated input `u` unchanged for state estimator simulation."
320320
sim_getu!(::StateEstimator, u, _ , _ ) = u
321321

322-
function get_indices(arg::IntRangeOrVector, n)
322+
function get_indices(arg::AbstractVector{Int}, n)
323323
if length(unique(arg)) length(arg) || maximum(arg) > n
324324
error("Plot keyword argument arguments should contains valid and unique indices")
325325
end

src/sim_model.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const IntRangeOrVector = Union{UnitRange{Int}, Vector{Int}}
2-
31
@doc raw"""
42
Abstract supertype of [`LinModel`](@ref) and [`NonLinModel`](@ref) types.
53

0 commit comments

Comments
 (0)