Title: UML-B: Formal Modeling and Design Aided by UML
1UML-B Formal Modeling and Design Aided by
UML
2B-Specification
- -state model based, formal specification
- -3steps(specification,implementation and
implementation) - -for refinement it requires refinement relation
30.. 1
UML-B model
NAME
ltltcreategtgtadd(numbNUMB) ltltdestroygtgt remove() Lookup() numb
NUMB
pbook
1
Operation Guard action
add Numberan(pbook) Pbooknumb
Remove - -
lookup - numbpbook
4Difficulties Translating from UML to B
- B is not object-oriented
- Restrictions on B component and variable access
- Simultaneous calls to several operations of
another machine are not allowed - UML-B profile
- -uses stereotypes
- -defines tagged values(invariants,guards etc)
5UML-B Model Architecture
- Class Diagrams
- -attributes
- -associations
CELL
powerlevel INT
PHONE
ltltconstantgtgt threshold HOLD
current
0..
0..1
1
0..
cellChannels
dspChannels
0..
0..
CHANNEL
broadcasting BOOL
6- TRANSLATION OF uB
- -OCLdefmyExpressionintegera ?
select(ocllsTypeOf(S)).x ? sum() - -uBSi.(i e C ? i e S ? i e a?i.x)
- BEHAVIOUR
- - Invariants
- instance invariants
- class invariants
- - Operation Specification
-
-
- - Initialization
- - Appearance and Disappearance of class
instances - - subroutines
PHONE
startCall(ttCHANNEL) success
CHANNEL
inUseBOOLFALSE
channels
7SPECIALIZATION OF CLASSES
CBCH
TRAFFIC
Callkind CALLKIND
ACCESS
CHANNEL
broadcasting BOOL FALSE
8BEHAVIOURAL SPECIFICATION BY STATE MACHINE
- State Dependant Invariants
- Example of state Machine Behaviour specification
Inc / bx bx1
Inc / bx bx10
new BB
Non_Zero
Zero
Dec bx1
Dec bxgt1
- State machine decision point
s2
G2 /A2
E1 G1 /A1
s1
s3
G4 /A4
G3 /A3
s4
G5 /A5
9G8/A8
s8
E10G10/A10
s10
s9
G9/A9
E5G5/A5
s5
G7/A7
s7
s6
E6G6/A6
10Alternative Semantics for UML-B State Machines
s1
s2
REFINEMENT
refines
ltltrefinementgtgt cellphone1
ltltmachinegtgt cellphone
11Refinement in UML-B
current
PHONE
CELL
PowerlevelINT
TRChannel
cellTRChannels
CBChannel
cellCBChannel
cellASChannles
ASChannels
CBCH
TRAFFIC
ACCESS
callkindCALLKIND
CHANNEL
broadcastingBOOLFALSE
12Refinement Relation
CLASS REFINEMENT_ RELATION
PHONE ChannelsCBChannel U ASChannels
CELL cellChannelscellChannel U cellTRChannels U cellASChannels