## 3 Program Development and Implementation
### Visualization of the Piping Network  
In the initial stage of pipeline network modeling, we used advanced drawing software to create a schematic diagram of the pipeline, as shown in Figure 1. In the diagram, larger rectangles represent storage tanks, thin lines represent pipelines, and the dots where thin lines intersect represent nodes, indicating that multiple pipeline segments are connected at that point. Arrows are used to indicate the direction of fluid flow (for target recognition, all pipelines with a fixed flow direction must be marked with arrows, while pipes without arrows indicate that the liquid can flow in both directions). Different colors are used to distinguish the functions of the pipes and the contents of the storage tanks. In this diagram, the example of a sewage system is used, with brown pipes and storage tanks. Users can also customize the colors, such as red for fire water or black for heavy oil. After completing the drawing, we saved the pipeline diagram in SVG format and imported it into the WPF environment as the base layer for the design. Subsequently, relevant control parameters, such as the valve's position, the pump's position, and the maximum allowable flow, can be set in WPF. This method not only allows for personalized visualization of the pipeline layout but also makes it easier for developers to adjust and optimize the diagram, ensuring it meets the design requirements of complex systems. In the design of the pipeline system, special attention is given to the visual representation of key components. For example, the pump and valve are shown in gray before they are activated and, when the user clicks on them with the mouse, they change to the color of the pipeline to indicate activation. Monitoring the status of flow and pressure in the pump and valve is particularly important, so we developed monitoring labels (including water level, pressure, and flow). As shown in Figure 2, we developed a set of control styles in WPF and stored them in a reusable resource library. In this example, flow and pressure are labeled with \"G\" and \"P\", respectively. Considering that flow is relatively larger, while pressure is smaller, the flow value retains one decimal place and the pressure value retains two decimal places for accurate representation. Figure 1: Visualization of the piping network. Figure 2: WPF control placement interface. In the pipeline diagram, valves are represented by two opposing triangles. One-way valves are shown as one gray and one white triangle, with the gray part indicating the direction of fluid flow. When the one-way valve opens, the gray part changes to the color of the pipeline, intuitively displaying the flow direction. If both triangles are white, it means the valve is a stop valve, which indicates that flow is blocked. When the stop valve is opened, the triangles change to the color of the pipeline. Different valve types are represented by different shapes, as shown in Figure 3. A triangle embedded in a circle represents a pump, and the direction of the triangle indicates the outlet direction of the pump. When the pump is not activated, it is displayed in gray-black and, when activated, it changes to the color of the pipeline. In real ships, pumps are usually designed with safety valves to prevent damage to the pump or pipeline due to excessive pressure when the discharge pipe is blocked. By default, pumps in this system are equipped with safety valves but, if the user opens only the pump and the valve at the inlet, the pump pressure will rise quickly until the safety valve opens. If the valve at the outlet is opened, the pump resumes normal operation. The rectangle inside the storage tank represents the water level label, providing a visual indication of the liquid level. In the design, the maximum water level in the tank is 100, with an initial water level of 70%. The water level label shows changes based on user operations. When the maximum water level is reached, water supply cannot continue and will be diverted to other branches.