*5.6. Smart Meter*

Upon receiving the (*Cp*,*macp*) in time slot *Ts*, the smart meter verifies *macp* using the shared key between the sink node and smart meter, as in [82]. Then, it validates the *Cp*. If *Cp* is valid, the smart meter performs a report reading and analyses the received aggregated reading. Moreover, it calculates *<sup>H</sup>*(*Ts*)*<sup>n</sup>*·*p*<sup>0</sup> through its secret keys. Next, the smart meter computes using the following equations (as adapted from [82])

$$\mathbb{C}'\_p = \mathbb{C}\_p \cdot H(T\_s)^{n \cdot p\_0} \bmod n^2 \tag{13}$$

$$\mathcal{C}'\_p = \prod\_{i=1}^N \mathfrak{c}\_{ip} \cdot H(T\_s)^{n \cdot (p\_0 + p\_{N+1})} \bmod n^2 \tag{14}$$

$$\mathbf{C}'\_{p} = \prod\_{i=1}^{N} [1 + n \cdot \boldsymbol{\sigma}\_{\circ} \cdot (\mathbf{x}\_{i} \cdot \boldsymbol{\sigma}\_{0} + \mathbf{x}\_{i}^{2})] \cdot H(T\_{s})^{n \cdot p\_{i}} \bmod n^{2} \quad \cdot H(T\_{s})^{n \cdot (p\_{0} + p\_{N+1})} \bmod n^{2} \tag{15}$$

$$\mathbf{C}'\_{p} = \prod\_{i=1}^{N} [1 + n \cdot \boldsymbol{\sigma} \ast\_{j} \cdot (\mathbf{x}\_{i} \cdot \boldsymbol{\sigma} \ast\_{0} + \mathbf{x}\_{i}^{2})] \cdot \prod\_{i=1}^{N+1} H(T\_{s})^{n \cdot p\_{i}} \bmod n^{2} \tag{16}$$

$$\mathbf{C}'\_{p} = \prod\_{i=1}^{N} [1 + n \cdot \boldsymbol{\sigma} \ast\_{\boldsymbol{j}} \cdot (\mathbf{x}\_{i} \cdot \boldsymbol{\sigma}\_{0} + \mathbf{x}\_{i}^{2})] \cdot H(T\_{s})^{\overset{N+1}{\sum\limits\_{i=1}^{N} p\_{i}}} \bmod n^{2} \tag{17}$$

$$\mathbf{C}'\_{p} = \prod\_{i=1}^{N} [1 + n \cdot \boldsymbol{\sigma} \ast\_{j} \cdot (\mathbf{x}\_{i} \cdot \boldsymbol{\sigma}\_{0} + \mathbf{x}\_{i}^{2})] \cdot H(T\_{s})^{n \cdot \lambda \cdot k} \bmod n^{2} \tag{18}$$

$$\mathbf{C}'\_{p} = \prod\_{i=1}^{N} [1 + \boldsymbol{n} \cdot \boldsymbol{\sigma} \ast\_{\boldsymbol{j}} \cdot (\mathbf{x}\_{i} \cdot \boldsymbol{\sigma}\_{0} + \mathbf{x}\_{i}^{2})] \bmod n^{2} \tag{19}$$

$$\mathbf{C}'\_p = \mathbf{1} + \boldsymbol{n} \cdot \sum\_{i=1}^{N} [\boldsymbol{\sigma} \ast\_j \cdot (\mathbf{x}\_i \cdot \boldsymbol{\sigma}\_0 + \mathbf{x}\_i^2)] \bmod n^2 \tag{20}$$

$$\mathcal{C}\_{p}^{\prime} = 1 + n \cdot \sum\_{j=1}^{k} \sigma\_{j} (\sum\_{G\_{i} \in \mathcal{G}\_{j}} (\mathbf{x}\_{i} \cdot \sigma\_{0} + \mathbf{x}\_{i}^{2})) \bmod n^{2} \tag{21}$$

The smart meter has the ability to calculate its mean and variance as

$$M\_{\bar{\jmath}} = M \bmod n\_{\bar{\jmath}} = \sum\_{i=1}^{N\_{\bar{\jmath}}} (\mathbf{x}\_i \cdot \boldsymbol{\sigma}\_0 + \mathbf{x}\_i^2) \tag{22}$$

$$E(\mathcal{G}\_{\vec{l}}) = \frac{M\_{\vec{l}} - (M\_{\vec{l}} \bmod \sigma\_0)}{\sigma\_0 \cdot N\_{\vec{l}}} \tag{23}$$

$$Var(\mathcal{G}\_j) = \frac{M\_j \bmod \sigma\_0}{N\_j} - E(\mathcal{G}\_j)^2 \tag{24}$$

Fault Tolerance

In cases where an appliance is not reporting according to protocols, the sink node will aggregate the data received from other appliances and send the results to the smart meter and inform the smart meter that the appliance *APa* is malfunctioning. The smart meter then uses the following method to calculate the mean and variance for the malfunctioning device.

• Step 1: *C*∗ *p* is mathematically represented as

$$C\_p^\* = \left(1 + n \cdot \sum\_{i=1, i \neq a}^N \sigma\_j^\* \cdot (\mathbf{x}\_i \cdot \sigma\_0 + \mathbf{x}\_i^2)\right)$$

$$\cdot \prod\_{i=1, i \neq a}^{N+1} H(T\_s)^{n \cdot p\_i} \bmod n^2 \tag{25}$$

Therefore, the smart meter computes

$$\begin{aligned} M\_s^\* &= \mathbf{C}\_p^{\*\lambda} \bmod n^2\\ &\xrightarrow{(1+n\cdot x)^{\lambda} \equiv (1+n\cdot \lambda x) \bmod n^2, \quad x^{\lambda n} \equiv 1 \bmod n^2} \\ &= 1 + n\cdot \lambda \cdot \sum\_{i=1, i\neq a}^N \sigma\_j^\* \cdot (\mathbf{x}\_i \cdot \sigma\_0 + \mathbf{x}\_i^2) \bmod n^2 \end{aligned} \tag{26}$$

and M can be calculated as

$$M = \left(\frac{M\_s^\*-1}{n \cdot \lambda} \bmod n\right) \bmod Q \tag{27}$$

• Step 2: Except for the subset containing malfunctioning devices, the smart meter calculates mean and variance using Equations (13) and (15).

• Step 3: For the subset containing malfunctioning devices, the smart meter computes *Mb* from Equation (13) and gains the mean and variance through

$$E(\mathcal{G}\_b) = \frac{M\_b - (M\_b \bmod \sigma\_0)}{\sigma\_0 \cdot (N\_b - 1)}\tag{28}$$

$$Var(\mathcal{G}\_b) = \frac{M\_b \bmod{\sigma\_0}}{N\_b - 1} - E(\mathcal{G}\_b)^2 \tag{29}$$

Hence, the proposed approach is still workable even if some devices are malfunctioning. As a result, the proposed approach satisfies the need for fault tolerance.
