Commit 513bde38 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

improve cosim

parent 8a511a6b
Pipeline #2204 failed with stages
in 51 seconds
......@@ -9,6 +9,7 @@ type output_style =
| StateListFull
| TimeAndLabels
| Debug
| CoSim
let style_list =
[
......@@ -22,6 +23,7 @@ let style_list =
"time_and_label";
"debug";
"void";
"cosim";
]
let style_of_string = function
......@@ -35,6 +37,7 @@ let style_of_string = function
| "state_list_full" -> StateListFull
| "debug" -> Debug
| "time_and_label" -> TimeAndLabels
| "cosim" -> CoSim
| _ -> Void
let string_of_style = function
......@@ -48,6 +51,7 @@ let string_of_style = function
| StateListFull -> "state_list_full"
| TimeAndLabels -> "time_and_label"
| Debug -> "debug"
| CoSim -> "cosim"
open Format
......@@ -97,6 +101,30 @@ struct
| StateList -> fprintf outfile "%a@." print_state st
| StateListFull -> fprintf outfile "%a\t%i@." print_state st 1
| StateListDelay -> fprintf outfile "%a\t%i@." print_state st 1
| CoSim ->
fprintf outfile "@[<h 0>%a@. @[<v 2>@[<v 0>%a@]@]@]@."
(print_state_long rgpoly) st
(fun f l ->
l
|> List.map (fun tr ->
let low = Bt.eval_max_bound st tr.ZoneGraph.lower_bound
and up = Bt.eval_min_bound st tr.ZoneGraph.upper_bound in
(tr, low, up))
|> List.sort (fun (tr1, low1, _) (tr2, low2, _) ->
if tr1.ZoneGraph.action <> tr2.ZoneGraph.action then
compare tr1.ZoneGraph.action tr2.ZoneGraph.action
else compare low1 low2)
|> List.iter (fun (tr, low, up) ->
if Array.length tr.ZoneGraph.weight > 0 then
let weight, _, _ = tr.ZoneGraph.weight.(i) in
let w = eval_poly_state_full ?smp st weight in
let target =
rgpoly.statelist.((List.hd tr.ZoneGraph.miniedge).target)
in
fprintf f "[%s]-[%g;%g]-->%g->\"%s\"@," tr.ZoneGraph.action
low up w target.name
else fprintf f "[%s]-[%g;%g]@," tr.ZoneGraph.action low up))
rgpoly.ZoneGraph.statelist.(get_loc st).ZoneGraph.transition
| Debug ->
fprintf outfile "@[<h 0>%a@. @[<v 2>@[<v 0>%a@]@]@]@."
(print_state_long rgpoly) st
......@@ -175,7 +203,7 @@ struct
fprintf outfile "%f\t%i@."
((fun (_, _, a) -> a) !mon_state)
(int_of_char tr.ZoneGraph.action.[0])
| StateList | Void -> ()
| StateList | Void | CoSim -> ()
end
let plot_of_style style store_traj ntraj data =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment