# CarTwin--Development of a Digital Twin for a Real-World In-Vehicle CAN Network
## 6 Experimental Evaluation of the Digital Twin
### Results  
In order to correlate the model outputs with the real-world vehicle data, we estimated the brake signal based on vehicle speed variations from the real-world vehicle trace and used it as an input in the CarTwin model. The vehicle direction input was always transmitted as straight, i.e., vehicle is always moving forward. The target vehicle speed, that is also the initial vehicle speed in the model, is of 140 km/h. While the brake is not active, the vehicle speed will increase up to the target vehicle speed. Next, we show one trial of collected vehicle data compared to the CarTwin model output. The model output signals are shown in Figure 14i,iii,v, while the real-world vehicle signals are shown in Figure 14 ii,iv,vi. The real-world vehicle trace contains a normal drive scenario on local roads and on the highway with a total duration of 44 min. There are two frames in the trace that we used to extract the vehicle speed, engine speed and odometer value. Vehicle speed and engine speed are transmitted every 10 ms, while the odometer is sent every 1 s. In the CarTwin model, we directly computed the trip distance based on vehicle speed, while in the vehicle trace, we used the odometer value. In order to correlate the model output with the vehicle trace, we subtracted in the latter the initial odometer value from the trace. From the vehicle trace, we extracted more than \(\sim\)250 k samples for the vehicle speed and engine speed, as shown in Figure 14 ii,iv, and more than \(\sim\)2.5 k samples for the vehicle trip  
Figure 14: Signals computed by CarTwin models (**left**) and signals collected from a car (**right**). distance based on the odometer value, as shown in Figure 14 vi. Considering the vehicle speed and engine speed changes between local road and highway driving locations and conditions, we emphasize the CarTwin behavior under similar conditions in what follows. In the collected trace, the vehicle speed varies between 0 km/h and 60 km/h during the first \(\sim\)100 k samples and is approximately 130 km/h for the next \(\sim\)150 k samples, while the vehicle is on the highway, as shown in Figure 14 ii. The engine speed, depicted in Figure 14 iv, varies with the vehicle speed between 1000 rpm and 4500 rpm at lower vehicle speeds and stays close to 3000 rpm while the vehicle speed increased, in the second part of the trace. In Figure 14 vi, it can be seen that the trip distance value has a slow increase in the first part of the trace, and after that, it grows linearly due to the fact that the vehicle speed is quite stable around 130 km/h. To compare CarTwin outputs with the vehicle trace signals in a more concise way, we split the entire trace from Figure 14 in two parts based on the driving location. In the first part, as illustrated in Figure 15, the vehicle is driven on local roads, and in the second part, as shown in Figure 16, it is driven on a highway. **Local roads. ** In Figure 15, we show the signals while the vehicle is driven in the city and on local roads. The plots from the left side are the outputs from our simulation, i.e., Figure 15 ii,iii,v, while the plots from the right side are the signals collected from the real car, i.e., Figure 15 ii,iv,vi. For the vehicle speed signal, the model output varies between 0 km/h and 85 km/h, while the vehicle speed signal collected from the vehicle varies between 0 km/h to 80 km/h (with the exception of one spike to 120 km/h during a car overtake in the real scenario). Engine speed varies between 800 rpm and 2500 rpm in the model output, while in the vehicle trace, the signal value is of 900 rpm to 2500 rpm (except for a few spikes at 4500 rpm). We have a different number of samples for the trip distance (between our simulation and the signal collected from the car) because our model runs at  
Figure 15: Signals computed by CarTwin models (**left**) and signals collected from a car (**right**) on local roads.