## 3 Proposed Solution
### Trust Calculation in Proposed Methodology
To address this issue, the proposed methodology incorporates the device layer nodes to gather only the trust parameters and send them to the fog node through a sink node for data aggregation and trust calculation. Once the overall trust calculations are computed at the fog layer, the same are stored in the global trust list and forwarded to all member nodes for subsequent actions. A general mathematical notation for calculating direct trust using the above trust parameters is depicted in Table 4, where EC stands for the energy used, L for the latency, EED for the end-to-end delay, and PDR for the number of dropped packets. 2. Indirect Trust Calculation for Blackhole Several features can be taken into account when utilizing the Gini index to find a blackhole node in a CPS. Here are several distinctive characteristics of a blackhole node: \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Description** \\ \hline PDR & Packet Drop Rate \\ EC & Energy Consumption \\ EED & End-to-End Delay \\ L & Latency \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Description of parameters for direct trust. \begin{table}
\begin{tabular}{l l} \hline \hline
**Symbol** & **Meaning** \\ \hline Trust(\(N\)) & Trust values assigned to each entity in \(N\) \\ \hline \(D\) & Set of dropped packets for each entity in \(N\) \\ \hline \(E\) & Set of energy consumption values for each entity in \(N\) \\ \hline \(O\) & Set of message overhead values for each entity in \(N\) \\ \hline \(G_{m}(T)\) & Gini index value of node \(m\) at time \(T\) \\ \hline \(P_{m}(T)\) & Packet loss rate of node \(m\) at time \(T\) \\ \hline \(L_{m}(T)\) & Latency of node \(m\) at time \(T\) \\ \hline \(Th_{m}(T)\) & Throughput of node \(m\) at time \(T\) \\ \hline \(\theta\) & Threshold value for node \(m\) \\ \hline \(\mathcal{G}\) & Average value for the Gini index \\ \hline \hline \end{tabular}
\end{table} 
Table 3: _Cont._* Deviation in Gini index: The Gini index gauges how uneven or unequal the CPS network's flow characteristics are. The Gini index values significantly differ when a blackhole node drops packets. * Packet loss: Incoming packets are purposefully dropped by blackhole nodes, which results in a high packet loss rate. * Latency: Blackhole nodes have the potential to cause large packet transport or response time delays. Blackhole node anomalous delays can be found by keeping an eye on the communication latency between nodes. * Energy consumption: Blackhole nodes have higher energy consumption than regular nodes due to packets being dropped. * Traffic distribution: Blackhole nodes can be found by examining the traffic distribution patterns and locating nodes with unusual or inconsistent traffic distribution. In addition to the Gini score, blackhole nodes in CPS networks can be quickly identified by taking into account these properties. These metrics are tracked, analyzed, and compared across the nodes to help find those that behave strangely or might be blackhole nodes. The Gini index's features for detecting a blackhole node in a CPS can be expressed mathematically as follows:  
Let \(G_{m}\) represent the Gini index value of node \(m\), \(P_{m}\) denote the packet loss rate of node \(m\), \(L_{m}\) stand for the latency of node \(m\), and \(EC_{m}\) signify the energy consumption of node \(m\). Additionally, let \(G\) be the set of Gini index values for all nodes in the CPS network, \(\bar{G}\) denote the average Gini index value of all nodes in the CPS network, \(\theta_{P}\) represent the predefined threshold for packet loss rate, \(\theta_{L}\) be the predefined threshold for latency, and \(\theta_{E}\)C signify the predefined threshold for energy consumption. These notations play a pivotal role in analyzing the behavior and performance of the CPS network.