• No se han encontrado resultados

BENEFICIOS EN LA ETAPA DE GENERACIÓN

In document Introducción de smart grids en el Ecuador (página 115-123)

CAPITULO 6: BENEFICIOS OBTENIDOS CON LA IMPLEMENTACIÓN DE

6.1. BENEFICIOS EN LA ETAPA DE GENERACIÓN

Note that by virtue of the rules, history state machines can be viewed as basic state machines. Thus, for applying aspects to state machines, we need not differ- entiate between basic state machines and history state machines.

6.4. Structural Extension bywhilstAspects

Semantically, whilstaspects define a syntactical extension of the base ma-

chine as well as modifications of its dynamic behavior. In this section, we describe the syntactical extension defined by whilst. Put very simply, awhilstaspect

w extends the base machine by a transition, which reacts totrigger(w), for each state contained inconfig(w). The dynamic semantics ofwhilstaspects will be

handled together with other dynamic HILA aspects in the following Sect.6.5. Given a transition system TSSM, representing a UML state machineSM, the

application of awhilstaspectwtoTSSM, notated byTSw

SM, is a transition sys-

tem withS(TSwSM) =S(TSSM)∪S0andT(TSwSM) =T(TSSM)∪TSMw whereS

0 andTw

SMare the smallest sets which satisfy the following:

• For each s ∈ config(w)∧isSimple(s), there is a transitionts ∈ TSMw

such that σts = σ0ts = ss, et = trigger(w), gts = constraint(w), and

ats =skip.

• For eachs∈config(w)∧isComposite(s), there is a statews,w∈S0, and a transition ts,w ∈ TSMw such thatσts,w = ws,w, σts,w0 = ss, ets,w = ∗,

gts,w =true,ats,w =skip. We further defineWsto be the set of all states

matchingws, , i.e.Ws :={ws,t|source(t) =s}.

• For eachs ∈ config(w)∧isComposite(s), let S be the set of all sim- ple states (directly or recursively) contained ins, i.e. S := {s0 | s0 ∈ subvertex+(s) ∧ isSimple(s0)}, there is for each s0 ∈ S a transition

ts0,w ∈ Tw

SM with σts0,w = ss0, σ

0

ts0,w = ws,w, ets0,w = trigger(w),

gts0,w =constraint(w), andats0,w =skip.

Given twowhilstaspectsw1 andw2, we notate the result of first extending TSSMbyw1and then byw2asTSw1,w2SM , and the result of first extendingTSSMby

w2and then byw1asTSSMw2,w1. Obviously it holds thatTSw1,w2SM =TSw2,w1SM . Given

a set W of whilstaspects, we write TSW

SM to refer to the result of extending TSSMby all aspects contained inW in an arbitrary order.

B «whilst» {trigger = b} C «advice» «pointcut» «aspect» WB

(a) Whilst aspect

F B2A b BW [p] I ab IY IX A X Y B bf bf ba b [else] ba * * * B2F * * * *

(b) Extended transition system

EXAMPLE6.2 (Structural extension bywhilstaspects). Figure6.2acontains

awhilstaspectWB. It defines, besides a behavior extension as will be described

below, a structural extension of the base machine. WhenWBis applied to the base machine SMgiven in Fig.6.1a(i.e. the transition system shown in Fig.6.1b), the transition system is extended to Fig. 6.2b, where new transitions with trigger b

leaving X andY and leading to stateBW, as well as a transition from BWto B, are introduced. Note the advice is not woven into the transition system. In HILA, advices are not understood as syntactical modifications.

6.5. Behavior Extension

To define the semantics of aspects we extend the rule (mch) to operate on a pair consisting of a transition system and a set of (concrete) aspect instances which we will proceed to define.

6.5.1. Pointcut. The pointcut of an aspect determines on which transitions of the base machine the aspect may be executed. On these transitions it must be checked at runtime whether the advice of the aspect should be executed or not.

Given a base machineSM(and its transition systemTSSM) and an aspecta, the

semantics ofpointcut(a)is a setPCaof transitions. We first define some auxiliary

functions:

• For a set of statesX ⊆S(SM),

Simple(X) :={s∈X|isSimple(s)},

• For a set of statesX ⊆S(SM),

Mbefore(X) :=S s∈Xss. • For a states∈S(SM), mtrout(s) :=S s∈subvertex∗(s0)Ss0. • For a states∈S(SM), mwhout(s) :=S s∈subvertex∗(s0)Ws0. • For a set of statesX ⊆S(SM),

Tbefore(X) :={t∈T(TSSM)|σt0 ∈Mbefore(X)}. • For a set of statesX ⊆S(SM),

Tafter(X) :=

{t∈T(TSSM)|(σt∈Ss∈Simple(X){ss} ∧σ0t∈/ S

s∈Simple(X)mtrout(s)) ∨σt∈Ss∈Xmtrout(s)}.

• For a set of statesX ⊆S(SM),

Twhilst(X) := {t∈T(TSSM)|(σt∈Ss∈Simple(X){ss} ∧σ 0 t∈/ S s∈Simple(X)mwhout(s)) ∨σt∈Ss∈Xmwhout(s)}.

PCais a set of transitions, defined as follows:

PCa:=         

Tbefore(config(a)), kind(a) =before

Tafter(config(a)), kind(a) =after

Tbefore(tgt(a))∩Tafter(src(a)), kind(a) =between

Twhilst(config(a)), kind(a) =whilst

6.5.2. Aspect Instance. LetAbe the set of all aspects. Several instances of an aspect may be active simultaneously; to avoid confusing these instances we rename the states of each aspect before activating it. Therefore, we assume an

In document Introducción de smart grids en el Ecuador (página 115-123)

Documento similar