# Visualization Program Design for Complex Piping Systems in Marine Engine Simulation Systems
## 3 Program Development and Implementation  
### Implementation of Piping Network Visualization  
At the initial stage of piping network modeling, we first used advanced drawing software to carefully draw piping schematic diagrams, as shown in Figure 1. In this schematic diagram, large rectangles represent tanks, and thin lines map out the pipes in the piping network. Arrows are used to indicate the direction of fluid flow in the pipes. We used different colors to distinguish pipes and tanks with different functions. In this paper, the color of pipes and tanks is brown for the sewage system, but users can also set the colors inside pipes and tanks themselves, such as generally using red for firefighting water, black for heavy oil, etc. After completing these detailed drawing tasks, we save the piping diagram in SVG format. Then, these SVG image files are imported into the WPF environment as the basic layer for design work. The significant advantage of this method is that it not only allows us to display the piping network layout in a personalized way but also ensures the clarity and accuracy of the SVG vector graphics at various display sizes and resolutions [24]. Furthermore, this method allows programmers to easily adjust and optimize piping diagrams to ensure that they meet the precise requirements of complex piping network system designs. When designing the piping network system, we focus on the visual representation of key components, such as pumps, valves, and monitoring tags, including water level, pressure, and flow. As shown in Figure 2, we developed a set of control styles in WPF and placed them in a reusable resource library. In this example program, flow and pressure are respectively marked with \"G\" and \"P\". Considering that the flow value is relatively large and the pressure is small, the flow value is kept to one decimal place, while the pressure value is kept to two, to facilitate accurate representation. In the piping network diagram, the valve is represented by two opposite triangles. The one-way valve is displayed as one black and one white triangle, with the gray-black part indicating the direction of fluid flow. When the valve is open, the black part will turn to the color of the piping for the operator to intuitively understand. It is worth noting that pumps on actual ships are generally designed with safety valves to prevent the pump or prime mover from being damaged when the pump operates when the discharge piping is not operational (equivalent to infinite system resistance). In this system, pumps are assumed to come with safety valves by default, but when the user only opens the pump and the valve in the direction of the pump inlet, the pump's pressure will be higher than the pump's rated pressure, and a warning will pop up (as shown in Figure 3). When the user opens the valve in the direction of the pump outlet so that the pump can work normally, the program will continue to run normally and cancel the warning. If both triangles are white, this indicates that the valve is a stop valve, meaning that the flow is blocked. When the stop valve is opened, the color of the triangles will all turn to the color of the piping. The triangle embedded in the circle represents the pump, and the direction of the triangle indicates the outlet direction of the pump. When the pump is not turned on, it shows a gray-black color and will show the color of the piping when it is opened. The rectangle inside the tank represents the water level tag, providing an intuitive way for the operator to understand the liquid level in the tank. In the design of this program, the upper limit of the tank's water is 100, the initial water level is 70%, and the water level shown in the water level tag will change with the user's operation. When the maximum water level is reached, it will be impossible to continue supplying water to the tank, and it will be diverted to other branches. Similarly, when the minimum water level is reached, it will be impossible to take water from the tank.