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
34
exm/zelus/parallel/parallel.zls
Normal file
34
exm/zelus/parallel/parallel.zls
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
(* Parallel simulation of harmonic oscillators. *)
|
||||
(* Illustrates the impact of unrelated parallel simulation. *)
|
||||
|
||||
let pi = 3.141592653589793
|
||||
|
||||
let hybrid harmonic(p) = x where
|
||||
rec der x = v init 1.0
|
||||
and der v = -2.0 *. pi *. x /. p init 0.0
|
||||
|
||||
let hybrid f () = (t, x, y) where
|
||||
rec der t = 1.0 init 0.0
|
||||
and x = harmonic(100.0)
|
||||
and y = harmonic(1000.0)
|
||||
|
||||
let hybrid main' () =
|
||||
let t, x, y = f () in
|
||||
present (period (0.001)) ->
|
||||
print_endline (String.concat ",\t" (List.map string_of_float [t;x;y]))
|
||||
else ()
|
||||
|
||||
let hybrid f' () = harmonic(100.0)
|
||||
let hybrid g' () = (harmonic(100.0), harmonic(1e-3))
|
||||
|
||||
let f_d = Solve.solve_sundials(f')
|
||||
let g_d = Solve.solve_sundials(g')
|
||||
let m = Solve.synchr f_d g_d
|
||||
|
||||
let node print (now, (xf, (xg, _))) =
|
||||
print_endline (String.concat ",\t" (List.map string_of_float [now;xf;xg]))
|
||||
|
||||
let input _ = ()
|
||||
let node main () =
|
||||
let input = Some (Solve.make (100.0, input)) fby None in
|
||||
Solve.period'_t 0.01 print (run m input)
|
||||
Loading…
Add table
Add a link
Reference in a new issue