dd mentalligent

Upload: irem-goekce-aydin

Post on 04-Jun-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 DD Mentalligent

    1/65

    GROUP : MENTALLIGENT

    COMPANY : Minder Technology

    STN YILDIRIM 1629419

    BERK ESEROL 1534908

    EVN ASLAN 1559921

    REM GKE AYDIN 1550268

    Course : CENG 490

    Assistant : Levent BAYINDIR

    2011

    DETAILED

    DESCRIPTION

    DESIGNfor

    BRAINWAVE BASED

    CONCENTRATIONENHANCING AND

    REHABILITATION

    SYSTEM

  • 8/13/2019 DD Mentalligent

    2/65

    TABLE OF CONTENTS1 INTRODUCTION ......................................................................................................................................................... 1

    1.2 Purpose ............................................................................................................................................................................................. 1

    1.3 Scope ................................................................................................................................................................................................. 1

    1.4 Overview ........................................................................................................................................................................................... 1

    2 SYSTEM OVERVIEW ................................................................................................................................................... 3

    3 DESIGN CONSIDERATIONS ......................................................................................................................................... 53.1 Design Assumptions, Dependencies and Constraints ....................................................................................................................... 5

    3.2 Design Goals and Guidelines ............................................................................................................................................................. 5

    4 DATA DESIGN ............................................................................................................................................................ 64.1 Data Description ................................................................................................................................................................................ 6

    4.2 Data Dictionary .................................................................................................................................................................................. 7

    Objects .............................................................................................................................................................................................. 7

    5 SYSTEM ARCHITECTURE ........................................................................................................................................... 105.1 Architectural Design ........................................................................................................................................................................ 10

    5.2 Description of Components............................................................................................................................................................. 12

    5.2.1 Manager ................................................................................................................................................................................. 12

    5.2.2 Game ...................................................................................................................................................................................... 14

    5.2.3 AI ............................................................................................................................................................................................ 16

    5.2.4 Analysis .................................................................................................................................................................................. 17

    5.2.5 Login....................................................................................................................................................................................... 18

    5.2.6 BCID ....................................................................................................................................................................................... 20

    5.2.7 Keyboard Mouse ................................................................................................................................................................. 21

    5.2.8 GUI ......................................................................................................................................................................................... 21

    5.3 Design Rationale .............................................................................................................................................................................. 23

    6 USER INTERFACE DESIGN ......................................................................................................................................... 236.1 Overview of User Interface ............................................................................................................................................................. 23

    6.2 Screen Images ................................................................................................................................................................................. 24

    6.3 Screen Objects and Actions ............................................................................................................................................................. 27

    6.4 Game Design ................................................................................................................................................................................... 28

    7 DETAILED DESIGN .................................................................................................................................................... 30Relations Of Basic Data Objects ............................................................................................................................................................ 30

    Complete Data Model ........................................................................................................................................................................... 31

    The Whole Process Of BCES .................................................................................................................................................................. 32

    7.1 Manager .......................................................................................................................................................................................... 32

    7.2 GAME .............................................................................................................................................................................................. 37

    7.3 AI ..... ...................... ...................... ..................... ...................... ...................... ...................... ...................... ..................... ................ 40

    7.4 BCID ................................................................................................................................................................................................. 42

    7.5 Keyboard Mouse ............................................................................................................................................................................. 46

    7.6 Analysis ........................................................................................................................................................................................... 47

    7.7 Login ................................................................................................................................................................................................ 50

    7.8 GUI .................................................................................................................................................................................................. 54

    8 LIBRARIES AND TOOLS ............................................................................................................................................. 57

    9 TIME PLANNIG (Gannt Chart) ................................................................................................................................... 609.1 Term 1 Gannt Chart ......................................................................................................................................................................... 60

    9.2 Term 2 Gannt Chart ......................................................................................................................................................................... 62

    10 CONCLUSION ......................................................................................................................................................... 63

  • 8/13/2019 DD Mentalligent

    3/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1

    1 INTRODUCTION1.1 Problem Definition

    The lack of concentration is one of the modern life issues and it is shown that it can be overcome

    by some daily training and basic rehabilitation. Moreover, people can always develop their level of

    concentration even if that level is not a problem for them. An increased and manageable

    concentration skill can be used to enhance the efficiency of human life. The main purpose of the

    BCES project is to create reliable concentration enhancement software using the neurofeedback

    technology. The software follows and records the brain activities of the user for a long period and

    tries to increase the users concentration values efficiently. The two main components of thesoftware, small but well designed concentration games and the artificial intelligent system with

    high planning capabilities that manage the game parameters, will provide an uncomplicated and

    entertaining training experience to the user.

    1.2 Purpose

    This document is written to create a common initial design schema of the BCES project. It can be

    used to write a detailed design document. On the other hand, it can be useful for designers and

    the programmers of the project during the implementation phase as a brief summary of the

    detailed design of the software.

    1.3 Scope

    This document contains the initial description of the design of the BCES project. Since it is an initial

    report, it contains only the overall system and data architecture and it also contains the main

    interaction and interface property of the software. In the document, all components are

    mentioned without much detail. Thus, the detailed design part of the project is not included by

    this report. For more detailed explanation of the components and for more complex descriptions

    of the software, use the detailed design document.

    1.4 Overview

    This initial software design report consists of ten main parts.

    The first part is introduction. A definition of the problem that the software based on is described

    in the introduction. General information about the document is also replaced here.

    The second part is system overview. A general overview of the project and the software system is

    mentioned here. The goals, objectives and benefits of the project are explained in that part.The third part is design considerations. Special design issues are addressed here. The design

    assumptions, dependencies and constraints are replaced here. The design goals and guidelines are

    also explained in that part.

    The fourth part is data design. The data sets and the explanation of these data sets used by the

  • 8/13/2019 DD Mentalligent

    4/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2

    software are belongs to that part. Moreover, the flow mechanism, derivations and alterations on

    the data are described here.

    The fifth part is system architecture. The very high level and overall architecture of the software is

    depicted here. The system is divided into its main components. The interior structure of these

    components, the behaviours and missions of them and the communication between the

    components are detailed in that section.

    The sixth part is user interface design. The user interaction of the system is described here. A

    general structure of the graphical user interface is depicted with a series of screenshots. The

    functionality of the user interface is explained from the user point of view.

    The seventh part is detailed design. This part contains the internal details of each design

    entity/component. These details include attributedescriptions for identification, processing anddata.The eighth part is libraries and tools. In that section, the properties behaviour and benefit of the

    the libraries, other helper software and tools for development are introduced.

    The ninth part is time planning. A detailed time plans and gannt chars are replaced in that section.

    The scope of the plans is the whole projects, thus all of the development, design and scheduling

    stages of the project can be found here.

    The tenth part is conclusion and it involves the end comments and expectations of the final

    product.1.5 Definitions, Acronyms and Abbreviations

    DefinitionsUser : The person using the software with a BCID

    Casual user : The possible end user group for the software.

    Database : Collection of all information about the users.

    Acronyms and Abbreviations

    Neurofeedback : Feedback generated by the brain activities of the user.BCID : Brain Computer Interface Device

    BCES : Brainwave Based Concentration Enhancing Software

    EPOC : The name of the Brain Computer Interface Device

    EPOC Library : The library that is provided by the company to get brainwaves from BCID.

    CVS : Current Version System

    GPL : General Public License

    IDE : Integrated Development Environment

    SWT : Standard Widget Toolkit

    FFT : Fast Fourier Transform

    1.6 References1. IEEE Std 1016-1998: IEEE Recommended Practice for Software Design Descriptions2. Mentalligent, 2010: Software Requirements Specification & Software Design Description for

    Brainwave Based Concentration Enhancing and Rehabilitation System.

  • 8/13/2019 DD Mentalligent

    5/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3

    2 SYSTEM OVERVIEW

    Figure 1 - A Screenshot from Software

    BCES is system which lets the users interact with their brains and see the role of their brains in

    thinking process and effect of it over acting with these thoughts. The main functionality of the

    BCES is to keep the user in a concentration state. This functionality will be established by cognitive

    games that we will design. In these games the user will be expected to handle with some tasks

    which require different concentration levels. According to the analyzed brainwave distribution of

    the user as delta, theta, alpha and beta, the parameters of game levels will be change accordingly

    to make the user be more focused on these tasks. The reason that we will observe the change in

    concentration of the user via computer games is the reality that computer games can easily take

    the attention of the user and with attractive features can easily make the players focused itself for

    long times. So we thought that games can be used to make users concentrated for a period of

    time to analyze the behaviour of brainwaves during game play. The BCID will help out in this

    brainwaves extraction process.

    In BCES, our goal is to try to maximize the duration of concentration state of the user as indicated

    above. In the game industry, there are many cognitive games that focus on developing

    concentration of the players in a specific given time. For example, a Nintendo DS game, Brain Age,

    is asking mathematic calculations to the player and the time is counted. The littleness of the time

    is the key to get more score.1Similar to these kinds of games, we will try to take the attention of

    the user and to make him/her be concentrated. So, in the project the main factor that affects theproduct and its requirements are the brainwaves of the user and the precisions of the

    transformation of the brainwaves from the BCID. Because if we can not extract the brainwave

    information after applying same functions, the raw brainwave information will be useless for the

    project and the rest of the operations in the software will be meaningless. So, we will plan to get

    the brainwave information more accurately as possible as we can.

    1http://www.lumosity.com/brain-games/attention-games

  • 8/13/2019 DD Mentalligent

    6/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4

    Figure 2 - Block Diagram Of BCES

    In BCES, the whole system is composed of by two main parts. One of them is hardware, the other

    one is software. At the fist stage, the user log in the system and to get the brainwaves of the user

    we need to have a Brain Computer Interface Device which has been provided by the company. In

    the process, after that we extract the brainwaves by the help of this device, by analyzing the

    features of different brainwaves (delta, alpha, theta, beta), the user will be asked to play the game

    application that we will develop. While monitoring the brainwaves, through the levels of the

    game, user will be wanted to concentrate very well to complete the level. In this process we

    expect to see the changes in the brainwaves of the user in an effective way. As mentioned above,

    the aim is to increase the Alpha and Beta brainwaves which are observed at the concentration

    state. Because the concentration of the user can be varied according to his gender, age,

    psychology and the environment, we will take these factors into account and will create a game in

    a way of getting attention and focusing concentration of the user much more easily and quickly.

    Moreover, to detect the brainwaves by the device correctly and to treat the user accordingly,

    there will be a continuous literature survey in the whole process. The running mechanism of the

    software and so the game will be explained in the following sections.The functionality of BCES is to show the brain activities of the users and changing the features of

    the applications accordingly during process. So the main benefit of the system is to help the user

    to increase the general concentration, attention and memory level of him. If the user has a lack of

    concentration then by our system, this situation will be handled. Because we will create the game

    levels by the help of an AI to decide whether the user is in upper or lower concentration and

    memory level. The game seems to be more academic but there will be components added to the

    game to make the game similar to the usual and real computer games. So there will beentertainment and amusement in the game to take the attention of the user more easily.

    Moreover, this project can be applied for other applications rather than only game. For example

  • 8/13/2019 DD Mentalligent

    7/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 5

    an music player application that plays music which of genre is decided according to the mood of

    the user. Because the frequencies of brainwaves are distributed according to mood of the user

    (including concentration), the AI part can be designed for different purposes like this. For example,

    if the user is unhappy than the player will play funny and cheering musics from the pre-defined

    database. The examples of these applications are present and used.3 DESIGN CONSIDERATIONS

    In BCES, the brainwave extraction part would be over-work for us. Because the BCID gets

    brainwaves as raw data and apply some transformations like FFT, classification, clustering and

    feature extraction, all these are a subject of signal processing which we are not very familiar with.

    So the company, Minder, has provided us a .jar file, namely epoclib, which include somelibraries to access the raw and band data (already processed data) via some classes and methods.

    By the help of these libraries we will be able to manipulate and work on the brainwave data easily.

    In the design of the BCES, the accuracy of the Alpha-Beta brainwave interval is important for us,because the whole application will depends on the amplitude and interval of them. Furthermore,

    for the game design we have had to consider the communication between the game component

    in which ActionScript(in Flash) programming language will be used and other components of the

    system in which JAVA language will be used. For this purpose a Flash Player API Java package,

    named JFlashPlayer, has been chosen that lets developers play and interact with Flash swf files

    within Java applications. Hence, by this package we will be able to change the game parameters

    from our java code.

    3.1 Design Assumptions, Dependencies and Constraints

    Because we will use a hardware, BCID, and because the extraction level of the brainwaves

    depends on the users condition such as the thickness of the scalp, age, gender or etc., thethreshold value for each brainwaves is decided by taking this fact into consideration. The other

    main standard that we will establish is to maintain the interfaces as simple as possible for the

    users. Because the number of types of brainwaves is known as a fact, the number of brainwaves

    types we will observe will be equal to that number. Moreover, the time of the training is limited

    and only one user can run the application at a time of process. Which means we will expect an

    improvement in the lack of concentration of one user in a specific interval. The security of the

    database of brainwaves history of the users is important and for the privacy rights of the users wewill develop our database part as secure as possible.3.2 Design Goals and Guidelines

    The goal of the system is to success in increment of the concentration level of the user with the

    help of computer games. For this purpose, we will create more than one game. In fact, the priority

    of the system will be to establish the games as modular. Because the portability of the games is

    important, we will form a isolated relation between the game, AI and user components. All the

    inputs will be received by a main manager component and the communication between thesecomponents will be across by this manager component. So, there will be no specification in the

    software for individual games. AI will change the parameters of the game, which will be common

    in the games, according to the incoming inputs via manager component. The guideline of the BCES

  • 8/13/2019 DD Mentalligent

    8/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 6

    is keeping the application as simple as possible. Because of the fact that focusing is important in

    game-play, the distracting factors will be kept at minimum. For example, the interface of BCES will

    be simple and the brainwave information will be shown in another tab interface. Only needed

    parts such as, game play, status of BCID and the Alpha-Beta brainwave stick indicator will be used.

    In the game design, the environment, game characters and tasks will be attractive and will not

    bore the users. In our system there will be no need for speed or memory usage considerations.

    Because we simply run a .swf file and the database, that we will keep the tracks of the history ofthe users, will not need to keep and/or access much complex data. The usability of the project is

    easy to understand. The user will only put on the BCID on his head and play one of the games. The

    results will be calculated and kept behind the user interface. Then, the end-user will be able to see

    the changes on his mind during this treatment in the analysis part.

    4 DATA DESIGN

    4.1 Data DescriptionThe data structures which are passing among components of the software are grouped by the components

    they are related to as in the followings. The following components will be represented and explained

    in section 5.

    Main Component:

    Manage Class: Manage class is the manager of whole system. Considering only information

    domain of the system, it is a bridge for every data transfer between different component of the

    system. It stores previous game level completion information as a class with an integer for

    completion time, an integer for game score and an integer for current rank of user. This

    information is asked by AI component to determine next level difficulty. Also next level difficulty isstored as integer which is requested by Game component. Manage class stores concentration data

    as EEGBandData which is provided by epoclib API. Concentration data is used for analysis ofusers current concentration. A float array of instantaneous concentration levels is stored to findusers cumulative concentration. Current tab information is stored as an integer so that, manager

    decides which tab to be shown. Finally, user login data is stored as a composition of user

    information such as name and password. This information is used at login phase for confirmation.

    Database Component:

    Login: The User Login Table is the first table in the database. At first it is created as an empty

    table. The table is composed of four columns. The first column is the user id and stored as Integerobject. The user id is unique for all users, namely it is the key of the User Login table. The second

    column is the user name and stored as a String object. The third column of the table is the

    password field; this field is String type too. The empty table is updated when users create new

    accounts. The last column is the user rank and it is stored as Integer object. The table columns are

    updated when the user change his/her information or deletes them via User Account Information

    tab of the user interface. If the user changes or deletes the User Login information, then the

    changes have to be made in the User History table too. The details will be mentioned in that

    section. As a result this table is only affected by user account information changes. This table only

    will be accessible by Login class.

    Analysis: The User History table is the second table in the database. At first it is created as an

    empty table. The table is composed of seven columns. The first column is the user id, which is

    unique to all users, and it is the key of the User History table. It is stored as Integer object. The

  • 8/13/2019 DD Mentalligent

    9/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 7

    second column is the user experience field. Experience is stored as an Integer object. Its value is

    decided by the AI of the software. The third column is the user rank, which is decided by the AI of

    the software. Rank also is stored as an Integer Object. The fourth column is the Concentration data

    that is taken from the user while the user played the game. This brainwave is stored as Float

    object. The fifth column is the id of the game, in order to specify which game was played by the

    user. The sixth column is the history id column, which is stored as Integer object. The seventh

    column is the date column, which keeps date when the game is played. The empty table is filled

    whenever a user logs in and plays a game. Then the related data is taken via Manager and the

    table is updated. This User History table is accessible from Analysis class.

    Game Component:

    Game Class: In game class, general information about any applicable game is stored. Users

    concentration experience and concentration rank are stored as integers. Initially this information

    is taken from database but as user plays the game, these parameters will be updated by a

    function. Game score, current level difficulty and completion time is also stored as integers. This

    information is taken from the game. Besides game score, level completion time and current rank

    information is packed as a class called game level completion information. Because AI componentsends this three data as a package. They are taken via Manager. To show user their instantaneous

    concentration level, a concentration data is stored as float. Later on in order to obtain a

    cumulative concentration, these instantaneous data are stored as float array.

    AI Component:

    AI Class:Main purpose of AI class is to determine next level difficulty. Next level difficulty is stored

    as integer and it is calculated using three information. These are previous level score, completion

    time and user rank. All this information is packed in the game level completion information class.

    UI Component:BCID Class:This class is provided with epoclib API. It includes one instance of EEGRawData classand one instance of EEGBandData. These instances stores raw and processed brainwave data.

    GUI Class:GUI class stores current tab information as integer. This information decides which tab

    is currently active and visible. Login data is also stored for GUI to receive login information such as

    username and password and then to send them to confirmation.

    4.2 Data Dictionary

    Objects

    - AI :

    Attributes :-nextLevelDifficulty : int-previousGameLevelCompletionInformation : GameLevelCompletionInformation

    Methods :+calculateNextLevel() : void+getNextLevelDifficulty() : int

    - ANALYSISAttributes :

    -userConcentrationHistory : float[]

  • 8/13/2019 DD Mentalligent

    10/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 8

    Methods :+addToConcentrationHistory(float []) : void+deleteConcentrationHistory() : void+getConcentrationHistory() : userConcentrationHistory

    - BCIDAttributes :

    -EEGRawData : HashMap-EEGBandData : HashMap

    Methods :+addEEGRawDataListener(EEGRawDataListener, long) : void+addEEGBandDataListener(EEGBandDataListener, long) : void+connectToBCI() : bool+exitApplication() : void+getEEGSampleBandData(long duration) : EEGSampleBandData+getInstantConcentrationData(EEGSampleBandData) : float+removeEEGBandDataListener(EEGBandDataListener) : void+removeEEGRawDataListener(EEGRawDataListener) : void

    - GAMEAttributes :

    -currentLevelDifficulty : int-gameScore : int-instantConcentrationData : float-levelCompletionInformation : Class-levelCompletionTime : int-sampleConcentrationData : float[]-userConcentrationExperience : int-userConcentrationRank : int

    Methods :+getGameLevelCompletionInformation() : LevelCompletionInformation+getInstantConcentrationData() : float+getMouseKeyboardInformation() : Event+getSampleConcentrationData() : float []+initializeGameWithGameDiffiuculty(GameLevelDifficulty) : void+updateConcentrationExperience() : void+updateRank() : void+updateSampleConcentrationData() : void

    - GUIAttributes :

    -currentTab : int-loginData : LoginData

    Methods :+displayAnalysisInterface() : void+displayCalibrationInterface() : void+displayGamePlay() : void+displayLoginInterface() : void

  • 8/13/2019 DD Mentalligent

    11/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 9

    +getCurrentTab() : int+getLoginData() : LoginData

    - KEYBOARD - MOUSEAttributes :

    -key_UP-key_DOWN-key_RIGHT-key_LEFT-left_MOUSE_CLICK-right_MOUSE_CLICK

    -mouse_POSITIONMethods :

    +getKeyboardMouseEvent()- LOGINAttributes :

    -name : String-password : String-userRank : int

    Methods :+confirmLoginData() : bool+createNewUser(String) : void+deleteUserLoginData(String) : void+readUserLoginData(String) : String+updateUserLoginName(String) : void+updateUserLoginPassword(String) : void

    - MANAGERAttributes :

    -concentrationData : ConcantrationData-currentTab : int-nextLevelDifficulty : int-previousGameLevelCompletionInformation : GameLevelCompletionInformation-sampleConcentrationData : float[]-userLoginData : LoginData

    Methods :+deleteUserAnalysisDataAlert() : void+getInstantConcentrationData() : ConcentrationData+getMouseKeyboardInformation() : Event+getNextLevelDifficulty() : int+getPreviousGameLevelCompletionInformation() : GameLevelCompletionInformation+getSampleConcentrationData() : float []+getUserConcentrationHistory() : float []+manageInterfaceTabs(int) : void+updateUser(String name) : void+updateUserAnalysis(String name) : void

  • 8/13/2019 DD Mentalligent

    12/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 0

    5 SYSTEM ARCHITECTURE

    Figure 3 - Package Diagram Of BCES

    Program architecture is composed of three packages which are the main package, database

    interface package and user interface package. Each package contains two or three parts which are

    the actual components of the whole system. The main package consists of three componentswhich are manager, game and AI. Moreover the game component is in interaction with an

    internal game module, the actual played game which is a swf file for example. So the swf file, the

    game, has its own internal classes. The database package contains two sub components, log-in and

    analyze. The user interface package includes three components which are BCID , keyboard-mouse

    and GUI.

    Figure 4 - Component Diagram Of BCES

    5.1 Architectural Design

    Among the packages, the control duties are given to the manager component. All other

    components interact only with the manager component and interconnections between other

    components are not allowed. Therefore, the manager component not only manages the system

    but also provides communication medium for other components.

    The relationships between these components are represented by the following use-case and class

    diagram. The other state and entity relation diagrams of the whole system are in section 7.

  • 8/13/2019 DD Mentalligent

    13/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 1

    Figure 5.1 - Use Case Diagram of Manager-GUIFigure 5.2 - Use Case Diagram of Manager - Other Components

    Figure 5.3 - Use Case Diagram of Manager-Game

    Figure 5.4 - Use Case Diagram Of User - BECS

  • 8/13/2019 DD Mentalligent

    14/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 2

    Figure 6 - Class Diagram Of the Whole System

    5.2 Description of Components

    5.2.1 Manager5.2.1.1 Processing Narrative for Manager

    It manages the whole system. All other components are connected to that component and theycommunicate via that manager component. Manager component is actually contains many event

    listener to answer other components needs. Moreover, it contains the exception system of thesoftware. When a run time error occurs, this component tries to handle it.

    5.2.1.2 The Interface Description for Manager

    Inputs:- Current keyboard and mouse state from relevant component.- Instant alterations of brainwave data from BCID component..- The next game level parameters from the AI component.- End level score from the Game component.- Cummulative concentration information from the Game component.

  • 8/13/2019 DD Mentalligent

    15/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 3

    - End game rank information from the Game component.- Current tab information from GUI component.- User log-in data from the Log-in component.- Confirmation message from the Log-in component.- The user historical data from Analysis component.- Confirmation message from the Analysis component.

    Outputs:

    - GUI warning to GUI component.

    - Related alteration information to the GUI component.

    - End level data to the AI component.

    - End level score information to- the AI component.

    - Cumulative concentration information to the AI component.

    - Current keyboard and mouse information to the Game component.

    - Instant concentration information to the Game component.

    - Next level parameters to the Game component.

    - Current rank information to the Game component.- Cumulative concentration information to the Analysis component.

    - Related create, update, delete messages to the Login component.

    5.2.1.3 Manager Component Processing Detail

    - It contains the main function of the software and becomes active when the software starts.

    - Firstly, it receives the given login data from the GUI component.

    - It sends the login data to the Login component.

    - If it receives confirmation information from the Login component, allows the access tothe main state of the program.

    - It receives the current tab information from the GUI.

    - If the Game tab is active, it runs the Game component and starts the communication

    between user interface, AI and the Game and Analysis components.

    - If Analysis tab is active, It requests the user history from the Analysis component and send

    it the the GUI component.

  • 8/13/2019 DD Mentalligent

    16/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 4

    5.2.1.4 Manager Dynamic Behavior

    Figure 7 - Sequence Diagram of Manager

    5.2.2 Game

    5.2.2.1 Processing Narrative For Game

    It provides the communication between the games attached to the system. Loading a game or

    removing a game is done by that component at run time. It also collect the game related data

    during the session and send them to the manager at the end of each game level. It also calculated

    the parameters and rank information if they does not need AI decisions.

    5.2.2.2 The Interface Description for GameInputs:

    - Current keyboard, mouse information from the Manager component.- Initial game file name form the Manager component.- Instant concentration data from the Manager component.- Next level game parameters from the Manager component.- End level score from the game executable.

  • 8/13/2019 DD Mentalligent

    17/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 5

    Output:

    - End level cumulative concentration data to the Manager component.- End level score information to the Manager component.- Current keyboard, mouse information to the game executable.- Instant concentration data to the game executable.- Next level game parameters to the game executable.- End level score to the Manager component.

    5.2.2.3 Game Component Processing Detail- It is started by the manager component.

    - It receives related parameters from the Manager component.

    - It stars and initiates the game executable with the coming parameters.

    - It delivers the coming concentration information and keyboard, mouse states to the game

    executable.

    - The end level information coming from the executable is sent to the Manager component.

    - It stores some samples information from the instant concentration data.

    - At the end of each game level, it receives the score information and from the game

    executable and sends it to the Manager component.

    - At the end of each game level, it sends the cumulative concentration data to the Manager

    component.

  • 8/13/2019 DD Mentalligent

    18/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 6

    5.2.2.4 Game Dynamic Behavior

    Figure 7 - Sequence Diagram Of Game

    5.2.3 AI

    5.2.3.1 Processing Narrative for AIThe AI component is started at the end of each game level by the manager component and it is

    used for determining the next level game parameters.

    5.2.3.2 The Interface Description for AIInputs:

    - Previous level parameters from the Manager component.

    - Previous level concentration data from the Manager component.- Previous level score data.

    - User current rank data.

  • 8/13/2019 DD Mentalligent

    19/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 7

    Outputs:

    - Next level game parameters.

    5.2.3.3 Game Component Processing Detail

    - It is started by the Manager component.

    - It receives required data which is related with the previous game level session.

    - It uses the internal planning algorithm.

    - The obtained result is returned to the Manager component.

    5.2.3.4 AI Dynamic Behavior

    Figure 8 - Sequence Diagram of AI

    5.2.4 Analysis

    5.2.4.1 Processing Narrative for Analysis

    This component is a kind of database interface. It is used by the Manager component when a

    database access is needed. It also stores the current session data which includes the logged in user

    information.5.2.4.2 The Interface Description for Analysis

    Inputs:- Database read, write, update access request from the Manager component.- New cumulative concentration data.- New rank data.- New score data.

  • 8/13/2019 DD Mentalligent

    20/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 8

    Outputs:- The requested data from the database to Manager Component.- Confirmation message to the Manager component.

    5.2.4.3 Analysis Component Processing Detail- This component is started by the Manager component.- The requested database query is created and sent.- The received answer is transferred to the Manager component.

    5.2.4.4 Analysis Dynamic Behavior

    Figure 9 - Sequence Diagram Of Analysis

    5.2.5 Login

    5.2.5.1 Processing Narrative for LoginLogin component is used only for authentication purposes. It communicates with the database

    for the user data in order to decide whether the user is registered earlier or not. After loginprocess, this component is not called again unless a log-out operation is done.

  • 8/13/2019 DD Mentalligent

    21/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 1 9

    5.2.5.2 The Interface Description for LoginInputs:

    - User-name information from the Manager component.

    - Password information from the Manager component.

    Outputs:

    - The confirmation or rejection message to the Manager component.

    5.2.5.3 Login Component Processing Detail

    - Manager component start this component.

    - Manager component initiates Login component with the user data.

    - Login component communicates with the database and received the confirmation or

    rejection message.

    - It transfers the coming message to the Manager component.

    5.2.5.4 Login Dynamic Behavior

    Figure 10 - Sequence Diagram Of Login

  • 8/13/2019 DD Mentalligent

    22/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 0

    5.2.6 BCID

    5.2.6.1 Processing Narrative for BCIDBCID is one of the user interface components. It provides the communication between the

    Manager component and the device. Moreover it does the corresponding calculation in order to

    make the coming input more understandable for the Manager component such as transform

    domain alterations.

    5.2.6.2 The Interface Description for BCID

    Inputs:

    - Raw data from the interface Device.

    - Data request from the Manager component.Outputs:

    - Processed data to the Manager component.

    5.2.6.3 BCID Component Processing Detail

    - It is started by the Manager component.

    - It receives the raw data from the interface device.

    - It applies the required calculations on the raw data and produces the data type

    required from the Manager component.

    - The result is sent the the Manager component.

    5.2.6.4 BCID Dynamic Behavior

    Figure 11 - Sequence Diagram of BCID API

  • 8/13/2019 DD Mentalligent

    23/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 1

    5.2.7 KeyboardMouse

    5.2.7.1 Processing Narrative for Keyboard, Mouse

    Since the system have a game playing purposes, we need a qualified communication between

    keyboard and mouse. This component provides the state information of both keyboard and

    mouse.5.2.7.2 The Interface Description for Keyboard, MouseInputs:

    - State information from keyboard and mouse.

    - Data request from the Manager component.

    Outputs:

    - Obtained data to the Manager component.

    5.2.7.3 Keyboard, Mouse Component Processing Detail

    - It is started by the Manager component.

    - It receives the state data from the keyboard and mouse.

    - The result is sent to the the Manager component.

    5.2.7.4 Keyboard, Mouse Dynamic Behavior

    Figure 12 - Sequence Diagram Of Keyboard-Mouse

    5.2.8 GUI

    5.2.8.1 Processing Narrative for GUIThis component deals with the graphical user interface. It receives user input and applies the

    corresponding alterations accordingly. Moreover, the warning and error messages are alsotransmitted to the user via this component.

  • 8/13/2019 DD Mentalligent

    24/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 2

    5.2.8.2 The Interface Description for GUIInputs:

    - Keyboard and mouse state from the Manager component.

    - Alteration request from the Manager component.

    - Warning or error messages from the Manager component.

    Outputs:

    - Current selected game file name to the Manager component.

    - User request messages to the Manager component.

    5.2.8.3 GUI Component Processing Detail

    - It is the firstly created component by the Manage component.

    - It receives the login information from the user at the authentication part and passes them

    to the Manage component.

    - If authentication is done, it shows the main interface.

    - It reports each user alteration to the Manage component.

    - It manages the game files and displays the game choices for the user

    5.2.8.4 GUI Dynamic Behavior

    Figure 13 - Sequence Diagram Of GUI

  • 8/13/2019 DD Mentalligent

    25/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 3

    5.3 Design RationaleDuring the design process, our first consideration about the system is the communication issue.

    The communication traffic of the each component is needed to manage. Therefore, after

    determining our main software components, we add the Manager component to the system in

    order to manage the communication and data transfer between other components. Therefore,

    each component communicates only with the Manager class and this feature makes the software

    more modular.

    The second problem we faced with was the modularity issues of the games in the system. We

    may need adding more games to the system in the future, thus game handling mechanism must

    be modular. At that point we discussed about the user interface and game interactions. Leaving

    the game and user interface communication as free decreases the modularity of the game. Hence

    we decided to let this communication issue is also handled by the Manager component and that

    feature makes adding new games to the system easier.

    6 USER INTERFACE DESIGN

    6.1 Overview of User Interface

    The user interface of the system will first expect from the user to input his/her password by the

    provided Login interface. If the user has not had an account yet, he/she will be able to create an

    account by this interface also. If the user inputs wrong log in data the interface will warn the user

    informing that wrong log in data is inputted. Unless the user input his/her existing account or

    create one, he/she will not be able to see any further information about the product. After

    creating an account or using an existing account, and logging in the user will be able to see the

    actual interface of the product. This interface is composed of seven tabs. They are:

    -Start Up

    -Calibration

    -Game

    -Brainwave Analysis

    -User Account Information

    -Help

    After logging; in the Start Up tab will be seen at the user interface. At this tab the user will be able

    to see the previous information about his/herself. Users previous concentration rank andconcentration experience will be displayed.

    After having seen the Start Up tab, user can pass to Calibration tab. In this Calibration tab the user

    will be see the instructions that describes how to wear the BCID, how to understand whether the

    device is functioning properly etc. The user will see a representative scene of the device showing

    all the nodes on it. The nodes that are functioning properly will be seen in red color, the ones that

    functioning properly will be seen in green color. The user has to make sure that all the nodes

    functioning properly. Otherwise the user will not be able to start the game and play it.

    In the Game tab user will see available game(s) names and a small picture taken from the game

  • 8/13/2019 DD Mentalligent

    26/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 4

    scene. The user will be able to choose the game he/she wants. Then the user will see the game

    opening. After the game is opened the user will play the game until the session is over. User then

    will see the current concentration rank and concentration experience. Then the game will be over.

    In the Brainwave Analysis tab the user will see his/her previous (history) information represented

    in a graphic. The user will be able to see how his /her brainwaves were acted during the game in

    the previous sessions and therefore see the changes time by time.

    At User Account Information tab, the user will be able to see his/her user name and password

    information. User can delete his/her account or make some modifications on it. If user account is

    deleted also the user history information is deleted automatically.

    At the Help tab the user will see the frequently confronted problems solution, and the basic

    information about the software. For example; what are the functionalities of tabs that are present

    in the interface, if a problem exists device what to do, how to learn playing the game etc.

    Also there will be a BCID status figures present all the time. So that the user will be able to see thedevice status all the time also while playing the game. The user will see whether the device lacks

    functionality or works with full functionality at that instant. If there are nodes that lack at

    functionality, the problematic nodes, they will be displayed with red circle, the full functionality

    ones will be displayed with green circles. Hence the user will be aware of the dis-functionalities

    while playing the game.

    6.2 Screen Images

    Figure 14 - Interface Of Start-Up Tab

  • 8/13/2019 DD Mentalligent

    27/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 5

    Figure 15 - Interface of Calibration Tab

    Figure 16 - Interface Of Game Tab

  • 8/13/2019 DD Mentalligent

    28/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 6

    Figure 17 - Interface of Analysis Tab

    Figure 18 - Interface of User Account

  • 8/13/2019 DD Mentalligent

    29/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 7

    Figure 19 - Interface of BCID

    6.3 Screen Objects and Actions

    In the user interface, the user will be welcomed by a login interface to the system. In login

    interface there will be User Name and User Password screen objects.

    User Name and User Password : Whenever the user logging in to the system with the correct

    information, the related user account data including login data and analysis history data will betaken from the database. The analysis history data will be represented graphically in the analysis

    tab in the following interface.

    After logging in, as indicated in the section 6.1 and in the former figure, there will be 5 tabs as

    screen objects. The transitions between these tabs will be managed by Manager ComponentStart-up : In the Start-up tab the background information of the user will be displayed. The

    information about user previous activities like user concentration rank and concentration

    experience will be taken from the database with the related user login account information.Calibration : In this tab, the displayed BCID status information will be extracted form BCID

    component. The BCID status information shows a picture of a representative brain with the

    following: if the device is placed properly, the 16 sensor of the headset which are placed on the

    user scalp will be displayed in green color in the representative figure. If there is a sensor that can

    not tune into electric signals produced by the brain of user effeciently, then its color will be red.Therefore, in this tab the user will be led to turn all the color of the sensors into green by some

    instructions.

    Games : In this tab there will be a concentration-meter bar showing the real-time amplitude of

    beta brainwave of user. This information will be extracted from the BCID component. In this tab,there will be thumbnails of different games. When the user chooses one of them, the SWF file of

  • 8/13/2019 DD Mentalligent

    30/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 8

    the related Flash game will run. While playing the game, the user can see the changes in the

    concentration-meter simultaneously.

    Brainwave Analysis : In this screen object, the current behaviour of the brainwaves bill be

    displayed. The brainwave status information will be extracted from BCID component in real-time.

    Additional to these, there will be also User Account Information, BCID Status and Help objects in

    the interface.

    User Account Information : In this part of the interface, the current user informations will be seen.

    If needed the user will be able to update the user name or password information or even can

    delete yourself from the database completely. If user deletes the account all the information

    related to that user including user name, password and the history data will be deleted from the

    database.BCID Status : In this part of the interface, the current BCID connection status will be displayed

    continuously during the running application. If the sensors changes their proper positions, then

    the user should placed them until all are in green color again.

    Help : With the help of this object, the functionality of other tabs will be explained to the user.

    Only a text message will be displayed on the screen as a pop-up.6.4 Game Design

    The game we will have these main features;

    - The main aim of the game will be feeding the animals (the black ones in the Figure), which are

    the same kind and identical (size and color are the same) and continuously moving, in the screen.

    After feeding the animals there will be no change in the appearances of the animals. So the user

    should concentrate on which animal did he/she feed before, which he/she didnt.

    - The number of fodder is equal to the number of animals on the screen. The user should feed

    each animal only once. If not, the user has time punishment (the time, which begins from 0 and

    counts from the beginning of the level, will increase suddenly).

    - The animals can have different speed and move features. For example, some of them move

    quickly on the screen, some of them are slow and moves by jumping.

    - According to the value in the Beta brainwave bar, we call it concentration-meter, the difficulty

    of the next level will be decided. For example, if the users concentration level is very high during alevel, in the next level the number of animals to feed will more rapidly increase.

    - The main aim of the game is feeding the moving animals by clicking over each of them and keep

    this feeding time as short as possible, which means keeping the concentration state of the user as

    long as possible.

  • 8/13/2019 DD Mentalligent

    31/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 2 9

    The main data objects in the BCES related to the game are;

    Brainwaves :This data object has a name, representation (density), unit and range attributes. This

    data object can be inherited as Delta, Theta, Alpha and Beta brainwaves.

    Game Levels :This data object has a name, representation, quantity and parameters(such as the

    number of animals, the movement type of them, time to finish the level..) attributes.

    Game Level Completion Time : This sub-data object has range and quantity attributes.

    When the user consumes all the fodder, time will stop for that level. As mentioned

    previously, the time starts counting from zero for every second and if the user feed the

    animals that he has fed previously more seconds will be added to the current time. For

    example while counting seconds one by one, if this situation occurs, an extra 5 seconds will

    added to the time variable. If the time will be out of the previously decided range, for

    example the user are not feeding the animals for a long time during the training, then level

    will end and next level will be decided considering this lack of concentration stage.

    Game Level Score :This sub-data object has range and quantity attributes. While feeding

    the animals that has not been fed before, an +10 points will be added to the score variable.

    Feeding wrong animal that has been fed before will not contribute to the score.

    User Data :This data object has a name, representation(including age and password variables) and

    parameters(User Rank, User Concentration Experience) attributes.

    User Concentration Experience :This sub-data object has range and quantity attributes. At

    the end of each level, the user will gain concentration experience according to the time

    that the user completes each level and score of previous level variables.

    User Rank : This sub-data object has only a name, quantity and range. And after this

    concentration experiences reached the decided upper bounds, the rank of the user will

    increase one by one. In other words, if the users rank value is high then this means thatthis user has high ability of being in concentration state for long time. In this situation, this

    high ranked user has completed the levels in shorter time and got more scores in each

    played level by being concentrated during these levels not to make mistakes.

    The process between brainwave and game level runs as in the following.

    -In a game level;

    After feeding each animal on the screen, 3 seconds will pass to enable the animals change

    their position and during this time interval the user can not feed the animals and should

    wait and observe the animals to feed.

    The concentration-meter will show the amount of Beta Brainwaves of the user. This

    information will come from the BCID and some mentioned transformations following to it.

    While playing the game, according to the moving number of animals in the screen, the user

    will be expected to concentrate on the level. Meanwhile, the value in concentration-meterwill change naturally. Because human cannot be fully focused in what he is doing all the

    time.

  • 8/13/2019 DD Mentalligent

    32/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 0

    While feeding the animals (correct or wrong), the time and score will be changing

    continuously. These time and score features of the levels makes the application more

    resembled to the usual computer games.

    When the concentration-meter reach the top limit, the color of the remaining unfed

    animals will be lightened for one second. This is an award for the concentrated users. All

    the values of the Beta brainwaves during time of the level will be represented as

    graphically (the descents and rises) in the analysis tab and be kept in the user database for

    long-term feedback.

    - Deciding next level;

    The difficulty stage of the next level will be calculated according to the cumulative average

    of the concentration-meter during the completion time of the previous level. Because the

    level of the Beta brainwaves in the concentration-meter is changing all the time.

    There will be a constant incrementation in the number of animals for the next level(for

    example 2 animal more), but by taking into consideration of the cumulative average of

    concentration state of the user, this incrementation will be additionally more.(instead of 2animal, increase 5 animal)

    According to the completion time of previous level, the user will gain concentration

    experience. If this experience is enough to jump to next rank, the rank of the user will be

    increased by one. So the completion time and concentration experience are inversely

    correlated.

    7 DETAILED DESIGNThe followings are the class diagram, activation diagram, and state diagrams of the whole system.

    Relations Of Basic Data Objects

    Figure 20 - ERD of The Simple Data Objects

  • 8/13/2019 DD Mentalligent

    33/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 1

    Complete Data Model

    Figure 21 - Complete Data Model

  • 8/13/2019 DD Mentalligent

    34/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 2

    The Whole Process Of BCES

    Figure 22 - State Transition Diagram of The Software

    7.1 Manager

    Classification:Class

    Definition: It represents the spine of the

    whole system. This is the only class that

    can communicate with all other classesof the system.

    Responsibilities:

    - Communication :

    The main responsibility of the

    manager class is to provide a

    communication environment between

    other components of the system. It has

    the capability to transmit the information

    from a component to the other.

  • 8/13/2019 DD Mentalligent

    35/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 3

    - Management :

    This class determines the working order of the other parts of the software. According to the

    generated events, the corresponding class awakened by the Manager class calling the relevant

    method of that class.

    - Handling :

    Error and exception handling is another responsibility of that class. If one of the all other classes

    faces a situation that needs the activation of the handling mechanism, it needs to indicate that

    situation to the Manager class.

    Processing:There are five distinct states of the Manager class, namely, initialization state transmission

    state, decision state, exception state and listen (idle) state.

    Initialization State:

    Initialize all other components.

    Subscribe event listeners.

    Go to Listen State.

    Decision State:

    Decide which component to run.

    If data transmission is needed go to Transmission state.

    If data transmission is not needed, active the next class and go to Listen state.

    Transmission State:

    Send data to relevant class.

    Go to listen state.

    Listen State:

    Wait until an event is generated.

    If an event is generated, go to decision state.

    If an exception is generated, go to exception state.

    Exception State:

    Handle the exception. According to the result of handling go to listen or decision.

  • 8/13/2019 DD Mentalligent

    36/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 4

    Figure 23 - Activity Diagram of Manager Component

    Constraints:States :

    The state constraints are the following:

    At the beginning it is in initialization state.

    After the initialization of the program, the first state is decision state.

    If the manager class is in the decision state, it can switch all other stages.

    If the manager class is in a state other than the listen state, it can only switch to the listen

    state.Communication and Data Transmission:

    Communication with the manager class can be done two ways. One way is to generate an event

    and the other one is to call related method. The communication constraints are the following:

    Maximum five events can be generated unless the response of that events.

    If a class need a method call from the manager class, firstly it must generate an event that

    request a method call communication.

    Data transmission is can be done only method call communication type as method

    parameters.

    Data transmission limits:

    Game -> Manager --- 128KB per game level.

    Manager -> Analysis --- 128KB per game level.

    BCID -> Manager --- 80 times size of double per second. (1KB approximation)

    Timing :

    Timing constraints alter according to the state of the class. Timing constraints are the following:

    In transmission state, if an EGG data is transmitted, the manager class must wait at least 2

    seconds in order to request another EGG data.

    In others states there is no timing constraint. The policy to handle exceptions and event is

    the earlier the request comes, the sooner the response generated.

  • 8/13/2019 DD Mentalligent

    37/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 5

    Uses / Interactions:

    Interaction:

    The manager class has right to direct interaction between each class component of the system.

    The types and procedures of the interactions are as follows:

    - Manager Class - Other Classes:

    Only the event generation types of interactions are possible. Other classes do not have right to

    access the methods of the manager class and they can only generate events in order to

    communicate with the manager class because of the security purposes. On the other hand,manager class have right to access the get and set methods of other classes.

    - Collaboration :

    Since the manager class has right to direct interaction between all other classes in the system,

    collaboration type of interaction is not valid for it.

    Resources:

    RAM :

    Manager class allocates memory for the following attributes:

    - previousGameLevelCompletioningInformation : object- concentrationData : object

    - nextLevelDifficulty : int

    - sampleConcentrationData : float[];

    - currentTab : int;- userLoginData : object

    CPU :Manager class uses CPU every time except it activates another component.

    GPU :Manager class does not use that component.

    Database :Manager class does not use that component.

    EPOC Library :Manager class does not use that component.

    EPOC :Manager class does not use that component.

    Keyboard and Mouse :Manager class does not use that component.

    Interface / Exports:There are three subroutines of the Manager component.getInstantConcentrationData():

    - It is a method of Manager Class.- It requires Transmission state.- Runs once at each two second.- Gets the EGG data from the BCID class.

    - Return ConcentrationData object.getMouseKeyboardInformation():

    - It is a method of Manager class.- It requires Transmission state.- Runs after related event generated by the KeyboardMouse class.- Gets the keyboard and mouse state changing from the Keyboard-Mouse class.- Generates event for GUI class.

  • 8/13/2019 DD Mentalligent

    38/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 6

    - Returns void.getInstantSampleData():

    - It is a method of Manager class.- It requires Transmission state.- Runs at the end of each game level.- Gets the concentration data from the Game class.- Returns float array.

    getNextLevelDifficulty():- It is a method of Manager class.- It requires Transmission state.- Runs at the end of each game level.- Gets the game difficulty parameters for the next game level from the AI class.- Returns integer.

    getPreviousGameLevelCompilationInformation():- It is a method of Manager class.- It requires Transmission state.- Runs at the end of each game level.- Gets the end game packet information from the game class.- Returns GameLevelCompilation object.

    getUserConcentrationHistory():- It is a method of Manager Class.- It requires Transmission state.- Runs when user goes to the analysis tab, after GUI event.- Gets the user history data from the database using the analysis class.- Returns float array

    manageInterfaceTabs():- It is a method of Manager class.- It requires Decision state.- Updates the GUI according to the generated events.- Take the tab ID as argument.- Returns void.

    updateUser():- It is a method of Manager class.- It requires Transmission state.- It updates the login information of the user, after GUI event.- Takes user ID as argument.- Returns void.updateUserAnalysis():- It is a method of Manager class.- It requires Transmission state.- It updates the analysis information of the user, after GUI event.- Takes user ID as argument.- Returns void.

  • 8/13/2019 DD Mentalligent

    39/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 7

    7.2 GAME

    Classification:Class

    Definition:This class does not contain the actual

    game classes. Game class is the component of

    the software and it is designed to manage the

    game modules attached to the system. It

    provides an interface to the game module to

    make them communicate with the rest of the

    system.Responsibilities:

    Communication :

    The game class establishes the

    communication between the manager class and

    the game module. The game modules can

    interact with the system using this class only.Game Playing :

    The game class is also responsible for the

    execution of the game. It must fulfill the

    requirements of the game module. Therefore, it

    provides a standard interface to the game modules.

    Data Collection :

    It collects data during the game session for each level and at the end of the level, sends that

    data to the manager class.

    Processing:There are four states of the class which are the idle state, the game play state, transmission

    state and the exception state.

    Idle State:

    After being initialized by the manager class, it is in idle state.

    If it is activated, goes to game play state.

    Game Play State:

    Loads the game module and starts the game.

    Communicates with manager class for user inputs.

    At the end of the game level, goes to transmission state.

    Transmission State:

    Sends the end level information to the manager.

    Receives the game parameters for the next level.

    Goes to game play state.

    Exception State:

    Reports the exception to the manager class.

    Goes to the idle state.

  • 8/13/2019 DD Mentalligent

    40/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 8

    Constraints:- States :

    The state constraints are the following:

    If the class is in the idle state, it can only go to the transmission state.

    In order to go the game play state, it previously must be in the transmission state.

    After game play state it goes to the transmission state only.

    - Communication and Data Transmission:

    If the class is not in the idle state, game class and manager class communication continues.

    There are two types of data transmission between game module, game class and manager class.One is the end level data transmission and the other one is the during level input transmission.

    The communication constraints are the following:

    Only manager class can reach the methods of game class

    Only game module and manager class can make data transmission with the game class.

    At a game session only one game module can communicate with the game class.

    Data transmission limits:

    Game -> Manager --- 128KB per game level.

    - Timing :

    Timing constraints alter according to the state of the class. Timing constraints are the following:

    - In the game play state, input transmissions must be done in 25 milliseconds.

    - In the transmission state, all transmissions must be done in 2 seconds.

    Uses / Interactions:

    Interactions :

    There are two system components that can make direct interaction with the game class. These

    are manager class and game module. The types and procedures of the interactions are as follows:

    Figure 24 - Activity Diagram of Game Component

  • 8/13/2019 DD Mentalligent

    41/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 3 9

    - Game Class - Manager Class :

    Two way interactions are possible. Manager class have right to access the methods of the

    game class, however game class does not have that right. Game class can interact with the

    manager class only using the event generations.

    - Game Class - Game Module :

    Two way interactions are possible. However game module cannot access all methods of the

    game class. It can only use the game module interface.

    On the other hand, game class can have full access on the game module. Collaboration :

    The game class has collaboration with five main classes. These are analysis class, BCID class, AI

    class, GUI class and KeyboardMouse class.

    Resources:

    RAM :

    Game class allocates memory for the following attributes:

    - userConcentrationExperience : int

    - userConcentrationRank : int- currentLevelDifficulty : int

    - instantConcentrationData : float

    - levelCompletionTime : int

    - gameScore : int

    - levelComplationInformation : object

    - sampleConcentrationData : float[]

    CPU :

    Game class uses CPU only in game play state and transmission states.

    GPU :

    Game class does not use that component.Database :

    Game class does not use that component.EPOC Library :

    Game class does not use that component.

    EPOC :Game class does not use that component.

    Keyboard and Mouse :

    Game class does not use that component.Interface / Exports:There are three subroutines of the Game component.

    updateConcentrationExperience():

    - It is a method of Game class.- It requires Transmission state.- Runs at the end of each game level.- Updates the concentration experience data.- Returns void.

    updateRank():- It is a method of Game class.- It requires Transmission state.- Runs at the end of each game level.

  • 8/13/2019 DD Mentalligent

    42/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4 0

    - Updates the concentration rank data.- Returns void.

    initializeGameWithGameDifficulty():- It is a method of Game class.- It requires Game Play state.- Runs at the end of the state by the manager class once.- Sends the parameters for the new game to the game module.- Returns void.

    getMouseKeyboardInformation():- It is a method of Game class.- It requires Game Play state.- Runs in every 25 milliseconds and generates an event.- Sends the information the the game module.

    getInstantConcentrationData():- It is a method of Game class.- It requires Game Play state.- Gets concentration data from the manager class in every 2 seconds generating an event.- Sends the information the the game module.

    getGameLevelComplationInformation():- It is a method of Game class.- It requires Transmission state.- It is run by the manager class at the end of each game level.- Sends the information to the manager class.

    getSampleConcentrationData():- It is a method of Game class.- It requires Game Play state.- It is run by the game module in every two seconds.- Sends the sampled data to the game module.

    updateSampleConcentrationData():- It is a method of Game class.- It requires Game Play state.- Runs after the getSampleConcentrationData method

    - Stores the sent information also in the game class.

    7.3 AI

    Classification:Class

    Definition: The AI class determines the

    parameters for the next game level

    during a game play session. Its aim is to

    find the optimal game parameters in

    order to increase the user concentration

    level without making the game boringly easy or too hard.

    Responsibilities:

    Planning :

    Using the planning algorithms and the previous level user concentration information,

    determines the game parameters for the next level.

  • 8/13/2019 DD Mentalligent

    43/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4 1

    Processing:

    There are two states for the AI class which are idle state and calculation state.

    - Idle state :

    After being initialized by the manager class, it is in idle state.

    If it is activated, goes to calculation state.

    - Calculation State :

    Receives the game parameters and concentration information from the managerclass.

    Calculates the next state parameters.

    Sends the result to the manager class.

    Goes to idle state.

    Constraints:- States :

    There is no state constraint for the AI class. Its states alters according to the manager class

    demands.

    - Communication and Data Transmission:

    The AI class does its communication and transmission with only manager class. There is no data

    transmission constraints because these transmissions is done using one object function

    parameters.

    - Timing :

    Since between each level section, the time limit of the game class is 2 seconds, the AI class

    must return its results in the calculation state in 1 seconds.

    Uses / Interactions:

    Interactions :

    The AI class has interaction only with the manager class. The types and procedures of the

    interactions are as follows:

    - AI Class - Manager Class :

    Two way interactions are possible. However AI class cannot access the methods of the

    manager class. It can only use the event system to send messages to the manager class. On the

    other hand, manager class can have full access on the AI class and has right to access all methods

    of the class.

    Figure 25 - Activity Diagram Of AI Component

  • 8/13/2019 DD Mentalligent

    44/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4 2

    Collaboration :

    The AI class has a collaboration only with the game class.

    Resources:

    RAM :

    AI class allocates memory for the following attributes:

    - previousGameLevelComplationInformation : object- nextLevelDifficulty : int

    CPU :

    AI class uses CPU only in the calculation state.

    GPU :

    AI class does not use that component.

    Database :

    AI class does not use that component.

    EPOC Library :

    AI class does not use that component.

    EPOC :AI class does not use that component.

    Keyboard and Mouse :

    AI class does not use that component.

    Interface / Exports:

    There are three subroutines of the AI component.

    calculateNextLevel():

    - It is a method of AI class.

    - It requires Calculation state.

    - Calculates the next level parameters using optimal planning algorithm.

    - Runs after getNextLevelDifficulty method.

    - Return integer.

    getNextLevelDifficulty():

    - It is a method of AI class.

    - It requires Calculation state.

    - It is run by the manager class at the end of each game level.

    - Runs the calculateNextLevel method.

    - Returns integer.

    7.4 BCIDClassification:Class

    Definition:This class gets the raw output from the

    BCID and provides a converted band brainwave

    data to the manager component. It provides a

    communication between the device and BCES.

    Responsibilities:

    - Gathering Device Output :

    The first action that the class executes is to

    extracting the raw brainwave data from the

    device.

  • 8/13/2019 DD Mentalligent

    45/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4 3

    - Processing Input Data :

    The raw input which got from the device is applied some transformations. Because the

    brainwaves are electrical signals to process over them and perform some operations according to

    them, there are some converting transactions. This transaction occurs as mapping raw data from

    EEG channels to a queue structure.

    - Transforming to Band Data :

    The mapped raw data is transformed to the simple frequency values to easily used in the BECS.

    After FFT operations, the coming signals from the device will be converted to processed signals

    which has an frequency and so distinguished types such as delta, theta, alpha and beta.

    Processing:

    There are three distinct states reading raw data, transforming to band data, writing raw and band

    data. While doing this EEG Raw Data Listener and EEG Band Data Listener interfaces are used.

    These interfaces are implemented in the Input Handler sub-class which is provided by the

    company.

    - Reading Raw Data :

    In this state, by the reader thread, which is initialized immediately after connected to device,all queued channel data is retrieved as EEG raw data.

    - Transforming To Band Data :

    In this state EEGBandData values are calculated with Fast-Fourier-Transform (FFT) on

    EEGRawData. In the sample Band Data, list of Band Data is kept because there are more than one

    Band Data for each time interval Windowing in FFT which is 250 ms. FFT converts the data from

    time domain to frequency domain. Raw Data values in this time interval are processed to find total

    power on frequency bands. The resulting Band Data is informed to the receiver.

    - Writing Raw/Band Data :

    The write thread continuously write the raw data and converted band data to a write buffer in

    a loop after reading it. These stored data will be requested by manager component by andband/raw data listener.

    -Exception State:

    In this state it reports the exception to the manager class. Waits for reply from the Manager, if

    not goes to the final termination state.

    Figure 26 - Activity Diagram Of BCID Component

  • 8/13/2019 DD Mentalligent

    46/65

    D e t a i l e d D e s i g n D e s c r i p t i o n f o r B r a i n w a v e B a s e d C o n c e n t r a t i o n E n h a n c i n g 4 4

    Constraints:

    - States :

    After initialized by manager component, it is in read state.

    The read and write states are working in synchronized and continuously. But before writing

    state the raw or band data should be read first.

    If an listener from the manager component is created, before going to converting from raw

    to band data state, there should be a raw data stored during at least 250 ms.

    Before Transforming to Band Data state, the manager should have created an event and

    called getEEGSampleBandData method from BCID class.

    - Communication and Data Transmission :

    This class only responds requests that come from manager component. The Band Data and Raw

    Data listeners should be created by the manager components to add its listener to the listener list

    and then answering its need as reading the sample band data. The data transmitted between BCID

    and manager component will be the Sample Band Data type. So;

    It holds the total powers on specific frequency ranges:

    - Alpha waves 7 to 13 Hz- Beta waves 13 to 30 Hz

    - Theta waves 4 to 7 Hz

    - Delta waves 1 to 4 Hz

    The relation between the raw data and band data conversion is as the following:

    - 2000 ms measured Single EEGRawData object is transformed into a List containing 36

    EEGBandData objects with different alpha, beta, theta, delta power values.

    Timing :

    Windowing determines the length of the time interval, whose values will be processed. Our

    time interval for