# Methodology for Designing an Electricity Demand System in the Context of IoT Household
## 4 Methodology to Simulate Household Appliance Consumption and Behavior  
A mathematical representation of electric consumption in a house is developed by a mathematical model. The sort of devices and their characterization are used for modeling. The devices description is conducted by kind of device, the minimum and maximum consumption, and the frequent use time. The on/off devices' states are represented by 1 and 0, respectively. Depending on the way in which the household appliances work, they can be sorted into flexible, not flexible, interruptible, and uninterruptible devices. The flexible devices are the devices of electric consumption whose function can be interrupted and continue in another moment. Flexible devices can be put on stand-by. The not-flexible appliances are devices of electric consumption that cannot be turned off; this type of appliance has a constant operation. Interruptible appliances are the electrical consumption devices that can be used at any time; their time of use varies according to the user's needs. Uninterruptible appliances are electrical devices that stop when their function has finished; the electric consumption can be constant or variable. The set of devices in a context is represented by \(A\), and i-esime device is represented by ai. In the set \(A\), there are four subsets \(A_{I}\), \(A_{U}\), \(A_{F}\), \(A_{NF}\), and \(A=A_{I}\)\(U\)\(A_{U}\)\(U\)\(A_{F}\)\(U\)\(A_{NF}\), where every subset represents a kind of device: \(a_{I}\)\(\epsilon\)\(A_{I}\), \(a_{U}\)\(\epsilon\)\(A_{U}\), \(a_{F}\)\(\epsilon\)\(A_{NF}\), \(a_{NF}\)\(\epsilon\)\(A_{NF}\). The on/off devices state in the C moment is represented by (C) = [0, 1], 1 represents turned device on, and 0 turned device off. There are 24 moments considered in the modelling, C C T, \(T\) = [C1, C2,..., C24]. The cardinality of set \(A\) and its subsets are represented in Equations (1)-(3):  
\[\mid A\mid=m,\ \mid AI\mid=n,\ \mid AU\mid=p,\ \mid AF\mid=q \tag{1}\]  
\[\mid ANF\mid=r.\ So,n+p+q+r=m \tag{2}\]  
\[A=\{a1,a2,\ldots,am\} \tag{3}\]  
Set \(A\) can have devices belonging to the same type of device with different identifiers. The function of the consumption Equation (4) of the devices takes the elements of the set \(A\) in each of the moments contemplated in \(T\) and generates the consumption measured in watts. The hourly consumption of a device at a specific time is given in Equation (5). \[\varepsilon:A\times T\ \rightarrow\ R^{+} \tag{4}\]  
\[\varepsilon(a_{i},\tau_{i})=Y^{\tau}_{u_{i}} \tag{5}\]  
The total consumption of the set is represented by Equation (6), which is the sum of the consumption made by all the devices daily. The hourly consumption Equation (7) of all the devices is the sum of the consumption that is carried out at a specific moment by each of the device groups. \[\varepsilon=\varepsilon_{I}+\varepsilon_{NI}+\varepsilon_{F}+\varepsilon_{ NF} \tag{6}\]  
\[Y^{\tau}=Y^{\tau}_{I}+Y^{\tau}_{NI}+Y^{\tau}_{F}+Y^{\tau}_{NF} \tag{7}\]  
The minimum consumptions per day are shown by Equation (8), those per hour by Equation (9). \[\varepsilon_{min}=\varepsilon_{NF}=\sum_{a_{NF}\in A_{NF}}\sum_{\tau=1}^{T}Y _{a_{NF}^{\tau}} \tag{8}\]  
\[Y^{\tau}_{min}=\sum_{a_{NF}\in A_{NF}}Y^{\tau}_{NF}\quad\forall\tau,\ \tau\in T \tag{9}\]The maximum consumptions per day and per hour are represented by Equations (10) and (11), respectively. \[\varepsilon_{max}=\varepsilon_{I}+\varepsilon_{NI}+\varepsilon_{F}+\varepsilon_{ NF}=\sum_{a_{i}\in A}\sum_{\tau=1}^{T}Y_{a_{i}}^{\tau},\quad a_{a_{i}}(\tau)=1 \tag{10}\]  
\[\mid ANF\mid=r.\ So,n+p+q+r=m \tag{2}\]0  
The mode is identified by Equation (12), where \(\varepsilon_{opt}\) meets the needs of the user, minimizes consumption, and reduces peaks average ratio. \[\mid ANF\mid=r.\ So,n+p+q+r=m \tag{2}\]1  
Set \(A\) has four subsets: \(A_{I}\), \(A_{U}\), \(A_{F}\), \(A_{NF}\). \(A_{I}\) represents all interruptible devices, \(a_{i}\,\mathfrak{C}\,A_{I}\), \(A_{I}=\{a_{I1},\,a_{I2},\,\ldots,\,a_{In}\}\), \(\mid A_{I}\mid=n<m\), where n is the cardinality of \(A_{I}\).