# TalkRoBots: A Middleware for Robotic Systems in Industry 4.0 +
## 5 Performance Analysis
### Analytical Results
Thus, we can establish a first estimation of the overhead related to the sensors:  
\[d_{devices}=2s+\Delta_{t}\sum_{i=1}^{s}x_{i} \tag{3}\]  
where \(d_{devices}\) is the number of the messages related to the plugged devices, \(s\) is the number of IIoT devices, \(x_{s}\) is the number of messages sent per second by each device (by default, it is set to 1 for each device) and \(\Delta_{t}\) is the number of elapsed seconds. To sum up the number of messages needed for the initialization process is described as follows. \[ \begin{split} d_{start}&=d_{boot}+d_{identification}+d_{devices}\\ &=\frac{1}{2}\Bigg{[}n(n+7)+4s+2+2\Delta_{t}\sum_{i=1}^{s}x_{i }\Bigg{]}\end{split}  \tag{4}\]  
Now, let us deal with the number of messages related to the tasks that should be executed during a scenario. These tasks could be executed using the direct/ROS mode or the interpreted one, and it can be calculated as follows:  
\[N_{task}=N_{d}+N_{i} \tag{5}\]  
where \(N_{task}\) is the total number of tasks in the scenario, \(N_{d}\) the number of tasks transmitted using direct or ROS mode and \(N_{i}\) the ones using the interpreted mode. Moreover, the number of exchanged messages to execute a scenario (\(d_{scenario}\)) can be separated into two parts. The first one, called \(d_{task}\), is related to the execution of the tasks themselves. The second one, named \(d_{forward}\) is related to the tasks' forwarding from a robot to its successor. Thus, one can obtain the following:  
\[d_{scenario}=d_{task}+d_{forward} \tag{6}\]  
where \(d_{task}\) is the number of messages sent to handle the tasks and \(d_{forward}\) is the number of messages needed to forward the tasks between the actors. For the accurate estimation of \(d_{scenario}\), the remainder of this section supposes that the fleet mixes robots using the direct mode and others using ROS and interpreted ones. In fact, at each time, a task is performed by a robot, and several messages are exchanged. The first message is sent from the robot to the middleware to notify that it is ready to handle a task. Then, the information related to the task that should be executed is sent from the middleware to the robot. More particularly, middleware sends five messages when the robot uses the interpreted mode. Otherwise, it sends only one message. Then, when the task is achieved, an acknowledgement message is sent from the robot to the middleware. Finally, the latter forwards an acknowledgment message to the GUI in order to update HMI. This scenario applies also when several successive tasks should be performed by the same robot. Hence, the number of exchanged messages to execute all tasks is as follows. \[d_{task}=4N_{d}+8N_{i} \tag{7}\]  
Finally, one more message is necessary when the next task in the scenario is not performed by the same actor than the current one. To illustrate this, let us consider a scenario including twelve tasks. As shown  
\(k=3\) and \(\sum\limits_{j=1}^{k}m_{j}=7\). From this scenario and without a loss of generality, one can obtain the following:  
\[ \begin{split} d_{forward}&=N_{task}-\sum\limits_{j=1 }^{k}m_{j}+k-1\\ &=N_{d}+N_{i}-\sum\limits_{j=1}^{k}m_{j}+k-1\end{split}  \tag{8}\]  
where \(k\) is the cardinality of task blocks that have to be executed by the same actor successively, and \(m_{j}\) (\(j\in\{1,2,\ldots,k\}\)) is the number of tasks in the set of task blocks. Applying this on our example, we have, as expected, a result of seven forward messages. Finally, by using Equations (6)-(8), the number of exchanged messages to execute a scenario is as follows. \[ \begin{split} d_{scenario}&=4N_{d}+8N_{i}+N_{d} +N_{i}-\sum\limits_{j=1}^{k}m_{j}+k-1\\ &=5N_{d}+9N_{i}-\sum\limits_{j=1}^{k}m_{j}+k-1\end{split}  \tag{9}\]  
Another type of messages that should be taken into account concerns data exchange with the IIoT devices. In fact, two situations are possible. The first one is related to the case where the robot requesting the data is associated with the device.