chore: update
This commit is contained in:
parent
4776edc9db
commit
416d97c513
25 changed files with 1653 additions and 283 deletions
21
exm/ball/ball.zls
Normal file
21
exm/ball/ball.zls
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
let dt = 0.01
|
||||
let g = 9.81
|
||||
|
||||
let node f_integr (x0, x') = x where
|
||||
rec x = x0 -> pre (x +. x' *. dt)
|
||||
let node b_integr (x0, x') = x where
|
||||
rec x = x0 -> (pre x) +. x' *. dt
|
||||
|
||||
let node bouncing_ball (p0, v0) = p where
|
||||
rec p = reset f_integr (q, v) every z
|
||||
and v = reset b_integr (w, -. g) every z
|
||||
and q = p0 -> 0.0 and w = v0 -> -0.8 *. (pre v)
|
||||
and z = false fby (p < 0.0)
|
||||
|
||||
let node main () =
|
||||
let rec t = 0.0 fby (dt +. t) in
|
||||
let p = bouncing_ball (5.0, 0.0) in
|
||||
match t <= 10.0 with
|
||||
| true -> (print_float t; print_string "\t"; print_float p; print_newline ())
|
||||
| false -> ()
|
||||
17
exm/ball/dune
Normal file
17
exm/ball/dune
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(env
|
||||
(dev
|
||||
(flags
|
||||
(:standard -w -a))))
|
||||
|
||||
(rule
|
||||
(targets exm_ball.ml ball.ml ball.zci)
|
||||
(deps
|
||||
(:zl ball.zls)
|
||||
(package zelus))
|
||||
(action
|
||||
(run zeluc -s main -o exm_ball %{zl})))
|
||||
|
||||
(executable
|
||||
(name exm_ball)
|
||||
(public_name exm_ball)
|
||||
(libraries zelus))
|
||||
Loading…
Add table
Add a link
Reference in a new issue