@@ -35,17 +35,17 @@ The decision variable is (excluding ``ϵ``):
3535thus it also includes the predicted states, expressed as deviation vectors from the
3636operating point ``\m athbf{x̂_{op}}`` (see [`augment_model`](@ref)):
3737```math
38- \m athbf{X̂_0} = \m athbf{X̂ - X̂_{op}} \b egin{bmatrix}
38+ \m athbf{X̂_0} = \m athbf{X̂ - X̂_{op}} = \b egin{bmatrix}
3939 \m athbf{x̂}_i(k+1) - \m athbf{x̂_{op}} \\
4040 \m athbf{x̂}_i(k+2) - \m athbf{x̂_{op}} \\
4141 \v dots \\
4242 \m athbf{x̂}_i(k+H_p) - \m athbf{x̂_{op}} \e nd{bmatrix}
4343```
4444where ``\m athbf{x̂}_i(k+j)`` is the state prediction for time ``k+j``, estimated by the
45- observer at time ``i=k`` or ``i=k-1`` depending on the `direct` flag. This transcription
45+ observer at time ``i=k`` or ``i=k-1`` depending on its `direct` flag. This transcription
4646method is generally more efficient for large control horizon ``H_c``, unstable or highly
47- nonlinear plant models/constraints. Sparse optimizers like `OSQP.jl ` or `Ipopt.jl ` are
48- recommended for large-scale problems.
47+ nonlinear plant models/constraints. Sparse optimizers like `OSQP` or `Ipopt` are recommended
48+ for large-scale problems.
4949"""
5050struct MultipleShooting <: TranscriptionMethod end
5151
@@ -365,13 +365,15 @@ function init_predmat(
365365 return E, G, J, K, V, B, ex̂, gx̂, jx̂, kx̂, vx̂, bx̂
366366end
367367
368- """
369- init_predmat(model::SimModel, estim, transcription::SingleShooting, Hp, Hc)
368+ @doc raw """
369+ init_predmat(model::SimModel, estim, transcription::MultipleShooting, Hp, Hc)
370+
371+ Return empty matrices except `ex̂` for [`SimModel`](@ref) and [`MultipleShooting`](@ref).
370372
371- Return empty matrices for [`SimModel`](@ref) and [`SingleShooting`](@ref) (N/A) .
373+ The matrix is `` \m athbf{e_x̂} = [ \b egin{smallmatrix} \m athbf{0} & \m athbf{I} \e nd{smallmatrix}]`` .
372374"""
373375function init_predmat (
374- model:: SimModel , estim:: StateEstimator{NT} , transcription:: SingleShooting , Hp, Hc
376+ model:: SimModel , estim:: StateEstimator{NT} , transcription:: MultipleShooting , Hp, Hc
375377) where {NT<: Real }
376378 nu, nx̂, nd = model. nu, estim. nx̂, model. nd
377379 nZ = get_nZ (estim, transcription, Hp, Hc)
@@ -381,19 +383,18 @@ function init_predmat(
381383 K = zeros (NT, 0 , nx̂)
382384 V = zeros (NT, 0 , nu)
383385 B = zeros (NT, 0 )
384- ex̂, gx̂, jx̂, kx̂, vx̂, bx̂ = E, G, J, K, V, B
386+ ex̂ = [zeros (NT, nx̂, Hc* nu + (Hp- 1 )* nx̂) I]
387+ gx̂, jx̂, kx̂, vx̂, bx̂ = G, J, K, V, B
385388 return E, G, J, K, V, B, ex̂, gx̂, jx̂, kx̂, vx̂, bx̂
386389end
387390
388- @doc raw """
389- init_predmat(model::SimModel, estim, transcription::MultipleShooting, Hp, Hc)
390-
391- Return empty matrices except `ex̂` for [`SimModel`](@ref) and [`MultipleShooting`](@ref).
391+ """
392+ init_predmat(model::SimModel, estim, transcription::TranscriptionMethod, Hp, Hc)
392393
393- The matrix is `` \m athbf{ex̂} = [ \b egin{smallmatrix} \m athbf{0} & \m athbf{I} \e nd{smallmatrix}]`` .
394+ Return empty matrices for all other cases .
394395"""
395396function init_predmat (
396- model:: SimModel , estim:: StateEstimator{NT} , transcription:: MultipleShooting , Hp, Hc
397+ model:: SimModel , estim:: StateEstimator{NT} , transcription:: TranscriptionMethod , Hp, Hc
397398) where {NT<: Real }
398399 nu, nx̂, nd = model. nu, estim. nx̂, model. nd
399400 nZ = get_nZ (estim, transcription, Hp, Hc)
@@ -403,30 +404,10 @@ function init_predmat(
403404 K = zeros (NT, 0 , nx̂)
404405 V = zeros (NT, 0 , nu)
405406 B = zeros (NT, 0 )
406- ex̂ = [zeros (NT, nx̂, Hc* nu + (Hp- 1 )* nx̂) I]
407- gx̂, jx̂, kx̂, vx̂, bx̂ = G, J, K, V, B
407+ ex̂, gx̂, jx̂, kx̂, vx̂, bx̂ = E, G, J, K, V, B
408408 return E, G, J, K, V, B, ex̂, gx̂, jx̂, kx̂, vx̂, bx̂
409409end
410410
411- """
412- init_defectmat(model::SimModel, estim, transcription::SingleShooting, Hp, Hc)
413-
414- Return empty matrices if `transcription` is a [`SingleShooting`](@ref) (N/A).
415- """
416- function init_defectmat (
417- model:: SimModel , estim:: StateEstimator{NT} , transcription:: SingleShooting , Hp, Hc
418- ) where {NT<: Real }
419- nx̂, nu, nd = estim. nx̂, model. nu, model. nd
420- nZ = get_nZ (estim, transcription, Hp, Hc)
421- Eŝ = zeros (NT, 0 , nZ)
422- Gŝ = zeros (NT, 0 , nd)
423- Jŝ = zeros (NT, 0 , nd* Hp)
424- Kŝ = zeros (NT, 0 , nx̂)
425- Vŝ = zeros (NT, 0 , nu)
426- Bŝ = zeros (NT, 0 )
427- return Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ
428- end
429-
430411@doc raw """
431412 init_defectmat(model::LinModel, estim, transcription::MultipleShooting, Hp, Hc)
432413
@@ -501,7 +482,11 @@ function init_defectmat(
501482 return Eŝ, Gŝ, Jŝ, Kŝ, Vŝ, Bŝ
502483end
503484
504- " Return empty matrices if `model` is not a [`LinModel`](@ref) (N/A)."
485+ """
486+ init_defectmat(model::SimModel, estim, transcription::TranscriptionMethod, Hp, Hc)
487+
488+ Return empty matrices for all other cases (N/A).
489+ """
505490function init_defectmat (
506491 model:: SimModel , estim:: StateEstimator{NT} , transcription:: TranscriptionMethod , Hp, Hc
507492) where {NT<: Real }
0 commit comments