Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.

Slides:



Advertisements
Similar presentations
Object-Oriented Software Engineering Visual OO Analysis and Design
Advertisements

Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
Chapter 8 Improving the User Interface
Models of Concurrency Manna, Pnueli.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Kurt Jensen ADA-220 Coloured Petri Nets Modelling.
© 2010 Delmar, Cengage Learning Chapter 9: Using ActionScript.
GUI Testing. High level System Testing Test only those scenarios and outputs that are observable by the user Event-driven Interactive Two parts to test.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
JavaScript Part for Repetition Statement for statement Cpecifies each of the items needed for counter-controlled repetition with a control variable.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Kurt Jensen & Lars Michael Kristensen (Edited by.
Informatics 43 – May 7, Restatement of Goals for Testing Want to verify software’s correctness  Need to test  Need to decide on test cases  No.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Performance Analysis and Monitoring Facilities in CPN Tools Tutorial CPN’05 October 25, 2005 Lisa Wells.
© The McGraw-Hill Companies, 2006 Chapter 18 Advanced graphics programming.
Modelling with Coloured Petri Nets Søren Christensen Department of Computer Science University of Aarhus.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
/faculteit technologie management DEMO CPN-tools Ronny Mans Eindhoven University of Technology, Faculty of Technology Management, Department of Information.
Chapter 2: Algorithm Discovery and Design
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
Games and Simulations O-O Programming in Java The Walker School
11 Chapter 4 LOOPS AND FILES. 22 THE INCREMENT AND DECREMENT OPERATORS To increment a variable means to increase its value by one. To decrement a variable.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
JavaScript: Functions © by Pearson Education, Inc. All Rights Reserved.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Designing Interface Components. Components Navigation components - the user uses these components to give instructions. Input – Components that are used.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems.
Towards a High-Level Petri Net Type DefinitionWorkshop on Interchange Formats for Petri Nets 1/18 June 26, 2004 Towards a High-Level Petri Net Type Definition.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
CS285 Visual Basic 2 Department of Computing UniS 1 Statements in Visual Basic A statement is the fundamental syntactical element of a program smallest.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Design Verification Code and Toggle Coverage Course 7.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC PROGRAMMING FUNDAMENTALS Bilal Munir Mughal 1 Chapter-8.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
JavaScript, Fourth Edition
Systems Analysis and Design in a Changing World, Fourth Edition
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
1. 2 Purpose of This Presentation ◆ To explain how spacecraft can be virtualized by using a standard modeling method; ◆ To introduce the basic concept.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Capturing Requirements. Questions to Ask about Requirements 1)Are the requirements correct? 2)Consistent? 3)Unambiguous? 4)Complete? 5)Feasible? 6)Relevant?
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
REEM ALMOTIRI Information Technology Department Majmaah University.
Department of Computer Science
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Babeş – Bolyai University
Topics Introduction to Repetition Structures
2.5 Another Java Application: Adding Integers
Organization of Programming Languages
More on Graphical User Interfaces
“Smart” State Spaces © Kurt Jensen Department of Computer Science University of Aarhus, Denmark "Smart" State.
Coloured Petri Nets Modelling and Validation of Concurrent Systems
Unit 27 - Web Server Scripting
T. Jumana Abu Shmais – AOU - Riyadh
Coloured Petri Nets Modelling and Validation of Concurrent Systems
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Creating a Simple Game in Scratch
Presentation transcript:

Kurt Jensen Lars M. Kristensen 1 Coloured Petri Nets Department of Computer Science Coloured Petri Nets Modelling and Validation of Concurrent Systems Kurt Jensen & Lars Michael Kristensen Chapter 13: Behavioural Visualisation Coloured Petri Nets Col

Kurt Jensen Lars M. Kristensen 2 Coloured Petri Nets Department of Computer Science CPN models may be complex  The CPN modelling language offers:  abstraction,  hierarchical module concept.  There can still be an overwhelming amount of detail.  Observing every single step in a simulation is often too detailed, especially for large CPN models.  When presenting and discussing a CPN model with people unfamiliar with the CPN modelling language, we need more natural ways to follow a simulation.

Kurt Jensen Lars M. Kristensen 3 Coloured Petri Nets Department of Computer Science Visualisation of the behaviour  The basic idea of behavioural visualisation is to augment the CPN model with visualisation graphics that reflect the execution of the model.  Feedback from simulations can be investigated at a more adequate level of detail using concepts that are specific for the system and domain being modelled.  Behavioural visualisation can be applied in such a way that the underlying formal CPN model becomes fully invisible to the observer.

Kurt Jensen Lars M. Kristensen 4 Coloured Petri Nets Department of Computer Science BRITNeY visualisation tool  CPN Tools can use the BRITNeY visualisation tool to create system and domain-specific graphics on top of CPN models.  The BRITNeY tool is a stand-alone application supporting a wide range of diagram types via a plug-in architecture.  CPN Tools invokes the primitives of BRITNeY via remote procedure calls.  Here we shall present:  Message Sequence Charts.  Interaction Graphics.

Kurt Jensen Lars M. Kristensen 5 Coloured Petri Nets Department of Computer Science CPN model for protocol

Kurt Jensen Lars M. Kristensen 6 Coloured Petri Nets Department of Computer Science Message sequence charts  Message Sequence Charts (MSCs) are used to describe the interaction patterns between processes/entities.  Also known as sequence diagrams (in UML).  Widely used in the telecommunication area (with an international standard).  They are used to specify use cases (i.e. typical scenarios).  CPN Tools supports Message Sequence Charts that are updated during the simulation of a CPN model.  They show what happened during that particular simulation. SenderS-NetworkReceiverR-Network (1,”COL”) Lost:(1,”COL”) 2 2 2

Kurt Jensen Lars M. Kristensen 7 Coloured Petri Nets Department of Computer Science Creation of message sequence charts  To create and initialise a MSC diagram we use primitives provided by BRITNeY.  The following CPN ML code is added to the declarations of the CPN model: structure Msc = MSC (val name = "Protocol"); Name of a new structurePredefined functor (provided by BRITNeY)  Structures and functors are the basic CPN ML constructs that allows larger CPN ML programs to be structured into modules each with their own name space.  Structures are similar to objects as known from e.g. Java.

Kurt Jensen Lars M. Kristensen 8 Coloured Petri Nets Department of Computer Science Creation of columns  The four columns of the MSC can now be created by the following sequence of CPN ML expressions (separated by semicolons): (Msc.addProcess "Sender"; Msc.addProcess "S-Network"; Msc.addProcess "R-Network"; Msc.addProcess "Receiver"); Structure Function in structure Argument (name of column)  The sequence is evaluated by evaluating the individual expressions one by one after each other.  The result of sequence is the result of the last expression.

Kurt Jensen Lars M. Kristensen 9 Coloured Petri Nets Department of Computer Science Code segments  The MSC is updated by means of code segments associated with the transitions of the CPN model.  Piece of Standard ML code which is evaluated each time the transition occurs.  Code segments are typically used to:  update visualisations,  perform nondeterministic calculations, or  read and write files.

Kurt Jensen Lars M. Kristensen 10 Coloured Petri Nets Department of Computer Science Code segment for SendPacket  SendPacket has the following code segment: input (n,d); action SPmsc(n,d);  SPmsc is a function defined as: fun SPmsc (n,d)= Msc.addEvent("Sender","S-Network",NOxDATA.mkstr(n,d)); Input part (specifies the variables of the transition which can be used in the action part) Action part (contains the code to be evaluated when the transition occurs) Label of arrow Text representation of (n,d) Function in Msc structure Creates an arrow in the MSC Takes three parameters Start of arrow Sender column End of arrow S-Network column SenderS-Network (1,”COL”)

Kurt Jensen Lars M. Kristensen 11 Coloured Petri Nets Department of Computer Science Code segment for TransmitPacket input (n,d,success); action TPmsc(n,d);  TPmsc is a function defined as: fun TPmsc (n,d,success) if success then Msc.addEvent("S-Network","R-Network",NOxDATA.mkstr(n,d)) else Msc.addInternalEvent("S-Network","Lost:"ˆ(NOxDATA.mkstr(n,d))); Creates an arrow (as before) Creates a small black square R-NetworkSenderS-Network (1,”COL”) Lost:(1,”COL”) (1,”COL”) Successful transmission Loss of packet

Kurt Jensen Lars M. Kristensen 12 Coloured Petri Nets Department of Computer Science CPN model with code segments for MSC visualisation In this model all action parts are function calls, but in general they can be any CPN ML expression of the proper type Using function calls saves space in the graphical representation of the CPN model

Kurt Jensen Lars M. Kristensen 13 Coloured Petri Nets Department of Computer Science Monitor instead of code segments  The visualisation can also be controlled by means of a monitor (as known from performance analysis).  Invokes the appropriate visualisation primitives depending on which transition occurs. fun obs (Protocol’Send_Packet(1,{n,d})) = SPmsc (n,d) | obs (Protocol’Transmit_Packet(1,{n,d,success})) = TPmsc (n,d,success) | obs (Protocol’Receive_Packet(1,{n,d,k,data})) = RPmsc (n,d,k) | obs (Protocol’Transmit_Ack(1,{n,success})) = TAmsc (n,success) | obs (Protocol’Receive_Ack(1,{n,k})) = RAmsc (n);  By using a monitor we avoid cluttering the graphical representation of the CPN model with code segments.  Moreover, it becomes easy to turn the visualisation on/off by turning the corresponding monitor on/off. Observation function:

Kurt Jensen Lars M. Kristensen 14 Coloured Petri Nets Department of Computer Science System-specific interaction graphics Coloured Petri Nets Col  Shows the current state of the protocol system in a way that can be interpreted without any knowledge of CP-nets. Sender NetworkReceiver Text string to be transmitted Text string received Next packet to be sent Next packet to be received Number of packets on the network buffers By clicking on the green/red button the user can determine whether (1,”COL”) is lost or not.

Kurt Jensen Lars M. Kristensen 15 Coloured Petri Nets Department of Computer Science How to specify the interaction graphics  The interaction graphics is created based on a SceneBeans file.  XML file describing the different elements in the visualisation:  the computer icons,  the network cloud,  the text labels,  the green/red buttons.  The scene file also describes the:  behaviour and timing of the animated graphical objects,  commands that can be invoked from the CPN model.  The BRITNeY visualisation tool contains an editor which can be used to develop the SceneBeans file.

Kurt Jensen Lars M. Kristensen 16 Coloured Petri Nets Department of Computer Science Initialisation of interaction graphics  The interaction graphics is initialised by the following lines of CPN ML code added to the declarations of the CPN model. structure Vis = SceneBeans (val name = "Protocol"); val _ = Vis.setVisualisation ("visualisation.xml"); structure DataDialog = GetString (val name = "Enter message"); globref networkcount = Array.array(4,0); Creates structure representing the interaction graphics diagram Functor provided by BRITNeY Loads the SceneBeans XML file into the diagram Creates a dialog box to be used for entering the message to be transmitted Creates an array used to keep track of the number of packets on the 4 network buffers

Kurt Jensen Lars M. Kristensen 17 Coloured Petri Nets Department of Computer Science Dialog box  When a simulation is started, a dialog box pops up allowing the user to enter the text string to be transmitted.  Simulation pauses until the user has entered the text string. OKCancel Coloured Petri Nets Message to send

Kurt Jensen Lars M. Kristensen 18 Coloured Petri Nets Department of Computer Science How to invoke the dialog box  The dialog box is invoked by a code segment associated with a new transition Init – which is the only enabled transition when simulation starts.  The action part contains a function InitVis which:  pops up the dialog box,  binds the text string entered by the user to the variable data in the output part of the code segment.  Function SplitData splits the text string into a number of tokens. After occurrence of Init transition

Kurt Jensen Lars M. Kristensen 19 Coloured Petri Nets Department of Computer Science InitVis function fun InitVis () = let val data = DataDialog.getString("Message to send","") val _ = Vis.setTextValue("send message",data) val _ = Vis.setTextValue("receive message","") val _ = (networkcount := Array.array(4,0)) in data end; Opens dialog box and gets the string entered by the user Initialises the two labels holding the text to be sent and the text received Resets array to 0s (necessary when we have multiple simulations)

Kurt Jensen Lars M. Kristensen 20 Coloured Petri Nets Department of Computer Science Code segment for SendPacket fun SPvis (n,d) = (Vis.setValue ("packet","text",NOxDATA.mkstr(n,d)); InvokeCommand("send packet"); IncNetworkCount(1)); Increments counter Performs visualisation by moving dots Sets label of packet to be visualised, e.g. (1,”COL”) input (n,d); action SPvis(n,d);  The SPvis function:  visualises the movement of a data packet from the sender into the network. (by displaying some moving coloured dots).  increments the counter in the upper left edge of the network cloud.

Kurt Jensen Lars M. Kristensen 21 Coloured Petri Nets Department of Computer Science Code segment for TransmitPacket fun TPvis (n,d) = (Visualisation.setValue ("packet","text",NOxDATA.mkstr(n,d)); DecNetworkCount(1); InvokeCommand("show buttons"); case Visualisation.getNextEvent () of "success" => (IncNetworkCount(2);true) | _ => false); Makes the green and red squares visible Increments counter in upper right corner and returns true Sets label of packet to be visualised, e.g. (1,”COL”) input (n,d); output (success); action TPvis(n,d);  The TPvis function:  makes the green and red squares visible.  binds the variable success to true/false depending on the choice of the user. Decrements counter in upper left corner Returns false

Kurt Jensen Lars M. Kristensen 22 Coloured Petri Nets Department of Computer Science Monitor instead of code segments  To update the interaction graphics we could consider using a monitor – in a similar way as we did for the MSC.  This is, unfortunately, not possible.  We want to allow the user to interact with the simulation:  input the text string to be sent,  choose between successful transmission and loss.  To do this we need input during the simulation step (to determine the binding of certain variables of the transition).  This is possible with code segments (which are executed during the step) but impossible with monitors (which are executed after the step).

Kurt Jensen Lars M. Kristensen 23 Coloured Petri Nets Department of Computer Science Questions