# CarTwin--Development of a Digital Twin for a Real-World In-Vehicle CAN Network
## 6 Experimental Evaluation of the Digital Twin
### Possible Applications  
A possible application for the experimental model is in the evaluation of cyberattacks on in-vehicle networks. Indeed, many related works on intrusion detection for in-vehicle buses use real-world traces collected inside the vehicle that are augmented with attacks in an off-line manner, e.g., [51; 52; 53]. One of the most common attacks in such works are fuzzing attacks in which frames containing random data are sent on the bus [54; 55; 56]. Clearly, exposing the actual car to such an attack may cause safety concerns since random packets may cause unexpected behavior for the car, a reason for which the off-line attack procedure is a good choice. However, this off-line attack procedure overlooks the impact of one parameter on another. As we show in Figure 18i,iii, when the vehicle speed and engine speed are subject to an off-line attack augmentation, the attack values will show as spikes on the original signals. These spikes on the vehicle speed and engine speed are, however, poorly correlated, which is not necessarily the case in a real vehicle. Obviously, in reality, there is good correlation between these two signals, and thus, the off-line attacks may be quite artificial. This is visible in Table 4, where the correlation between the two attacked signals is 0, which is expected as the attack values are random, while in the real-world data as well as in the CarTwin experimental model, the correlation between legitimate frames for the same signals is around 0.9. The lack of correlation between these two signals (vehicle speed and engine speed) will make such attacks easier to detect but also not very realistic for the real-world behavior of the car. In Figure 18 ii,iv, we show how an attack on the vehicle speed will influence engine speed when the CarTwin model is employed. The correlation is significantly better for the attacks on the CarTwin model as can be seen in Table 4. Even in case of the attack frames on vehicle speed and their impact on engine speed, the correlation coefficient is still 0.49 (note that in the off-line generated trace, the correlation is 0). There is a decreased correlation with an increase in the attack probability, which is expected (as the attack becomes more frequent, the correlation lowers since the attack represents an anomaly). While it is out of scope for us to delve further into security-related details, this suggests CarTwin to be useful in gaining insights into cyberattacks. Another possible area of investigation for the model is safety and fault tolerance. Our model does contain safety-relevant signals, such as brake, buckle and airbag status signals, etc. Fault tolerance is indeed highly recommended or even mandatory in case of safety critical signals. A well-known and employed solution to assure fault-tolerance is redundancy, either by using different sources for a signal or deriving it by distinct computations. For a case in which these signals are faulty, redundancy is a means to correct such faults. For example, vehicle speed is reported both by the ABS and PCM controllers, both of which are present in our model, etc. Such consistency checks can also be performed based on the data from the model. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Signal** & **Bin Width** & **Bin Percentages [Bins 1 to 7]** \\ \hline Vehicle speed (model) & 20 [km/h] & 27, 15, 5, 2, 2, 26, 23 [\%] \\ Engine speed (model) & 540 [rpm] & 4, 20, 15, 7, 3, 21, 30 [\%] \\ Vehicle speed (trace) & 22 [km/h] & 7, 9, 25, 7, 9, 9, 34 [\%] \\ Engine speed (trace) & 700 [rpm] & 0, 12, 25, 19, 43, 1, 0 [\%] \\ Vehicle speed (difference) & 20 [km/h] & 46, 34, 15, 4, 1, 0, 0 [\%] \\ Engine speed (difference) & 560 [rpm] & 60, 23, 13, 3, 1, 0, 0 [\%] \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Statistical data for distribution of the model output, real vehicle signal and their differences.