## 4 Results and Analysis  
To analyze the performance of the proposed MAC protocol, a system model based on multiple IoT-based smart sensors with adaptive data requirements creates a WPAN in a smart city. These IoT nodes may comprise some malicious nodes that disturb the TDMA-based medium by requesting the number of TDMA-based time slots. All the nodes in the WPAN transfer their data to the fog node acting as a PAN coordinator by using TDMA-based time slots in a contention-free manner. WPAN comprises a total of \(J\) nodes comprising \(K\) legitimate nodes and \(M\) malicious nodes. If one of the WPAN nodes \(i\) requests \(S_{i}\) slots in transferring its data in a session to the PAN coordinator, then the number of slots requests received by a fog node in a session \(a\) (\(TS_{a}\)) is calculated as  
\[TS_{a}=\sum_{i=1}^{J}S_{i} \tag{15}\]  
If node \(i\) transmits \(D_{i}\) amount of data in its allocated time slots and \(N\) nodes are successfully assigned GTSs in transmitting their data in a session, then the data that are transmitted in \(X\) number of sessions (\(\sigma_{TD}\)) are calculated as  
\[\sigma_{TD}=\sum_{a=1}^{X}\sum_{i=1}^{N}\times D_{ia} \tag{16}\]  
If there are \(B\) malicious nodes that are allocated TDMA slots during these sessions, then the total data transmitted by only legitimate nodes (\(\sigma_{TDL}\)) during \(X\) number of sessions are calculated as  
\[\sigma_{TDL}=\sigma_{TD}-\sum_{a=1}^{X}\sum_{b=1}^{B}D_{ba} \tag{17}\]  
The data transmission time of a node is calculated as the time when a node has data to send until it successfully transmits all its data to the PAN coordinator. The data transmitting time of slots allocating time depends upon the data size as well as the channel capacity between the data transmitting node and the PAN coordinator. If the transmission time of node \(i\) in transmitting its time during a session is \(t_{i}\), and \(P\) nodes successfully transmitted their data during that session, then the network delay \(ND\) of all the GTS-allocating nodes in a session is calculated as  
\[ND=\sum_{i=1}^{P}t_{i} \tag{18}\]  
For \(X\) number of sessions, the total network delay (\(\zeta_{ND}\)) is calculated as  
\[\zeta_{ND}=\sum_{a=1}^{X}\sum_{i=1}^{P}\times t_{ia} \tag{19}\]  
If there are \(B\) malicious nodes among the successfully allocated nodes, then the time calculated in transmitting the data of only legitimate nodes during \(X\) number of sessions \(\zeta_{NDL}\) is calculated as  
\[\zeta_{NDL}=\zeta_{ND}-\sum_{a=1}^{X}\sum_{b=1}^{B}\times t_{ba} \tag{20}\]  
Nodes have different times for transmitting their data to the PAN coordinator. If there are \(T_{N}\) nodes that transmitted data during \(X\) sessions and there are \(T_{M}\) malicious nodes during these sessions, then the average transmission delay of all slots allocating nodes and of legitimate nodes for \(X\) are represented as \(\zeta_{NDA}\) and \(\zeta_{NDLA}\), respectively, and are calculated as shown in Equations (21) and (22). \[\zeta_{NDA}=\frac{\sum_{a=1}^{X}\sum_{i=1}^{P}\times t_{ia}}{T_{N}} \tag{21}\]  
\[\zeta_{NDLA}=\frac{zeta_{ND}-\sum_{a=1}^{X}\sum_{b=1}^{B}\times t_{ba}}{T_{N}- T_{M}} \tag{22}\]  
To assess the effectiveness of \(TMPAD\) from various perspectives, we set up a simulation environment that covers a wide range of possibilities that can be experienced by the network, ranging from 50 to 150 nodes. The network mostly comprises legitimate nodes and there are two to four malicious nodes in the network as, generally, the malicious nodes will be fewer than the legitimate nodes. These IoT nodes are a member of a WPAN and the fog node is their PAN coordinator. The data rate is 250 kbps. The simulation environment also considers the varying bandwidth as well as varying power of the transmission of the node's data, as these are the resources that can be adjusted for data transmission.