Download presentation
Presentation is loading. Please wait.
1
Testing and Monitoring at Penn An Integrated Framework for Validating Model-based Embedded Software Li Tan University of Pennsylvania September, 2003
2
Testing and Monitoring at Penn Outline 1. Motivations 2. The overview of our approach 3. Model-based monitoring. 1. Monitoring hybrid automata 2. From logic specification to model-based monitor 3. Model instrumentation 4. Model-based testing 1. Creating and refining model-based testers 5. The case study on SONY AIBO Dog 1. Design-level validation 2. “on-board” validation 6. Conclusion
3
Testing and Monitoring at Penn Motivations 1. Implementing state-of-art validation technique is a painful and costly process. 1. Validation requires special instrument/programs. 2. The details/interfaces of targeted tools are not always available. 2. Lack of an integrated solution for both design- level and implementation-level validations. 1. Difficult to relate the result of design-level validation with implementation-level validation. 3. Bringing formal methods techniques down to implementation level is challenging. 1. Validation directly on targeted hardware platform is much needed in designing model-based embedded software.
4
Testing and Monitoring at Penn The outline of our approach Goal: introducing state-of-art validation techniques to model-based software design domain using existing tools and techniques. Solution: a model-based validation technique for model-based software design. A four-step plan. Synthesizing model-based monitor from the logic specification. Creating model-based tester from the testing criteria. Design-level validation: simulating self-monitoring and self-testing model. Implementation-level validation: generating self- monitoring and self-testing code for target hardware from the composed model.
5
Testing and Monitoring at Penn An overview MEDL specification Monitor Synthesizer System model Instrumented model Model Instrumentation Code Generator Self-testing and Self-monitoring Code Implementation Level Validation Monitor Model Coverage Criteria/ environment constrains Tester Model Coverage Checker Simulator Design Level Validation Composed Model
6
Testing and Monitoring at Penn The details of our plan 1. Modeling language: Charon for hybrid systems. Charon toolkit has, 1. A simulator. 2. A code generator to C++. 2. Model-based testing and monitoring. 1. Testing: working well on implementation level. 1. Need be extended to model level 2. Runtime verification: checking the execution of software system. 1. Need be extended to hybrid systems 3. SONY AiBo Robot Dog: a hands-on example. 1. The controller for its head is generated from a Charon model.
7
Testing and Monitoring at Penn Outline 1. Motivations 2. Overview of our approach 3. Model-based Monitoring. 1. Monitoring hybrid automata 2. From logic specification to model-based monitor 3. Model instrumentation 4. Model-based Testing 1. Creating and refining model-based testers 5. Case study on SONY AIBO Dog 1. Design-level validation 2. “on-board” validation 6. Conclusion
8
Testing and Monitoring at Penn Runtime verification MEDL specification Program Instrumentation Java Programs Runtime verification (monitoring) is to check an execution of a program again its temporal logic specification Java Programs +Filter Monitoring script Monitor MEDL compiler Computer events
9
Testing and Monitoring at Penn Monitoring hybrid automata MEDL specification Model Instrumentation Medl2Charon Monitor Synthesizer Simulator System Automaton FilterMonitoring Automaton Instrumented Model
10
Testing and Monitoring at Penn Hybrid Automata A hybrid automaton A ={S, V, T, G, W, D, A, I, s 0 } extends a EFSM {S, V, T, G, W, s 0 } with continuous behaviors 1. S is the set of modes 2. V is the set of variables 3. T=V £ V is the set of transitions 4. G assigns each t 2 T a guard, a predicate over V. 5. W assigns each t 2 T an assignment for V µ V. 6. D assigns each s 2 S a set of differential equations over. 7. A assigns each s 2 S a set of algebra equations over V. 8. I assigns each s 2 S an invariant, a predicate over V. 9. s 0 2 S is the initial mode.
11
Testing and Monitoring at Penn An example: Dog Head Controller x = -10 x -46. x 45? x -45 | | 10? | | >10? x : The visibility of the ball x: The angle of the head : The angle of the ball Hybrid automata can be composed concurrently. Hybrid automata can be composed hierarchically. 1. A location can be a collection of sub-locations.
12
Testing and Monitoring at Penn MEDL: expressing your properties 1. MEDL (Meta Events Definition Language) is a linear interval temporal logic for specifying safety properties. 1. MEDL is initially introduced for monitoring Java programs in MaC (Monitor and Checking) System [KKL01] 2. Syntax 1. Defined on conditions, events, and expressions. C := defined(C) | [E, E) | : C | C && C | C||C | Q Q E := e | start(C) | end(C) | E || E | E&&E | E when C Q := time(E) | c |Q } Q Where e is primitive event, c is a constant, 2 {>, <, =}, and } 2 {*,/,+,-}.
13
Testing and Monitoring at Penn ( Informal ) MEDL semantics Interpreting MEDL on runs of hybrid automata, 1. A condition C maps a time period with true, false, or undefined. If C is, 1. [E 1, E 2 ). C is true from event E 1 to E 2 (not included) 2. C 1 &&C 2. C is true when C 1 and C 2 are both true. 3. C 1 ||C 2. C is true when either of C 1 and C 2 is true. 4. : C 1. C is the dual of C 1. 2. An event E maps a time instance with true or false. If E is, 1. start(C). E occurs at the time C becomes true. 2. end(C). E occurs at the time C becomes not true. 3. E 1 ||E 2. E occurs when either E 1 or E 2 occurs. 4. E 1 &&E 2. E occurs when both E 1 and E 2 occur. 5. E 1 when C. E occurs when E 1 occurs and C is true 3. Q is an expression. If Q is, 1. time (E). Q’s value is the latest time E occurs. 2. Q 1 } Q 2. Q’s value is Q 1 } Q 2..
14
Testing and Monitoring at Penn An example If the dog loses the ball 50 seconds after the ball becomes visible, an alarm should be raised. Begin import event isVisible, isInvisible, track,lost; condition visible= [isVisible, isInvisible); event becameTruelost= lost when visible; alarm lostTrack=start (time(becameTruelost)- time(isVisible)>50); End isVisible, isInvisible, track, and lost are primitive events isVisible (isInvisible) occurs when >10 becomes true (false). Lost (track) occurs when | -x| > 10 become true (false). An alarm is an event which indicates the violation of the safety requirement..
15
Testing and Monitoring at Penn From Spec to Monitor Monitoring hybrid automaton A is synthesized from its MEDL specification S, 1. For each event E in S, 1. Variable V E in A records the latest time E occurs. 2. For each condition C in S 1. Variable V C in A records the current value of C. 2. Variable V C- in A records the previous value of C. 3. Variable V C l records the latest time C changes. 3. For each expression Q in S 1. Variable V Q in A records the value of Q..
16
Testing and Monitoring at Penn The monitor-synthesizing algorithm (1) The translation is highly modularized, Each condition, expression, and event is translated to an automaton just for it. Each has a token ID P c reflecting its syntactical order in MEDL script. Each automaton is enabled only if the token is passed to it (P=P c ) t records the occurrence time of the primitive event being processed.. (a) C= : C 1
17
Testing and Monitoring at Penn The monitor-synthesizing algorithm (2). (b) C=[E 1, E 2 ) (c) E=start(C) (d) Q=time(E)
18
Testing and Monitoring at Penn The monitor-synthesizing algorithm (3) Monitor is the composition of engine automaton and the automata for events, conditions, and expression. Engine automaton checks incoming event and initialize the token.. Automaton e 1 Automaton C n Token flow Alarm/event detecting is indicated by the value change on the event variable. V E records the time E occurs in the model. Engine Automaton Event, Condition, and Expression Automaton Monitoring Automaton
19
Testing and Monitoring at Penn Outline 1. Motivations 2. Overview of our approach 3. Model-based Monitoring. 1. Monitoring hybrid automata 2. From logic specification to model-based monitor 3. Model instrumentation 4. Model-based Testing 1. Creating and refining model-based testers 5. From Simulation to Implementation 6. Case study on SONY AIBO Dog 1. Design-level validation 2. “on-board” validation 7. Conclusion
20
Testing and Monitoring at Penn Model Instrumentation (1) Monitor observes primitive events emitted by system model. Event is emitted via shared variables (Option I) Model modification. x 45? x -45 | | 10? | | >10?
21
Testing and Monitoring at Penn Model Instrumentation (1) Monitor observes primitive events emitted by system model. Event is emitted via shared variables (Option I) Model modification. x 45? x -45 | | 10?V isInvisible =t, newEvent=true | | >10?V isVisible =t, newEvent:=true | -x| 10?V track =t, newEvent=true | -x| > 10?V lost =t, newEvent=true
22
Testing and Monitoring at Penn Model Instrumentation (2) x 45? x -45 | | 10? | | >10? (Option 2) Model Augmentation A observer automaton (filter) is concurrently composed with the model. The structure of the model will not be changed. | -x| > 10?V lost =t,newEvent=true | -x| 10?V track =t,newEvent=true | | > 10?V isVisible =t,newEvent=true | | 10?V isInvisible =t,newEvent=true Filter
23
Testing and Monitoring at Penn Outline 1. Motivations 2. Overview of our approach 3. Model-based Monitoring. 1. Monitoring hybrid automata 2. From logic specification to model-based monitor 3. Model instrumentation 4. Model-based Testing 1. Creating and refining model-based testers 5. Case study on SONY AIBO Dog 1. Design-level validation 2. “on-board” validation 6. Conclusion
24
Testing and Monitoring at Penn Modeling testing task Tester model reassembles a virtual environment which supplies test trace Environment /hardware constrains + Simulator Environ. ModelSystem Model Coverage Checker No Test Trace Tester Model Yes Determination Coverag e Criteria Coverag e Criteria
25
Testing and Monitoring at Penn Modeling tester: an example (1) Testing requirements. 1. Testing should cover all the locations in system model. 2. Testing should check the dog’s behavior when it lose the ball. Step I: Modeling the environment as a non-deterministic hybrid automaton. true? =20,t=0 =0 =0 true?d=d-10 true?d=d+10 true?b=b-0.1true?b=b+0.1 true?a=a-0.005 true? =0 true?a=a+0.005
26
Testing and Monitoring at Penn Modeling tester: an example (2) Step II: Select a simulation trace as test case. time Step III: Determinate environ. model for the test case u=10? =20,t=0,a=0.025,b=0.2,d=90
27
Testing and Monitoring at Penn Outline 1. Motivations 2. Overview of our approach 3. Model-based Monitoring. 1. Monitoring hybrid automata 2. From logic specification to model-based monitor 3. Model-based instrument 4. Model-based Testing 1. Create environment model 2. Obtain model-based tester model from environment model 5. Case study on SONY AIBO Dog 1. Design-level validation 2. “on-board” validation 6. Conclusion and related works
28
Testing and Monitoring at Penn Design-level validation The composition of instrumented model, tester, and monitor forms a self-validating Charon model Tester supplies test trace during simulation The occurrence of an event is indicated by the value of event variables during simulation (a) Alarm Detection
29
Testing and Monitoring at Penn Design-level validation (b) Primitive Events Emitted by Instrumented Model (c) The simulation trace of monitor
30
Testing and Monitoring at Penn Implemtation-level validation Monitoring automaton System Model Testing automaton Modular compilation MonitorGenerated CodeTester Link as needed
31
Testing and Monitoring at Penn Implementation-level validation The alarm is used for calling the external functions to report error. 1. “play” function is called when an alarm lostTrack is detected The space overhead of tester and monitor.
32
Testing and Monitoring at Penn Conclusion We proposed a framework for testing and monitoring model- based embedded systems. 1. The approach works directly on models. 1. Monitor and tester tasks are specified in the high- level modeling language. 2. It doesn’t require the changes on simulator etc. 2. The framework is for both design-level and implementation-level validations. 1. The results on implementation-level validation may be linked to design-level validation. 3. It produces a self-testing and self-monitoring code for embedded system 1. Monitor and tester are executable on the targeted hardware platform 2. Validation is done directly on “board”.
33
Testing and Monitoring at Penn Thank you!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.