TIOA-to-UPPAAL Translator & Front-End Integration Radu Grosu, Scott A. Smolka, Wenkai Tan Stony Brook University VeroModo Workshop, MIT, May 18, 2006
The TIOA-to-Uppaal Translator Uses Front-End to translate TIOA specs into input language of UPPAAL model checker for Timed Automata. Only UPPAAL-compliant subset of TIOA language is translatable.
Translator and the Front-End Implemented as plug-in to TIOA front-end Dynamically loaded to process AST & generate corresponding UPPAAL specification.
Integration with Front-End
UPPAAL-Compliant Subset of TIOA Variable types: only Int, Nat, Real, Const, Boolean and Enumeration are allowed for now Internal actions don't have parameters Effect statements are only assignments Trajectories limited to d(t)=1 Locations enumeration type defines TA states
Translation Scheme TIOA states translated to UPPAAL variables TIOA actions translated to UPPAAL transitions Composite TIOA actions in different primitive automata with same name translated to synchronized transitions in UPPAAL TIOA locations translated to UPPAAL states Stop-When conditions become state invariants
Train-Crossing Example Models a train approaching a crossing. After light is signaled, gate is lowered for train to cross. Each action takes place with a certain urgency.
Train-Crossing Timed Automaton
Train-Crossing Example in TIOA vocabulary Locations types Location enumeration [begin, light, gate] automaton Train imports Locations signature internal coming, approaching, passing states mode : Location := begin, time : Real transitions internal coming pre mode = begin /\ time > 2 eff mode := light; time := 0 internal approaching pre mode = light /\ time > 5 eff mode := gate; time := 0 internal passing pre mode = gate /\ time > 1 eff mode := begin; time := 0 trajectories trajdef begin invariant mode = begin stop when time = 5 evolve d(time) = 1 trajdef light invariant mode = light stop when time = 10 trajdef gate invariant mode = gate stop when time = 2
Generated UPPAAL Code process Train{ clock time; state begin {time<=5}, light {time<=10}, gate {time<=2}; init begin; trans begin -> light { guard time > 2; assign time := 0; }, light -> gate { guard time > 5; assign time := 0; }, gate -> begin { guard time > 1; assign time := 0; }; } system Train;
Fischer Protocol
Fischer in TIOA vocabulary ProgramCounter1 types Location enumeration [idle, request, wait, critical] automaton Fischer(pid : Const) imports ProgramCounter1 signature internal try, abort, enter input read_response(id : Int) output write_set(id : Int), write_exit(id : Int) states mode : Location := idle, turn : Int, time : Real transitions input read_response(id) eff turn := id internal try pre mode = idle /\ turn = 0 eff mode := request; time := 0 output write_set(id) pre mode = request /\ id = pid eff mode := wait; time := 0 internal retry pre mode = wait /\ time > 2 /\ turn ~= pid eff mode := idle internal enter pre mode = wait /\ time > 2 /\ turn = pid eff mode := critical output write_exit(id) pre mode = critical /\ id = 0 trajectories trajdef request invariant mode = request stop when time = 2 evolve d(time) = 1 trajdef traj
Fischer continued input write_set(id) automaton SharedVar signature input write_set(id : Int), write_exit(id : Int) output read_response(id : Int) states turn : Int := 0, send : Bool := true, t : Real transitions output read_response(id) pre send = true /\ id = turn eff send := false input write_set(id) eff send := true; turn := id input write_exit(id) trajectories trajdef traj evolve d(t) = 1 automaton sys components fischer1 : Fischer(1); fischer2 : Fischer(2); fischer3 : Fischer(3); SharedVar
Generated UPPAAL Code int id; urgent broadcast chan read_response; broadcast chan write_set,write_exit; process Fischer(const pid){ int turn; clock time; state idle, request {time <=2}, wait, critical; init idle; trans idle -> idle { sync read_response?; assign turn := id; }, request -> request { sync read_response?; assign turn := id; }, wait -> wait { sync read_response?; assign turn := id; }, critical -> critical { sync read_response?; assign turn := id; }, idle -> request { guard turn == 0; assign time := 0; }, request -> wait { guard sync write_set!; assign id := pid,time := 0; }, wait -> idle { guard time > 2 && turn != pid; }, wait -> critical { guard time > 2 && turn == pid; }, critical -> idle { guard sync write_exit!; assign id := 0; }; }
UPPAAL Code continued process SharedVar{ int turn := 0; bool send := true; clock t; state default; init default; trans default -> default { guard send == true; sync read_response!; assign id := turn,send := false; }, default -> default { sync write_set?; assign send := true,turn := id; }, default -> default { sync write_exit?; assign send := true,turn := id; };} fischer1 := Fischer(1); fischer2 := Fischer(2); fischer3 := Fischer(3); system fischer1, fischer2, fisher3, ShardVar;
Future work Semantics checking for UPPAAL compliancy Monte Carlo model checking for TIOA Efficient sampling of transition graphs
Efficient Sampling of Transition Graphs Basic idea (tree growth in nature): From all root-successors, randomly walk to a leaf Then repeat the following: Uniformly pick a node from the ones visited Randomly walk to a leaf from this node Check property on all intermediate nodes
Fischer Protocol (buggy) Processes Tree Sampling UPPAAL 2 0.002 0.021 4 0.008 0.041 8 0.083 1.280 12 0.524 18.61 16 1.018 oom
Bang & Olufson Audio/Video Protocol Senders Tree Sampling UPPAAL 2 0.041 0.174 3 14 1.05 4 32 10.1 5 8(min) 2(min) 6 37(min) oom