• Non ci sono risultati.

The translation of SDs in LGSPN models presented in this chapter takes into account of a subset of basic concepts specified in the Collaborations metamodel and it considers a subset of extended features of the SDs as well. The concepts of the Collaborations metamodel that have not been considered in the translation of SDs are listed below:

Activation An activation (focus of control) shows the period during which an object, that participates to the interaction modeled by a SD, is performing an action. The activation, that is graphically depicted as a tall thin rectangle on the object life-line with the top aligned with its initiation time and with the bottom aligned with its completion time, represents both the duration of the action performed by the object and the control relationship between the activation and its callers. We have decided to not translate explicitly this feature since we think that is more reasonable to consider the time required to execute a given action, being either an action related to communication or an internal action, in the translation of the SC representing the behavior of the object.

Multi-objects A multi-object represents a set of objects belonging to the same class (or playing the same role in the interaction): this feature is described in the context of Collaboration Diagrams but it can be used also in SDs, e.g., to represent a broadcast/ multicast of messages. In both the cases the use of multi-objects implies an “object level modeling” while the proposed GSPN translation of SDs assumes the specification of the system at “class” level.

Timing constraints They are defined by using time expressions on messages; UML specifies several default time functions that can applied to message names to yield a time, e.g., sendTime that returns the time at which the message is sent, receiveTime that returns the time at which the message is received. The proposed translation of SDs produces stochastic models to be used mainly for a quantitative evaluation of the system. Such models are not meant for the validation of timing constraints, for this reason we have not considered this feature in the translation.

Chapter 6

Joint analysis of the translated UML diagrams

This chapter deals with the analysis based on the combined use of Sequence Diagrams (SDs) and StateCharts (SCs) so as to be able to assess what is the consistency among the two UML descriptions, and to stochastically evaluate those behaviors of the system that are consistent with the patterns of interaction described by a SD.

An interesting analysis of the role of SDs with respect to system behavior can be found in [51] where a number of questions are enounced as a basis for a classification actually in the context of Message Sequence Charts but the adaptation to our context is straightforward and leads to the following questions:

Q1 What does a SD mean with respect to the set of system components described by the SCs? Possible answers in our context are: participants to the interaction represented by the SD are all and only those whose behavior is described by the corresponding SCs, or are a proper subset.

Q2 How complete is the information of a SD with respect to the effective exchange of messages described by the SCs ?

Different answers to the above questions lead to different analysis goals, and to different composition of the translated SCs and SDs.

We have identified three different ways to create a final analyzable model of the system, and the relative ob-jectives. By final analyzable model we mean a GSPN model that includes the behavior of the SCs and of their interactions represented by a single SD and on which we can verify logical properties and compute performance/

dependability metrics: therefore, we have to define how the GSPN components are composed, what is the initial marking, the metrics to compute, the properties to check and to assign values to the rate/weight parameters.

We do not deal with the computation of a significant value for the rate and weight parameters: we will assume that for each parameter resulting from the translation of the SCs and of the SD in GSPNs an input value is given.

In Chapter 5, we have suggested a mapping of the parameters of the GSPN models resulting from the translation of the delayed and conditional messages of a SD to some tag associated to thePAstep stereotype in case of annotated SDs according to the UML Profile for Schedulability, Performance and Time Specification[65].

125

It is worth to notice that it is not restrictive to consider a single generic SD instead of a set of independent SDs.

Since a generic SD can contain branch constructs with mutually exclusive messages it is always possible to model a set of independent SDs{sdi}i=1,..,Krepresenting interactions among M components (or among a subset of them) as a unique generic SD representing an interaction among M + 1 components in which the added component is a fictitious external user whose behavior simply consists in sending an initial conditional message mi, (i = 1, ..K) to start the execution of the interaction modeled by the corresponding SD sdi. In Figure 6.1 is shown how two independent SDs sd1and sd2(on the left side) can be represented as a unique SD (on the right side): the external user can send either message m10 or message m20 and the communication causes the execution of either sd1 or sd2, respectively.

/rj:cj

/rl:cl :ck

m11

m12

m13

/rj:cj :ck :cy

m21

m22

m23

/rj:cj

/rl:cl :ck :cy

m11

m12

m13

m21

m22

m23

[c1]m10

[c2]m20

c1 AND c2 = false c1 OR c2 = true sd1

sd2

Figure 6.1: Representation of two independent SDs as a unique generic SD.

The case in which the K SDs are not independent is not trivial, since cause-effect relations of the messages belonging to different SDs have to be taken in account and this implies a re-definition of the precedence relation established between messages: this issue will be matter of future research work.

We will then assume that there are K SCs{sm1, ..., smK} and a single generic SD sd. Let {LSsm1, ...,LSsmK} be the LGSPN models of the K SCs produced according to the translation given in [59] andLSsd the LGSPN model of the SD produced according to the translation given in Chapter 5.

6.1 The full technique

The first technique, that is called “full”, is based on the construction of a complete SC model by superposition over event and event acknowledge places of the K SCs, and on the composition of the resulting model with the

CHAPTER 6. JOINT ANALYSIS OF THE TRANSLATED UML DIAGRAMS 127 one representing the SD.

Let Evkbe the set of events produced/consumed by smkand LevkPthe set of labels of event and event acknowl-edge places, LevkP={e evx, ∀evx ∈ Evk}S{ack evx, ∀evx ∈ Evk}, and LevP=Sk∈{1,...,K}LevkP, then the complete model sc of the K SCs is given by the LGSPN

LS0sc=

j=1,..,K /0,Lev| |P

LSsmj (6.1)

Observe that this has exactly the same effect as a superposition over the all set of labels LP=Sk∈{1,...,K}LkP, since the only place labels that appear in more than one LGSPN are those associated with event and event acknowledge places.

LS0can contain acknowledge places that are sinks (indeed all transitions that represent the consumption of an event send an acknowledge back since it is not defined if the event is synchronous or asynchronous), but if the event is generated by an asynchronous action no acknowledge is ever consumed and therefore the corresponding places should be removed. Let Pack be the set of sink places with label of type ack evx, then the model sc is:

LSsc=LS0sc\ Pack

where A\ B removes from net A all places in B and their incidence arcs.

Let LevT be the set of transition labels that represents actions and events consumption in the SD sd:

LevT={e evx, ∀evx ∈ Esd}[{acty, ∀acty ∈ AAsd} [{S acty, E acty ∀acty ∈ ASsd}

where Esdis the set of events of sd, AAsdand ASsdare the set of asynchronous and synchronous actions of sd.

The final LGSPN modelLS is obtained by superposition ofLSscandLSsdover the set of transitions of labels in the set LevT, that is to say:

LS=LSsc | |

LevT,/0LSsd (6.2)

Again, according to the labeling produced by the translation, by using the whole set of transition labels we would get the same resulting net.

Note that a transition that is produced by the superposition of two transitions of different priority is assigned a priority equal to the lower of the twos (so the superposition of an immediate with a timed produces a timed transition).

Observe that in the model produced according to the “full” technique the presence of sd only constraints the sc behavior for what concerns the actions modeled inLSsd, while all others interactions among and inside K SCs are still freely permitted.

The default initial marking ofLS is derived from the initial markings assigned to its component modelsLSsc

andLSsd: indeed, since the composition is performed over transitions, the marking of the places of the com-ponent models is not changed. This marking represents the initial state of each participant j to the interaction,

modeled by the corresponding smj( j = 1, ..., K), and, if the sd is not characterized by an initial iteration of a set of messages, the initial state of the sd. The initial marking of the LGSPNLSmay be re-defined or not depending on the type of analysis that has to be carried out and, in particular, on the metrics that have to be computed.

Assuming that the LSGPN model LSsd, representing sd, is characterized by sink places, then on the “full”

model we can check the properties and compute the metrics listed in the following:

Prop1 From the initial marking it is possible to reach one (or more than one) state in which sink place(s) ofLSsd

is (are) marked. Let Mend be one such state.

Prop2 Compare the actions that are included in the shortest path of the reachability graph ofLS which starts from the initial marking M0and ends in Mendwith the actions that are modeled inLSsd.

Metric1 Compute transient measures for entering specific states (for example Mend).

If, instead, the LGSPN modelLSsddoes not has sink places, meaning that the corresponding sd is characterized by a unique iteration that includes all the messages of the SD, we can check and compute the following properties onLS:

Prop3 Provided that initial marking M0represents the initial state of the SCs{sm1, . . . , smK} and of sd, verify whether it is reachable from any other reachable marking (i.e., whether it is an home state).

Metric2 Compute steady state measures as the mean execution time Tsdexecof the interaction represented by sd.

The interpretation of the results obtained depends on the hypothesis we are making on the reciprocal role of sc and sd. Coming back to the two questions Q1 and Q2 stated in the introduction of this chapter, if we assume for Q1 that the set{sm1, . . . , smK} includes SCs that are not involved in the sd interaction, then it is highly probable that states like Mend (Prop1) are not deadlock states, since the system may be able to evolve, even if the only marked places of sd are sink places. Moreover the shortest path to Mend (Prop2) may well contain actions that are not considered in the sd interaction, but that belong to the sc description. Finally, the measures refer either to the (potentially) many possible ways of reaching Mend(Metric1) or to the (potentially) many possible durations Tsdexec

i of execution of sd (Metric2) taking stochastically into account the whole behavior of the system.

Question Q2 is answered by Prop2 and Prop3 above: if the shortest path to Mend (Prop2) includes actions not in sd then sd only describes a subset of the interactions. On the other hand, if either no marking Mendis reachable from M0 (Prop2) or the initial marking M0is not an home state (Prop3), then sd describes an interaction that can never take place in the sc description of the system.