Automatic Conversion from UML to CPN for Software ... - Science Direct

0 downloads 0 Views 233KB Size Report
Unified Modeling Language (UML) and Colored Petri Net (CPN) have a lot of ... Keyword: CPN; UML; performance evaluation model; automatic conversion; ...
Available online at www.sciencedirect.com Available online at www.sciencedirect.com

Procedia Engineering

ProcediaProcedia Engineering 00 (2011) Engineering 29 000–000 (2012) 2682 – 2686 www.elsevier.com/locate/procedia

2012 International Workshop on Information and Electronics Engineering (IWIEE)

Automatic Conversion from UML to CPN for Software Performance Evaluation ZHU Lian-Zhanga*, KONG Fan-Sheng College of Computer and Communication Engineering, China University of Petroleum, Qingdao 266555, China

Abstract In the area of software performance evaluation, performance characters would not show up until the realization of the software when failures are unavoidable. Up to now the best way to solve this problem is to bring performance evaluation mechanism of software into software development life cycle through the way of modeling and simulation. Unified Modeling Language (UML) and Colored Petri Net (CPN) have a lot of advantages in software design and dynamic simulation respectively. So expanding UML models to performance models, and then converting to CPN models is considered one of the most effective ways to solve the software performance evaluation problems. However, the transformation needs a lot of manual intervention because of the differences between the semantic of the two models. In this paper, we propose an approach based on modular transformation, providing an intermediate model consists of modules which are abstracted from the elements in UML and CPN according to function and structure. The transformation is composed of three steps: expanding UML models, extracting intermediate model and converting them to CPN models. The transformation is automatic and needs little manual intervention. The converted CPN models can work correctly and provides a basis for software performance evaluation. An example of this method is given to verify its effectiveness and reasonability.

© 2011 Published by Elsevier Ltd. Open access under CC BY-NC-ND license. Keyword: CPN; UML; performance evaluation model; automatic conversion; intermediate model

1. Introduction The development of large-scale software is usually according to software development life cycle, but performance always comes out accurately after the completion of software, when the failure of software

* Corresponding author. Tel.: +86-532-86981957; fax: +86-532-86981339. E-mail address: [email protected].

1877-7058 © 2011 Published by Elsevier Ltd. Open access under CC BY-NC-ND license. doi:10.1016/j.proeng.2012.01.372

2

ZHU Lian-Zhang KONG Fan-Sheng Procedia Engineering 29 (2012) 2682 – 2686 ZHU and Lian-Zhang / Procedia /Engineering 00 (2011) 000–000

performance means the failure of the whole. Therefore, the introduction of performance evaluation mechanism during software development cycle is of great significance to ensure the smooth development of software projects. From the 1980s, many scientists begin to discuss software performance evaluation, for example, queuing network[1], Petri net[2], Stochastic process algebras[3]. All of these can also be applied to evaluate software performance. Although these solutions are reliable and accurate, it becomes very difficult to compute because of the state space explosion when the system reaches a certain size. Marsan, Giovanni, Kurt, Wells, etc. give methods of performance evaluation from the perspective of software modeling and simulation using Petri nets and colored Petri net (CPN)[4,5]; this method largely avoids the problem of state space explosion and is considered to be one of the most suitable methods for system performance evaluation. But it requires evaluation staff to master CPN in order to build models by themselves, and this may be a great challenge. Given the wide application range of Unified Modeling Language (UML) in software life cycle, the most effective way to solve the problems of software performance is considered to build performance models from the pre-established UML documents and simulate, evaluate the models dynamically. Smith also published a book, introducing performance engineering to software engineering firstly[6]. Currently methods applying UML modeling and simulation to performance evaluation at home and abroad can be divided into three types: The first type is theoretical exploration. These works[7,8] confirm the ability of UML extension mechanisms to express the performance of software. Unfortunately, they have no platforms to use. The second kind of method is largely based on the characteristics of UML performance models, dividing the execution of process into modules, etc. Firstly, calculating the entire or part of the resource utilization according to that of each module, and thus computing performance indicators by using queuing network (QN). Some typical representatives are Smith, Marzolla, Petriu and other work [6, 9]. Such method has the advantage of simple calculation and having the only results, but the execution is not always easy to express the execution of process using sequences, branches, and loops. The third kind of methods mainly focus on converting UML performance models directly into executable CPN [10-14], which we call dynamic simulation. Due to CPN has the ability of Turing machine[5], which is considered the most effective method for software performance evaluation. These methods avoid the shortage of the second method through simulation. But because of he semantic differences between CPN and UML, it is difficult to make a correspondence between them, and always requiring a lot of manual intervention. The method this article describes introduces an intermediate layer - the "intermediate model" between the UML and the CPN model, which provides a support similar to the structured programming language, in addition to the support for structured process such as order, branches, loops, but also the support of introduction of events strategy and random responses. Intermediate model is composed of a variety of types of nodes: simple node, resource node, etc. In the process of conversion to CPN model, each type of node has a specific corresponding with CPN module, so we can establish a direct correspondence between the intermediate model and the CPN model. The intermediate model can solve the semantic differences between UML and CPN, and lays the foundation for the automatic conversion from UML to CPN. This is meaningful for understanding the software performance accurately and availability ahead of time in large-scale software development cycle. 2. Automatic Conversion Mechanism from UML to CPN According to the characteristics of current life-cycle in software engineering, the general software development process generates UML documents in every stage. This paper involves three processes: the

2683

2684

ZHU Lian-Zhang and KONG Fan-Sheng / Procedia Engineering 29 (2012) 2682 – 2686 ZHU Lian-Zhang / Procedia Engineering 00 (2011) 000–000

extension of UML models, extracting the intermediate model, and finally transforming the intermediate models into CPN performance evaluation model. This paper mainly discusses the automatic conversion from UML sequence diagram to a CPN model. 2.1. Extension of UML models The UML models generated in general software design cycle are lack of information required for performance evaluation, so we need to introduce this information into the UML design model by UML extension mechanism. UML SPT[15] and UML-MARTE[16] provide a good reference for UML modelbased expansion. But this information is still insufficient to achieve automatic conversion from UML to CPN. So we need to build intermediate model and its node library. 2.2. Intermediate model and its node library This intermediate model supports XMI format. Its structure is similar to the structure of programming language, and can be constituted by many layers. It is composed of nodes in the node library, which contains five types: Simple nodes, Resource nodes, Structure nodes, Functional nodes, and ResourceVisit nodes. Nodes are equivalent to stereotypes in UML. Extension of UML design model is actually a process to identify the elements in UML models. In the conversion from the intermediate model to the CPN model, each node has a corresponding CPN model. 1) Simple node: It is a description of the simplest node in the process similar to the basic statements in high-level programming language. It is corresponding to a transaction and a place in CPN. 2) Structure Node: It is a description of opt, loop, case and par structure in the process. a) opt node is similar to “if” statement in high-level programming language, depending on a guard condition to determine whether to execute. And loop node is similar to “loop” statement, displaying behavior needed to repeat. c) par node represents that a segment in the process is executed in parallel, and CPN also has its own advantages in describing parallel and concurrent. Fig 1 shows an example of loop.

Fig.1Example of the loop node and its corresponding CPN

3) Functional Node: it is a class of nodes with specific functions which maps a complex CPN module, such as arrival node, counter node, start node, end node. Arrival node records the event entry strategy (arrival rate, distribution subject to, etc.).

Fig.2 Example of the Arrival node and its corresponding CPN

3

ZHU Lian-Zhang KONG Fan-Sheng Procedia Engineering 29 (2012) 2682 – 2686 ZHU and Lian-Zhang / Procedia /Engineering 00 (2011) 000–000

4

4) Resource node establishes the registration of resources use, including the initial number of resources, access time, and default-use time. Resource-Visit node represents the visit of a sequence of resources, recording the resource, request time and use of time. 3. Automatic conversion instance This paper further illustrates the automatic conversion theory through an example. Figure 3(a) shows a login process. The symbol marked with "opt" shows an optional step in the process. 1) The sequence diagram and expansion. In this case, the objects DB, Idle are expanded as resource node, and the call messages are expanded as resource-visit node. Routing structure opt are extended to structure node. After expansion, the next step is to extract intermediate model.

Fig.3 (a)The sequence diagram; (b)Its intermediate model

2) Automatic conversion from UML to CPN. In the intermediate model, nodes represent the node sequence; resources represents all the resources related to this process. 5 1 3

2

4

Fig.4 (a) CPN model; (b) adding a monitor ; (c) log output file

3) After extracting the intermediate model, the next step is to translate every node to its corresponding CPN model. Transformed CPN model can run directly. On this basis, the performance evaluator can modify the model with individual needs, such as adding a monitor to a place. In this case, we add a monitor to place user, In Fig 4(b). Part of the output file is shown in Figure 4(c).

2685

2686

ZHU Lian-Zhang and KONG Fan-Sheng / Procedia Engineering 29 (2012) 2682 – 2686 ZHU Lian-Zhang / Procedia Engineering 00 (2011) 000–000

4. Conclusion This paper presents a approach of conversion from the UML sequence diagram to an intermediate model, and then converted to a CPN model, which resolves the problem of needing a lot of manual intervention. The intermediate model fills the semantic gap between UML and CPN. The transformed CPN model can be directly used for performance evaluation, providing the basis for the automation of large-scale software performance evaluation. Therefore, in the software development life cycle, performance evaluation can be implemented quickly at any time in order to prevent software failure caused by performance problems. The conversion method proposed in this paper need improvement in some areas: such as variable declaration in the CPN, ML function block, etc. References [1] E.D. Lazowska, et. al. Quantitative System Performance, Prentice-Hall, Inc. 1984 [2] Lin C. Stochastic Petri net and system performance evaluation. BeiJing: Tsinghua university press, 2005.4 [3] D. Compare, et. al. Our experience in the integration of process algebra based performance validation in an industrial context. Tech. Rep. TR SAH/047, MIUR Sahara Project, Oct. 2003 [4] M.A. Marsan. On Petri Net-Based Modeling Paradigms for the Performance Analysis of Wireless Internet Accesses (PNPM'01), September 2001 [5] J. Kurt. Coloured Petri Nets. Basic Concepts, Analysis Methods and Practical Use. Volume 1, Basic Concepts. Monographs in Theoretical Computer Science, Berlin, Germany: Springer–Verlag. 1997 [6] C. U. Smith. Performance Engineering of Software Systems. Addison-Wesley, 1990 [7] A. Gherbi, F. Khendek. From UML/SPT models to schedulability analysis: approach and a prototype implementation using ATL, Autom Softw Eng (2009) 16: 387–414 [8] A. W. Liehr, K. J. Buchenrieder. Generation of MARTE Allocation Models from Activity Threads, Languages for Embedded Systems and Their Applications, Lecture Notes in Electrical Engineering 36, Springer Science + Business Media B.V. 2009 [9] M. Marzolla, S. Balsamo. UML-PSI: the UML performance simulator, First International Conference on the Quantitative Evaluation of Systems, 2004. QEST 2004. pp340 - 341 [10] Shin, E. Michael, et. al. Mapping of UML–based System Model to Design/CPN Model for System Model Evaluation, Workshop on Compositional Verification of UML'03 (San Francisco, CA, October 22) [11] Y. Shinkawa. Inter-Model Consistency in UML Based on CPN Formalism, APSEC'06, December 2006 [12] D. Salvatore, et. al. From UML to Petri Nets: The PCM-Based Methodology, IEEE Transactions on Software Engineering, Volume: 37 , Issue: 1 , 2011 , pp 65 - 79 [13] H. Zhang, L. Zhu. Building dynamic model in UML using colored petri nets, 1st International Symposium on Computer Network and Multimedia Technology, CNMT 2009, December 18, 2009 [14] L. Zhu, M. Zhang. Modeling and Evaluating of Net Protocol Based on Timed Colored Petri Net, 1st International Conference on Modeling and Simulation, AUG 04-07, 2008 [15] Object Management Group (OMG). UML Profile for Schedulability, Performance and Time specification. Final Adopted Specification ptc/02-03-02, OMG, Mar. 2002 [16] Object Management Group. UML Profile for Modeling and Analysis of Real-Time and Embedded systems (MARTE) RFP, document realtime/05-02-06, Feb.6, 2005

5