# OPC-UA Agent for Legacy Programmable Logic Controllers +
## 4 Performance Evaluation
### Experimental Setup  
When building the OPC-UA system, the user host was configured to have only core namespace nodes, and the agent host was set up to support the information model for IEC 61131-3 and the UA client function blocks shown in Table 1. The legacy controller is an embedded system that runs PLC programs without an operation system. It controls servo motors and handles 20-channel digital I/O. Table 2 summarizes the specifications of the hardware and software used in the experiment. The OPC-UA agent connects to the legacy controller and the external UA server or client over the TCP/Ethernet network. \begin{table}
\begin{tabular}{c c c} \hline \hline
**System** & **Item** & **Description** \\ \hline \multirow{6}{*}{**External OPC-UA system**} & CPU & Intel(R) Core(TM) i5-9300H CPU @2.40 GHz \\  & Main memory & 8.00 GB DDR4 DRAM \\  & Operating system & Windows 11 Pro \\  & OPC-UA software & open62541 v1.1 by open62541 community project \\  & Network & Realtek Gaming GbE Family Controller \\ \hline \multirow{6}{*}{**OPC-UA agent**} & CPU & Intel(R) Core(TM) i5-8500 CPU @3.00 GHz \\  & Main memory & 8.00 GB DDR4 DRAM \\ \cline{1-1}  & Operating system & Windows 10 Home \\ \cline{1-1}  & OPC-UA software Network & open62541 v1.1 by open62541 community project \\ \cline{1-1} \cline{2-3}  & CPU & Arm Cortex-R4F-based TI RM46L852 MCU \\ \cline{1-1}  & Main memory & 16 MB flash memory and 32 KB NVRAM \\ \cline{1-1}  & Network & WIZnet W5300 Ethernet controller \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Specifications of experimental system. Figure 8: Experimental setup used for performance evaluation. Based on the OPC-UA agent design, we have defined performance metrics for the OPC-UA server and client as shown in Figure 9. The UA server agent can handle various services for accessing variables in the legacy PLC. One of those services, UA read service, can be used synchronously to access data items by an external UA client. To evaluate the read performance, we define the latency for read service (\(L_{\textit{read}}\)) and the response time of the UA server agent (\(R_{\textit{server}}\)). \(L_{\textit{read}}\) means the time from when the external client sends a read request to when the server agent sends a read response. \(R_{\textit{server}}\) is defined as the total time required by the OPC-UA server to process the read service. So, the terms \(L_{\textit{read}}\) and \(R_{\textit{server}}\) can be calculated as:  
\[L_{\textit{read}}=t_{4}-t_{1}, \tag{1}\]  
\[R_{\textit{server}}=t_{3}-t_{2}. \tag{2}\]  
The time \(t_{1}\) is when the external client sends a UA read request to the agent, and \(t_{2}\) and \(t_{3}\) represent the time when the agent receives the UA read request, and when it sends the response to the external client, respectively. The \(t_{4}\) represents the time the external client receives the response data sent by the UA server in the agent. In the legacy controller, OPC-UA client function blocks can be executed along with other PLC codes. For the evaluation of client function blocks, we define performance measures considering the execution of RPC-based client functions. The response time of a client function in the legacy controller, \(R_{\textit{func}}\), is defined as the total time elapsed from when the client function is called in the PLC task until when the RPC response from the OPC-UA agent is delivered back to the PLC task. The time required to execute the client function in the agent, \(R_{\textit{client}}\), means the total time it takes to recognize the call request, process it, and update the result in the shared memory. Similarly, \(L_{\textit{client}}\), the latency for a client function, is defined as the time it takes the UA client agent to receive its response after requesting a service from the external server.