• Non ci sono risultati.

The third technique presented in this section has been defined in order to eliminate non-wanted behaviors in the final GSPN models obtained by following the “full” and the “constrained” methods. As previously explained, these models constraint the system behavior, represented by a set of SCs{sm1, .. . , smK}, for what concerns the execution of those actions that cause the sending of messages represented in the SD sd.

We can observe two important aspects of the behavior of the final GSPN modelLS (produced by adopting either the “full” technique or the “constrained” one) that have to be taken in account during the analysis in order to give the right interpretation of the results obtained.

First, when sd contains asynchronous communications, in the execution paths ofLS that represent the inter-action modeled by the SD the order of execution of the inter-actions that cause the messages to be sent follows the precedence relation of messages in sd, while the reception (and the processing) of the messages does not. The second aspect is that when several state machines can accept the same type of events then, inLS, an event occur-rence generated by the sending of a message can be processed by a state machine that is not the receiver of the message.

An example of this second behavioral aspect is shown in Figure 6.3 where the SCs sc1, sc2, sc3 representing the behavior of classes C1,C2and C3, respectively, are depicted on the upper left side of the Figure, and, on the lower left side are shown their corresponding LGSPN translation. The three classes are involved in the interaction represented by the simple SD, drawn on the right side, together with its corresponding LGSPN model that is a reduced version of the original LGSPN translation to consider only the labeled transitions.

As sc1 and sc2 can perform the same type of action send ev1, in their LGSPN translation, the transitions corresponding to execution of this action are relabeled by prefixing the original label with the name of the state machine they belong to. In the LGSPN translation of sd the transitions representing this action are also relabeled by prefixing the original label with the name of the state machine that performs the action. Since the actions (causing the sending of the messages) of the SD are all the possible interaction actions present in the SCs the models obtained by applying the full and constrained techniques are equal and correspond to the LGSPN model depicted in Figure 6.4.

The model is characterized by two deadlocks: the first one corresponds to the state reached by the system due to the execution of the SD, while the other one corresponds to the state reached by the system due to the processing of the event ev1 by the state machine sc3instead of the state machine sc2, hence, the execution path that ends to this deadlock marking does not represent the interaction modeled by sd. Actually, the LGSPN model of Figure 6.4 contains two non wanted conflicts: the first between transitions T1 and T2 and the second the

CHAPTER 6. JOINT ANALYSIS OF THE TRANSLATED UML DIAGRAMS 131

Figure 6.3: Example of events common to different state machines.

ini_A

Figure 6.4: Final LGSPN model resulting from the application of both the full and the constrained technique.

between transitions T11 and T22. According to sd, transitions T2 and T11 should not exist.

In general, if we assume that all the messages of the SD are timed, to obtain a final model that constraints the system behavior to perform exclusively the interaction represented by the SD, we can adopt one of the solutions described below.

1) Relabeling before composition

The transitions corresponding to the processing of the events that can be accepted by different state machines are relabeled before applying the composition rules 6.1 and 6.2. We can adopt the same criteria used for the relabeling of common actions, so that for each LGSPN component model of the state machineLSsmj we prefix the interested transition labels with the name of the state machine and in the LGSPN component model representing the interactionLSsdwe prefix the interested transition labels with the name of the state machine that receives the event.

In the example of Figure 6.4, transition t1 ofLSsc2and transition t3 ofLSsdshould be relabeled as sc2e ev1, while transition t2 ofLSsc3and transition t4 ofLSsd should be relabeled as sc3e ev1. After the relabeling the final analyzable model, obtained by applying the composition rules 6.1 and 6.2, LS is the one represented in Figure 6.4 without the time transitions T2 and T11 and with the transitions T1 and T22 labeled as sc2e evx and sc3e evx, respectively.

2) L´opez1constrained technique

Let evx be an event that can be accepted by more than one state machine and let m∈ {m1, . . . , mJ} be a message of sd sent to the state machine sm whose reception generates the event evx.

Then from the final LGSPN model obtained by applying the “constrained” techniqueLS we eliminate each timed transition labeled as e evx that results from the synchronization of a transition belonging to the LGSPN model representing a state machine smj6= sm with the timed transition belonging toLSsd and representing the processing of event evx.

Formally, looking at the composition rules used to obtainLS = (S,ψ,λ) and by definition of the superposition operator| |LP,LT, the set of transitions ofLS is equal to

T = Tsc\ TscEevT ∪ Tsd\ TsdEevT ∪ Tnew,

where Tsc is the set of transitions ofLSsc= (Sscscsc), Tsd is the set of transitions ofLSsd= (Ssdsdsd), EevT = LevT∩λsc(Tsc)∩λsd(Tsd) and Tnewis the set of transitions resulting from the composition 6.2. Moreover, since the composition 6.1 of the LGSPN models representing the state K machinesLSsmj = (Ssmjsmjsmj), j = 1, . . . , K used to obtainLSsc and the composition 5.3 of the MLGSPN models representing the J messages ofMLSmi= (Smimimi), i = 1, . . . , J used to obtainLSsdwere performed over place labels, we have:

Tsc= Tsm1∪ ... TsmK, Tsd= Tm1∪ .. . TmJ

1Juan L´opez-Grao is the researcher who first realized this issue on the model of Figure 6.4 and gave me new ideas on how to solve it.

CHAPTER 6. JOINT ANALYSIS OF THE TRANSLATED UML DIAGRAMS 133

Let t∈ Tmsuch thatλm(t) = e evx and sm = m.receiver.availableContents.behavior, then in the set of tran-sitions

Tevxt ={t,t0∈ Tnew: t2−1T (t)) =π2−1T (t0))} we have to eliminate those transitions t:

π1−1T (t))∈ Tsmj where smj6= sm

. In the example of Figure 6.4 the application of the technique results in the elimination of the transitions T2 and T11. Indeed transitions t3 and t4 ofLSsdbelong, respectively, to the sets Tm1 and Tm2, where m1is sent to state machine sc2and m2is sent to state machine sc3. In the set Tev1t3 ={T 1, T 2} we have that:

π1−1T (T 2))∈ Tsc3, sc36= sc2

and in the set Tev1t4 ={T 11, T 22} we have that

π1−1T (T 11))∈ Tsc2, sc26= sc3

Observe that if the messages in sd that provoke such event evx are immediate, the above modifications 1) and 2) do not solve the problem: indeed, the LGSPN translation of immediate messages allows to constrain only the actions that generate the sending of the messages but not the reception of the events. In this situation, we have to translate the immediate messages as they were timed, adopt one of the above solutions and, finally, change all the timed messages, labeled as e evx in the constrained model, to immediate.