let hybrid int(k, x0, u) = x where rec der x = k *. u init x0
let hybrid vint(n)(x0, u) = x where
rec forall i in 0 .. (n - 1), x0i in x0, ui in u, xi out x do
der xi = ui init x0i done
let hybrid vint2(n)(x0, u) = x where
rec forall i in 0 .. (n - 1), x0i in x0, ui in u, xi out x do
xi = int(1.0, x0i, ui) done
let hybrid reset_int(k, x0, res, u) = (x, x) where
rec der x = k *. u init x0 reset res -> x0
do der y = k *. u and sat = Dint.Between
unless up(y -. upper) then Upper
else up(-. (y -. lower)) then Lower
| Upper ->
do y = upper and sat = Dint.Upper unless up(-. u) then Between
| Lower ->
do y = lower and sat = Dint.Lower unless up(u) then Between
end
every r
*)
let hybrid limit_int(k, y0, upper, lower, r, u) = (y, sat) where
rec reset
init y = y0
and
automaton
| Between ->
do der y = k *. u and sat = Dint.Between
unless up(last y -. upper) then Upper
else up(-. (last y -. lower)) then Lower
| Upper ->
do y = upper and sat = Dint.Upper unless up(-. u) then Between
| Lower ->
do y = lower and sat = Dint.Lower unless up(u) then Between
end
every r
let hybrid filter(n)(k, u) = udot where
rec udot = n *. (u -. f)
and f = int (k, 0.0, udot)