Feature Petri Nets

Feature Petri Nets

Feature Petri Nets Radu Muschevici Dave Clarke Jose´ Proenc¸a DistriNet & IBBT, Dept. Computer Science Katholieke Universiteit Leuven, Belgium Email: fradu.muschevici, dave.clarke, [email protected] Abstract—In software product line (SPL) engineering, formal The main contribution of this paper is two Petri net variants modelling and verification are critical for managing the inher- suitable for modelling software product lines. These models ent complexity of systems with a high degree of variability. enable the specification of system behaviour such as resource The number of products in an SPL can be exponential in the number of features. Therefore, the challenge when usage and workflow of the entire product line in one model. modelling SPL lies in analysing and verifying large, complex We extend Petri nets in two steps. We start by guiding models efficiently, in order to ensure that all products behave the execution of a Petri net based on the feature selection, correctly. The choice of a system modelling formalism that and later we introduce a mechanism to update the feature is both expressive and well-established is therefore crucial. selection based on the execution of the Petri net. We call In this paper we propose two lightweight extensions to Petri nets: Feature Petri Nets provide a framework for modelling the first model Feature Petri Nets (FPN), and the second and verifying software product lines; and Dynamic Feature Dynamic Feature Petri Nets (DFPN). Our models provide Petri Nets provide additional support for modelling dynamic an elegant separation between behaviour, modelled by the software product lines. underlying Petri net, and available functionality, modelled Keywords-software product lines; behavioural models; dy- by feature sets. namic variability; Petri nets; The paper is organised as follows. The next section shows a motivating example. Section III formally introduces the I. INTRODUCTION notion of Feature Petri nets. SectionIV motivates Dynamic Feature Petri Nets and SectionV presents their formal The need to tailor software applications to specific re- semantics. SectionVI discusses the relation of FPN and quirements, such as specific hardware, markets or customer DFPN to Petri Nets and how they can be used to model SPL. demands, is growing. If each application variant is maintained Section VII discuses related work. Section VIII presents our individually, the management overhead quickly becomes conclusions and future work. infeasible [1]. Software Produce Line Engineering (SPLE) is seen as a solution. II. FEATURE PETRI NET EXAMPLE A Software Product Line (SPL) is a set of software We illustrate the modelling challenge in SPLE using an products that share a number of core properties but also example of a software product line of coffee machines. A differ in certain, well-defined aspects. The products of an manufacturer of coffee machines offers products to match SPL are defined and implemented in terms of features, which different demands, from the basic black coffee dispenser, to are subsequently combined in specific ways to obtain the more sophisticated machines, such as ones that can add milk final software products. The key advantage hereby over or sugar, or charge a payment for each serving. Each machine traditional approaches is that all products can be developed variant needs to run software adapted to the set of hardware and maintained together. A challenge for the SPL approach features. Such a family of different software products that is to ensure that all products meet their specifications without share functionality is typically developed using an SPLE having to check each product individually, but rather checking approach, that is, as one piece of software structured along the product line itself. This raises the need for novel SPL- distinct features. This has major advantages in terms of code specific formalisms to model SPL and reason about and reuse, maintenance overhead and so forth. The challenge is verify their properties. ensuring that the software works appropriately in all product Petri nets [2] provide a solid formal basis for system configurations. modelling. They have been studied and applied widely, and Petri nets are used to specify how systems behave. Figure1 they come with a wealth of formal analysis and verification presents an example of a Petri net for a coffee machine. techniques. Places, represented by circles, can host tokens, represented by dots or a natural number, and the execution of a Petri net This research is partly funded by the EU project FP7-231620 HATS: consists of the flow of tokens between places via transitions, Highly Adaptable and Trustworthy Software using Formal Methods (http://www.hats-project.eu), and the K.U.Leuven BOF-START project depicted as filled rectangles. In our example, the coffee STRT1/09/031 DesignerTypeLab. machine has a capacity for n coffee capsules; it can brew the product corresponding to the feature selection. Second, SERVE COFFEE by projecting an FPN onto a feature selection, one obtains a Petri net describing the behaviour of the same product. We WAIT READY show that these two notions of semantics coincide. We start with some necessary preliminaries, first by BREW defining multisets and basic operations over multisets. Then n we define Petri nets and their behaviour. FULL REFILLABLE Definition 1 (Multiset). A multiset over a set S is a mapping REFILL COFFEE M : S ! N. We view a set S as a multiset in the natural way, that is, Figure 1: Petri net model of a basic coffee machine that can S(x) = 1 if x 2 S, and S(x) = 0 otherwise. We also lift only dispense coffee. arithmetic operators to multisets as follows. For any function : N × N ! N and multisets M1, M2, we define M1 M2 as (M1 M2)(x) = M1(x) M2(x). A. Petri Nets and serve coffee, and refill the machine with new coffee capsules. Note that in our model the action ‘refill’ does not To ground our theory, we recall the terminology and mean filling the coffee reservoir completely, but refilling only notation surrounding Petri nets [4]. one unit of coffee. Definition 2 (Petri Net). A Petri net is a tuple (S; T; R; M0), If we now add the Milk feature, that is, if we assume where S and T are two disjoint finite sets, R is a relation that the coffee machine can also add milk to the coffee, on S [ T (the flow relation) such that R \ (S × S) = we need to adapt the Petri net. Furthermore, for every new R \ (T × T ) = ;, and M0 is a multiset over S, called the feature we would need to specify a new Petri net for each initial marking. The elements of S are called places and the possible combination of features, resulting in an explosion elements of T are called transitions. Places and transitions of combinations. are called nodes. We address this problem by annotating transitions with application conditions [3], which are logical formula over Sometimes we omit the initial marking M0. features that reflect when the transition is enabled. Our Definition 3 (Marking of a Petri Net). A marking M of a example considers a product line whose products are over the Petri net (S; T; R) is a multiset over S. A place s 2 S is set of features fCoffee; Milkg. The new Petri net model is marked iff M(s) > 0. called Feature Petri Nets (FPN). Figure2 exemplifies an FPN of a coffee machine with a milk reservoir. The conditions Definition 4 (Pre-sets and post-sets). Given a node x of a on the transitions reflect that the three transitions on the Petri net, the set •x = fy j (y; x) 2 Rg is the pre-set of x right-hand side can be taken only when both features Coffee and the set x• = fy j (x; y) 2 Rg is the post-set of x. and Milk are present, and the three transitions on the left- Definition 5 (Enabling). A marking M enables a transition hand side can be taken when the Coffee feature is present. t 2 T if it marks every place in •t, that is, if M ≥ •t. The restriction of the example net to the transitions that can fire for feature selection fCoffeeg is exactly the Petri net in The behaviour of a Petri net is a sequence of states, Figure1, after removing unreachable places. where each state is defined by a marking. The change from the current state to a new state occurs by the firing of a III. FEATURE PETRI NETS transition. A transition t can fire if it is enabled. Firing Feature Petri nets (FPN) are a Petri net variant used to transition t changes the marking of the Petri net by decreasing model the behaviour of an entire software product line. For the marking of each place in the pre-set of t by one, and this purpose, FPN have application conditions [3] attached increasing the marking of each place in the post-set of t by to their transitions. An application condition is a boolean one. logical formula over a set of features, describing the feature combinations to which the transition applies. It constitutes a Definition 6 (Transition occurrence rule). Given a Petri net necessary (although not sufficient) condition for the transition N = (S; T; R), a transition t 2 T occurs, leading from a state with marking Mi to a state with marking Mi+1, denoted to fire. In effect, if the application condition is false, it is as t if the transition was not present. Mi −! Mi+1, iff the following two conditions are met: We define Feature Petri Nets and give their semantics. We • Mi ≥ t (enabling) present two semantic accounts of FPN. First, when a set of • • features is selected, an FPN directly models the behaviour of Mi+1 = (Mi − t) + t (computing) Coffee Coffee ^ Milk SERVE COFFEE SERVE COFFEE W/MILK Coffee Coffee ^ Milk WAIT READY READY BREW ADD MILK n m Coffee Coffee ^ Milk FULL REFILLABLE FULL REFILLABLE REFILL COFFEE REFILL MILK Figure 2: FPN of the product line ffCoffeeg; fCoffee; Milkgg showing each product in its initial state.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us