Home   :   Matrix Language   :   Model Examples   :   Gothic Hotel

Gothic Hotel Model

 

Introduction

 

This example shows how the Gothic Hotel security system should be analysed by using entities abstracted from the problem space. The previous example model, Gothic Hotel Controller followed the original article by implementing a state machine based solution.

 

The Gothic Hotel model is based on a description of an amusing but fantastical security system described by Martin Fowler of ThoughtWorks while discussing Domain Specific Languages (DSL) . The article is an extract from his book, Domain-Specific Languages and discusses the different forms a DSL can take by way of this introductory example.

 

 

UML Diagram Notation Conversion

 

Unfortunately, the existing de facto UML notation is sub-optimal for Matrix analysis. Instead, the notation used in the Shlaer-Mellor method has been enhanced for use with the Matrix language. For completeness, the names of the Shlaer-Mellor diagrams have also been included in the table below:

 

 

Matrix Notation Executable UML Notation Shlaer-Mellor Notation
Domain Bridge Diagram (DBD) Package Diagram Domain Chart
Entity Relationship Diagram (ERD) Class Diagram Information Model
State Transition Diagram (STD) Statechart State Transition Diagram
Process Flow Diagram (PFD) Activity Diagram Action Data Flow Diagram

 

 

Overview

 

The Gothic Hotel model describes a security system which controls access to a secret panel in a guest's room.

 

The panel can be opened only after performing a series of actions such as closing the room door and turning on a light.

 

Matrix Model Walkthrough

 

The Domain Bridge Diagram (DBD) below shows the application Gothic Security domain and sets the system boundary for the model.

 

Realm: Analysis_Of_Application (Domains)

 

The Entity Relationship Diagram (ERD) below shows the relationships between the various entities in the Gothic Security domain.

 

A secret panel is unlocked by going through one or more unlocking sequences. Each unlock step in a sequence is detected by a sensor device built in to a furniture item. If an action is performed out of sequence then that sequence is cancelled but another sequence may still remain valid.

 

The notation used by the diagrams below is based on Shlaer-Mellor Method notation (similar to UML) . To see an annotated version, click on the diagram.

 

Domain: Gothic Security

 

The diagram below shows all the STDs from the Gothic Security domain without showing how they interact. Click on the picture to get an expanded view of the diagram.

 

Domain State Transition Diagrams (Separate)

 

The Gothic Hotel Security domain works by hidden devices sending signals to a central computer which is also hidden. The computer unlocks a secret panel if the certain actions take place in the correct order.

 

Opening the room door resets the system. Immediately closing the door prepares the system to receive unlocking steps by making active all unlocking sequences belonging to the secret panel in that room.

 

When the correct unlock action is received the corresponding unlock step is in the primed state. The unlock will then prime the next unlock step and so on until the sequence is complete. If the unlock is not in the prime state when it receives the unlock event the sequence is cancelled.

 

Click on the picture below to get an expanded view of the diagram showing the source of actual events and their destination among the collaborating entity STDs. An event based notation is used .

 

Domain State Transition Diagrams (Annotated)

 

The Role of Domain Specific Languages

 

In Matrix, a Domain Specific Languages' only role is to make the completion of the M0 Silo object model easier for the user.

 

The M0 Silo provides the complete dynamic state of the entire model frozen in time. This system starting point initialises the state machine in the Gothic Hotel model.

 

The Matrix model initialisation section, M0 Silo, is introduced by the following Matrix statements:

 

 

Silo:M0:Real_World_Objects

RealmObject:Objects_Of_Analysis

DomainObject:Gothic_Security

 

 

The EntityObject statement introduces an entity's objects, relations and events that are to be initialised.

 

 

|-----------

 

EntityObject:Room_Device

Object

| Identity                              | State    | Name

ROOM_DEVICE_101_ROOM_DOOR               : Redirect : "Door"

ROOM_DEVICE_101_SECRET_PANEL            : Redirect : "Panel"

ROOM_DEVICE_101_UNLOCKING_DEVICE_LIGHT  : Redirect : "Light"

ROOM_DEVICE_101_UNLOCKING_DEVICE_DRAWER : Redirect : "Drawer"

ObjectRelation:Contained_in:Room

ROOM_DEVICE_101_ROOM_DOOR               : ROOM_101_MISS_GRANT

ROOM_DEVICE_101_SECRET_PANEL            : ROOM_101_MISS_GRANT

ROOM_DEVICE_101_UNLOCKING_DEVICE_LIGHT  : ROOM_101_MISS_GRANT

ROOM_DEVICE_101_UNLOCKING_DEVICE_DRAWER : ROOM_101_MISS_GRANT

ObjectRelation:Generalisation:Room_Door

ROOM_DEVICE_101_ROOM_DOOR : ROOM_DOOR_101

ObjectRelation:Generalisation:Secret_Panel

ROOM_DEVICE_101_SECRET_PANEL : SECRET_PANEL_101

ObjectRelation:Generalisation:Unlocking_Device

ROOM_DEVICE_101_UNLOCKING_DEVICE_LIGHT  : UNLOCKING_DEVICE_101_LIGHT

ROOM_DEVICE_101_UNLOCKING_DEVICE_DRAWER : UNLOCKING_DEVICE_101_DRAWER

 

|-----------

 

EntityObject:Room_Door

Object

| Identity    | State

ROOM_DOOR_101 : Open

ObjectRelation:Specialisation:Room_Device

ROOM_DOOR_101 : ROOM_DEVICE_101_ROOM_DOOR

 

|-----------

 

EntityObject:Secret_Panel

Object

| Identity       | State

SECRET_PANEL_101 : Closed

ObjectRelation:Opened_by:Unlocking_Sequence

SECRET_PANEL_101 : UNLOCKING_SEQUENCE_101_ID001

SECRET_PANEL_101 : UNLOCKING_SEQUENCE_101_ID002

ObjectRelation:Specialisation:Room_Device

SECRET_PANEL_101 : ROOM_DEVICE_101_SECRET_PANEL

 

|-----------

 

EntityObject:Unlocking_Device

Object

| Identity                  | State

UNLOCKING_DEVICE_101_LIGHT  : Updating

UNLOCKING_DEVICE_101_DRAWER : Updating

ObjectRelation:Sets:Unlock_Step

UNLOCKING_DEVICE_101_LIGHT  : UNLOCK_STEP_101_SEQ001_LIGHT_ON

UNLOCKING_DEVICE_101_LIGHT  : UNLOCK_STEP_101_SEQ002_LIGHT_ON

UNLOCKING_DEVICE_101_DRAWER : UNLOCK_STEP_101_SEQ001_DRAWER_OPEN

UNLOCKING_DEVICE_101_DRAWER : UNLOCK_STEP_101_SEQ002_DRAWER_OPEN

 

|-----------

 

EntityObject:Unlocking_Sequence

Object

| Identity                   | State

UNLOCKING_SEQUENCE_101_ID001 : Idle

UNLOCKING_SEQUENCE_101_ID002 : Idle

ObjectRelation:Opens:Secret_Panel

UNLOCKING_SEQUENCE_101_ID001 : SECRET_PANEL_101

UNLOCKING_SEQUENCE_101_ID002 : SECRET_PANEL_101

ObjectRelation:Starts_at:Unlock_Step

UNLOCKING_SEQUENCE_101_ID001 : UNLOCK_STEP_101_SEQ001_LIGHT_ON

UNLOCKING_SEQUENCE_101_ID002 : UNLOCK_STEP_101_SEQ002_DRAWER_OPEN

 

|-----------

 

EntityObject:Unlock_Step

Object

| Identity                         | State

UNLOCK_STEP_101_SEQ001_LIGHT_ON    : Locked

UNLOCK_STEP_101_SEQ001_DRAWER_OPEN : Locked

UNLOCK_STEP_101_SEQ002_DRAWER_OPEN : Locked

UNLOCK_STEP_101_SEQ002_LIGHT_ON    : Locked

ObjectRelation:Followed_by:Unlock_Step

UNLOCK_STEP_101_SEQ001_LIGHT_ON    : UNLOCK_STEP_101_SEQ001_DRAWER_OPEN

UNLOCK_STEP_101_SEQ002_DRAWER_OPEN : UNLOCK_STEP_101_SEQ002_LIGHT_ON

ObjectRelation:Part_of:Unlocking_Sequence

UNLOCK_STEP_101_SEQ001_LIGHT_ON    : UNLOCKING_SEQUENCE_101_ID001

UNLOCK_STEP_101_SEQ001_DRAWER_OPEN : UNLOCKING_SEQUENCE_101_ID001

UNLOCK_STEP_101_SEQ002_DRAWER_OPEN : UNLOCKING_SEQUENCE_101_ID002

UNLOCK_STEP_101_SEQ002_LIGHT_ON    : UNLOCKING_SEQUENCE_101_ID002

 

|-----------

 

EntityObject:Room

Object

| Identity          | Number

ROOM_101_MISS_GRANT :    101

ObjectRelation:Contains:Room_Device

ROOM_101_MISS_GRANT : ROOM_DEVICE_101_ROOM_DOOR

ROOM_101_MISS_GRANT : ROOM_DEVICE_101_SECRET_PANEL

ROOM_101_MISS_GRANT : ROOM_DEVICE_101_UNLOCKING_DEVICE_LIGHT

ROOM_101_MISS_GRANT : ROOM_DEVICE_101_UNLOCKING_DEVICE_DRAWER

 

 

Matrix Model

 

The Matrix Professional Edition of the Gothic Hotel model is available . The model is contained in a standard main file, System.matrix, plus several other files which describe the main active entities and lastly, a file describing the model's configuration at initialization.

 

 

Expected Output

 

The output from the Matrix version of the Gothic Hotel model executing a scenario is available and another log is also available of the same scenario with an increased level of tracing .

Copyright 2017 Dark Matter Systems Ltd. All Rights Reserved.