Purpose Due to the increase of the traffic, issues are appearing on DC electrified railway feeding systems. One candidate solution to solve these issues and to improve their performances is to add storage systems in the railway DC electrical network. The paper presents a method based on an Optimal Power Flow (OPF) for the analysis and design of DC railway feeding systems with storage. Design/methodology/approach The paper describes a new methodology based on optimization to study DC electrified railways, including storage systems. A load flow model of a DC 1500V railway electrification system is presented, including the mobility of the train sets. Then, an Optimal Power Flow model of the DC network, including energy storage systems and feeding substation rectifiers has been developed. Finally, the OPF model has been tested on a real application case showing its benefits while searching solutions in order to improve the network performances. Findings An OPF model suitable for analysis of DC networks with storage is presented. It shows its ability to solve large scale problems. Research limitations/implications The paper focuses on the physical model of the network. The optimization model will have to be extended with application constraints. Originality/value The hypothesis presented in this paper allows to remove the discontinuities of the system in order to use a continuous optimization approach.