Unit-12: Modeling timing constraints
- B. Srivathsan
Chennai Mathematical Institute
NPTEL-course July - November 2015
1/20
Unit-12: Modeling timing constraints B. Srivathsan Chennai - - PowerPoint PPT Presentation
Unit-12: Modeling timing constraints B. Srivathsan Chennai Mathematical Institute NPTEL-course July - November 2015 1 / 20 Traffic lights controller Flight control Automatic gear control Pacemaker ATM Controllers need to adhere to strict
NPTEL-course July - November 2015
1/20
ATM Traffic lights controller Automatic gear control Flight control Pacemaker Controllers need to adhere to strict timing constraints
2/20
ATM Traffic lights controller Automatic gear control Flight control Pacemaker
Controllers need to adhere to strict timing constraints
2/20
How do we model-check systems with timing constraints?
3/20
4/20
5/20
TRAIN GATE
6/20
TRAIN GATE far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate
6/20
far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate
far, 0, up near, 1, up near, 2, down in, 1, up in, 2, down far, 3, down approach lower enter enter exit lower raise Train || Controller || Gate
7/20
far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate
far, 0, up near, 1, up near, 2, down in, 1, up in, 2, down far, 3, down approach lower enter enter exit lower raise Train || Controller || Gate
Unsafe state: Train is in when gate is still up
7/20
far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate
far, 0, up near, 1, up near, 2, down in, 1, up in, 2, down far, 3, down approach lower enter enter exit lower raise Train || Controller || Gate
Unsafe state: Train is in when gate is still up - need to add timing information in the model
7/20
TRAIN GATE far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate after > 2 minutes after = 1 minute <= 1 minute execution time
8/20
9/20
far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
Train Controller Gate
10/20
far near in 1 2 3 up down approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up down approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up down approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up down approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up
comingdown
down
comingup
approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up
comingdown z ≤ 1
down
comingup z ≤ 1
approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 z := 0 z := 0 Train Controller Gate
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up
comingdown z ≤ 1
down
comingup z ≤ 1
approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 z := 0 z := 0 Train Controller Gate Reset Invariant Guard
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up
comingdown z ≤ 1
down
comingup z ≤ 1
approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 z := 0 z := 0 Train Controller Gate Reset Invariant Guard Train || Gate || Controller
10/20
far in near x ≤ 5 in x ≤ 5 1 2 3 up
comingdown z ≤ 1
down
comingup z ≤ 1
approach enter exit approach lower exit raise lower raise
x := 0 x ≥ 2 y := 0 y == 1 y := 0 y == 1 z := 0 z := 0 Train Controller Gate Reset Invariant Guard Train || Gate || Controller Synchronous product gives timed transition system for the joint behaviour
10/20
◮ Resets: to start measuring time ◮ Guards: to impose time constraint on action ◮ Invariants: to limit time spent in a state
11/20
Kim Larsen, Paul Pettersson, Wang Yi - Computer-Aided Verification Award in 2013 for UPPAAL
12/20
13/20
◮ Adding states, transitions and clocks ◮ Simulation environment ◮ (Subset of) CTL property verification
13/20
14/20
x y p1 p2 p3
15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2]
15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S U S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S U S S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S U S U S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x y p1 p2 p3 [1, 3] [1, 3] [1, 2] Inertial delay
[1,3] x p1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 S U S U S U S S: Stable (matches truth table) U: Unstable (does not match truth table) 15/20
x p1 〈 x , p1 〉
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3 x : 0, z1 ≤ 3
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3 x : 0, z1 ≤ 3 x : 0, z1 := 0
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3 x : 0, z1 ≤ 3 x : 0, z1 := 0 p1 : 1, 1 ≤ z1 ≤ 3
16/20
x p1 〈 x , p1 〉 〈0,1〉 〈1,0〉 〈1,1〉 〈0,0〉
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3 x : 0, z1 ≤ 3 x : 0, z1 := 0 x : 1, z1 ≤ 3 p1 : 1, 1 ≤ z1 ≤ 3
16/20
y p
x y p2 〈 x , y , p2 〉 〈000〉 〈010〉 〈100〉 〈111〉 〈110〉 〈011〉 〈101〉
y : 1 y : 0 x : 1 x : 0 x : 1, z2 := 0 x : 0, z2 ≤ 3 p2 : 1 1 ≤ z2 ≤ 3 y : 1, z2 := 0 y : 0, z2 ≤ 3 x : 0, z2 := 0 y : 0, z2 := 0 x : 1, z2 ≤ 3 y : 1, z2 ≤ 3 p2 : 0 1 ≤ z2 ≤ 3 p2 : 0 1 ≤ z2 ≤ 3
17/20
[ ]
p1 p2 p3 〈 p1 , p2 , p3 〉 〈001〉 〈011〉 〈101〉 〈110〉 〈111〉 〈010〉 〈100〉
p2 : 1 p2 : 0 p1 : 1 p1 : 0 p1 : 1, z3 := 0 p1 : 0, z3 ≤ 2 p3 : 0 1 ≤ z3 ≤ 2 p2 : 1, z3 := 0 p2 : 0, z3 ≤ 2 p1 : 0, z3 := 0 p2 : 0, z3 := 0 p1 : 1, z3 ≤ 2 p2 : 1, z3 ≤ 2 p3 : 1 1 ≤ z3 ≤ 2 p3 : 1 1 ≤ z3 ≤ 2
18/20
h0,1i h1,0i h1,1i h0,0i
x : 1, z1 := 0 p1 : 0, 1 ≤ z1 ≤ 3 x : 0, z1 ≤ 3 x : 0, z1 := 0 x : 1, z1 ≤ 3 p1 : 1, 1 ≤ z1 ≤ 3
h000i h010i h100i h111i h110i h011i h101i
y : 1 y : 0 x : 1 x : 0 x : 1, z2 := 0 x : 0, z2 ≤ 3 p2 : 1 1 ≤ z2 ≤ 3 y : 1, z2 := 0 y : 0, z2 ≤ 3 x : 0, z2 := 0 y : 0, z2 := 0 x : 1, z2 ≤ 3 y : 1, z2 ≤ 3 p2 : 0 1 ≤ z2 ≤ 3 p2 : 0 1 ≤ z2 ≤ 3
h001i h011i h101i h110i h111i h010i h100i
p2 : 1 p2 : 0 p1 : 1 p1 : 0 p1 : 1, z3 := 0 p1 : 0, z3 ≤ 2 p3 : 0 1 ≤ z3 ≤ 2 p2 : 1, z3 := 0 p2 : 0, z3 ≤ 2 p1 : 0, z3 := 0 p2 : 0, z3 := 0 p1 : 1, z3 ≤ 2 p2 : 1, z3 ≤ 2 p3 : 1 1 ≤ z3 ≤ 2 p3 : 1 1 ≤ z3 ≤ 2
Synchronous product of above will give timed transition system for circuit
19/20
◮ Modeling timing constraints in systems ◮ Timed transition systems ◮ Model-checker UPPAAL
20/20
◮ Modeling timing constraints in systems ◮ Timed transition systems ◮ Model-checker UPPAAL
A theory of timed automata, by Alur and Dill.
Theoretical Computer Science Journal, 1994
20/20