In the context of direct-current electrified railway systems, power supply quality issues are a major concern forthe railway network operators. Indeed, after signaling systems and track equipment, voltage issues may be the most challenging factor for the capacity of a direct-current railway line. These issues and the high cost of new substations motivate the implementation of wayside energy storage systems to support the system. Since an appropriate sizing methodology is a key step towards an energy storage system implementation in a railway line, in this paper a sizing methodology is presented in detail. As hypothesis, the sizing methodology is defined such that the storage system is able to support the railway line under projected conditions of the rolling stock traffic, along with other technical criteria relevant to the railway operator. A real-time simulation oriented, direct-current railway network modeling approach is proposed and exploited in this sizing methodology. Using this modeling method, the optimal energy storage sizing formulation is described. The objective function to minimize is the trade-off between energy storage capacity and charging power. The proposed sizing method is applied to a real railway line with known power supply quality issues. This case study is introduced by analyzing real voltage measurements on two key sites of the line over several days. Then, the sizing methodology is applied and the results are discussed for the study case, defining the minimal technical requirements to install. The obtained minimal technical requirements for the storage system are considered by the operator to take a cost-effective decision in contrast with the reinforcement of the line with new substations.