-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.sysml
50 lines (46 loc) · 1.45 KB
/
model.sysml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
bdd [package] selfie::acs [ACS]
-------------------------------
block Building
references
rooms: Room[*] <- building
cards: Card[*] <- building
values
emergency: Boolean
block Door
references
from: Room[1] <- exits
to: Room[1] <- entries
values
isOpen: Boolean
operations
pass(card: Card)
pre: mayPass(card)
post: card.location = to
constraints
def: mayPass(card: Card): Boolean =
if from.building.emergency
then isOpen
else card.location = from and card.authorizations->contains(to)
inv: from.building = to.building
inv: isOpen implies from.building.emergency
block Card
references
authorizations: Room[*] <- authorized
location: Room[1] { subsets authorizations } <- checkedIn
building: Building[1] <- cards
constraints
inv: authorizations->forall(r| r.building = self.building)
inv: building.rooms->forall(r | not r.authorized->contains(self) implies not r.hasAccess(self)))
inv: building.rooms->exists(r | r.isSafe and r.hasAccess(self))
block Room
references
building: Building[1] <- rooms
exits: Door[*] <- in
entries: Door[*] <- out
authorized: Card[*] <- authorizations
checkedIn: Card[*] { subsets authorized } <- location
values
isSafe: Boolean
constraints
def: hasAccess(card: Card): Boolean =
card.location = self or entries->exists(e | e.mayPass(card) and e.from.hasAccess(card))