The numerical model was developed to estimate the transient behavior of pressure waves in pipe systems. The computational algorithm was proposed to model the water hammer phenomenon in a pipe system with pump shutdown at midstream and sudden valve closure at downstream. To predict the pressure head and the flow velocity as a function of time as a result of rapidly closing a valve and pump shutdown, two boundary conditions at the ends considering pump operation and valve control can be implemented as specified equations of the pressure head and flow velocity based on the characteristics method. It was shown that the effects of transient flow make it determine the needs for protection devices, such as surge tanks, surge relief valves, or air valves, at various points in the system against overpressure and low pressure. It produced reasonably good performance with the results of the proposed transient model for pipeline systems. The proposed numerical model can be used as an efficient tool for the safety assessment of hydropower plants due to water hammer.