28
Applied Formal Methods - From CSP to Executable Hybrid Specifications Jan Peleska Technologie-Zentrum Informatik TZI, Universit¨ at Bremen and Verified Systems International GmbH, [email protected] TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Applied Formal Methods - From CSP toExecutable Hybrid Specifications

Jan PeleskaTechnologie-Zentrum Informatik TZI,

Universitat Bremen andVerified Systems International GmbH,

[email protected]

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 2: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Overview

1. Overview: Practice Stimulates TheoryApplied CSP and Beyond

2. Specification-Based Hard Real-Time TestingTest Automation for TCSP

3. Hybrid Low-Level Language FrameworkTransformational semantics and hard real-time executionenvironment for hybrid formalisms

4. Conclusion

Extended abstract and presentation slides available underhttp://www.tzi.de/~jp

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 3: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Overview

1. Overview: Practice Stimulates TheoryApplied CSP and Beyond

2. Specification-Based Hard Real-Time TestingTest Automation for TCSP

3. Hybrid Low-Level Language FrameworkTransformational semantics and hard real-time executionenvironment for hybrid formalisms

4. Conclusion

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 4: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Practice Stimulates Theory: Applied CSP

motivatesresearchabout

motivatesresearchabout

motivatesresearchabout

Code AbstractionModel CheckingCompositional Reasoning

CSP SpecificationReasoning about FailuresCombination of Denotational and OperationalSemantics

Fault−TolerantSystem Development(Philips 1985...)

Occam Code Verification forInternational Space Station ISS(TZI 1996...)

Testing the AirbusCabin CommunicationSystem (A340,A318)

(Verified Systems 1998...)

Timed CSP Specifications

Automated Specification−Based

Real−Time Testing

Page 5: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Practice Stimulates Theory: Beyond CSP

motivatesresearchabout

Hybrid StatechartsTest Automation forHybrid Systems

motivatesresearchabout

Hybrid Low−Level Languageand Execution FrameworkTransformational Semanticsfor High−Level Formalisms

Testing AirbusIntegrated ModularAvioncis (A380)(Verified Systems 2002...)

Development ofRailway Control Systemsfrom Domain−SpecificDescriptions

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 6: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Overview

1. Overview: Practice Stimulates TheoryApplied CSP and Beyond

2. Specification-Based Hard Real-Time TestingTest Automation for TCSP

3. Hybrid Low-Level Language FrameworkTransformational semantics and hard real-time executionenvironment for hybrid formalisms

4. Conclusion

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 7: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

Hardware-in-the-loop test configurations

Hardware−in−the−LoopTest System

EnvironmentOperational

Controller)(embedded

Target System

tested by

Discrete InterfacesAnalog Interfaces

Analog ActuatorsAnalog Sensors

state manipulation channelsadditional monitoring and

Controller)(embedded

Target System

HARDWARE−IN−THE−LOOP TEST CONFIGURATIONOPERATIONAL SYSTEM CONFIGURATION

System to be Tested

System Under Test

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 8: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

Building blocks of a test automation system

• Test Generator creates test cases from specifications. This requires

– Environment Specification: simulation of environment

behaviour – stimulation all “relevant” events, in order to trigger

specific reactions of system under test (SUT)

– SUT Specification: to avoid creation of “irrelevant” tests

• Test Driver executes test cases in real-time

• Test Oracle checks SUT test execution against SUT specification

• Test Monitor checks whether test case executions are complete and

required test coverage has been achieved

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 9: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

Structural Decomposition Theorem for Networks ofSequential TCSP Processes:TCSP process P may be decomposed into

P’ = PU [| {| s0, s1, ..., e0, e1, ... |} |] TIM

where PU only contains untimed CSP operators[| |], |||, \, ->, [], |~|, ; and TIM is an interleaving

of Timer Processes T following the pattern

T = s.t -> ((WAIT t; e.t -> T) [] T)

P ′ is timed-failures equivalent to P .

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 10: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

Examples for structural decomposition: TCSP processes

P = WAIT t; a -> b-> P

Q = (a -> Q) [t> (x -> Q)

are transformed into

PU = s.t -> e.t -> a -> b -> PU

QU = s.u -> (a -> QU [] e.u -> x -> QU)

with timers

T1 = s.t -> ((WAIT t; e.t -> T) [] T)

T2 = s.u -> ((WAIT u; e.u -> T) [] T)

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 11: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

The system

SYS = P [| a |] Q

is transformed into

SYS’ = ((PU [| a |] QU)

[| s.t, s.u, e.t, e.u |]

(T1 ||| t2))

\ { s.t, s.u, e.t, e.u }

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 12: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

Basic approach to automated specification-basedtesting with TCSP:

• Use un-normalised transition graph representationTG(SYS ′) for SYS ′ as defined and implemented for UntimedCSP.

• TG(SYS ′) encodes complete timed failures model ofSYS ′, and therefore of the equivalent original process SYS .

• Test data generation and checking algorithms are based ontraversal of TG(SYS ′)

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 13: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

• Test Oracles are implemented by back-to-back checkingof SUT behaviour against TG(SYS ′).

– Since TG(SYS ′) encodes all information about timers,correctness of timed traces can be checked on-the-fly in hardreal-time for deterministic SUT → currently applied todevelopment of built-in-test equipment of train controlsystems.

– Non-deterministic SUT may be checked in soft real-time bymaintaining set S of potential SUT states in the testoracle. Timed trace behaviour of SUT is correct as long asS 6= ∅.

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 14: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

• Test data generation for timed-failures testing isbased on a zone abstraction of TG(SYS ′)

– During time intervals where no timer elapses, SUT behaviour

remains stable with respect to refused and accepted

events.

– Since TCSP asserts maximal progress, events refused by SUT

may be probed using test patterns like

TEST = (a -> ACCEPTED(a)) [t> REFUSED(a) for small t > 0.

– By blocking specific inputs to or outputs from SUT, testing

environment may explore SUT behaviour at time boundaries

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 15: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Specification-Based Hard Real-Time Testing

TG(PU)

s.t

e.t

a

b

e.v

TG(QU)

a s.u

e.u

x

e.w

PU QUab c

P = WAIT t; a −> b −> P

Q = (a −> Q) [u> (x −> Q)

PU = s.t −> e.t −> a −> b −> PU

structural decomposition

QU = s.u −> ( a −> QU [] e.u −> x −> QU)

TEST SYSTEM

TIMER1 TIMER2

s.t e.t s.u e.u

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 16: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Overview

1. Overview: Practice Stimulates TheoryApplied CSP and Beyond

2. Specification-Based Hard Real-Time TestingTest Automation for TCSP

3. Hybrid Low-Level Language FrameworkTransformational semantics and hard real-time executionenvironment for hybrid formalisms

4. Conclusion

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 17: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Hybrid Low-Level Language Framework

Motivation

• Development, test and formal verification of Hybrid ControlSystems, with discrete and time-continuous observables

• Requirements engineering with physical models requiresglobal observables

• Specifications to be developed in various formalisms,e. g. Hybrid Statecharts, Hybrid Automata, Duration Calculus,Hybrid CSP, . . .

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 18: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Hybrid Low-Level Language Framework

• Specifications should be automatically transformedinto hard real-time execution environment, becausedevelopment by stepwise refinement . . .

– offers too many degrees of freedom,

– cannot be performed by domain specialists who are notformal methods specialists at the same time.

• Execution environment should have well-definedreal-time semantics

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 19: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Hybrid Low-Level Language Framework

• Semantics for new (high-level) formalisms should be definedby transformation into execution environment:

– Obtain semantic specification model and executable systemin a single step

– Extensions of the new high-level formalism only requireextension of the transformation

• Automatic compilation seems feasible for specificwell-defined application domains, such as railway-controlsystems

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 20: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Hybrid Low-Level Language Framework

OPERATING SYSTEM MECHANISMS

CPU ReservationLight Weight Processes (LWP)

Interrupt RelayingCluster Communication (Myrinet)Reflective Memory (VMIC)

HL3 HYBRID LOW LEVEL LANGUAGEUser Thread Scheduler Wait on Condition: @waitCond()

Return Thread Ctrl: @yield()Global VariablesThread Context VariablesThread−>CPU allocation: @CPU()

High Resolution Clock

Timed State−Transition SystemSemantics

competes with GIOTTO

User Threads: @abstract machineFlows: @flow

Host Language C/C++

HybridUMLUML 2.0 ProfileSemantics Intuition:Hierarchic Hybrid Automata(Alur et al. CHARON)

RTTL REAL−TIME TEST LANGUAGE

AssociateFormal Semanticsby Transformation

Channel−Port Communication AbstractionTest Support Functions: − Automated Test Data Generation − Automated Checking of SUT Responses

− Test Verdict Management− Automated Log Generation

− Test Stub Generator− HW Drivers+HW Abstraction

Atomic transformation: @put(x,timetag)

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 21: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Hybrid Low-Level Language Framework

Features of the Hybrid Low-Level LanguageFramework HL3.

• Designed as an alternative to Henzinger’s GIOTTO – HL3 more flexible

with respect to applicable programming paradigms

• Timed transition system semantics

• Atomic transformations implemented using visibility time tags for

global state variables

• Discretised stepwise integration of flows with guaranteed scheduling

precision

• High-level formalisms are transformed into HL3 Abstract Machines, global

state, scheduling conditions and mappings between HW/SW interfaces.

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 22: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Overview

1. Overview: Practice Stimulates TheoryApplied CSP and Beyond

2. Specification-Based Hard Real-Time TestingTest Automation for TCSP

3. Hybrid Low-Level Language FrameworkTransformational semantics and hard real-time executionenvironment for hybrid formalisms

4. Conclusion

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 23: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Conclusion

• Since 1985, CSP has been applied successfully by theauthor’s research teams at TZI and verifications teams atPhilips, DST and Verified Systems International GmbH for

– Formal specification and verification ofdependability mechanisms

– Code verification by abstraction, model checking andcompositional reasoning

– Automated hard real-time testing

– Automated generation of real-time simulations

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 24: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Conclusion (. . . continued)

• The main application domains for the listed verificationprojects have been

– Fault-tolerant systems (Philips)

– Space applications (DASA Space Infrastructure)

– Avionics (Airbus)

– Railway interlocking and train control systems(Siemens)

– Automotive control (Daimler Chrysler)

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 25: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Conclusion (. . . continued)

• In order to incorporate physical modelling into the developmentphases, Hybrid Statecharts have been designed, combining

– Global discrete and analogue observables,

– Hierarchical real-time Statecharts

– Invariants on global state

– Flow conditions on time-continuous evolutions

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 26: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Conclusion (. . . continued)

• To cope with the evolution of (hybrid) real-time formalisms,the Hybrid Low-Level Language Frame Work (HL3)has been designed to

– “Compile” high-level specifications from different formalismsinto HL3,

– Define semantics of high-level specifications bytransformation into HL3,

– Generate executable hard-real time systems bytransformation.

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 27: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Conclusion (. . . continued)

• Ongoing research work focuses on

– Completion of theory and tool support for testautomation based on TCSP

– Development of test data generation methods andstrategies for Hybrid Systems

– Combined model checking and test automation

– Automated generation of executable systems fromdomain-specific descriptions

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH

Page 28: Applied Formal Methods - From CSP to Executable …...Specification-Based Hard Real-Time Testing • Test data generation for timed-failures testing is based on a zone abstraction

Contributions by . . .

. . . Peter Amthor, Kirsten Berkenkotter, Stefan Bisanz, JanBredereke, Bettina Buth, Markus Dahlweid, Christof Efkemann,Hans-Jurgen Ficker, Ulrich Hannemann, Anne E. Haxthausen,Oliver Meyer, Michael O. Moller, Anders Ravn, Willem-Paul deRoever, Raymond Scholz, Michael B. Schronen, Uwe Schulze,Hauke Steenbock, Aliki Tsiolakis, Cornelia Zahlten, . . .

TECHNOLOGIE- ZENTRUM INFORMATIK VERIFIED SYSTEMS INTERNATIONAL GMBH