uppaal lite

21
 An introduction to An introduction to Uppaal Uppaal Ulrik Hørlyk Hjort Ulrik Hørlyk Hjort BestPractice Consulting & Advising 2010 BestPractice Consulting & Advising 2010

Upload: ulrik-horlyk-hjort

Post on 30-May-2015

1.377 views

Category:

Documents


4 download

DESCRIPTION

Lite introduction to Uppaal

TRANSCRIPT

Page 1: Uppaal Lite

   

An introduction toAn introduction to

Uppaal Uppaal

Ulrik Hørlyk HjortUlrik Hørlyk HjortBestPractice Consulting & Advising 2010BestPractice Consulting & Advising 2010

Page 2: Uppaal Lite

   

The Uppaal SystemThe Uppaal System

► UPPAAL is a tool for modeling, validation and UPPAAL is a tool for modeling, validation and verification of real-time systems.verification of real-time systems.

► It is appropriate for systems that can be modeled as It is appropriate for systems that can be modeled as a collection of non-deterministic processes with finite a collection of non-deterministic processes with finite control structure and real-valued clocks (i.e. timed control structure and real-valued clocks (i.e. timed automata), communicating through channels and (or) automata), communicating through channels and (or) shared data structures.shared data structures.

► Typical application areas include real-time Typical application areas include real-time controllers, communication protocols, and other controllers, communication protocols, and other systems in which timing aspects are critical.systems in which timing aspects are critical.

Page 3: Uppaal Lite

   

Uppaal SystemUppaal System

► Integrated tool environment for:Integrated tool environment for:■ ModellingModelling

■ SimulationSimulation

■ VerificationVerification

Page 4: Uppaal Lite

   

The System EditorThe System Editor

► The system editor is used to create and edit the The system editor is used to create and edit the system model to be analysedsystem model to be analysed

► A system model describe a network of a finite A system model describe a network of a finite number of non-deterministic finite state number of non-deterministic finite state automataautomata

► Transitions between states may be labeled with:Transitions between states may be labeled with:

■ GuardsGuards

■ SynchronizationsSynchronizations

■ Assignment statementsAssignment statements

Page 5: Uppaal Lite

   

Uppaal ModelUppaal Model

Initial Location

Location

Edge

Synchronization

Page 6: Uppaal Lite

   

Uppaal ModelUppaal Model

procedure Factorial is

  Result : Integer := 5;

begin   for I in reverse 1 .. 4 loop      Result := Result * I;   end loop;

    Put_Line(Integer'Image(Result));

end Factorial;

Page 7: Uppaal Lite

   

Task SynchronizationTask Synchronizationtask body TaskA isbegin   TaskB.WriteTaskName;end TaskA;

task body TaskB isbegin      accept WriteTaskName  do         Put_Line("Task B");      end WriteTaskName;end TaskB;

Page 8: Uppaal Lite

   

Subprogram SynchronizationSubprogram Synchronizationprocedure Main is

   procedure Hello is   begin      Put_Line("Hello, World!");   end Hello;

begin     Hello;end Main;

Page 9: Uppaal Lite

   

Parametrised SynchronizationParametrised Synchronizationprocedure Factorial is

   function Fac(N: Integer) Return Integer is        Result : Integer := N;   begin       for I in reverse 1 .. N­1 loop           Result := Result * I;       end loop;      return Result;   end Fac;

begin      Put_Line(Integer'Image(Fac(5)));end Factorial;

Page 10: Uppaal Lite

   

The Model Checker (Verifier)The Model Checker (Verifier)

► The model checker verify the model with respect to a The model checker verify the model with respect to a requirement specification. requirement specification.

► Verifies safety, bounded-liveness and other user Verifies safety, bounded-liveness and other user specified properties by reachability analysis.specified properties by reachability analysis.

► The model checker support three Path formulae:The model checker support three Path formulae:

■ ReachabilityReachability

■ Safety Safety

■ LivenessLiveness

Page 11: Uppaal Lite

   

E<>φ - “φ Reachable”E<>φ - “φ Reachable”► E<>φ – It is possible to reach a state in which E<>φ – It is possible to reach a state in which

φ is satisfied φ is satisfied

► φ is true in – at least – one reachable stateφ is true in – at least – one reachable state

Page 12: Uppaal Lite

   

The SimulatorThe Simulator

► Lets users simulate the models to visually Lets users simulate the models to visually explore their dynamic behavior.explore their dynamic behavior.

Page 13: Uppaal Lite

   

Simple Phone CaseSimple Phone Case

► Model a phone that can:Model a phone that can:■ Receive a callReceive a call

■ Make a callMake a call

■ Receive an smsReceive an sms

► Requirement:Requirement:■ If a call come while user write an sms, the user If a call come while user write an sms, the user

shall be able to answer or reject the call and then shall be able to answer or reject the call and then return to the sms editor.return to the sms editor.

Page 14: Uppaal Lite

   

DeclarationsDeclarationsbool INCOME_CALL = false;

chan letter, digit, send, cancel, accept, acceptCall, rejectCall;

broadcast chan incomeCall, incomeSms, callTone, smsTone, handleCall, handleSms;

chan enterSms, exitSms, enterCall, exitCall, exitReceiveCall;

Page 15: Uppaal Lite

   

User and Mainscreen ModelsUser and Mainscreen Models

User Model

Main Screen Model

Page 16: Uppaal Lite

   

Make CallMake Call

Page 17: Uppaal Lite

   

Receive CallReceive Call

Page 18: Uppaal Lite

   

Send SmsSend Sms

Page 19: Uppaal Lite

   

Simple Phone Requirement Simple Phone Requirement VerificationVerification

► Requirement:Requirement:

■ If a call come while user write an sms, the user shall be able to If a call come while user write an sms, the user shall be able to answer or reject the call and then return to the sms editor.Trueanswer or reject the call and then return to the sms editor.True

► Verify that there is a path to the location “Call” in the Verify that there is a path to the location “Call” in the “ReceiveCall” automata and a path to the location “ReceiveCall” automata and a path to the location “ExitReceivedCall” in the “SendSms” automata“ExitReceivedCall” in the “SendSms” automata

► The requirement can be verified with the reachability The requirement can be verified with the reachability property as:property as:

■ E<>SendSms.ExitReceivedCall and ReceiveCall.CallE<>SendSms.ExitReceivedCall and ReceiveCall.Call

► Which evealuate to true in the verifier Which evealuate to true in the verifier

Page 20: Uppaal Lite

   

Simulate the simple phone Simulate the simple phone modelmodel

► Use the simulator to verify that it is possible Use the simulator to verify that it is possible to cover all edges in the model and that the to cover all edges in the model and that the model is deadlock freemodel is deadlock free

Page 21: Uppaal Lite

   

Questions?Questions?

www.uppaal.comwww.uppaal.com