We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
precompile.jl
1 parent 8da356f commit 6f644d5Copy full SHA for 6f644d5
src/precompile.jl
@@ -79,11 +79,18 @@ exmpc.estim()
79
u = exmpc([55, 30])
80
sim!(exmpc, 2, [55, 30])
81
82
-f(x,u,_,model) = model.A*x + model.Bu*u
83
-h(x,_,model) = model.C*x
+function f!(xnext, x, u, _, model)
+ mul!(xnext, model.A , x)
84
+ mul!(xnext, model.Bu, u, 1, 1)
85
+ return nothing
86
+end
87
+function h!(y, x, _, model)
88
+ mul!(y, model.C, x)
89
90
91
92
nlmodel = setop!(
- NonLinModel(f, h, Ts, 2, 2, 2, solver=nothing, p=model),
93
+ NonLinModel(f!, h!, Ts, 2, 2, 2, solver=nothing, p=model),
94
uop=[10, 10], yop=[50, 30]
95
)
96
y = nlmodel()
@@ -118,7 +125,7 @@ u = nmpc_mhe([55, 30])
118
125
sim!(nmpc_mhe, 2, [55, 30])
119
126
120
127
function JE( _ , Ŷe, _ , R̂y)
121
- Ŷ = Ŷe[3:end]
128
+ Ŷ = @views Ŷe[3:end]
122
129
Ȳ = R̂y - Ŷ
123
130
return dot(Ȳ, Ȳ)
124
131
end
0 commit comments