feat: a LOT of stuff (final report, examples, simulation of a single assert, move from node instances to node definitions, etc.)
This commit is contained in:
parent
ba5db5bd99
commit
f2c545ce2c
49 changed files with 12377 additions and 1898 deletions
41
exm/zelus/ballcos/ball.zls
Normal file
41
exm/zelus/ballcos/ball.zls
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
(* Ball rolling on a cosine curve. *)
|
||||
(* Illustrates the impact of an observer on the simulation. *)
|
||||
|
||||
let g = 9.81
|
||||
let mu = 0.5 (* Friction coefficient. *)
|
||||
|
||||
let hybrid ball(v0) = (x, v) where
|
||||
rec der x = v init 0.0
|
||||
and der v = a *. (cos x) init v0
|
||||
and a = g *. (sin x) -. mu *. v /. (cos x)
|
||||
|
||||
let hybrid vdp_c(mu) = (x, y) where
|
||||
rec der x = y init 1.0
|
||||
and der y = (mu *. (1.0 -. (x *. x)) *. y) -. x init 1.0
|
||||
|
||||
let hybrid print(p)(t, x, v, x', y) = () where
|
||||
present(period(p)) -> do
|
||||
() = print_endline(String.concat ",\t\t" (List.map string_of_float [t;x;v;x';y]))
|
||||
done
|
||||
|
||||
(* Changing the period for [print] changes the result. *)
|
||||
let hybrid main () = () where
|
||||
rec der t = 1.0 init 0.0
|
||||
and (x, v) = ball(2.953)
|
||||
and (x', y) = vdp_c(0.5)
|
||||
and () = print(0.5)(t, x, v, x', y)
|
||||
|
||||
(*
|
||||
let input _ = 2.953
|
||||
|
||||
let node print_discrete (now, (x, v)) =
|
||||
print_endline (String.concat ",\t\t" (List.map string_of_float [now;x;v]))
|
||||
|
||||
let ball_discrete = Solve.solve_sundials(ball)
|
||||
|
||||
let node main_discrete () =
|
||||
let input = Some (Solve.make(30.0, input)) fby None in
|
||||
let o = run ball_discrete input in
|
||||
Solve.period'_t 1.0 print_discrete o
|
||||
*)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue