Skip to content

Doc: minor corrections and add preview cleanup workflow #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/DocCleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Doc Preview Cleanup

on:
pull_request:
types: [closed]

jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages

- name: Delete preview and history
run: |
git config user.name "Documenter.jl"
git config user.email "[email protected]"
git rm -rf "previews/PR$PRNUM"
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
env:
PRNUM: ${{ github.event.number }}

- name: Push changes
run: |
git push --force origin gh-pages-new:gh-pages
10 changes: 7 additions & 3 deletions docs/src/manual/nonlinmpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ model = setname!(NonLinModel(f, h, Ts, nu, nx, ny); u=vu, x=vx, y=vy)
The output function ``\mathbf{h}`` converts the ``θ`` angle to degrees. Note that special
characters like ``θ`` can be typed in the Julia REPL or VS Code by typing `\theta` and
pressing the `<TAB>` key. The tuple `par` is constant here to improve the [performance](https://docs.julialang.org/en/v1/manual/performance-tips/#Avoid-untyped-global-variables).
Note that a 4th order [`RungeKutta`](@ref) differential equation solver is used by default.
It is good practice to first simulate `model` using [`sim!`](@ref) as a quick sanity check:
A 4th order [`RungeKutta`](@ref) method solves the differential equations by default. It is
good practice to first simulate `model` using [`sim!`](@ref) as a quick sanity check:

```@example 1
using Plots
Expand All @@ -80,7 +80,9 @@ savefig("plot1_NonLinMPC.svg"); nothing # hide

![plot1_NonLinMPC](plot1_NonLinMPC.svg)

The [`setname!`](@ref) function allows customizing the Y-axis labels.
The [`setname!`](@ref) function allows customized Y-axis labels. The available plotting
options are detailed in the documentation of the corresponding [`plot`](@ref ModelPredictiveControl.plot)
method.

## Nonlinear Model Predictive Controller

Expand Down Expand Up @@ -146,6 +148,8 @@ savefig("plot4_NonLinMPC.svg"); nothing # hide

![plot4_NonLinMPC](plot4_NonLinMPC.svg)

See [`sim!`](@ref) documentation for details on the possible simulation scenarios.

## Economic Model Predictive Controller

Economic MPC can achieve the same objective but with lower economical costs. For this case
Expand Down
15 changes: 8 additions & 7 deletions src/estimator/kalman.jl
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ is based on the process model :
```
See [`SteadyKalmanFilter`](@ref) for details on ``\mathbf{v}(k), \mathbf{w}(k)`` noises and
``\mathbf{R̂}, \mathbf{Q̂}`` covariances. The functions ``\mathbf{f̂, ĥ}`` are `model`
state-space functions augmented with the stochastic model, which is specified by the numbers
of integrator `nint_u` and `nint_ym` (see Extended Help). The ``\mathbf{ĥ^m}`` function
represents the measured outputs of ``\mathbf{ĥ}`` function (and unmeasured ones, for
``\mathbf{ĥ^u}``).
state-space functions augmented with the stochastic model of the unmeasured disturbances,
which is specified by the numbers of integrator `nint_u` and `nint_ym` (see Extended Help).
The ``\mathbf{ĥ^m}`` function represents the measured outputs of ``\mathbf{ĥ}`` function
(and unmeasured ones, for ``\mathbf{ĥ^u}``).

# Arguments
!!! info
Expand Down Expand Up @@ -483,9 +483,10 @@ UnscentedKalmanFilter estimator with a sample time Ts = 10.0 s, NonLinModel and:
# Extended Help
!!! details "Extended Help"
The Extended Help of [`SteadyKalmanFilter`](@ref) details the augmentation with `nint_ym`
and `nint_u` arguments. Note that the constructor does not validate the observability of
the resulting augmented [`NonLinModel`](@ref). In such cases, it is the user's
responsibility to ensure that the augmented model is still observable.
and `nint_u` arguments. The default augmentation scheme is identical, that is `nint_u=0`
and `nint_ym` computed by [`default_nint`](@ref). Note that the constructor does not
validate the observability of the resulting augmented [`NonLinModel`](@ref). In such
cases, it is the user's responsibility to ensure that it is still observable.
"""
function UnscentedKalmanFilter(
model::SM;
Expand Down
2 changes: 0 additions & 2 deletions src/plot_sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -614,8 +614,6 @@ end
Plot the simulation results of a [`PredictiveController`](@ref).

# Arguments
!!! info
Keyword arguments in *`italic`* are non-Unicode alternatives.

- `res::SimResult{<:Real, <:PredictiveController}` : simulation results to plot
- `plotry=true` : plot plant output setpoints ``\mathbf{r_y}`` if applicable
Expand Down