Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5db223f
changed: using the new `juliaci.yml` workflow
franckgaga Aug 16, 2026
99792ce
Merge branch 'main' into ci_yml
franckgaga Aug 20, 2026
e3f24f6
removed: x64 MacOS and x86 windows on CI
franckgaga Aug 20, 2026
ef38567
removed: Linux x86, same reasons
franckgaga Aug 20, 2026
6334bc0
test: smaller chunks for nonlinear MPC and MHE tests
franckgaga Aug 20, 2026
cb53222
test: remove useless test for MHE
franckgaga Aug 20, 2026
5009952
test: shorter titles
franckgaga Aug 20, 2026
6a25b0b
doc: less finicky `jldoctest`
franckgaga Aug 20, 2026
308c47b
test: small `Aqua` tests
franckgaga Aug 20, 2026
aac8d56
test: less finicky soft real-time measurements
franckgaga Aug 20, 2026
4bb82fc
test: shorter names
franckgaga Aug 20, 2026
667a7b2
test: timeout from 1200 -> 3600
franckgaga Aug 20, 2026
b6eb1e0
test: include Linux x86
franckgaga Aug 20, 2026
933d70d
test: debug `jldoctest` for `x86` platforms
franckgaga Aug 20, 2026
6b6493d
Merge branch 'main' into ci_yml
franckgaga Aug 20, 2026
c7dab4e
test: skipping all x86 jobs for now
franckgaga Aug 20, 2026
8d12b73
test: loosen tolerances for MHE v.s. KF tests
franckgaga Aug 20, 2026
ac4f22e
test : wip debugging last test on MacOS lts
franckgaga Aug 20, 2026
7255d9f
test: debug `gc` tests on MHE
franckgaga Aug 20, 2026
04cd48c
test: disabling timeout altogether
franckgaga Aug 21, 2026
ac71939
test: idem, trying `null`
franckgaga Aug 21, 2026
33f15b4
test: same, trying empty string
franckgaga Aug 21, 2026
3bfc76c
test: trying back 3600
franckgaga Aug 21, 2026
6cbd01b
test: trying Inf
franckgaga Aug 21, 2026
07b9fcd
test: trying -1
franckgaga Aug 21, 2026
f680aa0
test: going back to 3600
franckgaga Aug 21, 2026
61398a6
bench: result on summary
franckgaga Aug 21, 2026
a248ea8
test: looser tolerance for soft real-time
franckgaga Aug 21, 2026
64c8ea3
test: removing Aqua persistent tasks
franckgaga Aug 21, 2026
947098e
Merge branch 'main' into ci_yml
franckgaga Aug 21, 2026
b0faa51
doc: regex to improve `jldoctest` robustness
franckgaga Aug 22, 2026
78a6878
bench: add permissions for pull request comments in benchmark.yml
franckgaga Aug 23, 2026
a33dfc4
bench: revert changes in the files
franckgaga Aug 24, 2026
c9b3743
test: removing timeout config
franckgaga Aug 25, 2026
dfe7e21
test: trying memory treshold
franckgaga Aug 26, 2026
52ee07a
doc: no `jldoctest` for `periodsleep`
franckgaga Aug 26, 2026
6d3c194
doc: add signuature headers on abstract types
franckgaga Aug 27, 2026
316644a
doc: moving linear term update in misc. section
franckgaga Aug 27, 2026
416a544
doc: correct method signature
franckgaga Aug 27, 2026
d6bd358
doc: using anonymous functions in `NonLinModel` as a workaround
franckgaga Aug 27, 2026
2d9104f
doc: mistake in method signature
franckgaga Aug 27, 2026
b75fd02
doc: reverting anonymous function in `NonLinModel`
franckgaga Aug 27, 2026
5e83b0d
doc: more precise header
franckgaga Aug 27, 2026
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
49 changes: 0 additions & 49 deletions .github/workflows/CI.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/TagBot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
steps:
- uses: MilesCranmer/AirspeedVelocity.jl@action-v1
with:
julia-version: '1'
julia-version: '1'
26 changes: 0 additions & 26 deletions .github/workflows/documentation.yml

This file was deleted.

25 changes: 25 additions & 0 deletions .github/workflows/juliaci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Julia CI

on:
push: {branches: [main,master]}
pull_request: {types: [opened,synchronize,reopened,ready_for_review,converted_to_draft]}
issue_comment: {types: [created]}
workflow_dispatch:
inputs:
feature:
type: choice
description: What to run
options: [DocDeploy, LintAndTest, TagBot]

jobs:
julia-ci:
uses: julia-testitems/testitem-workflow/.github/workflows/juliaci.yml@v2
with:
memory-threshold: 0.9
include-rc-versions: true
include-windows-x86: false
include-linux-x86: false
include-macos-x64: false
permissions: write-all
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ModelPredictiveControl"
uuid = "61f9bdb8-6ae4-484a-811f-bbf86720c31c"
version = "2.12.1"
version = "2.12.2"
authors = ["Francis Gagnon"]

[deps]
Expand Down
8 changes: 8 additions & 0 deletions docs/src/internals/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Pages = ["misc.md"]
```@docs
ModelPredictiveControl.init_orthocolloc
```

## Update Linear and Quadratic Terms

```@docs
ModelPredictiveControl.initpred!
ModelPredictiveControl.linconstraint!
ModelPredictiveControl.linconstrainteq!
```
8 changes: 0 additions & 8 deletions docs/src/internals/predictive_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ ModelPredictiveControl.get_nonlinobj_op(::NonLinMPC, ::ModelPredictiveControl.Ge
ModelPredictiveControl.get_nonlincon_oracle(::NonLinMPC, ::ModelPredictiveControl.GenericModel)
```

## Update Quadratic Optimization

```@docs
ModelPredictiveControl.initpred!(::PredictiveController, ::LinModel, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
ModelPredictiveControl.linconstraint!(::PredictiveController, ::LinModel, ::TranscriptionMethod)
ModelPredictiveControl.linconstrainteq!
```

## Solve Optimization Problem

```@docs
Expand Down
7 changes: 0 additions & 7 deletions docs/src/internals/state_estim.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,6 @@ ModelPredictiveControl.correct_estimate!
ModelPredictiveControl.update_estimate!
```

## Update Quadratic Optimization

```@docs
ModelPredictiveControl.initpred!(::MovingHorizonEstimator, ::LinModel)
ModelPredictiveControl.linconstraint!(::MovingHorizonEstimator, ::LinModel, ::TranscriptionMethod)
```

## Solve Optimization Problem

```@docs
Expand Down
4 changes: 2 additions & 2 deletions src/controller/transcription.jl
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,9 @@ end
deletex̂end_lincon!(i_x̂min, i_x̂max, ::SimModel, ::SingleShooting, _, _, _, _) = i_x̂min, i_x̂max

@doc raw"""
linconstraint!(mpc::PredictiveController, model::LinModel)
linconstraint!(mpc::PredictiveController, model::LinModel, ::TranscriptionMethod)

Set `b` vector for the linear model inequality constraints (``\mathbf{A Z̃ ≤ b}``).
Set `b` vector for the linear model inequality constraints (``\mathbf{A Z̃ ≤ b}``) of MPC.

Also init ``\mathbf{f_x̂} = \mathbf{g_x̂ d_0}(k) + \mathbf{j_x̂ D̂_0} + \mathbf{k_x̂ x̂_0}(k) +
\mathbf{v_x̂ u_0}(k-1) + \mathbf{b_x̂}`` vector for the terminal constraints, see
Expand Down
7 changes: 2 additions & 5 deletions src/estimator/construct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,8 @@ and unstable `model` (see Examples).
```jldoctest
julia> model = LinModel(append(tf(3, [10, 1]), tf(2, [1, 0]), tf(4,[-5, 1])), 1.0);

julia> nint_ym = default_nint(model)
3-element Vector{Int64}:
1
0
1
julia> default_nint(model) |> println
[1, 0, 1]
```
"""
function default_nint(model::LinModel, i_ym=1:model.ny, nint_u=0)
Expand Down
2 changes: 1 addition & 1 deletion src/estimator/luenberger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ end


"""
correct_estimate!(estim::Luenberger, y0m, d0, _ )
correct_estimate!(estim::Luenberger, y0m, d0)

Identical to [`correct_estimate!(::SteadyKalmanFilter)`](@ref) but using [`Luenberger`](@ref).
"""
Expand Down
7 changes: 6 additions & 1 deletion src/estimator/mhe/execute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,12 @@ function initpred!(estim::MovingHorizonEstimator{NT}, model::LinModel) where NT<
JuMP.set_objective_function(optim, obj_quadprog(Z̃var, H̃, q̃))
return nothing
end
"Does nothing if `model` is not a [`LinModel`](@ref)."

"""
initpred!(estim::MovingHorizonEstimator, LinModel::SimModel) -> nothing

Does nothing if `model` is not a [`LinModel`](@ref).
"""
initpred!(::MovingHorizonEstimator, ::SimModel) = nothing

"Get the estimated state at arrival from the decision vector `Z̃`."
Expand Down
10 changes: 4 additions & 6 deletions src/estimator/mhe/transcription.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ from ``j=N_k-1`` to ``0``, also in deviation form, are computed with:
```
The matrices ``\mathbf{E, G, J, B, E_X̂, G_X̂, J_X̂, B_X̂}`` are defined in the Extended Help
section. The vectors ``\mathbf{F, F_X̂, f_x̄}`` are recalculated at each discrete time step,
see [`initpred!(::MovingHorizonEstimator, ::LinModel)`](@ref) and [`linconstraint!(::MovingHorizonEstimator, ::LinModel)`](@ref).
see [`initpred!`](@ref) and [`linconstraint!`](@ref).

# Extended Help
!!! details "Extended Help"
Expand Down Expand Up @@ -426,7 +426,7 @@ end
@doc raw"""
init_defectmat_mhe(
model::LinModel, transcription::MultipleShooting, direct::Bool,
He, i_ym, Â, B̂u, Ĉm, B̂d, D̂dm, x̂op, f̂op, As, Co, λo
He, Â, B̂u, B̂d, x̂op, f̂op, As, Co, λo
) -> ES, GS, JS, BS

Init the matrices for computing the defects over the predicted states.
Expand Down Expand Up @@ -511,7 +511,7 @@ end
@doc raw"""
init_defectmat_mhe(
model::SimModel, transcription::TranscriptionMethod, direct::Bool,
He, Â, _ , _ , _ , _ , As, _ , _
He, Â, _ , _ , _ , _ , As, _ , _
) -> ES, GS, JS, BS

Init the matrices for computing the defects of the stochastic states only.
Expand Down Expand Up @@ -816,9 +816,7 @@ function deleteŴ_lincon!(i_Ŵmin, i_Ŵmax, ::SimModel, ::TranscriptionMethod
end

@doc raw"""
linconstraint!(
estim::MovingHorizonEstimator, model::LinModel, transcription::TranscriptionMethod
)
linconstraint!(estim::MovingHorizonEstimator, model::LinModel, ::TranscriptionMethod)

Set `b` vector for the linear inequality constraints (``\mathbf{A Z̃ ≤ b}``) of MHE.

Expand Down
2 changes: 2 additions & 0 deletions src/predictive_control.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@doc raw"""
abstract type PredictiveController end

Abstract supertype of all predictive controllers.

---
Expand Down
8 changes: 5 additions & 3 deletions src/sim_model.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@doc raw"""
abstract type SimModel end

Abstract supertype of [`LinModel`](@ref) and [`NonLinModel`](@ref) types.

---
Expand Down Expand Up @@ -289,7 +291,7 @@ function savetime!(model::SimModel)
return model.t[]
end

"""
@doc raw"""
periodsleep(model::SimModel, busywait=false) -> nothing

Sleep for `model.Ts` s minus the time elapsed since the last call to [`savetime!`](@ref).
Expand All @@ -305,14 +307,14 @@ simple soft real-time simulations, see the example below.
restart it at a convenient time e.g.: just before calling `periodsleep`.

# Examples
```jldoctest
```julia-repl
julia> model = LinModel(tf(2, [0.3, 1]), 0.25);

julia> function sim_realtime!(model)
t_0 = time()
for i=1:3
t = savetime!(model) # first function called
println(round(t - t_0, digits=3))
println(round(t - t_0, digits=2))
updatestate!(model, [1])
periodsleep(model, true) # last function called
end
Expand Down
2 changes: 2 additions & 0 deletions src/state_estim.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@doc raw"""
abstract type StateEstimator end

Abstract supertype of all state estimators.

---
Expand Down
2 changes: 2 additions & 0 deletions src/transcription.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const COLLOCATION_NODE_TYPE = Float64

"""
abstract type TranscriptionMethod end

Abstract supertype of all transcription methods for the optimization problems.

The module currently supports [`SingleShooting`](@ref), [`MultipleShooting`](@ref),
Expand Down
8 changes: 4 additions & 4 deletions test/1_test_sim_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ end
updatestate!(linmodel1, [1])
periodsleep(linmodel1)
end
@test all(isapprox.(diff(times1[2:end]), 0.25, atol=0.025))
@test all(isapprox.(diff(times1[2:end]), 0.25, atol=0.05))
linmodel2 = LinModel(tf(2, [0.1, 1]), 0.25)
times2 = zeros(5)
for i=1:5
times2[i] = savetime!(linmodel2)
updatestate!(linmodel2, [1])
periodsleep(linmodel2, true)
end
@test all(isapprox.(diff(times2[2:end]), 0.25, atol=0.0001))
@test all(isapprox.(diff(times2[2:end]), 0.25, atol=0.05))
end

@testitem "NonLinModel construction" setup=[SetupMPCtests] begin
Expand Down Expand Up @@ -406,7 +406,7 @@ end
updatestate!(nonlinmodel1, [1])
periodsleep(nonlinmodel1)
end
@test all(isapprox.(diff(times1[2:end]), 0.25, atol=0.025))
@test all(isapprox.(diff(times1[2:end]), 0.25, atol=0.05))
linmodel2 = LinModel(tf(2, [0.1, 1]), 0.25)
nonlinmodel2 = NonLinModel(
(x,u,_,_)->linmodel2.A*x + linmodel2.Bu*u,
Expand All @@ -419,5 +419,5 @@ end
updatestate!(nonlinmodel2, [1])
periodsleep(nonlinmodel2, true)
end
@test all(isapprox.(diff(times2[2:end]), 0.25, atol=0.0001))
@test all(isapprox.(diff(times2[2:end]), 0.25, atol=0.05))
end
Loading
Loading