# Design and Application of a Distribution Network Phasor Data Concentrator
## 3 DPDC Design
### Software Architecture
Inside the DPDC has shown in Figure 2, the blue lines indicate data pipes for transmitting data frames, the red lines indicate command pipes for transmitting command frames (CMD) and configuration frames (CFG), and the orange lines indicate file pipes for transmitting file command frames and file frames. The data pipes and the command pipes will remain connected after the communication is started. The file pipes will only be established when there is a file sending task and will be disconnected after the task is completed. In order to ensure the stability of the data pipes and command pipes between the DPDC and \(\upmu\)MPMUs, the connection check module is used to check whether each connection is valid. Here we set a timer of 3 s to check the continuity of the connection. If it is determined that a connection has been disconnected, the connection is re-established. After the \(\upmu\)MPMU testarts or the communication link is temporarily faulty, etc., the communication can be resumed through the connection check module. When the data from the \(\upmu\)MPMU enters the DPDC via the data pipe, the Read data module completes the reading of the data in response to the event. Similarly, the Read cmd module reads data from the command pipe, and the Read file module reads data from the file pipe. All kinds of data will be sent to the data check module first, and then checked and processed by the data check module and sent to the corresponding pipe data processing module. The data check module checks if the data has sticky or incomplete packets. Sticky packets mean that multiple small packets are placed in the same TCP packet. An incomplete packet means that a large packet is separated into multiple TCP packets. The worst case is that a TCP packet has a complete packet and an incomplete packet, and the remaining data is placed in the subsequent TCP packet for transmission. The data check module  
Figure 2: DPDC architecture considering multiple communication methods. decomposes and combines the data in which the above situation occurs and sends the processed data to each pipe data processing module according to the type. In general, the PMU and \(\mu\)MPMU disable the Nagle algorithm of TCP in order to ensure the uniform transmission of data frames in time, so that data frames do not have sticky packets and incomplete packets. The data check module checks the data frames with very little time and does not need to process them. Because configuration frames and file frames are longer than data frames, they are most likely to have sticky and incomplete packets, but their requirements for time are far less than the data frame, and the processing time is acceptable. After the data check module, the data frame is sent to the data processing module of the \(\mu\)MPMU data pipe (D_data_pipe). The main function of this module is to aggregate the data frames of the \(\mu\)MPMU. First, it is judged whether the data frame is a compressed frame, and the decompressed data frame is sent to the data aggregation stage for processing. If no decompression is required, the data frame directly enters the data aggregation stage. The data aggregation stage produces DPDC data frames in the standard format, which are written to real-time (RT) data files (the file format refers to [21]) and sent to the data processing module of the main station data pipe (U_data_pipe). The data of \(\mu\)MPMU and DPDC are stored by using structure arrays. Figure 3 shows the cache structure of the DPDC. The structure array pdcData[ ] is used as the buffer of the DPDC, and the depth is max + 1. The value of max will affect the time difference tolerance of the DPDC. In theory, the time difference tolerance is proportional to the max. This value is not recommended to be set to a fixed value. It should be set according to the actual network environment where the DPDC is located. It is included in the configuration file sent by the local or the main station and is assigned when the device is initialized.