# Visualization Program Design for Complex Piping Systems in Marine Engine Simulation Systems
## 3 Program Development and Implementation
### Data Analysis and Calculation  
During program operation, when the user clicks a valve or pump, the color will change to the color of the piping to indicate that it has been opened, and at the same time, the opening signal will be transmitted to the calculation program. This visual effect intuitively displays the current state of the valves and pumps, enhancing the user experience. Then, the program will analyze the piping network to determine which pipe sections can allow fluid flow. It works through a traversal method, reading and evaluating the state of controls on the pipe sections. When the number of open controls on a pipe section and the number of controls set in the external Excel spreadsheet match (for example, the controls on Pipe1 section are LineValve1, LineValve2, and LinePump1 when the program calculates the open property value of the pipe section as 3), the program will judge that pipe section as allowing flow. When all pipe sections from a source pipe section to an end pipe section allow flow, the pipes composed of these pipe sections will be considered capable of fluid flow. Once a pipe is determined to allow flow, the process of flow calculation and transmission will start. The flow calculation process is detailed as follows. The program, based on the power of the pump and the flow direction of the pipe predetermined in the external Excel spreadsheet, will request flow from the source section starting from the pump inlet. In this process, if the maximum flow provided by an upstream pipe section exceeds the rated flow of the pump, the system will request according to the pump's rated flow; otherwise, if the maximum flow that can be provided by the upstream pipe section does not reach the pump's rated flow, it will adjust the request value according to the maximum flow limit of that section. In this process, the flow is temporarily stored at each upstream node of the pump and continues to request upstream until the source is reached. In particular, when there are multiple branches at the upstream node, the system will implement an equal flow distribution strategy, that is, it will request flow from each branch node and create an average value. If the maximum flow limit of any branch is lower than the average value calculated, the system will request according to the maximum flow of that branch, and the remaining flow will be distributed to other branches at the same level. When all branches at the same level reach their maximum flow limit, the system will automatically adjust the maximum flow setting of the upstream node to the sum of the maximum flow limits of all branches at the same level. After the flow is assigned to the source, it will be distributed downstream to each branch node along the piping. The processing of the pump outlet is similar, and the flow stored in the pump node will be adjusted downwards according to the maximum allowable value of the downstream section, following the same principle of average distribution and adjustment of maximum flow limit, until it reaches the terminal. The entire distribution process ensures the accurate and balanced distribution of flow from the source to the end pipe sections. All calculated and distributed flow values are detailed in the pipeline node processing scheme shown in Figure 5, to ensure the intuitiveness of the piping network operation and the clarity of logic. This software provides a dynamic piping network control and flow display interface. Users can simply click to adjust the working status of valves and pumps, while tracking the flow dynamics of the piping network in real time. This visualization technology not only enhances the interactive experience of users but also makes the understanding and control of the ship piping network system more precise. Through the immediate adjustment of the colors and status of valves and pumps, combined with the intuitive display of flow dynamics, the program plays a crucial role in the visualization of ship piping network  
Figure 5: Process of pipeline node processing. instruction and operation.