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 matrices L 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.
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: Section 2 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 AUNIT 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=fx1,x2,…,xn.Any Boolean function can be expressed as a Sum of Products (SOP) in a canonical form, as follows:(3)fx1,x2,…,xn=d1·m0+d2·m1+⋯+d2n·m2n-1.Equation (3) can be represented in a matrix form, as follows:(4)y=d1d2⋯d2n·m0m1⋮m2n-1,where d1d2⋯d2n is the coefficient matrix that holds the values of all of the minterms of the logic function, while the m0m1⋮m2n-1 vector holds all of the minterms. The order of the matrix and vector terms must be adhered to.
The ith column of an identity matrix (In) is used to represent the logic value in the logic equations [9]. Considering the identity matrix, V=1001 in terms of Boolean values. True (1) and False (0) are represented as v21=10 and v22=01, respectively. If there are n variables, then the Boolean function is a logical mapping from a set of v21,v22n to v21,v21.
Assuming that x1 and x2 are two logic variables that are represented as x1=a-a and x2=b-b, with a and b∈{0,1}, then the Kronecker product (⊗) of the two logic variables is calculated in the following way:(5)x1⊗x2=a-a⊗b-a=a-b-a-bab-ab=m0m1m2m3.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=x1⊗x2⋯⊗xn=m0m1⋮m2n-1.The coefficient matrix elements (d1,d2,…,d2n) consist of two values d-idi, where di∈{0,1} and i=1,2,…,2n are the substituting values, and the dimension of the coefficient matrix D is equal to 2-by-2n, where n is the number of logic variables: (7)D=d-1d-2⋯d-2nd1d2⋯d2n.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)y1=f1x1,x2,…,xn,y2=f2x1,x2,…,xn,⋮ym=fmx1,x2,…,xn.Equation (8) can be expressed as the SOP in a canonical form:(10)f1x1,x2,…,xn=e1,1·m0+e1,2·m1+⋯+e1,2n·m2n-1,f2x1,x2,…,xn=e2,1·m0+e2,2·m1+⋯+e2,2n·m2n-1,⋮fmx1,x2,…,xn=em,1·m0+em,2·m1+⋯+em,2n·m2n-1.Equation (10) can be represented by m linear equations akin to (4):(11)y1=e1,1e1,2⋯e1,2n·m0m1⋮m2n-1,y2=e2,1e2,2⋯e2,2n·m0m1⋮m2n-1,⋮ym=em,1em,2⋯em,2n·m0m1⋮m2n-1.All of the elements of the coefficient matrix and yi in (10) are represented by ei,j=e-e, yi=y-y, with e, and y∈{0,1}, and are expressed as follows:(12)y-1y1=e-1,1e-1,2⋯e-1,2ne1,1e1,2⋯e1,2n·m0m1⋮m2n-1,y-2y2=e-2,1e-2,2⋯e-2,2ne2,1e2,2⋯e2,2n·m0m1⋮m2n-1,⋮y-mym=e-m,1e-m,2⋯e-m,2nem,1em,2⋯em,2n·m0m1⋮m2n-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 2m-by-2n, where m is the number of logic functions and n is the number of logic variables, as follows:(13)E=e1∗e2∗⋯∗em,E=Col1e1⊗Col1e2⊗⋯Col1emCol2e1⊗Col2e2⊗⋯Col2em⋯Col2ne1⊗Col2ne2⊗⋯Col2nem.Applying the Kronecker product (⊗) on the left side of (12), (14)y=y-1y1⊗y-2y2⋯⊗y-mym.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)x1t+1=f1x1t,…,xnt,u1t,…,umt,x2t+1=f2x1t,…,xnt,u1t,…,umt,⋮xnt+1=fnx1t,…,xnt,u1t,…,umt,where fi:Vn+m→V, i=1,2,…,n, and xj∈V, j=1,2,…,n, are the states of the devices and ul∈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)y1t=h1x1t,x2t,…,xnt,y2t=h2x1t,x2t,…,xnt,⋮ypt=hpx1t,x2t,…,xnt,where hj:Vn→V, j=1,2,…,p, are the logical functions; xj∈V, j=1,2,…,n, are the states of the devices; and yl∈V, l=1,2,…,p, are the situations.
Using the procedure described in Section 2, the multiple logical functions expressed by (16) and (17) can be converted into standard discrete-time dynamic systems, as follows: (18)xt+1=C·xt⊗ut,yt=H·xt,where the matrices C and H are called the coefficients of the logical functions of (16) and (17), respectively. One has x(t+1)=x1(t+1)⊗x2(t+1)⊗⋯xn(t+1), x(t)=x1(t)⊗x2(t)⊗⋯xn(t), u(t)=u1(t)⊗u2(t)⊗⋯um(t), and y(t)=y1(t)⊗y2(t)⊗⋯yp(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.
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 environment u1, u2, u3, u4, and u5 are formed on the basis of the sensor data and the four devices’ states are considered as x1, x2, x3, and x4. 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.
Logic rules for state change.
Rules for state change
(i)
If x1∨¬x2∨¬x3∨x4∧u1∧u2∧¬u3∧¬u4∧¬u5= True then x1 = True
(ii)
If x1∨x2∨x3∨¬x4∨x5∧u1∧¬u2∧¬u3∧¬u4∧¬u5 = Truethen x2 = True
(iii)
If ¬x1∨x2∨x3∨¬x4∨x5∧u1∧¬u2∧¬u3∧u4∧¬u5 = Truethen x3 = True
(iv)
If x1∨¬x2∨¬x3∨x4∨x5∧u1∧¬u2∧u3∧¬u4∧¬u5 = Truethen x4 = True
These logic rules can be assumed as the following:(19)x1t+1=x1t+x-2t+x-3t+x4t·u1t·u2t·u-3t·u-4t·u-5t,x2t+1=x1t+x2t+x3t+x-4t·u1t·u-2t·u-3t·u-4t·u-5t,x3t+1=x-1t+x2t+x3t+x-4t·u1t·u-2·u-3t·u4t·u-5t,x4t+1=x1t+x-2t+x-3t+x4t·u1t·u-2t·u3t·u-4t·u-5t.There are four current states and five input variables on the right-hand side of (19). We consider that 29=512, SOP for the expression of the logical function (19) into a canonical form. When we calculated the minterms, we used variable x4 as MSB and u1 as LSB. Figure 2 shows the variable minterm format.
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)x1t+1=m3+m35+m67+m99+m131+m163+m227+m259+m291+m323+m355+m387+m419+m451+m483,x2t+1=m1+m33+m65+m97+m129+m161+m193+m225+m289+m321+m353+m385+m417+m449+m481,x3t+1=m9+m41+m73+m105+m137+m169+m201+m233+m265+m329+m361+m393+m425+m457+m489,x4t+1=m5+m37+m69+m101+m133+m169+m229+m261+m293+m325+m357+m389+m421+m453+m485.Equation (20) can be represented in a matrix form as the following:(21)x1t+1=00100⋯0·m0m1m2m3m4⋮m511,x2t+1=10000⋯0·m0m1m2m3m4⋮m511,x3t+1=00000⋯0·m0m1m2m3m4⋮m511,x4t+1=00001⋯0·m0m1m2m3m4⋮m511.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 m0m1⋮m511 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)=10 and False (0)=01. 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=c1∗c2∗⋯∗c4,C=Col1c1⊗Col1c2⊗⋯Col1c4Col2c1⊗Col2c2⊗⋯Col2c4⋯Col512c1⊗Col512c2⊗⋯Col512c4.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=x1⊗x2⊗⋯⊗x4 and u=u1⊗u2⊗⋯⊗u5, as follows:(23)xt⊗ut=m0m1⋮m511.By substituting xi(t+1) by xi=x-ixi with xi∈{0,1}, followed by the application of the Kronecker product (⊗) on the left-hand side of (21), the following can be derived: (24)xt+1=x-1x1⊗x-2x2⋯⊗x-4x4.From the use of (22) by (21), (23) and (24) can be written in the following way:(25)xt+1=C·xt⊗ut.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.
Logic rules for situation.
Rules for situation
(i)
If x1∧¬x2∧¬x3∧¬x4 = Truethen y1 = True
(ii)
If x1∨x2∨x3∧¬x4 = Truethen y2 = True
(iii)
If x1∨x2∧¬x3∧¬x4 = Truethen y3 = True
(iv)
If ¬x1∧x2∨x3∨x4 = Truethen y4 = True
These logic rules can be assumed as the following:(26)y1t=x1t·x-2t·x-3t·x-4t,y2t=x1t+x2t+x3t·x-4t,y3t=x1t+x2t·x-3t·x-4t,y4t=x-1t·x2t+x3t+x4t.Similarly, a logical function that describes the situation can be represented by a linear algebraic equation in the following way:(27)yt=H·xt,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 are 29=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.
Data: input-state coefficient matrix C, state-output coefficient matrix H, at a given
time, List of input I, List of state S, input vector u, state vector x
Result: Situation y
(1)x, u initialization;
/∗ Next state calculation ∗/
(2)fori=1 to qdo
/∗q is the total no. of inputs in list of input I∗/
(3)u=u⊗Ij;
(4)end
(5)x=C×x⊗u;
(6)forj=1 to l do
/∗l is the total no. of inputs in list of input I∗/
(7)x=x⊗Sj;
(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 Figure 3; 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.
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.
Competing Interests
The authors declare that they have no competing interests.
Acknowledgments
This work was supported by the Industrial Strategic Technology Development Program (10041788, Development of Smart Home Service Based on Advanced Context-Awareness) funded by the Ministry of Trade, Industry & Energy (MI, Korea). The work reported in this paper was conducted during the sabbatical year of Kwangwoon University in 2013.
FriedlandB.CookD. J.DasS. K.MozerM. C.The neural network house: an environment that adapts to its inhabitantsProceedings of the AAAI Spring Symposium on Intelligent Environments1998110114HongJ.-Y.SuhE.-H.KimS.-J.Context-aware systems: a literature review and classificationParkH.-S.ChoS.-B.A modular design of Bayesian networks using expert knowledge: context-aware home service robotKabirM. H.HoqueM. R.ThapaK.YangS.-H.Two-layer hidden Markov model for human activity recognition in home environmentsTruemperK.EdwardsC. R.The logic of Boolean matricesChengD.QiH.LiZ.LjungL.SöderströmT.SchiffJ. L.