SLIDE 1 Measuring with Timed Patterns
CAV’15 Thomas Ferr` ere1 Oded Maler1 Dejan Nickovic2 Dogan Ulus1
1 VERIMAG University of Grenoble / CNRS 2 AIT Austrian Institute of Technology
July 24, 2015
SLIDE 2
Measurements current practice...
◮ scripts, signal processing blocks, etc. ◮ ad-hoc approach
SLIDE 3 Declarative language for measurements
w [0, T] → Rn ϕ behavior identification (ti, t′
i)
R2 µ measure aggregation mi R
◮ timed regular expression ϕ describes intervals where measure can be
taken
◮ continuous aggregating operators µ: duration, integral, maximum, etc.
SLIDE 4 Declarative language for measurements
w [0, T] → Rn ϕ behavior identification (ti, t′
i)
R2 µ measure aggregation mi R
◮ timed regular expression ϕ describes intervals where measure can be
taken
◮ continuous aggregating operators µ: duration, integral, maximum, etc.
SLIDE 5
Timed regular expressions – interval semantics
Definition (Syntax of TRE)
ϕ := ǫ | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ∗ | ϕ[l,u] p proposition, and l, u integer constants.
Definition (Semantics of TRE)
(t, t′) ∈ ǫw iff t = t′ (t, t′) ∈ pw iff ∀t < t′′ < t′, p ∈ w[t′′] (t, t′) ∈ ϕ · ψw iff ∃t ≤ t′′ ≤ t′, (t, t′′) ∈ ϕw and (t′′, t′) ∈ ψw (t, t′) ∈ ϕ ∨ ψw iff . . . (t, t′) ∈ ϕ ∧ ψw iff . . . (t, t′) ∈ ϕ∗w iff . . . (t, t′) ∈ ϕ[l,u]w iff l ≤ t′ − t ≤ u and (t, t′) ∈ ϕw
SLIDE 6
Timed regular expressions – interval semantics
Definition (Syntax of TRE)
ϕ := ǫ | p | ϕ · ϕ | ϕ ∨ ϕ | ϕ ∧ ϕ | ϕ∗ | ϕ[l,u] p proposition, and l, u integer constants.
Definition (Semantics of TRE)
(t, t′) ∈ ǫw iff t = t′ (t, t′) ∈ pw iff ∀t < t′′ < t′, p ∈ w[t′′] (t, t′) ∈ ϕ · ψw iff ∃t ≤ t′′ ≤ t′, (t, t′′) ∈ ϕw and (t′′, t′) ∈ ψw (t, t′) ∈ ϕ ∨ ψw iff . . . (t, t′) ∈ ϕ ∧ ψw iff . . . (t, t′) ∈ ϕ∗w iff . . . (t, t′) ∈ ϕ[l,u]w iff l ≤ t′ − t ≤ u and (t, t′) ∈ ϕw
SLIDE 7 Timed pattern matching
Theorem (FORMATS’14)
The set of matches ϕw is computable as a finite union of 2d zones
Proof principle
Structural induction over ϕ zp
zϕ·ψ
. . . zϕ[l,u]
SLIDE 8 Timed pattern matching
Theorem (FORMATS’14)
The set of matches ϕw is computable as a finite union of 2d zones
Proof principle
Structural induction over ϕ zp
zϕ·ψ
. . . zϕ[l,u]
SLIDE 9
Example
Expressions: ϕ = p[1,5] ψ = q[0,2] ϕ · ψ Set of matches:
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ϕ ψ ϕ · ψ p q
SLIDE 10 Example
Expressions: ϕ = p[1,5] ψ = q[0,2] ϕ · ψ Set of matches:
t′ t t′ t′′
ψ ϕ · ψ p q
SLIDE 11
Conditional expressions
Introduce preconditions and postconditions.
Definition (Syntax of Conditional TRE)
ϕ := . . . | ϕ · ϕ | . . . | ϕ ? ϕ | ϕ ! ϕ
Definition (Semantics of Conditional TRE)
. . . (t, t′) ∈ ϕ · ψw iff ∃t ≤ t′′ ≤ t′ (t, t′′) ∈ ϕw and (t′′, t′) ∈ ψw . . . (t, t′) ∈ ψ ? ϕw iff ∃t′′ ≤ t (t, t′) ∈ ϕw and (t′′, t) ∈ ψw (t, t′) ∈ ϕ ! ψw iff ∃t′ ≤ t′′ (t, t′) ∈ ϕw and (t′, t′′) ∈ ψw
SLIDE 12
Conditional expressions
Introduce preconditions and postconditions.
Definition (Syntax of Conditional TRE)
ϕ := . . . | ϕ · ϕ | . . . | ϕ ? ϕ | ϕ ! ϕ
Definition (Semantics of Conditional TRE)
. . . (t, t′) ∈ ϕ · ψw iff ∃t ≤ t′′ ≤ t′ (t, t′′) ∈ ϕw and (t′′, t′) ∈ ψw . . . (t, t′) ∈ ψ ? ϕw iff ∃t′′ ≤ t (t, t′) ∈ ϕw and (t′′, t) ∈ ψw (t, t′) ∈ ϕ ! ψw iff ∃t′ ≤ t′′ (t, t′) ∈ ϕw and (t′, t′′) ∈ ψw
SLIDE 13
Conditional expressions
Introduce preconditions and postconditions.
Definition (Syntax of Conditional TRE)
ϕ := . . . | ϕ · ϕ | . . . | ϕ ? ϕ | ϕ ! ϕ
Definition (Semantics of Conditional TRE)
. . . (t, t′) ∈ ϕ · ψw iff ∃t ≤ t′′ ≤ t′ (t, t′′) ∈ ϕw and (t′′, t′) ∈ ψw . . . (t, t′) ∈ ψ ? ϕw iff ∃t′′ ≤ t (t, t′) ∈ ϕw and (t′′, t) ∈ ψw (t, t′) ∈ ϕ ! ψw iff ∃t′ ≤ t′′ (t, t′) ∈ ϕw and (t′, t′′) ∈ ψw
SLIDE 14
Example
Expressions: ϕ = p[1,5] ψ = q[0,2] ϕ ! ψ ϕ ! ψ Set of matches:
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ϕ ψ ϕ ? ψ p q 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ϕ ψ ϕ ! ψ p q
SLIDE 15
Expressions with events
Events
Zero-duration expressions: ↑ p = p ? ǫ ! p (rising edge) ↓ p = p ? ǫ ! p (falling edge)
Event-bounded expressions
Syntactically enforced: ψ := ↑ p | ↓ p | ψ · ϕ · ψ | ψ ∪ ψ | ψ ∩ ϕ with ϕ arbitrary expression
Proposition (Finiteness)
Event-bounded expressions have a finite set of matches.
SLIDE 16
Expressions with events
Events
Zero-duration expressions: ↑ p = p ? ǫ ! p (rising edge) ↓ p = p ? ǫ ! p (falling edge)
Event-bounded expressions
Syntactically enforced: ψ := ↑ p | ↓ p | ψ · ϕ · ψ | ψ ∪ ψ | ψ ∩ ϕ with ϕ arbitrary expression
Proposition (Finiteness)
Event-bounded expressions have a finite set of matches.
SLIDE 17
Expressions with events
Events
Zero-duration expressions: ↑ p = p ? ǫ ! p (rising edge) ↓ p = p ? ǫ ! p (falling edge)
Event-bounded expressions
Syntactically enforced: ψ := ↑ p | ↓ p | ψ · ϕ · ψ | ψ ∪ ψ | ψ ∩ ϕ with ϕ arbitrary expression
Proposition (Finiteness)
Event-bounded expressions have a finite set of matches.
SLIDE 18 Example
Expressions: ↓ p ↑ q ϕ = p[1,5] ↑ q · ϕ · ↓ p Set of matches:
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
↑ q ϕ ↑ q · ϕ · ↓ p p q
SLIDE 19
Measurements
Measure Pattern
A Conditional TRE ϕ = α ? ψ ! β with arbitrary conditions α, β, and ψ event-bounded.
Measure Expression
An expression µ(ϕ) with ϕ a measure pattern, and µ = duration, supx, integralx, . . . continuous aggregation operator.
SLIDE 20
Measurements
Measure Pattern
A Conditional TRE ϕ = α ? ψ ! β with arbitrary conditions α, β, and ψ event-bounded.
Measure Expression
An expression µ(ϕ) with ϕ a measure pattern, and µ = duration, supx, integralx, . . . continuous aggregation operator.
SLIDE 21 DSI3 standard
e(t) a(t) R C CONTROLER SENSOR i v
◮ Analog communication protocol ◮ Communication via pulses on
◮ voltage line v ◮ current line i
◮ Two phases with different nominal levels
◮ discovery mode: v in range V0 to V1 ◮ command and response mode: v in range V2 to V3
SLIDE 22 DSI3 standard
e(t) a(t) R C CONTROLER SENSOR i v
◮ Analog communication protocol ◮ Communication via pulses on
◮ voltage line v ◮ current line i
◮ Two phases with different nominal levels
◮ discovery mode: v in range V0 to V1 ◮ command and response mode: v in range V2 to V3
SLIDE 23 DSI3 standard
e(t) a(t) R C CONTROLER SENSOR i v
◮ Analog communication protocol ◮ Communication via pulses on
◮ voltage line v ◮ current line i
◮ Two phases with different nominal levels
◮ discovery mode: v in range V0 to V1 ◮ command and response mode: v in range V2 to V3
SLIDE 24 Model and requirements
e(t) a(t) R C CONTROLER SENSOR i v
◮ Behavioral model:
◮ gaussian distribution of pulse timing ◮ uniform distribution of sensor load resistance
◮ Simulation: 100 sequences of discovery + command and response ◮ Measurements:
- 1. time between consecutive discovery pulses
- 2. energy transmitted through power pulses
SLIDE 25 Model and requirements
e(t) a(t) R C CONTROLER SENSOR i v
◮ Behavioral model:
◮ gaussian distribution of pulse timing ◮ uniform distribution of sensor load resistance
◮ Simulation: 100 sequences of discovery + command and response ◮ Measurements:
- 1. time between consecutive discovery pulses
- 2. energy transmitted through power pulses
SLIDE 26 Model and requirements
e(t) a(t) R C CONTROLER SENSOR i v
◮ Behavioral model:
◮ gaussian distribution of pulse timing ◮ uniform distribution of sensor load resistance
◮ Simulation: 100 sequences of discovery + command and response ◮ Measurements:
- 1. time between consecutive discovery pulses
- 2. energy transmitted through power pulses
SLIDE 27 Model and requirements
e(t) a(t) R C CONTROLER SENSOR i v
◮ Behavioral model:
◮ gaussian distribution of pulse timing ◮ uniform distribution of sensor load resistance
◮ Simulation: 100 sequences of discovery + command and response ◮ Measurements:
- 1. time between consecutive discovery pulses
- 2. energy transmitted through power pulses
SLIDE 28
Measurement 1: time between consecutive discovery pulses
time between 2 consecutive pulses ∈ [l, u] ϕ1 ↓ c V0 V1 b b a c ↓ c ↑ c
◮ Voltage levels:
a ≡ v ≤ V0 b ≡ V0 ≤ v ≤ V1 c ≡ v ≥ V1
◮ Pulse pattern:
ϕ1 ≡ ↓ c · b · a · b[l,u] · ↑ c
◮ Measure expression: M1 = duration(ϕ1 · c ! ϕ1)
SLIDE 29
Measurement 1: time between consecutive discovery pulses
time between 2 consecutive pulses ∈ [l, u] ϕ1 ↓ c V0 V1 b b a c ↓ c ↑ c
◮ Voltage levels:
a ≡ v ≤ V0 b ≡ V0 ≤ v ≤ V1 c ≡ v ≥ V1
◮ Pulse pattern:
ϕ1 ≡ ↓ c · b · a · b[l,u] · ↑ c
◮ Measure expression: M1 = duration(ϕ1 · c ! ϕ1)
SLIDE 30
Measurement 1: time between consecutive discovery pulses
time between 2 consecutive pulses ∈ [l, u] ϕ1 ↓ c V0 V1 b b a c ↓ c ↑ c
◮ Voltage levels:
a ≡ v ≤ V0 b ≡ V0 ≤ v ≤ V1 c ≡ v ≥ V1
◮ Pulse pattern:
ϕ1 ≡ ↓ c · b · a · b[l,u] · ↑ c
◮ Measure expression: M1 = duration(ϕ1 · c ! ϕ1)
SLIDE 31
Measurement 2: energy transmitted during power pulses
Power Phase i V2 V3
◮ Voltage levels:
e ≡ v ≥ V2 f ≡ V2 ≤ v ≤ V3 g ≡ v ≥ V3
◮ Pulse pattern:
ϕ2 ≡ ↑ e · f · g · f · ↓ e
◮ Measure expression: M2 := integralv×i(ϕ2)
SLIDE 32
Measurement 2: energy transmitted during power pulses
Power Phase i V2 V3
◮ Voltage levels:
e ≡ v ≥ V2 f ≡ V2 ≤ v ≤ V3 g ≡ v ≥ V3
◮ Pulse pattern:
ϕ2 ≡ ↑ e · f · g · f · ↓ e
◮ Measure expression: M2 := integralv×i(ϕ2)
SLIDE 33
Measurement 2: energy transmitted during power pulses
Power Phase i V2 V3
◮ Voltage levels:
e ≡ v ≥ V2 f ≡ V2 ≤ v ≤ V3 g ≡ v ≥ V3
◮ Pulse pattern:
ϕ2 ≡ ↑ e · f · g · f · ↓ e
◮ Measure expression: M2 := integralv×i(ϕ2)
SLIDE 34 Results
235.0 240.0 245.0 250.0 255.0 260.0 265.0
Measured duration (µs)
5 10 15 20 25 30 35
Number of occurrence
3.5 3.6 3.7 3.8 3.9 4.0 4.1 4.2 4.3
Measured energy (mJ)
1 2 3 4 5 6 7 8
Number of occurrence
SLIDE 35
Performance
Computation time (seconds) relative to sampling rate: Measure 1 Measure 2 samples Tp Tϕ Tµ T Tp Tϕ Tµ T 1M 0.047 0.617 0.000 0.664 0.009 0.004 0.011 0.024 5M 0.197 0.612 0.000 0.809 0.050 0.005 0.047 0.103 10M 0.386 0.606 0.000 0.992 0.101 0.005 0.100 0.216 20M 0.759 0.609 0.000 1.368 0.203 0.005 0.260 0.468 Program:
◮ TRE matching algorithms based on IF library ◮ Python signal processing library
SLIDE 36
Conclusion
Present
◮ declarative language for mixed-signal measurements ◮ general and efficient to monitor
Future
◮ language extension ◮ online measurements