Towards Smart Railways: A Charging Strategy for Railway Energy Storage Systems

The huge power requirements of future railways require the usage of energy-efficient strategies towards a more intelligent railway system. The usage of on-board energy storage systems enables better usage of the traction energy with a higher degree of freedom. In this article is proposed a top-level charging controller for the on-board and wayside railway energy storage systems. Its structure comprehends two processing levels: a real-time fuzzy logic controller for each energy storage system, and a genetic algorithm meta-heuristic, that remotely and automatically tune the fuzzy rules weight. As global results, the reduction of regenerated energy is 22.3% with the fuzzy logic controller. With the optimization strategy, this reduction can be further extended to 28.7%. The need for a smart railway framework is also discussed towards a realistic implementation of such charging strategy. Thus, with a high degree of flexibility, the efficiency of railway energy systems can be increased with the proposed framework. Received on 07 September 2020; accepted on 06 January 2021; published on 14 January 2021


Introduction
The development of next-generation electrical smart grids is on a rise in past years, with the integration of information technologies into the electrical system. This leads to improved controllability, distributed generation and controlled demand of such power grids. These concepts are now being transported to the railway sector, which comprises a special case of the electrical power system, [1]. Specifically, the objective of the power system is to provide power, whereas the objective of the railway system is to transport passengers and goods. The railway electrification system is a particular case of a power system, where most of the loads are trains varying in space and time. Also, the interconnection with power grid is made through Traction Power Substations (TPS), usually heterogeneous power grids (strong/weak grids), and the amount of power being handled by each train can vary drastically in a few having in focus a smart management of the railway electrification energy flow.
The main objective of this paper is to present a charging strategy for railway ESS, by proposing a twolevel hierarchical Energy Management System (EMS) strategy using a Fuzzy Logic Controller (FLC) with a Genetic Algorithm (GA). The objective of this approach is to have a distributed processing architecture with two levels: a local processing unit for real-time update of the storage charging profile, based on real-time measurements; and a remote central processing unit, common to all trains, that optimizes the operation of the local units. The proposed strategy is presented in Fig. 1. This paper will contribute to a new railway EMS strategy based on a two-level hierarchical architecture. This strategy is a generic one: 1. It is demonstrated for a case study of a single train journey, but is compatible to have multiple input variables for the local-processing unit; 2. It includes the usage of a GA to include multiple optimization criteria; 3. It comprehends an automatic learning algorithm, based on a database of results of the GA.
This decoupled operation allows the desired automatic learning, based on the real-time operation of each train, and sharing with all other trains the results of the GA optimization. This paper is structured into six sections. In the following section is presented the scientific literature review in the strategies for energy management in smart railways. Then, in Sect. 3 is presented the materials and methods used in this work (the FLC and the GA). In Sect. 4 is covered the results, without and with the optimization enabled, and later are discussed the results. In Sect. 5 is presented and discussed a conceptual implementation of such railway smart charging strategy. Finally, in Sect. 6 are presented the conclusions of this article.

Literature Review
A charging strategy for railway ESS inherits the concepts of power management associated with the development of the railway smart grid (RSG). The Shift2Rail program identifies this vision, thought the TD3.10 technical demonstrator, where "the detailed mapping of energy consumption of a railway system is mandatory for energy efficiency analysis and management" where the knowledge of the power flow will enable "global system load prediction, peak shaving and energy cost optimisation" highlighting "the most effective actions that could be implemented to give energy savings" [5].

Energy Management in Smart Railways
The research in this thematic has the work of [6] as one of the first references to the inclusion and demonstrative application of the smart grid concept to the railway power and energy system, within the Japan Railway Company. It was enabled the chance to integrate bi-directional communication and advanced computational features within the new components of the RSG. The better usage of the regenerative braking energy (RBE), as well as the availability of the renewable energy sources (RES) and the energy storage systems (ESS) are the drivers for the need of RSG.
In the 2014 work of Pilo et al. [1], is highlighted the "vision for integration of the smart grid concept into the railway system". Each supply station of a railway track may be seen as a microgrid. The RSG concept enables the potential use of RBE, ESS and RES, towards multiple benefits in the railway system. The flexibility of trains regarding the speed profiles allows the main objective of this transportation system -the transport passengers and goods according to a schedule -to be compatible with the availability of all energy resources. Therefore, new opportunities in energy optimization and cost of energy optimization are open up.
From the outcomes of the MERLIN European project 1 , an integrated EMS was investigated, with the viability demonstrated with several publications. Khayyam et al. [7,8] firstly presented the Railway Energy Management System (REM-S) concept and architecture, where the contribution is in the demonstration that the railway systems are eligible to the application of the Smart Grid concept, where three objectives are listed: 1) Optimization of the energy consumption, while keeping the fulfilment of the performance requirements; 2) Optimization of the power demand, by reducing, as an example, the peak power 1 https://cordis.europa.eu/project/id/314125 2 EAI Endorsed Transactions on Energy Web Online First consumption (enhancing the electricity network capacity); 3) Costs optimization with a more rational use of energy. The proposed automation architecture for the REM-S is a hybrid centralized-distributed architecture model. The REM-S must be based on the division of the system into different zones, mostly due to the distributed nature of the railway system as well as the size, complexity and uncertainties. In this automation architecture, each subnetwork of active entities of the system is in contact with the central controller and with the neighbouring subnetworks. Furthermore, the architecture of REM-S comprises three operational modes: 1) Day-Ahead Optimization; 2) Minutes-Ahead Optimization; and 3) Real-Time Operation.
Several works have been published based on the REM-S. In [9], is presented a proposal for the application of the RMS-E in the Spanish railway, with a focus on detailing the communications infrastructure. Flek et al. [10], focus on the presentation of the methodology for the Day-Ahead Optimization algorithm. It targets the interaction with the power grid and the participation in the energy market. Furthermore, the time intervals considered by the DAO will be compatible with the time-step in energy trading at the electricity market. The DAO algorithm proposed by Flek et al. [10] considers two steps. In the first step, the optimization objective is to find the best solution considering cost and power peak optimization criteria, using a GA. Then, the RESS are evaluated and further optimized. The proposed algorithm was successfully applied to real scenarios of railway tracks in France and Spain. Later in 2018, Khayyam et al. [11] further tested the real-time online operation on a Spanish railway line for a few hours. The study focus on comparing the REM-S operation in offline and online modes. Then, Razik et al. [12] specify the prototype implementation of an advanced automation architecture designed to operate the railway electrical systems as a cyber-physical system. The algorithms for the Real-Time Operation level of the REM-S are comprehensively presented.
Other contributions also tried to solve the energy management problem in railway systems. A practical strategy to transfer power between sides of neutral zones achieving up to 31 % in cost reduction was proposed in [13]. In [14,15] is presented a solution to recover braking energy in DC lines to be used in non-railway applications (proposing hybrid-buses as an example).
Two-level hierarchical EMS were proposed in [16], [17][18][19], [20] and [21]. In [16] is proposed a hierarchical two-level EMS to charge wayside ESS, having an FLC to manage in real-time the net balance of the power, and a GA as an ultimate optimization strategy having the predictions and the cost of electricity as a reference for the FLC (the generated reference will be an extra input variable of the FLC). In [17][18][19] is introduced a hierarchical structure for the RSG comprising two levels, and were able to achieve up to 45 % cost reduction and 40 % reduction on energy consumption, for a case study with an actual rail route and trains of an existing commercial brand. The paper in [20] proposes a two-level EMS considering a day-ahead dispatch and an intra-day feedback correction. In [21], the AC railway with RES and ESS is targeted to be managed by a two-level hierarchical management structure, having not only to optimize the energy consumption but also to provide power quality by reducing the negative sequence currents and to contributing to reactive power compensation.
Generic optimization strategies for railway EMS were also proposed in [22], [23], [24], [25], [26] and in the PhD thesis of [27]. In [22], an optimal scheduling approach of substation integrated RES, RBE, and hybrid ESS was proposed, and the achieved costs and energy savings for a realistic case study were 33.2% and 9.6%, respectively. In [23] the proposed EMS considers several case studies to take into consideration the uncertainties associated to the PV generation, to the variation of the number of passengers and the initial State of Charge (SoC) of the ESS, reaching a reduction of 35 % in the cost of daily energy consumption. In [24] is evaluated the feasibility of integration PV power plant and a super-capacitor ESS in a railway power system, in a real tramway electric system, having a random optimization procedure for the EMS. In [25] is presented a comparison between two real metro lines, in Italy and in Spain, where the excess of energy resultant from the regenerative braking is used to charge electric vehicles, and it was estimated that between 685 and 1000 EVs could be charged every day using the wasted braking energy for, respectively, the considered Spanish and Italian lines. In [26] is proposed an EMS on top of a railway power quality compensator (RPQC) capable of having ESS and to be implemented in the TPS and in the neutral zones, with a centralized-decentralized management architecture. In [27] is proposed optimization algorithms to design the optimal installation of reversible substations and energy storage systems, to maximize the use of energy coming from regenerative braking.

Railway Power Systems
The railway system has huge power requirements, which leads the railway operators to focus their efforts to increase energy efficiency and reduce the energy consumption bill. Modern trains can enhance the energy consumption with the usage of power electronic devices, which allow bi-directional power flow and, as an ultimate goal, the regeneration of energy due to the braking, [28]. 3 EAI Endorsed Transactions on Energy Web Online First From the data from [29], a typical train power consumption has the profile presented in Fig. 2a). In Fig. 2b), visible a huge dispersion of the power consumption/regeneration, which is caused mostly by the needs to guarantee a given journey timetable, and in this case, stop in every passenger station.
According to EN 50388-1, [30], the train operator can inject the excess energy in the railway electrification system, as long as limit voltage levels are not achieved. However, in certain situations, the regenerated energy cannot be returned to the Transmission/Distribution System Operator TSO/DSO. Therefore, in these cases, most of the regenerated energy must be dissipated in the train rheostatic system and the billed energy will not be the blue graph of Fig. 2c), being the red graph.
According to [31], in the worst case where the headway between trains is big, almost all of the regenerated energy will not be absorbed by another train, and it will result in around 60% of energy losses.
Therefore, in similar conditions, there is a need to minimize the regenerated energy without affecting the train dynamic characteristics. One way to achieve this is with the use of railway Energy Storage Systems.

Railway Energy Storage Systems
Ideally, when it is not possible to inject the regenerated energy into the main grid, the most effective way to increase the global efficiency of traction systems is to use the regenerative braking energy to feed another train in traction mode (and absorbing the totality of the braking energy), [32]. However, this solution requires an excellent synchronism and a small distance between "in traction mode" and "in braking mode" trains.
Therefore, in the occurrence of small delays, the regenerative energy cannot be used by another train and can be dissipated in the train rheostatic system or, if possible, can be returned to the DSO, [33].
The usage of regenerative braking energy to charge ESS is one effective way to increase the global efficiency of traction systems, [28,33]. However, due to the high cost of ESSs, alternatives such as reversible TPS result in a higher cost-effective solution [34].
Nevertheless, onboard ESS are the most commonly used solution for a catenary-free system, [35]. Besides, to the best knowledge of the authors, wayside ESS research only considers the acquisition cost of infrastructure having the totality of ESS, without considering the possibility of not including batteries (or other storage technology).
In the future, it will be possible and needed to have Electric Vehicles (EVs) charging stations located at passenger stations, as previously reviewed. Therefore, in theory, it is possible to connect the charging stations to the catenary and increase the degree of freedom in the EVs charging strategy. This way, having this possibility, the wayside ESS can now be a costeffective solution, having multiple charging objectives. Also and fortunately, the higher demands for power consumption and regeneration occurs in the vicinity of a passenger station, which leads this location to be a point of interest for such wayside ESS.
In this paper, an ESS multiple-objective charging strategy is proposed based on FLC with GA optimization. This charging controller considers onboard ESS, as a case study, but it can be extended to wayside ESS.

Optimal Charging Strategy of ESS
The management of ESS charging system is a research topic in smart grids. Usually, the optimal charging strategy is based on the scheduling of charging profiles, using the knowledge of a predicted load profile, [36].
However, due to the high variation of the railway energy consumption resulting in a relatively difficult task for energy consumption prediction, the scheduling of the charging profile is not an option. In this work, optimal charging strategies without scheduling are explored to be implemented in an ESS system, where the charging controller decides in real-time the energy flow.
A multi-objective system using an FLC for energy management, as proposed in [37] and extended in [38] and in [39], is a real-time charging strategy, with the rule weights and Membership Function (MF) parameters being the search space of the optimization algorithm.
Since the performance of a fuzzy system is more dependent on rule weights rather than MF parameters [40], in this work the MF parameters are fixed and were defined upon the authors' knowledge of the system (please see subsection 3.1 for further details). The search space of the GA is, therefore, the adjustment of the rule weights.
Based on [38], there are two possible objectives for the charging strategy: (i) the financial objective function, purely based on the cost of buying/selling energy in different times; and (ii) the battery stress level, to represent the physical degradation of the battery.
In this work, the financial objective is related to the energy consumption/regenerated, whereas the battery stress is dependent on the square value of the current of the ESS charging converter (later called converter temperature).

Materials and Frameworks
As previously stated, this approach is an extension of the work in [4]. In this section is presented the methodology and tools used to support the proposed on-board railway charging strategy, where the development repository is accessible 2 .
This strategy requires that trains will contain an energy storage unit, as illustrated in Fig. 3.
In Fig. 3 is presented an AC 1x25 kV electrification scheme, which is the system under study in [29], having the sub-urban trains with a nominal power consumption of 1.4 MW. However, this work targets any type of train, as long as it has capabilities for regenerative braking operation. Furthermore, the technology and power electronics topology and control solution to implement such an ESS is not the focus of this work. It was considered that the traction converter has the DC bus accessible and it is considered that train has enough physical space to include a bidirectional power converter, batteries of some sort of technology and all the auxiliary elements to ensure proper operation (battery management systems, safety apparatus, among others).
2 Repository: github.com/vitormorais/railway_charging_ESS. Having these elements into consideration, the results of this article were obtained with an arbitrarily chosen hypothetical and generic ESS hardware. Specifically, the power capabilities of the ESS was set to have 350 kW of charging/discharging maximum power (25% of the train power consumption) and 35 kWh of stored energy (6 minutes to fully charge the ESS when the charging profile is constant and with an absolute per-unit (p.u.) value). Regarding the efficiency of the ESS, recent research on railway ESS has established the efficiency for battery ESS to be 80%, and the efficiency of the super-capacitor ESS is 98% [20,41]. It is reasonable to consider in this study a unitary efficiency for the ESS if recent technological advancements on supercapacitors and in silicon carbide (SiC) transistors are taken into consideration, and if the focus of this study is on the capabilities of the FLC and the GA optimization algorithms.
Regarding the charging strategy, this comprises two levels of processing: a real-time FLC which generates references for the ESS Power Converter; and an optimization GA, running in off-line, which increases the energy efficiency of the global ESS.
The architecture for such a charging strategy is visible in Fig. 4 Specifically, the GA optimizer generates a fuzzy ruleset corresponding to the optimal operation of a specific train consumption profile. Then and in real-time, the FLC adapts the power of the train ESS Power Converter, resulting in the charging or discharging of on-board batteries.

Proposed Fuzzy-Based Charging Optimization Strategy
In this subsection, the proposed fuzzy-based charging strategy is detailed. The main core of the energy storage control system is a Mamdani FLC, proposed in [42], having the structure illustrated in the Fig. 5a.
The FLC has multiple inputs (the train power flow value, the ESS State of Charge (SoC) and a variable representing the temperature of the ESS) and one output (the set point for the ESS power flow). From 5 EAI Endorsed Transactions on Energy Web Online First   (4) storage (4) convTemp (3) chargProfile (5)   The first input is the power consumption of the train and it can be categorized as consumption (if the train is in the traction mode and the energy flows from the catenary to the wheels) or categorized as regeneration (if the train is in braking mode and the regenerated energy from the motors flows back to the catenary). The second input is the onboard ESS SoC and corresponds to 100% if the system is fully charged or 0% if the system is fully discharged (considering those values the absolute maximum/minimum voltage values, and considering that reaching SoC values above 80% and below 20% should be avoided by the controller). To promote a reasonable usage of the ESS, a third variable is proposed. This variable mimics the semi-conductors heating and the battery state of health and is a quadratic function of the charging power.
On the FLC output, a variable is proposed to define the ESS charging profile, in an absolute p.u. value.
In this work, the FLC is tested with a testbed in which a near 70-minute train journey is considered. The train power consumption presented in Fig. 2 is the independent input of the testbed. The objective of the proposed testbed is better clarified in Fig. 6.
The SoC and the converter temperature depend on the previous result of the FLC output variable. Iteratively for each time instant, the stored energy and the ESS temperature variables are calculated from previous values, following the Fig. 7 The K ESS constant defines the storage capacity and the charger design limitations. The K temp and the K dissip represents the temperature increase of the ESS, as a quadratic function of the power, and a dissipation factor  (4) storage (4) convTemp (3) chargProfile (5) storageMgmt (mamdani) N rules Figure 6. Illustration of the testbed: at each time instant, the train power consumption is used together with state of charge and temperature to generate a charging profile; then from the generated charging profile, the SoC and the ESS temperature are updated.
to promote the temperature reduction. In this work, no effort was made to use a specific ESS system and these values were arbitrarily chosen.
To ensure the physical limits, the input variables are limited by its admissible maximum and minimum values and, in the case of the occurrence of overtemperature, over-charge or over-discharge events, the charging profile value is changed to avoid those events. 6 EAI Endorsed Transactions on Energy Web Online First  (4) storage (4) convTemp (3) chargProfile ( Regarding the FLC rule-set, in this work, these rules were manually defined from the expected behaviour of the system. Specifically, 17 different rules were defined based on the relevant combinations of input MF and output MF, being presented in Table 1 (please refer to MF from Fig. 5b to Fig. 5e for the physical meaning of each rule-set). The weights of the FLC rule-set is in this work, is an array starting with a value of 0.5, and this array can be adjusted by an optimization algorithm, as explained in the following.

Proposed Meta-Heuristic Rule Weight Adjustment
As a way to define the fuzzy rules, human knowledge is a good starting point to obtain a charging strategy for the FLC. In this section is proposed a GA as a metaheuristic to define the weights of the fuzzy rules, having an objective function as the optimization criteria.
Therefore, each individual of the GA population will have an array of 17 weights (genes) and a value for its objective function that will be obtained in the FLC for a given testbed. The crossover process considers the best individuals and a new individual is generated having part of the genetic material from the parent individuals. The mutation considers the random increase/decrease of certain genes. If a gene from the previous generation has changed, in the mutation, it has a higher probability to increase/decrease accordingly. The algorithm for the implemented GA is presented in Algorithm 1.
The initial population is generated from five individuals having the weights defined from human knowledge in the previous section. Furthermore, 30 new individuals were generated as mutations from After each FLC rule-set weight is tested, for a timeseries array of train power consumption, this results in three time-series arrays of ESS SoC, Temperature and the Charging Profile. Also, the energy at pantograph (consumed and regenerated) is calculated using the train power consumption and ESS charging profile time-series arrays. From these arrays, four partial metrics are extracted: • The RMS value of the graph of converter temperature; • The RMS value of the resultant charging profile; • The difference between the initial and the final value of the ESS SoC; • The final value of the regenerated energy.
As optimization criteria, it is considered the objective to avoid peak values in the first two metrics (avoiding high stress on the ESS, by having a high square value of the charging profile). In the remaining metrics, the optimization objective is to minimize the difference between the final and initial values of SoC and to minimize the difference between the regenerated energy without and with the ESS.
In the design of the global objective function metric, all four metrics are considered, having arbitrarily defined weights to better fulfil the expected behaviour of the system (in terms of convergence speed, the stability of the GA, intuition, etc.). Therefore, to obtain the results presented in Sect. 4, the converter temperature and charging profile metrics, have received small weights, and the SoC variation and global energy reduction have received a higher weight (with the global energy reduction tuned to rapidly reduce this metric).

Results and preliminary discussion
In this section is presented the results of the proposed methodology. Specifically, is illustrated the results for 7 EAI Endorsed Transactions on Energy Web Online First Table 1. List of fuzzy rules with the initial weights.
Later, this methodology is evaluated and discussed.

Preliminary Knowledge of System Behavior
The following results present the testbed evaluated with the 17 known rules. For different generations (throughout the evolution of the GA) and the same independent power consumption input (Fig. 10a), in Fig. 10b is illustrated the evolution of stored energy; in Fig. 10c is presented the evolution of the charging profile and in Fig. 10d is visible the evolution of the converter temperature. (Note: these illustrations are visible with different coloured plots).
At each generation, 40 new individuals are generated from the previous population, where 25   individuals result from crossing the genetic material (the weight of FLC rules) from the previous generation and the other 15 as result from mutations on the population. Between generations, only the five best individuals are eligible to pass to the next generation. The evolution of the objective function is presented in Fig. 11. Figure 11a shows the evolution of individual objective functions, and by providing different weights for each of the metrics, following the expression in (1), a global objective function is presented in Fig. 11b.
Each of the individual objective functions was adapted to result in a near-unitary value, with the product by the weight in bold in expression (1). As an example, in the first line of the equation regarding the ESS temperature, if the ESS is in average 20 • C above the ambient temperature, this part of the objective function will be almost unitary. The non-bold gains were defined manually, by viewing the evolution graph (as example, visually, the global energy must reduce and the ESS SoC must be near zero; the other should be kept contained) and adapting them accordingly.
Specifically, Fig. 11 illustrates the weights of all individuals of the same generation, plotted with "+" in the graphs, having the best individual of a generation highlighted with a square (in Fig. 11b).
For each rule, the FLC rule weights evolution for 200 generations are presented in the heat map graph of Fig. 12.
From the previous heat map result, certain rules will contribute more to the expected optimality. As an example, the heuristic algorithm will increase the weight of rules 1, 3, 6, 8 and 14, and reduce the weight of remaining rules, to achieve the desired lower value of the objective function.
This can be also visible in Fig. 13, with the modification of the FLC rule surface. As an example, higher values for charging profile are achieved for higher values of regenerative power and for a more discharged battery.

Evaluation of Energy Optimization
In Fig. 14 is presented the comparison of the train journey energy consumption/regeneration for the three possible cases in the study: • A train without onboard ESS, in Fig. 14a; • A train with ESS, with a FLC charging controller but without fuzzy weights optimization (only with the 17 known rules having the same weights), in Fig. 14b; • A train with onboard ESS, with the charging controller based on FLC, using the GA optimization criteria over the 17 known rules, in Fig. 14c; In Table 2 is summarized the comparison of the train energy for the three cases in the study: the inclusion or not of the onboard ESS and the inclusion or not of the optimization procedure.

Discussion
From the results in Table 2, globally, a maximum near 28.7% of reduction on the regenerated energy is achieved, as well as a reduction of 9.5% of energy consumption.
As an example, the catenary voltage level, measured in train pantograph, could be an important input variable for the FLC. The catenary voltage provides a good image of the state of the system. Clearly, the rules should be easy to be defined: "if the catenary voltage is low, then the ESS should discharge; otherwise, it should 11 EAI Endorsed Transactions on Energy Web Online First charge". Another variable can be train speed. This variable provides information for near-future energy needs: "if the train is stopped, then it most likely requires high demand for power in near future, for the departure; of the speed is high, then it might be needed to be stored a high amount of energy in the ESS".
However, this is strongly dependent on the train position and on the operation conditions of other trains. Therefore, it is essential to have a broad picture of the electrification system, through a power-flow system state analyser. Such analyser requires that each train reports in real-time the data from energy meters to a remote metering database.
The obtained results also depend on the ESS technology. The chosen unitary efficiency has led to the presented results and it should be considered lower improvements in energy efficiency depending on the ESS technology. However, with the consideration of super-capacitors and SiC transistors that can lead to an efficiency of 98%, the expected results must be closer to the obtained ones. Future research directions are possible with the study of the case study for different parameters (different capacities for ESS, different ratings, different efficiency values, etc.).
In the following section is discussed a practical implementation of the proposed methodology in a smart railway framework.

Smart Railway Framework
As previously discussed, the presented charging strategy considers a specific train journey. However, for a practical implementation, a smart railway framework must be considered, as illustrated in Fig. 15.
The hardware for onboard ESS is coupled in each train DC bus. The references for the charging profile came from the "Onboard Smart Railways Processing Unit", which is a computational platform that reports data from each train to a remote processing unit (represented in Fig. 15 by the cloud) and receives setpoints to improve the energy efficiency.
This cloud-based strategy has been explored in [43], where the knowledge of the electrification power flow is required for the necessary setpoints and a fast communication link provides better actuation.
This generation of FLC rules is performed remotely by the GA, and it must be based on the result of onboard train prediction algorithm: each train generates a prediction, then it compares this prediction with a database of predictions and finally, it updates the FLC rule-set. This strategy is better explained in Fig. 16 ... Figure 16. Strategy for real-time operation of on-board smart railways processing unit.

Genetic Algorithm Optimizer
As an example, if the prediction algorithm is capable to generate a one-minute prediction of the train power consumption, then this array of predictions is compared to a database of previously generated FLC rule-sets. The comparison is performed through the Root Means Square Error (RMSE): the prediction is compared with all arrays in the database, in a 1×N approach (where N is the size of the database); then the arrays are ordered and the one having the lower RMSE is selected (specifically, the previously processed FLC rule-set is selected, correspondent to the lower RMSE). It should be noted that this comparison procedure can be fast (as an example, the RMSE comparison of a 1000 points prediction array with a database of 10 000 elements takes around 0.2 s in a modern computer).
Besides, if the predicted power consumption is quite different from any of the elements in the databasethe lower value of the comparison RMSE is higher than a minimum RMSE -then the train sends the predicted value to the cloud, and the GA will generate a new fuzzy rule-set for the corresponding array. Finally, this is sent back to all trains (considering that all trains have similar ESS device).
In Fig. 17 is illustrated exactly how the information should flow between the two sides.
This proposed charging strategy can also be included in wayside ESS. In this, it is needed a real-time evaluation of the state of the system. Therefore, it is required that every train has onboard energy meters and these measurements must be transmitted in realtime to a remote database, wherewith such information, is possible to calculate the power flow in the railway electrification.
With this remote power flow analysis and measurements, the wayside can take advantage of the excess of energy injected by each train when they are operating in regenerative braking. Also, the opposite is viable, where the wayside railway ESS can support the departure of trains when their demand is nearly the maximum available torque and power.
In Fig. 18 is illustrated a particular case of wayside ESS, specifically the electric vehicles parked in passengers station parking lot.
In the example of the Fig. 18, the wayside ESS comprises a passenger parking lot, having electric vehicle chargers where the energy for this chargers comes from the catenary. The passenger stations are the points on the line where, naturally, the train mostly needs to brake and accelerate. Therefore, this place is a point of interest to have the power injection. The flexibility of the proposed two-level hierarchical energy management strategy is now demonstrated.

Conclusions
The initial approach of a storage charging controller, focused on multiple optimization criteria, and applied to railway transportation systems, is presented here. The proposed strategy is a two-level hierarchical EMS, 13 EAI Endorsed Transactions on Energy Web Online First  Figure 17. Illustration on the information flow between local and remote processing units.
where the real-time processing level is ensured by a fuzzy logic controller and the higher-level is responsible for the optimization through a genetic algorithm. This optimization strategy combines the knowledge of the expected behaviour of the system, by manually defining the rules of a fuzzy logic controller and, later, a metaheuristic is used to adjust the weight of the fuzzy rules. The contribution of this paper was partially demonstrated in the first part of this paper, with a case study of a single train journey. The focus of this work was to validate that a feasible charging solution having multiple input variables can be easily implemented with an FLC. This charging solution can result in the high reduction of the regenerated energy (near 22.3% in the presented case study). Later, as an optimization strategy, a metaheuristic can achieve 6.4% of regenerated energy reduction, on top of baseline.
With the demonstration of the feasibility of the solution for a single train journey case study, the second part of this paper tries to clarify, with a conceptual discussion, the integration of the proposed algorithms into a smart railway framework for energy management. In here are addressed questions regarding the need to have prediction models in train on-board processing units, and the need to hold a database on the results of the GA outcomes. The big advantage of the proposed algorithm is the ability for automatic learning.
With the discussion on the solution, further research directions have emerged. First, the prediction of the train state is needed to better adapt the real-time operation of the FLC. Then is required a power system state analyser, that is capable to generate the knowledge on the global railway electrification state. This task is computationally demanding since not only it requires the collection of all power consumptions of all trains, as well as their geographical positions, but also, it needs to automatically calculates the power flow in the catenary. Not only this task performs the calculation for the instantaneous time-stamp, but also for the prediction time window.
A reliable communication link is also required for the operation of the proposed strategy. With a well-designed software solution combined with faster computational resources and with a faster communication link, it is enabled the operation of this energy management system with good performance. The lower the latency between the data acquisition and the decision, the better the operation of this strategy.
The valid demonstration of the proposal together with the relevant scientific contributions leads to the conclusion that with a smart railway framework it is possible to increase the railway energy efficiency, with a high degree of flexibility.  (4) storage (4) convTemp (3) chargProfile (5) storageMgmt (mamdani)

N rules
On-board Smart Railways Processing Unit Figure 18. Smart railways framework to support the wayside and on-board railway charging strategy.

Conflicts of Interest
The authors declare no conflict of interest.