# Mathematical Modeling of Smart Space for Context-Aware System: Linear Algebraic Representation of State-Space Method Based Approach

Authors: Sung-Hyun Yang; M. Humayun Kabir; M. Robiul Hoque
Journal: Mathematical Problems in Engineering
 (2016)

---

## Abstract

A smart space is embedded with several components such as sensors, actuators, and computing devices that enable the sensing and control of the environment, and the inhabitants interact with the devices in the smart space whenever they need to. To model a smart space, a dynamic relationship needs to be established among the elements of the space whereby the interactions with devices are considered a dynamic-process state. In this paper, a linear model of a smart space is presented using a state equation, where the two coefficient matricesL and H need to be defined to model the smart space, and the coefficient matrix L is used to determine the states of the devices; similarly, the situation of the smart space is determined using coefficient H. An algorithm is presented to make a linear model from the logical functions that are used to describe the system. This model is flexible in terms of the control of the smart-space environment because the environmental factors are represented by a matrix element. This linear smart-space model is helpful for the control of a context-aware system, and we use an example to illustrate the effectiveness of the proposed model.


---

## Body

## 1. Introduction

The mathematical modeling of a system is the most important step in the design of a control system, as it represents the behavior of a system in response to the changes of states and inputs. The following are the two modeling approaches for linear systems: the transfer-function approach and the state-space approach [1]. Out of the two approaches, the state-space approach is used to represent a dynamic system. The important feature of the state-space approach is the usage of first-order differential/difference equations to represent systems. The behavior of the system can be predicted by solving the differential/difference equations that are used for modeling.A smart space is composed of a number of components such as sensors, actuators, and computing devices that enable the sensing and control of the environment. The goal of the smart space is to collect the environmental information and provide service automatically for user’s comfort and safety [2]. In a smart space, users generally interact with various devices according to their needs, and these interactions can be considered a dynamic-process state. The next states of the devices can be described using the information regarding the current states of the devices and control inputs; in terms of the smart space, its situation can be described according to the current device states. The aim of this paper is to generalize the smart-space domain through linear modeling by using a state equation. This linear model describes the relations between the next states of devices and the current states of devices along with the control inputs and between the current states of devices and the situations. Several algorithms were proposed to implement context-aware systems using knowledge and resources such as production rules (if-then relationships), neural networks, support vector machines, fuzzy logic, Bayesian networks, and Hidden Markov Model [3–6]. In [7], the author proposed a unified and mathematically compatible method for logic-based intelligent system. However, this method requires special knowledge on mathematical logic and most of the deductions are tricky. Logic-based system used the logical function sets to show the relations between the states of devices and the control inputs and between the states of devices and the smart-space situation. The matrix expression is very convenient in logic inference because it converts the problem to solving linear algebraic equation. In this paper, we have presented an algorithm to convert these logical functions into a linear algebraic equation using the Sum of Products (SOP) canonical form and logic vector. The proposed smart-space linear model can be helpful for the control of a context-aware system because all of the variables are expressed by a matrix element and the relation between every variable is expressed by a coefficient matrix.The rest of the paper is organized as follows: Section2 presents an algorithm to convert a logic function into a linear algebraic equation; Section 3 illustrates the mathematical modeling of a smart space; and Section 4 presents an example to illustrate the effectiveness of the smart-space model, followed by the conclusion and a discussion of future work in Section 5.


## 2. Linear Algebraic Representation of Logic Function

Generally, a smart space can be described by logic expressions and logic related special knowledge needs to control the environment. If logic expressions are converted into algebraic equation, then control can be done effectively by manipulating matrix elements. To develop a linear model, we need conversion of logic expression into algebraic equations. Edwards uses a canonical form to express Boolean functions in matrix algebra [8]. This approach is different from “conventional” matrix algebra, as it requires the “unit” matrix A
U
N
I
T for multiplication operations. Authors in [9] proposed the usage of a semitensor product to represent Boolean functions in an algebraic form. In this paper, we have proposed an algorithm using Sum of Products (SOP) canonical form and logic vector (ith column of an identity matrix) as logic value to represent the logic functions in the algebraic equations. Using this approach, the logic function has been represented similarly to its representation in conventional algebra, as follows:(1)
y
=
D
·
x
,where D is called the coefficient matrix that defines the logic function(s) and x and y are the input and output vectors, respectively.


### 2.1. Single Logic Function

In this section, a single logic function has been converted into a linear algebraic equation. Consider the following Boolean-logic function:(2)
y
=
f
x
1
,
x
2
,
…
,
x
n
.Any Boolean function can be expressed as a Sum of Products (SOP) in a canonical form, as follows:(3)
f
x
1
,
x
2
,
…
,
x
n
=
d
1
·
m
0
+
d
2
·
m
1
+
⋯
+
d
2
n
·
m
2
n
-
1
.Equation (3) can be represented in a matrix form, as follows:(4)
y
=
d
1
d
2
⋯
d
2
n
·
m
0
m
1
⋮
m
2
n
-
1
,where d
1
d
2
⋯
d
2
n is the coefficient matrix that holds the values of all of the minterms of the logic function, while the m
0
m
1
⋮
m
2
n
-
1 vector holds all of the minterms. The order of the matrix and vector terms must be adhered to.Theith column of an identity matrix (
I
n
) is used to represent the logic value in the logic equations [9]. Considering the identity matrix, V
=
1
0
0
1 in terms of Boolean values. True (1) and False (0) are represented as v
2
1
=
1
0 and v
2
2
=
0
1, respectively. If there are n variables, then the Boolean function is a logical mapping from a set of v
2
1
,
v
2
2
n to v
2
1
,
v
2
1.Assuming thatx
1 and x
2 are two logic variables that are represented as x
1
=
a
-
a and x
2
=
b
-
b, with a and b
∈
{
0,1
}, then the Kronecker product (
⊗
) of the two logic variables is calculated in the following way:(5)
x
1
⊗
x
2
=
a
-
a
⊗
b
-
a
=
a
-
b
-
a
-
b
a
b
-
a
b
=
m
0
m
1
m
2
m
3
.Equation (5) shows that the Kronecker product between two logic variables represents all of the minterms; similarly, the following can also be shown: (6)
x
=
x
1
⊗
x
2
⋯
⊗
x
n
=
m
0
m
1
⋮
m
2
n
-
1
.The coefficient matrix elements (d
1
,
d
2
,
…
,
d
2
n) consist of two values d
-
i
d
i, where d
i
∈
{
0,1
} and i
=
1,2
,
…
,
2
n are the substituting values, and the dimension of the coefficient matrix D is equal to 2-by-2
n, where n is the number of logic variables: (7)
D
=
d
-
1
d
-
2
⋯
d
-
2
n
d
1
d
2
⋯
d
2
n
.From (4), and using (6), it can be written as the following:(8)
y
=
D
·
x
,where y
=
y
-
y with y
∈
{
0,1
}. In the previously mentioned section, a single logic function is converted into an algebraic equation, whereas the next section will present multiple logic functions.


### 2.2. Multiple Logic Functions

Consider the following Boolean-logic functions:(9)
y
1
=
f
1
x
1
,
x
2
,
…
,
x
n
,
y
2
=
f
2
x
1
,
x
2
,
…
,
x
n
,
⋮
y
m
=
f
m
x
1
,
x
2
,
…
,
x
n
.Equation (8) can be expressed as the SOP in a canonical form:(10)
f
1
x
1
,
x
2
,
…
,
x
n
=
e
1,1
·
m
0
+
e
1,2
·
m
1
+
⋯
+
e
1,2
n
·
m
2
n
-
1
,
f
2
x
1
,
x
2
,
…
,
x
n
=
e
2,1
·
m
0
+
e
2,2
·
m
1
+
⋯
+
e
2,2
n
·
m
2
n
-
1
,
⋮
f
m
x
1
,
x
2
,
…
,
x
n
=
e
m
,
1
·
m
0
+
e
m
,
2
·
m
1
+
⋯
+
e
m
,
2
n
·
m
2
n
-
1
.Equation (10) can be represented by m linear equations akin to (4):(11)
y
1
=
e
1,1
e
1,2
⋯
e
1,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
y
2
=
e
2,1
e
2,2
⋯
e
2,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
⋮
y
m
=
e
m
,
1
e
m
,
2
⋯
e
m
,
2
n
·
m
0
m
1
⋮
m
2
n
-
1
.All of the elements of the coefficient matrix and y
i in (10) are represented by e
i
,
j
=
e
-
e, y
i
=
y
-
y, with e, and y
∈
{
0,1
}, and are expressed as follows:(12)
y
-
1
y
1
=
e
-
1,1
e
-
1,2
⋯
e
-
1,2
n
e
1,1
e
1,2
⋯
e
1,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
y
-
2
y
2
=
e
-
2,1
e
-
2,2
⋯
e
-
2,2
n
e
2,1
e
2,2
⋯
e
2,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
⋮
y
-
m
y
m
=
e
-
m
,
1
e
-
m
,
2
⋯
e
-
m
,
2
n
e
m
,
1
e
m
,
2
⋯
e
m
,
2
n
·
m
0
m
1
⋮
m
2
n
-
1
.By applying the Khatri-Rao product (∗) between all of the coefficient matrices, we can obtain the coefficient matrix E for (12) [10]. The dimensions of coefficient matrix E are equal to 2
m-by-2
n, where m is the number of logic functions and n is the number of logic variables, as follows:(13)
E
=
e
1
∗
e
2
∗
⋯
∗
e
m
,
E
=
Col
1
e
1
⊗
Col
1
e
2
⊗
⋯
Col
1
e
m
Col
2
e
1
⊗
Col
2
e
2
⊗
⋯
Col
2
e
m
⋯
Col
2
n
e
1
⊗
Col
2
n
e
2
⊗
⋯
Col
2
n
e
m
.Applying the Kronecker product (⊗) on the left side of (12), (14)
y
=
y
-
1
y
1
⊗
y
-
2
y
2
⋯
⊗
y
-
m
y
m
.From (12), the usage of (6), (13), and (14) can be written as the following:(15)
y
=
E
·
x
.


## 2.1. Single Logic Function

In this section, a single logic function has been converted into a linear algebraic equation. Consider the following Boolean-logic function:(2)
y
=
f
x
1
,
x
2
,
…
,
x
n
.Any Boolean function can be expressed as a Sum of Products (SOP) in a canonical form, as follows:(3)
f
x
1
,
x
2
,
…
,
x
n
=
d
1
·
m
0
+
d
2
·
m
1
+
⋯
+
d
2
n
·
m
2
n
-
1
.Equation (3) can be represented in a matrix form, as follows:(4)
y
=
d
1
d
2
⋯
d
2
n
·
m
0
m
1
⋮
m
2
n
-
1
,where d
1
d
2
⋯
d
2
n is the coefficient matrix that holds the values of all of the minterms of the logic function, while the m
0
m
1
⋮
m
2
n
-
1 vector holds all of the minterms. The order of the matrix and vector terms must be adhered to.Theith column of an identity matrix (
I
n
) is used to represent the logic value in the logic equations [9]. Considering the identity matrix, V
=
1
0
0
1 in terms of Boolean values. True (1) and False (0) are represented as v
2
1
=
1
0 and v
2
2
=
0
1, respectively. If there are n variables, then the Boolean function is a logical mapping from a set of v
2
1
,
v
2
2
n to v
2
1
,
v
2
1.Assuming thatx
1 and x
2 are two logic variables that are represented as x
1
=
a
-
a and x
2
=
b
-
b, with a and b
∈
{
0,1
}, then the Kronecker product (
⊗
) of the two logic variables is calculated in the following way:(5)
x
1
⊗
x
2
=
a
-
a
⊗
b
-
a
=
a
-
b
-
a
-
b
a
b
-
a
b
=
m
0
m
1
m
2
m
3
.Equation (5) shows that the Kronecker product between two logic variables represents all of the minterms; similarly, the following can also be shown: (6)
x
=
x
1
⊗
x
2
⋯
⊗
x
n
=
m
0
m
1
⋮
m
2
n
-
1
.The coefficient matrix elements (d
1
,
d
2
,
…
,
d
2
n) consist of two values d
-
i
d
i, where d
i
∈
{
0,1
} and i
=
1,2
,
…
,
2
n are the substituting values, and the dimension of the coefficient matrix D is equal to 2-by-2
n, where n is the number of logic variables: (7)
D
=
d
-
1
d
-
2
⋯
d
-
2
n
d
1
d
2
⋯
d
2
n
.From (4), and using (6), it can be written as the following:(8)
y
=
D
·
x
,where y
=
y
-
y with y
∈
{
0,1
}. In the previously mentioned section, a single logic function is converted into an algebraic equation, whereas the next section will present multiple logic functions.


## 2.2. Multiple Logic Functions

Consider the following Boolean-logic functions:(9)
y
1
=
f
1
x
1
,
x
2
,
…
,
x
n
,
y
2
=
f
2
x
1
,
x
2
,
…
,
x
n
,
⋮
y
m
=
f
m
x
1
,
x
2
,
…
,
x
n
.Equation (8) can be expressed as the SOP in a canonical form:(10)
f
1
x
1
,
x
2
,
…
,
x
n
=
e
1,1
·
m
0
+
e
1,2
·
m
1
+
⋯
+
e
1,2
n
·
m
2
n
-
1
,
f
2
x
1
,
x
2
,
…
,
x
n
=
e
2,1
·
m
0
+
e
2,2
·
m
1
+
⋯
+
e
2,2
n
·
m
2
n
-
1
,
⋮
f
m
x
1
,
x
2
,
…
,
x
n
=
e
m
,
1
·
m
0
+
e
m
,
2
·
m
1
+
⋯
+
e
m
,
2
n
·
m
2
n
-
1
.Equation (10) can be represented by m linear equations akin to (4):(11)
y
1
=
e
1,1
e
1,2
⋯
e
1,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
y
2
=
e
2,1
e
2,2
⋯
e
2,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
⋮
y
m
=
e
m
,
1
e
m
,
2
⋯
e
m
,
2
n
·
m
0
m
1
⋮
m
2
n
-
1
.All of the elements of the coefficient matrix and y
i in (10) are represented by e
i
,
j
=
e
-
e, y
i
=
y
-
y, with e, and y
∈
{
0,1
}, and are expressed as follows:(12)
y
-
1
y
1
=
e
-
1,1
e
-
1,2
⋯
e
-
1,2
n
e
1,1
e
1,2
⋯
e
1,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
y
-
2
y
2
=
e
-
2,1
e
-
2,2
⋯
e
-
2,2
n
e
2,1
e
2,2
⋯
e
2,2
n
·
m
0
m
1
⋮
m
2
n
-
1
,
⋮
y
-
m
y
m
=
e
-
m
,
1
e
-
m
,
2
⋯
e
-
m
,
2
n
e
m
,
1
e
m
,
2
⋯
e
m
,
2
n
·
m
0
m
1
⋮
m
2
n
-
1
.By applying the Khatri-Rao product (∗) between all of the coefficient matrices, we can obtain the coefficient matrix E for (12) [10]. The dimensions of coefficient matrix E are equal to 2
m-by-2
n, where m is the number of logic functions and n is the number of logic variables, as follows:(13)
E
=
e
1
∗
e
2
∗
⋯
∗
e
m
,
E
=
Col
1
e
1
⊗
Col
1
e
2
⊗
⋯
Col
1
e
m
Col
2
e
1
⊗
Col
2
e
2
⊗
⋯
Col
2
e
m
⋯
Col
2
n
e
1
⊗
Col
2
n
e
2
⊗
⋯
Col
2
n
e
m
.Applying the Kronecker product (⊗) on the left side of (12), (14)
y
=
y
-
1
y
1
⊗
y
-
2
y
2
⋯
⊗
y
-
m
y
m
.From (12), the usage of (6), (13), and (14) can be written as the following:(15)
y
=
E
·
x
.


## 3. Linear Modeling of a Smart Space

Smart space is set up with the sensors and several devices. In this section, we have presented the linear model of a smart space. In a smart space, an inhabitant interacts with several devices through the combinational state of devices, and each device can be operated in two states. The next state of a device can be described by the logical function of the current states of the device and its input information about the environment. The situation of a smart space at any time is described by the combination of the states of the devices at that time. The sensor network in a smart space is used to collect the input data about the environment which is needed to represent a space state. The next states of the devices can be expressed as the following:(16)
x
1
t
+
1
=
f
1
x
1
t
,
…
,
x
n
t
,
u
1
t
,
…
,
u
m
t
,
x
2
t
+
1
=
f
2
x
1
t
,
…
,
x
n
t
,
u
1
t
,
…
,
u
m
t
,
⋮
x
n
t
+
1
=
f
n
x
1
t
,
…
,
x
n
t
,
u
1
t
,
…
,
u
m
t
,where f
i
:
V
n
+
m
→
V, i
=
1,2
,
…
,
n, and x
j
∈
V, j
=
1,2
,
…
,
n, are the states of the devices and u
l
∈
V, l
=
1,2
,
…
,
m, are the inputs that represent the environment.The situation of the smart space can be expressed as the following:(17)
y
1
t
=
h
1
x
1
t
,
x
2
t
,
…
,
x
n
t
,
y
2
t
=
h
2
x
1
t
,
x
2
t
,
…
,
x
n
t
,
⋮
y
p
t
=
h
p
x
1
t
,
x
2
t
,
…
,
x
n
t
,where h
j
:
V
n
→
V, j
=
1,2
,
…
,
p, are the logical functions; x
j
∈
V, j
=
1,2
,
…
,
n, are the states of the devices; and y
l
∈
V, l
=
1,2
,
…
,
p, are the situations.Using the procedure described in Section2, the multiple logical functions expressed by (16) and (17) can be converted into standard discrete-time dynamic systems, as follows: (18)
x
t
+
1
=
C
·
x
t
⊗
u
t
,
y
t
=
H
·
x
t
,where the matrices C and H are called the coefficients of the logical functions of (16) and (17), respectively. One has x
(
t
+
1
)
=
x
1
(
t
+
1
)
⊗
x
2
(
t
+
1
)
⊗
⋯
x
n
(
t
+
1
), x
(
t
)
=
x
1
(
t
)
⊗
x
2
(
t
)
⊗
⋯
x
n
(
t
), u
(
t
)
=
u
1
(
t
)
⊗
u
2
(
t
)
⊗
⋯
u
m
(
t
), and y
(
t
)
=
y
1
(
t
)
⊗
y
2
(
t
)
⊗
⋯
y
p
(
t
).The input-state coefficient matrix (C) and the state-situation coefficient matrix (H) are matrix representations of the SOP of a logic variable that is used in logic expressions. Input (u), state (x), and output (y) vectors represent the possible control inputs, the states of the devices, and the situations in the smart space, respectively. A block diagram of the proposed linear model is shown in Figure 1.Figure 1
Block diagram of the proposed smart-space model.


## 4. An Example of a Smart Space

In this example, we assume that a smart space which is composed of a sensor network and four devices will be operated by sensor data. The input data about the environmentu
1, u
2, u
3, u
4, and u
5 are formed on the basis of the sensor data and the four devices’ states are considered as x
1, x
2, x
3, and x
4. The next states of the devices are determined based on the current states of the devices and the input information about the environment. The situation of a smart space at any time is dependent on the combinational states of the devices at that time. Two different logical functions are used to describe the relations between the information about the environment and device states and the device states and situations. All of the variables are considered Boolean logical variables (“ON,” “OFF”). If the current states of the devices are known, then the next device states are updated according to the current states and input information about the environment [11]. The next states of the devices can be represented by (16) and we can express the function by logic rules (if-then relationship) as tabulated in Table 1.Table 1
Logic rules for state change.
Rules for state change
(i)
Ifx
1
∨
¬
x
2
∨
¬
x
3
∨
x
4
∧
u
1
∧
u
2
∧
¬
u
3
∧
¬
u
4
∧
¬
u
5
= True then x
1 = True
(ii)
Ifx
1
∨
x
2
∨
x
3
∨
¬
x
4
∨
x
5
∧
u
1
∧
¬
u
2
∧
¬
u
3
∧
¬
u
4
∧
¬
u
5 = Truethen x
2 = True
(iii)
If¬
x
1
∨
x
2
∨
x
3
∨
¬
x
4
∨
x
5
∧
u
1
∧
¬
u
2
∧
¬
u
3
∧
u
4
∧
¬
u
5 = Truethen x
3 = True
(iv)
Ifx
1
∨
¬
x
2
∨
¬
x
3
∨
x
4
∨
x
5
∧
u
1
∧
¬
u
2
∧
u
3
∧
¬
u
4
∧
¬
u
5 = Truethen x
4 = TrueThese logic rules can be assumed as the following:(19)
x
1
t
+
1
=
x
1
t
+
x
-
2
t
+
x
-
3
t
+
x
4
t
·
u
1
t
·
u
2
t
·
u
-
3
t
·
u
-
4
t
·
u
-
5
t
,
x
2
t
+
1
=
x
1
t
+
x
2
t
+
x
3
t
+
x
-
4
t
·
u
1
t
·
u
-
2
t
·
u
-
3
t
·
u
-
4
t
·
u
-
5
t
,
x
3
t
+
1
=
x
-
1
t
+
x
2
t
+
x
3
t
+
x
-
4
t
·
u
1
t
·
u
-
2
·
u
-
3
t
·
u
4
t
·
u
-
5
t
,
x
4
t
+
1
=
x
1
t
+
x
-
2
t
+
x
-
3
t
+
x
4
t
·
u
1
t
·
u
-
2
t
·
u
3
t
·
u
-
4
t
·
u
-
5
t
.There are four current states and five input variables on the right-hand side of (19). We consider that 2
9
=
512, SOP for the expression of the logical function (19) into a canonical form. When we calculated the minterms, we used variable x
4 as MSB and u
1 as LSB. Figure 2 shows the variable minterm format.Figure 2
The format variables that can be used in the minterm calculations.Equation (19) can be expressed as the SOP in canonical form, as follows:(20)
x
1
t
+
1
=
m
3
+
m
35
+
m
67
+
m
99
+
m
131
+
m
163
+
m
227
+
m
259
+
m
291
+
m
323
+
m
355
+
m
387
+
m
419
+
m
451
+
m
483
,
x
2
t
+
1
=
m
1
+
m
33
+
m
65
+
m
97
+
m
129
+
m
161
+
m
193
+
m
225
+
m
289
+
m
321
+
m
353
+
m
385
+
m
417
+
m
449
+
m
481
,
x
3
t
+
1
=
m
9
+
m
41
+
m
73
+
m
105
+
m
137
+
m
169
+
m
201
+
m
233
+
m
265
+
m
329
+
m
361
+
m
393
+
m
425
+
m
457
+
m
489
,
x
4
t
+
1
=
m
5
+
m
37
+
m
69
+
m
101
+
m
133
+
m
169
+
m
229
+
m
261
+
m
293
+
m
325
+
m
357
+
m
389
+
m
421
+
m
453
+
m
485
.Equation (20) can be represented in a matrix form as the following:(21)
x
1
t
+
1
=
0
0
1
0
0
⋯
0
·
m
0
m
1
m
2
m
3
m
4
⋮
m
511
,
x
2
t
+
1
=
1
0
0
0
0
⋯
0
·
m
0
m
1
m
2
m
3
m
4
⋮
m
511
,
x
3
t
+
1
=
0
0
0
0
0
⋯
0
·
m
0
m
1
m
2
m
3
m
4
⋮
m
511
,
x
4
t
+
1
=
0
0
0
0
1
⋯
0
·
m
0
m
1
m
2
m
3
m
4
⋮
m
511
.From (21), the first matrix on the right-hand side is the coefficient matrix that holds all of the minterms values of each function of (20), and the m
0
m
1
⋮
m
511 vector holds all of the 512 minterms of the logic functions of (20). All of the elements of the coefficient matrix are substituted by True (
1
)
=
1
0 and False (
0
)
=
0
1. By applying the Khatri-Rao product (∗) between all four of the coefficient matrices in (21), the following coefficient of matrix C can be obtained: (22)
C
=
c
1
∗
c
2
∗
⋯
∗
c
4
,
C
=
Col
1
c
1
⊗
Col
1
c
2
⊗
⋯
Col
1
c
4
Col
2
c
1
⊗
Col
2
c
2
⊗
⋯
Col
2
c
4
⋯
Col
512
c
1
⊗
Col
512
c
2
⊗
⋯
Col
512
c
4
.The dimension of the coefficient of matrix C is equal to 16-by-512. The minterm vector can be calculated by x
(
t
)
⊗
u
(
t
), where x
=
x
1
⊗
x
2
⊗
⋯
⊗
x
4 and u
=
u
1
⊗
u
2
⊗
⋯
⊗
u
5, as follows:(23)
x
t
⊗
u
t
=
m
0
m
1
⋮
m
511
.By substituting x
i
(
t
+
1
) by x
i
=
x
-
i
x
i with x
i
∈
{
0,1
}, followed by the application of the Kronecker product (⊗) on the left-hand side of (21), the following can be derived: (24)
x
t
+
1
=
x
-
1
x
1
⊗
x
-
2
x
2
⋯
⊗
x
-
4
x
4
.From the use of (22) by (21), (23) and (24) can be written in the following way:(25)
x
t
+
1
=
C
·
x
t
⊗
u
t
.The situation of this smart space can be expressed by (17), and we can express the function by logic rules (if-then relationship) as shown in Table 2.Table 2
Logic rules for situation.
Rules for situation
(i)
Ifx
1
∧
¬
x
2
∧
¬
x
3
∧
¬
x
4 = Truethen y
1 = True
(ii)
Ifx
1
∨
x
2
∨
x
3
∧
¬
x
4 = Truethen y
2 = True
(iii)
Ifx
1
∨
x
2
∧
¬
x
3
∧
¬
x
4 = Truethen y
3 = True
(iv)
If¬
x
1
∧
x
2
∨
x
3
∨
x
4 = Truethen y
4 = TrueThese logic rules can be assumed as the following:(26)
y
1
t
=
x
1
t
·
x
-
2
t
·
x
-
3
t
·
x
-
4
t
,
y
2
t
=
x
1
t
+
x
2
t
+
x
3
t
·
x
-
4
t
,
y
3
t
=
x
1
t
+
x
2
t
·
x
-
3
t
·
x
-
4
t
,
y
4
t
=
x
-
1
t
·
x
2
t
+
x
3
t
+
x
4
t
.Similarly, a logical function that describes the situation can be represented by a linear algebraic equation in the following way:(27)
y
t
=
H
·
x
t
,where H is the coefficient matrix and y and x are the output and input vectors, respectively. The dimensions of y, H, and x are 16-by-1, 16-by-16, and 16-by-1, respectively.In this example, a total of nine variables (sum of device states and environmental information) are used. Using these nine variables, there are2
9
=
512 different input sequences available. These 512 input sequences are used to determine next states of devices. Then, smart-space situations can be calculated from combination of different devices states. We have calculated smart-space situation in two ways: firstly using logic rules and secondly using linear model. In logic rules method, we used rules for state change (Table 1) and rules for situation (Table 2) to infer the situation of smart space and considered the outcomes as manipulated data. In terms of the linear model, (25) and (27) represent the state equation and situation equation, respectively, and these matrix expressions generalize the logical operations that are convenient in logical inference. Control can be complete effectively by matrix calculations using this linear smart-space model. The situation of smart space can be inferred using Algorithm 1. Outcomes of Algorithm 1 are considered as linear-model data.Algorithm 1:Linear model (C, H, u, x).
Data: input-state coefficient matrix C, state-output coefficient matrix H, at a given
time, List of inputI, List of state S, input vector u, state vector x
Result: Situation y
(1)
x, u initialization;
/∗ Next state calculation ∗/
(2)
for  i
=
1 to q  do
/∗  q is the total no. of inputs in list of input I  ∗/
(3) u
=
u
⊗
I
j;
(4)end
(5)
x
=
C
×
x
⊗
u;
(6)
for  j
=
1 to l do
/∗  l is the total no. of inputs in list of input I  ∗/
(7) x
=
x
⊗
S
j;
(8)end
(9)
y
=
H
×
x;Using manipulated data, a plot was drawn for the “ON” states of the devices with a corresponding situation, while the linear-model data is presented for the purpose of comparison, as shown in Figure3; every situation is composed of a set of device states. In Figure 3, different markers were used to show the “ON” state of each device. Our results show an overlap between the linear-model data and the manipulated data, proving that a linear model represents the logic function equally well and can be used to model a smart space. Using linear model control can be done easily by manipulating matrix elements.Figure 3
Representation of a situation with corresponding devices at “ON” states.


## 5. Conclusion

We have proposed a smart-space linear model through the conversion of a logic function to a linear model. A smart space is typically represented by a logic function whereby smart devices operate in the smart space; in a state-space approach, the smart space is expressed as a linear model by the presented algorithm. This linear model describes the relations between the device states and inputs that represent the environment and between the device states and the situation of smart space. The example in this paper presents a linear model of smart space using four devices, each of which has two states and five control inputs based on the proposed model. In addition, the states of the devices and the corresponding situations are shown with different control inputs. Experimental result shows that outcomes using this linear model are the same as logic rules. Although the linear-model results are the same as logic functions, control can be done easily using linear model by manipulating the matrix elements. Moreover, if the infrastructure of smart space is changed, then it can be easily adopted because environmental factors are represented by matrix elements and the relation between every variable is expressed by the coefficient matrix. This model can be applied in an Internet of Things platform whereby correspondence between devices is necessary for a number of purposes. In this modeling, all of the logical variables are represented by the values of 1 or 0. In the future,k-value logic will be used to express the logic variable more effectively.



---

*Source: 8325054-2016-04-13.xml*