Skip to content

Commit 2a7f0f2

Browse files
committed
doc: minor modification
1 parent db94d8b commit 2a7f0f2

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/controller/nonlinmpc.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ the manipulated inputs, the predicted outputs and measured disturbances from ``k
126126
```
127127
since ``H_c ≤ H_p`` implies that ``\mathbf{Δu}(k+H_p) = \mathbf{0}`` or ``\mathbf{u}(k+H_p)=
128128
\mathbf{u}(k+H_p-1)``. The vector ``\mathbf{D̂}`` includes the predicted measured disturbance
129-
over ``H_p``. The argument ``\mathbf{p}`` is a custom parameter object of any type.
129+
over ``H_p``. The argument ``\mathbf{p}`` is a custom parameter object of any type but use a
130+
mutable one if you want to modify it later e.g.: a vector.
130131
131132
!!! tip
132133
Replace any of the 4 arguments with `_` if not needed (see `JE` default value below).

src/estimator/execute.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ function returns the next state of the augmented model, defined as:
3232
```
3333
where ``\mathbf{x̂_0}(k+1)`` is stored in `x̂next0` argument. The method mutates `x̂next0` and
3434
`û0` in place, the latter stores the input vector of the augmented model
35-
``\mathbf{u_0 + ŷ_{s_u}}``.
35+
``\mathbf{u_0 + ŷ_{s_u}}``. The model parameter vector `model.p` is not included in the
36+
function signature for conciseness.
3637
"""
3738
function f̂!(x̂next0, û0, estim::StateEstimator, model::SimModel, x̂0, u0, d0)
3839
# `@views` macro avoid copies with matrix slice operator e.g. [a:b]

src/estimator/kalman.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ See [`SteadyKalmanFilter`](@ref) for details on ``\mathbf{v}(k), \mathbf{w}(k)``
582582
\text{diag}(Q, Q_{int_u}, Q_{int_{ym}})}`` and ``\mathbf{R̂ = R}``. The functions
583583
``\mathbf{f̂, ĥ}`` are `model` state-space functions augmented with the stochastic model of
584584
the unmeasured disturbances, which is specified by the numbers of integrator `nint_u` and
585-
`nint_ym` (see Extended Help). Model parameters ``\mathbf{p}`` are not an argument of
585+
`nint_ym` (see Extended Help). Model parameters ``\mathbf{p}`` are not argument of
586586
``\mathbf{f̂, ĥ}`` functions for conciseness. The ``\mathbf{ĥ^m}`` function represents the
587587
measured outputs of ``\mathbf{ĥ}`` function (and unmeasured ones, for ``\mathbf{ĥ^u}``). The
588588
matrix ``\mathbf{P̂}`` is the estimation error covariance of `model` state augmented with the

src/model/nonlinmodel.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ functions are defined as:
6767
\mathbf{y}(t) &= \mathbf{h}\Big( \mathbf{x}(t), \mathbf{d}(t), \mathbf{p} \Big)
6868
\end{aligned}
6969
```
70-
where ``\mathbf{x}``, ``\mathbf{y}, ``\mathbf{u}``, ``\mathbf{d}`` and ``\mathbf{p}`` are
71-
respectively the state, output, manipulated input, measured disturbance and parameter vectors,
72-
and ``t`` the time in second. If the dynamics is a function of time, simply add a measured
73-
disturbance defined as ``d(t)=t``. The functions can be implemented in two possible ways:
70+
where ``\mathbf{x}``, ``\mathbf{y}``, ``\mathbf{u}``, ``\mathbf{d}`` and ``\mathbf{p}`` are
71+
respectively the state, output, manipulated input, measured disturbance and parameter
72+
vectors. If the dynamics is a function of time, simply add a measured disturbance defined as
73+
``d(t) = t``. The functions can be implemented in two possible ways:
7474
7575
1. **Non-mutating functions** (out-of-place): define them as `f(x, u, d, p) -> ẋ` and
7676
`h(x, d, p) -> y`. This syntax is simple and intuitive but it allocates more memory.
@@ -99,11 +99,11 @@ See also [`LinModel`](@ref).
9999
100100
# Examples
101101
```jldoctest
102-
julia> f!(ẋ, x, u, _ , _ ) = (ẋ .= -0.2x .+ u; nothing);
102+
julia> f!(ẋ, x, u, _ , p) = (ẋ .= p*x .+ u; nothing);
103103
104104
julia> h!(y, x, _ , _ ) = (y .= 0.1x; nothing);
105105
106-
julia> model1 = NonLinModel(f!, h!, 5.0, 1, 1, 1) # continuous dynamics
106+
julia> model1 = NonLinModel(f!, h!, 5.0, 1, 1, 1, p=-0.2) # continuous dynamics
107107
NonLinModel with a sample time Ts = 5.0 s, RungeKutta solver and:
108108
1 manipulated inputs u
109109
1 states x
@@ -127,8 +127,8 @@ NonLinModel with a sample time Ts = 2.0 s, empty solver and:
127127
State-space functions are similar for discrete dynamics:
128128
```math
129129
\begin{aligned}
130-
\mathbf{x}(k+1) &= \mathbf{f}\Big( \mathbf{x}(k), \mathbf{u}(k), \mathbf{d}(k), \mathbf{p}(k) \Big) \\
131-
\mathbf{y}(k) &= \mathbf{h}\Big( \mathbf{x}(k), \mathbf{d}(k), \mathbf{p}(k) \Big)
130+
\mathbf{x}(k+1) &= \mathbf{f}\Big( \mathbf{x}(k), \mathbf{u}(k), \mathbf{d}(k), \mathbf{p} \Big) \\
131+
\mathbf{y}(k) &= \mathbf{h}\Big( \mathbf{x}(k), \mathbf{d}(k), \mathbf{p} \Big)
132132
\end{aligned}
133133
```
134134
with two possible implementations as well:

0 commit comments

Comments
 (0)