## 3 Proposed Solution
### Trust Calculation in Proposed Methodology  
Trust calculation methodologies in CPSs are instrumental in evaluating the trustworthiness of entities within the system. These methodologies employ trust models, algorithms, and selected metrics to assess the behavior, reputation, and history of entities. By considering factors such as past performance, adherence to security protocols, successful task execution, feedback, and reputation, trust values are computed for each entity. These values enable informed decision making, resource allocation, and detection of malicious behavior. Trust calculation methodologies in CPS are adaptive, ensuring accurate and up-to-date trust assessments. A list of symbols used in mathematical notations is given in Table 3. Algorithm 1 represents the detection of malicious nodes in a smart healthcare CPS. ```
Input: Trust Parameters Output: Malicious Node Detected // Initialize variables
1 forallnodes in the networkdo
2 Collect parameters;
3 Send parameters;
4 ifsink=0 then
5 Forward parameters;
6 Discover all nodes;
7 fornodeidexistsinfogdo
8 ifendthen
9 return;
10
11 else
12 Register node id;
13
14
15 Analyze trust; // Function to calculate trust score (PD, EC, EED, L)
16 forachnodeiddo
17 Preprocess trust score to blockchain;
18 Preprocess trust score to Gini trust calculator;
19
20 forI\(\leq\)nodesdo
21 ifGinivalue\(\leq\)thresholdthen
22 Display \"Legitimate node\";
23 Propagate into network;
24
25 elseifGinivalue\(\geq\)thresholdthen
26 Display \"Malicious node\";
27 Propagate into network;
28 Eliminate \"Malicious node\";
```  
**Algorithm 1**Malicious node detection. \begin{table}
\begin{tabular}{l l} \hline \hline
**Symbol** & **Meaning** \\ \hline \(I\) & Gini index (inequality of flow distribution in CPS network) \\ \hline \(a_{i}\) & Proportion of flow \(i\) in the network \\ \hline \(DR\) & Drop rate (the rate at which network packets are dropped or rejected) \\ \hline \(L\) & Latency (delay experienced by packets during transmission) \\ \hline \(T\) & Throughput (success rate of data transmission across the network) \\ \hline \(G_{m}\) & Gini index value of node \(m\) \\ \hline \(P_{m}\) & Packet loss rate of node \(m\) \\ \hline \(L_{m}\) & Latency of node \(m\) \\ \hline \(Th_{m}\) & Throughput of node \(m\) \\ \hline \(G\) & Set of Gini index values for all nodes in the CPS network \\ \hline \(Average(G)\) & Average Gini index value of all nodes in the CPS network \\ \hline \(N\) & Set of entities in the system \\ \hline \hline \end{tabular}
\end{table} 
Table 3: List of symbols used in mathematical notations. 1. Direct Trust Calculation Monitoring nodes at the device layer of the CPS is referred to as direct trust calculation. Monitoring nodes at the device layer is performed by resource-constrained devices by continuously tracking and examining the actions and interactions of other nodes within the CPS. The real-time data gathered by these nodes include trust parameters such as the packet drop rate, energy usage, end-to-end delay, and message overhead. Monitoring nodes use trust models and algorithms as part of the direct trust calculation process to assess the reliability and behavior of CPS entities. In a CPS, direct trust computation at the device layer offers a number of benefits. First of all, it offers real-time trust evaluation, allowing for the quick detection of malicious or untrustworthy system elements. Second, direct trust computation gives a thorough evaluation of entity trustworthiness by taking into account trust factors such as the packet loss rate, energy consumption, end-to-end delay, and message overhead. Direct trust calculation at the device layer has its challenges. The precision and scalability of trust computations may be impacted by the monitoring nodes' constrained memory and computational capacity. In order to avoid unauthorized access or manipulation of trust values, it is also essential to ensure the security and privacy of trust data.