# Extended Reality Application Framework for a Digital-Twin-Based Smart Crane
## 3 Results  
### The Performance of the Framework  
The response times are summarized in Table 4. Each statistical data was from the 2000 pairs of the value recorded by the OPC UA server and the Unity Client. The measurements show that using the OPC UA-MQTT wrapper is significantly faster. Meanwhile, the OPC UA-MQTT wrapper is more stable with the lowest standard deviation. Consider the MQTT client in Unity executed the subscription function to subscribe to the changed data. To implement the identical function, we developed the subscription functions for the REST client and OPC UA client in Unity. The function implementation rate in Unity is influenced mainly by the self-refresh rate of the Unity engine. Therefore, the performance difference between the OPC UA-GraphQL wrapper and the OPC UA client in Unity is relatively small.  
In our XR development framework, the development of the communication middleware influences the development efficiency and application capacity. Except for the communication performance with quantitative analysis, we further concentrated on the discussion of the potential applied scenarios, the comparison of three middleware is shown in Table 5.  
OPC UA-MQTT wrapper is an innovative communication combination for IIoT. The wrapper can fetch data from the devices leveraging the OPC UA protocol, and decouple the data via the OPC UA-MQTT gateway. Then, the MQTT client can be easily developed with the specific topic in Unity. The OPC UA-MQTT wrapper is appropriate for continuously changing data monitoring scenarios with the one-directional data flow. For example, we can fetch the movement position of the crane via the OPC UA-MQTT wrapper. Given the shortage of MQTT that is lacking context among the data, it cannot transfer the information model of the target machine.  
OPC UA-GraphQL wrapper is software providing API for the service layer. It enables developers to receive data through the RestSharp package in Unity without interacting with the machine layer. The integration with GraphQL increases the latency of the data transmission [65]; however, it allows the developers to concentrate on the service layer without industrial communication knowledge. OPC UA-GraphQL is suitable for the data bidirectional interaction scenarios. Besides, it is suitable for developers without strong industrial backgrounds.  
OPC UA-Unity client enables to receive all information from the OPC UA server, including value, reference, alarm, and event. It is more reliable, consistent, and has low latency. However, the development of the OPC UA-Unity Client requires higher learning costs, in particular, rebuilding the entire information model of the targeting equipment in Unity. In summary, the OPC UA-Unity client suits the crucial and complex event information interaction.  
\begin{table}
\begin{tabular}{l l l l l l} \hline \hline  & **Min** & **Max** & **Mean** & **Median** & **SD** \\ \hline OPC UA-GraphQL wrapper & 0.01 & 1.023 & 0.505 & 0.508 & 0.289 \\ OPC UA-MQTT wrapper & 0.004 & 0.545 & 0.273 & 0.283 & 0.149 \\ OPC UA Client in Unity & 0.001 & 1.001 & 0.531 & 0.552 & 0.278 \\ \hline \hline \end{tabular}
\end{table}
Table 4: The response times in seconds for the different communication middleware. SD = standard deviation.