about the use of correlations in component based frameworks georg jung department of computing and...
DESCRIPTION
b Why Using Correlators! We can: Reduce network traffic Simplify computation inside the component Clarify the design Define the components in a more general way Consider the following situation: a ab C A B a + b If we add correlations to the infrastructure If we add correlations to the infrastructureTRANSCRIPT
![Page 1: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/1.jpg)
About the Use of Correlations in Component Based Frameworks
Georg [email protected]
Department of Computing and Information Sciences
Kansas State University
![Page 2: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/2.jpg)
b
Why Using Correlators?
Component C is receiving from two components A and B
A and B send at different rates
C needs both inputs to become active
Consider the following situation:
aA
B
Cab
![Page 3: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/3.jpg)
b
Why Using Correlators!
We can: Reduce network
traffic Simplify computation
inside the component Clarify the design Define the
components in a more general way
Consider the following situation:
a
ab C
A
B
a + b
If we addcorrelations to
the infrastructure
![Page 4: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/4.jpg)
Hello World!Scenario:Example scenario from introduction slides:
C
A
B
• Three Components A, B, and C • Component C receives • A and B send at different rates
![Page 5: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/5.jpg)
TransformerFilter
Head
Hello World!φC correlation HelloWorld (φA a, φB b)a + b
{case true:push new φC { x := a.data,
y := b.data }}
![Page 6: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/6.jpg)
Information about: which events arrived what data is present
The Two-Phase ModelConceptually, the correlator divides
into two distinct phases:1. The Filter2. The Transformere1 e3 e1 e2 e2
Stream of incoming events
Filter
Transformereout eout
Information about: which events arrived what data is present
Generates new output events
Detection ofevent patterns
Reacting to adetected pattern
And performs internal actions
Transformer
Filter
![Page 7: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/7.jpg)
φC correlation HelloWorld (φA a, φB b)a + b
{case true:push new φC { x := a.data,
y := b.data }}
Back to “Hello World!”
In this simple examplethe transformer does
a type conversion!
![Page 8: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/8.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 9: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/9.jpg)
Race ConditionScenario:Components A and B carry out a task
and deliver the results to C.Component C expects the results to
come in first from A, then from B.
The resulting race condition betweenA and C can be caught with a
correlator.
![Page 10: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/10.jpg)
Race ConditionSolution:φdata correlation CatchRacing (φdata a, φdata b)
a + b{
case true:push a;push b;
}
![Page 11: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/11.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 12: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/12.jpg)
Most Recent / EarliestScenario:A component C receives from A and B.
a + bwhen both events arrive, C wants the
most recent (earliest) of both forwarded.
We change the filter expression to:la:(a ; b) | lb:(b ; a)
![Page 13: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/13.jpg)
Most Recent / EarliestφData correlation First
(φData a; φData b)la:(a; b) | lb:(b; a)
{case la: push a;case lb: push b;
}
![Page 14: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/14.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 15: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/15.jpg)
Double MatchConsider the following filter expression:
(a + b) | (a + c)
And the following streams:
a b a a c c …
a c a b b a …
c b b c a a …
matches: a + bmatches: a + cmatches: a + band a + c
![Page 16: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/16.jpg)
Double Match
(a + b) | (a + c)
l1:(a + b) | l2:(a + c)
Adding Labels to the expression
![Page 17: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/17.jpg)
Double Matchl1:(a + b) | l2:(a + c)
Transformer 1: Send a general notification
{case true: push new φnote {};
}
![Page 18: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/18.jpg)
Double Matchl1:(a + b) | l2:(a + c)
Transformer 2: Send two outputs
{case l1: push b;case l2: push c;
}
![Page 19: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/19.jpg)
Double Matchl1:(a + b) | l2:(a + c)
Transformer 3: Send one output, withpriority on b if present.
{case l1: push b;case l2 & !l1: push c;
}
![Page 20: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/20.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 21: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/21.jpg)
Interleaving EventWe consider three subexpressions x1, x2, x3. x2 shall not interleave between x1 and x3.
x1 ; (l2:(x2 ; x3) | l3:x3)
φ correlation Interleaving (...)x1 ; (l2:(x2 ; x3) | l3:x3)
{case l2: push some error event;case l3 & !l2: push some success event;
}
![Page 22: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/22.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 23: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/23.jpg)
Redundant-Sensor-ArrayConsider an array of redundant components
A1, A2, …, An.and a single receiving component B, interested in the accumulation of all events
a1, a2, …, an.The filter expression is then
a1 + a2 + … + an
An
A3A2
…
A1 +B
![Page 24: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/24.jpg)
Redundant-Sensor-Arraya1 + a2 + … + an
In a component system some components
can be temporarily unavailable!If one component does not send anymore
the whole pattern is never satisfied!
An
A3A2
…
A1 +B
![Page 25: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/25.jpg)
An
A3A2
…
A1
Redundant-Sensor-ArrayNotify correlation SensorArray (Notify a1, …, Notify an, Control c1, …, Control cn)l1:a1 + … + ln:an || m1:c1 || … || mn:cn
{ case l1 & … & ln: push new Notify {} case m1: toggle l1 …case mn: toggle ln
}
Sensor
Array
B
C
![Page 26: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/26.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 27: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/27.jpg)
Mode-AwarenessScenario:This scenario generalizes the previous.
Instead of single devices to switch on or off, we have a several modes to chose from.The same mechanism is used
to switch between modesas previously to switch the
different devices on and off.
![Page 28: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/28.jpg)
Mode Awarenessn filter expressions, labeled with n
labels:m1:e1 || … || mn:en
n labeled control events:l1:c1 || … || ln:cn
![Page 29: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/29.jpg)
Mode Awarenessφout correlation Modal3(φc c1, φ c c2, φ c c3, arguments for ei…)m1: e1 || m2: e2 || m3: e3 ||l1: c1 || l2: c2 || l3: c3
{abort (m2, m3);
clauses for e1, e2, e3…
case l1: revive (m1); abort (m2, m3);case l2: revive (m2); abort (m1, m3);case l3: revive (m3); abort (m1, m2);
}
![Page 30: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/30.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
![Page 31: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/31.jpg)
Periodic Checks of Aperiodic EventsScenario:We introduce a periodic supervisor
component into an aperiodic system.
Whenever a clock-tick occurs, a sample is collected and sent to the supervisor.
![Page 32: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/32.jpg)
φsample correlation PeriodicChck(φtimer t, φa a, φb b, φc c)t ; (l1:(a + b + c) | l2:t)
{case l1:push new φsample{d1 := a.data,d2 := b.data,
d3 := c.data }case l2:push some error event (missed sample);
}
Periodic Checks of Aperiodic Events
![Page 33: About the Use of Correlations in Component Based Frameworks Georg Jung Department of Computing and Information Sciences Kansas State University](https://reader035.vdocuments.us/reader035/viewer/2022081513/5a4d1b497f8b9ab0599a4d41/html5/thumbnails/33.jpg)
ExamplesThis presentation will include: How to prevent a race condition How to chose the most recent/earliest in a
sequence How to handle a double match How to catch interleaving events How to deal with redundant-device-
components How to introduce mode-dependent behavior How to bridge the gap between periodic and
aperiodic systems
These are our examples.Feel free to add your own…