**1. Introduction**

The need to respect and safeguard the world has led issues such as sustainability to become the main focus in order to reduce the environmental impact generated by human activities [1]. In particular, in the railway sector, researchers are focusing on the development of new solutions and techniques to improve the e fficiency and systems' capacity to achieve higher energy savings [2]. One of the possible strategies is the recovery of the energy produced by the trains during the braking phases [3]. However, a coordination between traction and braking phases is needed. Contrariwise the regenerated energy must be dissipated in the rheostats, which leads to a significant loss of energy e fficiency.

For this reason, it is necessary to increase the receptivity of the system, that is its ability to accept braking energy, by installing:


**Figure 1.** Recovery of braking energy: (**a**) reversible substations (RSSs); (**b**) energy storage systems (ESSs).

More in detail, there are two types of energy storage systems:


Energy storage systems can bring benefits from an energy and environmental point of view (less energy taken from the primary grid, lower consumption of fossil fuels). The problem of sizing an ESS has been addressed under many aspects. First of all, from the point of view of the location: installation solutions have been provided both on board the train and along the railway line [7–15]. The wayside ESS installations provide the advantage of not overloading the trains and their sizing has been analyzed from different points of view:


The second is more complete and adherent to reality; an oversized ESS can work considering the energy saving, but it makes the investment not convenient if the system never provides a positive economic return.

The evaluation of investments in financial mathematics through two methodologies, namely the net present value (NPV) and the payback period (PBP) could be very attractive.

The purpose of the paper is to use the NPV as the objective function of an optimization algorithm, to solve an engineering problem. The correct sizing and positioning of an ESS through an economic approach. The solution provided finds the maximum NPV to obtain the greatest economic returns, at this point the PBP in which the investment is repaid is calculated, as a further economic indicator of the advantage of the installation.

This solution, the best from an economic point of view, should then be approached from a technical one, to see what appreciable innovations it produces from this point of view.

Through the use of a railway simulation software it is possible to calculate the energy taken from the network and the energy losses in the system, thus comparing these parameters between the solution found and the initial case (without ESS installed) it is also possible to evaluate the technical benefits of the proposed solution.

Optimal siting and sizing of ESSs are investigated deeply in literature [7,8,16–34].

A short dissertation of literature references compared with the proposed approach is presented.

In [7] a genetic algorithm (GA) is used to find the optimal sizing of a storage system placed on board the train minimizes the energy withdrawn from the network, maximizing energy saving. From an economic point of view the method shown an investment very onerous. It also highlights long simulation times with the GA, while the choice of the PSO in our paper is aimed precisely at reducing this drawback.

Reference [11] finds the optimal sizing of a storage system located along the line through a genetic algorithm (GA) that minimizes the energy taken from the grid. In this case several solutions are offered between obtaining greater energy savings or lower economic costs, but in any case the energy withdrawn from the network is less than [7]. The methodology proposed in our paper shows that the ESS position could be found near one of the several electrical substations.

In [21] a particle swarm optimization (PSO) algorithm find the best position and size of a supercapacitor minimizing energy taken from the grid. The study does not carry out an economic analysis of the investment and the model allows to use only supercapacitors. The approach proposed in our paper allows to foresee the use of di fferent types of storage for the ESS to be installed.

In [23] the PSO algorithm is used with the aim of minimizing the annual cost of energy, obtaining as output the optimal sizing and position of the ESS. The paper has a techno-economic approach similar to that proposed by our paper, with the use of the PSO algorithm to minimize the objective function; however, it uses a parameter that is not part of the investment evaluation methodologies of financial mathematics, unlike the NPV and PBP proposed by our paper.

In [30] an optimization algorithm has been used to find the optimal sizing of an ESS minimizing its installation cost but not considering the best position. Moreover, the costs are based on load time series and not using a railway simulator, as in our case.

There are also studies in which the PSO is not the best choice, for example in the reference [31] it is highlighted that the PSO has a robustness, calculated in terms of e fficiency, of 65% in the calculation of the position and optimal sizing of a hybrid PV system with storage, therefore it was decided to use crow search optimization (CSO) algorithm which instead shows an e fficiency of 90% in this study.

In [33] the PSO shows an increase in costs and in convergence times (when the uncertainty on the generation capacity from renewable sources rises) higher than in the general algebraic modeling system (GAMS). for the correct positioning and sizing of ESS and capacitor bank in a microgrid Therefore, the second method is preferred.

By comparing di fferent optimization algorithms for positioning and dimensioning of ESS in a radial distribution network, in [34] it is highlighted how the PSO has a shorter execution time than the others but the solution found is not the best. For this reason, teacher learning-based optimization (TLBO) is defined as more satisfactory for the case in question.

The paper proposes a new method to determine the optimal configuration (position and size) of one or more ESSs along the route, with the aim of maximizing the return on investment. The numerical simulations performed on an extra-urban railway system, with the aid of two simulation tools using a realistic tra ffic model, show the e ffectiveness of the proposed method. The resulting problem is a nonlinear integer optimization model where some of the involved functions are a black box, namely are known only by means of the use of a simulation toolbox which does not allow the use of standard mixed integer nonlinear programming (MINLP) methods [35] that make use of derivatives.

For this reason, the optimal configuration is carried out with a heuristic optimization algorithm, the particle swarm optimization (PSO), which has proved to be very flexible and successful in dealing with computationally intensive and highly nonlinear problems, such as the one presented by railway simulation. In [36] two optimization algorithms, dynamic programming optimization (DPO) and particle swarm optimization (PSO), to minimize the energy taken from the grid in a metropolitan network are compared, finding that the second takes about 60% less time to find the solution. The simulation time is a choice factor in the use of the PSO algorithm also for our proposed method.
