# Dynamic Optimization of Data Packet-based Communication for PLC Visual Monitoring
## 2 Dynamic Optimization of Data Packet-based Communication for PLC Visual Monitoring
### Descriptions of Data Packet-based Communication  
Suppose that there are \(N\) sub-networks of PLC ladder programs in the present monitoring view, where multiple monitoring views could be displayed simultaneously in multiple windows. Sub-network \(i\) corresponds to a series of logic operations, in which \(L_{i}\) refers to their memory space (in bytes), and it is assumed \(L\triangleq\max\limits_{i=1,\dots,N}[L_{i}]\). Whenever a PLC responds to a request, a set of memory frames should be loaded to form a set of communication packets. If a communication request needs to get access to a total number of \(N\) sub-networks, the total number of successive sub-networks to be included in a communication packet, i.e., the maximum data length of a communication packet  
Figure 3: Illustrative examples of scrolling views and updating monitoring data. should be optimized in line with the visual monitoring requirement. Assume that a total number of \(N_{P}\) packets should be generated to fulfill the communication request. When there is a communication error, a packet with data errors or losses should be transmitted, which will result in less effective communication. Thus, the size of a transmission packet should be moderate in consideration of the transmission error rate and the maximum transmission time. Here the available network bandwidth and transmission speed is denoted as \(\rho\) (byte/s), and the application layer packet loss or retransmission rate as \(\delta\) (1/byte). When the monitoring view remains the same, the data packets of associated sub-networks will be updated periodically. When the monitoring view is scrolled, the remote PLCs should respond to the command request immediately. Let's consider a request of loading a monitoring data packet \(i\), the communication time \(T_{i}\) mainly includes transmission time \(T_{i}^{s}\), access time \(T_{i}^{a}\), queue time \(T_{i}^{d}\) and broadcast time \(T_{i}^{b}\), which can be denoted as below. \[T_{i}=T_{i}^{s}+T_{i}^{a}+T_{i}^{d}+T_{i}^{b} \tag{1}\]  
The expected transmission time of transmitting \(N_{P}\) packets is represented as,  
\[E(T)=\sum_{i=1}^{N_{P}}E(T_{i}) \tag{2}\]  
Generally, the expected transmission time should be minimized as far as possible to achieve communication efficiency. However, this paper takes into account the response delay of human cognition [13; 28] when optimally deciding the communication packets. The human cognitive response involves a complex psychological process, and it is commonly believed that different people have different response times towards the same situation and even the same person may have different response times in different situations. In addition, recent research also demonstrates that human responses can be highly correlated to the fractional-order representation of visual cues [14], and the human response delay can only be approximated by a Gamma distribution [29]. As a result, it is difficult to measure the human response delay in a precise manner. Thus, in this paper, the human response delay is formulated as an adjustable parameter, and the upper bound of each single data packet's refresh  
Approximately, the total transmission time can be computed as two parts:  
\[T_{i}=T_{i}^{s}+T_{i}^{a}+T_{i}^{d}+T_{i}^{b}\approx T_{i}^{s}+T^{0} \tag{6}\]  
where \(T_{i}^{s}\) denotes the transmission time while \(T^{0}\) refers to the access delay. Except for additional bytes (denoted as \(d\)) such as the packet headers and the CRC bytes, the size of a data packet is mainly dependent on the load data size. Let's use \(S_{i}\) to denote the size of the \(i\)th data packet. Accordingly, the bandwidth between the monitoring computer and a PLC is fixed. Then the transmission time \(T_{i}^{s}\) is shown as follows:  
\[T_{i}^{s}=(d+S_{i})/\rho \tag{7}\]  
It is obvious with a fixed \(d\) that packing large data packets will send less additional bits and provide higher transmission efficiency.