Hardware-in-the-Loop Modeling of an Actively Fed MVDC Railway Systems of the Future

This paper presents an averaged real-time model of an arbitrary size MVDC railway system. In contrast to references already available in the literature, focusing mainly on specific parts of such a railway network (e.g. power converter installed in a locomotive), this paper offers a thorough insight into the modeling of every part belonging to it. Through a set of reasonable assumptions, the concept of a sector is presented allowing for a straightforward synthesis of any MVDC railway network. Thereafter, real-time models of catenaries, rails, trains, as well as power converters supplying the system are presented in a comprehensive manner. Without loss of generality, the system analyzed hereafter represents a 200km section of a double-track EuroCity line powered by an actively fed electrification system with three transformer-rectifier groups and two modular multilevel converters. The proposed modeling approach was verified on a large-scale hardware-in-the-loop system comprising one RT Box 3, hosting the model of the exemplary railway network, and two modular multilevel converter digital twins relying on the use of industrial ABB PEC800 controllers.


I. INTRODUCTION
F OR decades, the European Union (EU) has been making efforts towards the concept of a Single European Transport Area [1]. By unifying its transportation sector, the EU intends to improve the free movement of individuals, services and goods, which is at the heart of its single market. However, such a goal requires the ever extending transport infrastructure to cut ties with fossil fuel technologies due to concerns with pollution and sustainability. Consequently, extending its already large electric railway infrastructure and establishing a Single European Railway Area (SERA) represents one of the important ambitions of the EU.
Throughout Europe, railway systems are mainly differentiated by their voltage, with the most typical levels being 600 V DC , 750 V DC , 1.5 kV DC , 3 kV DC , 15 kV AC (16.7 Hz) and 20 kV AC (50 Hz) [2]. Such a wide variety of systems is a major hurdle for the creation of SERA as it limits the interoperability of rolling stocks. In this context, references [3], [4] introduced the potential of a new 9 kV DC electrification system. Such a system is intended to replace the existing 1.5 kV DC and 3 kV DC railway lines, with the aim of improving the traffic capacity and overall system efficiency. In the existing 1.5 kV DC and 3 kV DC railway networks, the energy is usually delivered by Transformer-Rectifier Groups (TRGs) [4] (e.g. 6-, 12or 24-pulse rectifiers). This technology is well known, efficient, robust and can be easily upscaled to support the need of the 9 kV DC system. Notwithstanding the simplicity, efficiency and robustness of TRGs, the proposed voltage level opens the door for the use of Modular Multilevel Converters (MMCs) [5], which, in railway applications, offer potential advantages over Diode Rectifier (DR)-based configurations: • In a TRG, the output voltage drops with an increase in the load current due to commutation caused by the VOLUME X, 202X i transformer leakage inductance [6]. This drop affects the pantograph voltage, which can be considered a drawback given that the pantograph voltage is supposed to stay within a predefined range. The MMC, however, can control the voltage across its DC terminals [7], irrespective of the load current. Thus, the minimum pantograph voltage is expected to be higher if some TRGs are replaced with MMCs. • When a train decelerates, some of the braking energy can be recovered and injected back into the overhead lines. Unfortunately, TRGs are unidirectional. Therefore, if there is no train in the vicinity to consume this energy, the excess is dissipated in the Voltage Limiting Unit (VLU) installed on the roof of the locomotive. One way to prevent this waste is to install super-capacitors and/or batteries inside the locomotive [8] or at the railway stations [9]. The excess energy is temporarily stored and used later to accelerate the train when it leaves the station. Another method relies on the bidirectional nature of the MMC, which enables one to inject the excess energy into the AC grid and recover it later. • DRs have no capability of reactive power control, while causing significant harmonic polution on both AC and DC sides. As a result, reactive power compensators and filters are normally required. With the MMC, however, these are not needed as active and reactive power can be controlled independently, while ensuring an outstanding quality of AC currents due to its multilevel nature [7], [10], [11]. • In the case of a fault, an MMC realized with Full-Bridge (FB) cells can counter short-circuit currents by producing a negative voltage [12], [13].
Prior to deploying any technology in the field, especially if massive and expensive High Voltage (HV) or Medium Voltage (MV) systems are considered, control verification in a risk-free environment is more than recommended. For this reason a Hardware-in-the-Loop (HIL) replica of the MMC described in [14] was developed and presented in [15], [16]. Essentially, the converter power stage is emulated in the real-time simulator, while the actual control hardware is interfaced with the later using standard I/O connections. This way, the controller is never able to differentiate between the simulator and the real power hardware. In order to assess the performance of the MMC in railway applications, the digital twin of an MMC needs to be extended with a real-time model of an entire 9 kV DC railway line, which is the main purpose of this work. At first glance, developing the realtime model of an Medium Voltage Direct Current (MVDC) railway system might seem a trivial task. Nonetheless, several technical challenges, listed bellow, can be associated to it: • In general, hardware capabilities of an employed simulator impose a hard limit on the complexity of a network model. Railway systems are particularly demanding for two reasons. Firstly, the network topology varies over time depending on the number of trains and their positions within the network itself. Unfortunately, some real-time simulators cannot handle circuits with time-varying parameters (e.g. RT-Box [17]). Secondly, the switching behavior of train converters requires extremely small simulation step-sizes, which are quite often unrealistic in case a large-scale system is simulated. In other words, simulation speed/fidelity contradicts the requirement of simulating the system being as large as possible. • Real-time simulation of TRGs and trains represents a demanding task for simulators solving the circuit equations in the state-space (e.g. RT-Box and TyphoonHIL) since the number of state-space matrices is directly tied with the number of switches in the system. What is more, in the circuit with N switching elements, the number of different state-space matrices equals 2 N . To avoid online calculation of system matrices, which happens to be time consuming, these are normally precomputed and stored in the simulator memory. On these terms, a set of matrices, used in the upcoming simulation step, must be selected and loaded from memory, which is an inevitable time expense. From here, it can be concluded that the more TRGs and trains in the simulated network, the higher the simulation step-size requirements.
So far, modeling of railway systems, in a broader sense, has been addressed on multiple occasions. In [18], an analysis of rail potential and stray currents in an MVDC railway system was provided. However, such an analysis requires the rail model comprising a significant number of switches. According to the previous paragraph, such an approach is not suitable for real-time simulations. Reference [19] contains a detailed overview of MVDC railway systems, however, no modeling (neither offline nor real-time) is discussed. Similar conclusion stands for [20], where an MVDC railway system is proposed, however, no details on modeling are presented. Substantial amount of documentation on MVDC railway systems was published within Shift2Rail project [21]. Nonetheless, these studies are dedicated to potentials of MVDC technology in the railway domain and not to real-time modeling of systems they are proposing. In [22], offline model of an MVDC railway line containing two power stations and one train was proposed. The railway line was modeled in Simulink with a variable resistance block, which happens to be unavailable in some real-time simulators (e.g. RT Box) for the reasons falling outside of this paper's scope. Therefore, this modeling approach is not considered suitable for real-time simulations. Similar conclusion can be drawn in the case of [23], where offline modeling of an on-board hybrid energy storage systems for railway applications was discussed. Publication [24] provides an insight into real-time simulation of a converter/machine pair installed on the rolling stock. However, no other details were provided on modeling of the rest of the railway system. Identical conclusions can be made in the case of [25]- [28].
ii VOLUME X, 202X The work presented in [29] provides an information on real-time modeling of an AC railway network, where system admittance matrices are solved on dSPACE platform, which significantly differs from the simulator chosen for this work. Similarly, real-time model concerning mechanical parts of the train was introduced in [30], while the other system parts were tested by means of a reduced-power test bed. Similar idea was used in [31]. Once again, models mentioned in [30], [31] were implemented on dSPACE platform, making them different compared to ones discussed herewith. References [32], [33] touch on the topic of railway modeling, however, only on the converter level, while other parts existing in the railway system are not necessarily mentioned. In [32], device-level modeling of an MMC, operating as a 25 kV AC traction feeder, was presented, while similar principles were discussed in [33] for the MMC operating as a rolling-stock converter.
As can be seen, most HIL models for railway applications focus on a specific part of the system, such as the traction system [24]- [28], [32]- [35] or the traffic management [36]. To the best knowledge of the authors, the only publication presenting the real-time model of a complete DC railway line considers a simple network with two substations, two trains and an ideal rail with no linear resistance [37]. What is more, it focuses on a peculiar topology with a superconductor wire in parallel with the catenary. The aim of the current work, however, is to propose a systematic way to deal with larger networks and all the parts comprising them, which is considered its most important contribution.
Forthcoming paragraphs provide a thorough insight into the real-time modeling of all the parts comprising an MVDC railway network -catenaries, rails, trains and converters supplying the network itself. The employed modeling techniques allow an essentially time-varying circuit to be replaced with a time-invariant counterpart, which enables the use of simulators incapable of operating with time-varying elements. Through a set of reasonable assumptions, averaging of the train and TRG models is introduced, leading to a significant reduction in the number of state-space matrices describing the considered system. In other words, the approach presented hereafter provides a model suitable for the system load flow studies, which comes in handy especially if the potential of a certain solution (e.g. MVDC railway network incorporating MMCs) is to be compared to its traditional counterparts (i.e. solutions relying on the use of mature technology such as TRG).
The rest of the paper is organized as follows. Sec. II includes a general system overview supported by a set of assumptions adopted in the upcoming paragraphs. Sec. III provides an in-detail model of the sector, including transmission line and rail models. Sec. IV deals with the train modeling, as well as relevant speed/power profiles of trains considered by this work. Sec. V covers the topic of the substations' modeling. Finally, Sec. VI contains the description of setup used to verify the modeling approach presented herewith along with the results obtained by means of it.

II. SYSTEM OVERVIEW AND GENERAL ASSUMPTIONS
The railway network under study is directly inspired by the double-track line proposed in [3] and it is illustrated in Fig. 1. Electric power facilities (substations) are either TRGs or MMCs and they are distributed at regular distances along the line. The power is then injected into a catenary system and shared between tracks by connecting them in parallel at the substations and half-way in-between paralleling stations. Finally, the current is collected by pantographs and circled back to the substations through the rails.
Since 9 kV DC locomotives do not exist yet, the train used in this work is a modified EC 250 "Giruno" from the Schweizerische Bundesbahnen (SBB) [38], Switzerland. This is a high-speed train built by Stadler Rail operating between Frankfurt and Milan through the Gotthard Base Tunnel in Switzerland. Also, it is certified to operate in Austria. Since the electrification systems are not unified between these countries, the EC 250 must support multiple supply voltages: 15 kV AC /16.7 Hz, 25 kV AC /50 Hz and 3 kV DC with the later being used in Italy. In this work, it is assumed that the EC VOLUME X, 202X iii  250 can be modified to support 9 kV DC instead of 3 kV DC . Characteristics of this train are summarized in Tab. 1.
In [3], the authors presented a method of sizing a DC railway network based on the load-flow analysis, the purpose of which was to ensure that the line respects the constraints related to temperature, voltage range and rail-to-ground voltage at all times. Once the choice of the rail and the overhead cable is made, the railway line sizing is constrained mainly by two parameters -the catenary cross-section and the spacing between substations. In general, the cross-section should be large enough to ensure a satisfactory current density, while the spacing between two neighboring substations should be as small as possible to limit voltage drops along the line. In this work, rails and overhead cables are of the same type as in [4], however, instead of 230 mm 2 the cable crosssection is set as 250 mm 2 , while the spacing between two substations is chosen as 50 km instead of 40 km. Parameters of the overhead lines and rails can be found in Tabs. 2 and 3, respectively. Further, following the European Standard EN 50163 [39], the voltage range of a DC line for traction applications is limited. Even though this standard does not cover 9 kV DC lines, the specifications for 9 kV DC can be scaled up, as explained in [3], according to Tab. 4.
To deal with arbitrarily large networks, one can introduce the concept of a sector. Henceforward, a segment of the line where only two trains can circulate at a time (one per direction) will be referred to as the sector. The complete line is then built by connecting multiple sectors in series and adding equally spaced substations at the terminations of some sectors, as shown in Fig. 1. Considering the substations spacing previously adopted in Tab. 2, a 250 km h train would need between 2 m 24 s and 6 m to cross a sector. Given that a train must be able to perform an emergency braking without any collision, it is safe to choose a sector length of 25 km. This also means that the spacing between two adjacent trains is 25 km, which corresponds to a very dense high-speed train traffic. Nonetheless, such a schedule represents a very convenient scenario for the system performance verification.
The following statement comes rather as a fact than an assumption -the dynamics of the mechanical system is multiple orders of magnitude slower compared to the electric time constant in the system. Nevertheless, such an obvious conclusion contributes to a significant simplification of the railway line modeling suitable for the upcoming studies, as will be seen shortly. Further, irrespective of the type of a TRG (i.e. 6-, 12-, 24-pulses, etc.), its output voltage contains a certain amount of higher order harmonics (e.g. 6th, 12th, etc.). However, the locomotives, as will be seen in Sec. IV, include an on-board inductive filter which allows for a straightforward control of their currents to almost pure DC waveform. In other words, higher order harmonics present in the system voltage take no part in power transfer. Therefore, they can easily be ignored, allowing for the averaging of the TRG real-time model. Similar conclusion can be applied to the MMC considering high quality of its AC and DC voltages, which renders higher order harmonics in the railway network current rather insignificant.

III. MODELING OF THE SECTOR A. TRANSMISSION LINE MODEL
Considering the adopted sector length of 25 km, it is appropriate to use a transmission line model for the catenary and the rail. Generally speaking, an infinitesimal segment of a transmission line can be modeled as shown in Fig. 2a, as discussed in [40]. The linear resistance R accounts for the Joule losses of the line, L sums up both the self-inductance of the line and the mutual inductance with the neutral conductor, C is the parasitic capacitance between the line and the neutral, and G represents conductance of a space separating the line from the ground. As the railway line is DC, while the switching behavior of converters is ignored according to the previous section, the linear inductance and capacitance can be neglected. Additionally, the distance between the catenary and the rail is large enough to assume that the air acts as a perfect insulator [8]. Thus, the transmission line model of the catenary is simplified to a linear resistance, as illustrated in Fig. 2b. For the rail, however, the conductor is close to the ground. As a result, the insulation is usually imperfect, which leads to leakage currents (called stray currents in [3]) between the rail and the ground. Fig. 2c presents the transmission line model of the rail including the rail-to-ground leakage. As for the catenary, the resistivity σ [ Ω mm 2 km ] of the cable is known from a manufacturer's datasheet, and parameter to size is the cross-section S c [mm 2 ] of the cable. The linear resistance is then Similarly, the resistivity σ [ Ω mm 2 km m ] of the rail is known from a manufacturer, and parameter to choose is the rail density ρ [ kg m ]. The line resistance of the rail is then Finally, the linear rail-to-ground conductance G rail [ S km ] depends on materials used for the railway ties, the ballast and the rail insulators. It is fixed by the construction process. According to Tab. 3, this parameter equals G rail = 0.075 S km . As a train moves along the sector, catenary resistances left and right from it change. Consequently, the need for a variable resistor model becomes more than evident. While the majority of the offline simulators support the variable resistance model, circuit operation with variable parameters imposes a challenge for certain real-time simulators (e.g. RT Box [17]). Such a hurdle can be circumvented in by relying on the model depicted in Fig. 3a.
From here, one can establish the expression which can be further simplified based on the assumptions made in Sec. II. Namely, the dynamics of mechanical system happens to be several orders of magnitude slower compared to the electrical one. From the real-time simulator viewpoint, this means that there is barely any difference between two samples of current flowing through the analyzed block. Thus, one can assume that which indicates that the structure from Fig. 3a behaves as a resistor with the resistance set externally as R * . The lower and the upper saturation limits of R * equal 0 and R max , respectively.
In some cases, there is a need for an infinite resistance, however, including a resistor with a large resistance into the model can make matrices describing an analyzed system stiff. Therefore, another approach for modeling an infinite resistance was proposed in Fig. 3b. As can be seen, the current flowing between terminals labeled with A and B equals Since potentials of points A and B are supposed to stay unchanged over a few sampling periods of the real-time simulator, one can claim that In other words, the circuit from Fig. 3b behaves as an open circuit, which is equivalent to an element having infinite resistance. Lastly, circuits from Figs. 3a and 3b can be combined as depicted in Fig. 3c, which sets the framework for modeling of the double-track lines.

B. DOUBLE-TRACK LINE MODEL
Each train in the sector is moving along the line over time. Therefore, based on the transmission line model, the catenary is split into two variable resistances (left and right), as illustrated in Fig. 4a. However, when considering a doubletrack line, rails of both tracks are connected in parallel all along the line [3], [4]. The first consequence is that the rail is split into 3 sections (left, middle and right), since the distance between trains must also be considered. The second  consequence is that the topology of the sector is different depending on whether or not the trains have crossed (please compare Fig. 4a and Fig. 4b).
A catenary resistance is computed from the position of the locomotive, length of the sector x Σ and the linear resistance R cat as The rail resistances depend on the position of the locomotives x 1 and x 2 , the length of the sector x Σ , linear resistance R rail and the number of tracks in parallel (in this case two), denoted by N t , according to the following expressions: The rail-to-ground conductances are calculated in a similar way, as presented in (11) and (12). However, while implementing the model on an HIL simulator, one should be careful and recall that the rail conductance is split into two parts in the π-scheme, as illustrated in Fig. 2c.
What can be concluded is that the sector is actually to be represented with two circuits, the one of which is used depending on whether the trains have already met along the line or not. The switch-over between two circuits depicted in Figs. 4a and 4b can be performed by extending the sector model by two ideal switches, however, such an idea contradicts the requirement of minimizing the number of switching components used in the model. As a result, another approach to the unification of circuits from Figs. 4a and 4b must be relied upon.
In this particular case, it is not possible to use some averaged model of the sector as there is an interest to follow the displacement of trains as a function of time. Instead, the behavior of ideal switches can be emulated with variable resistances. By choosing parameters labeled with R 1L , R 2L , R 1R and R 2R according to (13) and (14), the circuit from Fig. 5 can be made equivalent to either of those presented in Figs. 4a and 4b.
The main advantage of the equivalent model from Fig. 5 lies in the fact that a single electrical circuit represents the sector. Consequently, a railway line made of N sectors in a row is also described by a single circuit and a single set of state-space matrices. It is noteworthy that using infinite resistances does not make the system matrices stiff, thanks to the variable resistance implementation from Fig. 3c. vi VOLUME X, 202X

IV. TRAIN MODELING A. LOCOMOTIVE
In 2021, locomotives supplied with 9 kV DC do not exist yet. However, the conversion chain can be derived from existing locomotives supplied either with DC or AC voltage. The pantograph would likely be connected to an input filter, followed by a Power Electronic Traction Transformer (PETT) to isolate the traction unit from the catenary and step-down the voltage. At 9 kV DC , PETT would rather imply a multilevel topology, where two main concepts, implying either partial (c.f. [41]) or bulk (c.f. [42]) power processing, depicted in Figs. 6a and 6b are recognized. Thereafter, the rest of the propulsion chain would be the same as in existing locomotives [43]: a low voltage DC bus is protected by a VLU (typically, a non-isolated buck-type converter), and supplies multiple AC motors with their own inverters. Of course, several topologies are possible, and Figs. 6a and 6b illustrate just a general idea. In either case, the conversion chain structure enables a high-bandwidth control of the current drawn from the pantograph. As a result, when observed from an overhead line, the train can be modeled with a controlled current source.
Obviously, the train current cannot take any arbitrary value since, in practice, power converter mounted on the train has a current limitation. According to [4], the locomotive should be able to operate at its nominal power until a certain lower threshold voltage is reached. For lower pantograph voltages, the converter enters the current limitation mode,  leading to a linear drop of the maximal power. The effect of the current limitation is shown in Fig. 7 with min/max pantograph voltages (c.f. Tab. 4) being labeled V min and V max , respectively. The threshold voltage is simply up-scaled from the 1.5 kV DC locomotive presented in [4] as When a locomotive brakes, the excess of energy flows back towards an overhead line the locomotive is connected to. Unless the braking energy is recuperated either by a train in the vicinity or returned to the AC grid the railway network is connected to, the pantograph voltage increases. Fortunately, the MMC substations are bi-directional. Therefore, the excess of braking energy could be retrieved and injected back into the AC grid. Nonetheless, if there is no MMC or no other train at proximity to absorb the braking energy, the pantograph overvoltage must be prevented by means of a VLU, as presented in Fig. 8.
As explained in the next section, train current depends on its power reference along with the available pantograph voltage. Let the train power reference be denoted by P * . According to Fig. 9, the pantograph overvoltage can be avoided, during the braking phase, if the train power is corrected as

VLU Logic
Power limitation where threshold limits V th,low and V th,up were set as 10.6 kV and 10.7 kV respectively, while the nominal power of the train was denoted by P n . Thereafter, the corrected power reference P c gets compared with the train P/V characteristics from Fig. 7 in order to obtain the reference which is subsequently converted in the train current. It must be emphasized that other voltage limiting strategies could have also been chosen, while the one provided Fig. 9 represents only an example this work relies on.

B. SCHEDULER
According to [44], [45], a typical speed profile of a train is made of the following phases: 1 Acceleration at maximum torque 2 Cruising at constant speed 3 Coasting -the train slowly decelerates when approaching a railway station 4 Braking at maximum torque 5 Wait time at the station. Fig. 10 depicts the speed profile of the locomotive. The corresponding power consumption of the train was then deduced from the tractive and braking effort characteristics presented in [45], and is illustrated in the lower plot of the same figure. Sectors were envisioned in a way allowing only one train to circulate per sector and per track at a given time. This limitation makes sense from a traffic perspective as trains must maintain a minimal distance between them to prevent collision in case of an emergency braking. For this reason, a train cannot enter the next sector if the previous train has not left it yet. To respect this condition, two options are possible in terms of schedule:

The upper plot in
• Trains wait at the end of their sector until they can pass to the next one • All trains moving in the same direction have exactly the same speed at all times. If this is the case, they will all reach the end of their sector at the same time and they do not need to wait. In a real-time simulation, the schedule can easily be handled by the use of Finite State Machines (FSMs), however, such a topic falls out of this paper's scope. Instead, it is worthy to note that speed and power profiles from Fig. 10 are not convenient for an implemenation in the FSM. Therefore, these are rather simplified (linearized) as presented in Fig. 11. From the system viewpoint, it does not truly matter what the speed profile is since it only affects the time needed for a train to pass through a sector. This, in turn, impacts how long the simulation lasts. However, the power profile is important from a load-flow perspective. When comparing the realistic and simplified power profiles, the later is less favorable because locomotives consume more power during the cruising and coasting phases. In fact, this is as if the trains were overloaded and needed to operate at full power to maintain their nominal speed. Additionally, the total braking energy (area under the power curve during the braking phase) is also lower, which reduces the overall system efficiency. As such, the simplified model is more conservative.

A. TRGs
In a TRG, the DR performs AC-DC rectification, while the transformer modifies the AC voltage amplitude such that viii VOLUME X, 202X the DR open-circuit voltage, denoted by V R0 , matches the requirement from the EN 50163 standard. Fig. 12a depicts a 6-pulse DR connected to an AC grid by means of phase inductors labeled with L g . It is noteworthy that identical schematics is to be used in case the DR is connected to the grid by means of a transformer. In this case, L g denotes leakage inductance of the transformer. Anyhow, commutation of the DR output current among phase inductors causes the average output voltage drop [46], which can be observed from (17).
In the above expression, V g represents the RMS value of the AC grid line-to-line voltage, whereas it was assumed that the DR output current is purely DC. However, something like that is not unrealistic, especially if all the trains can control the current drawn from their pantographs. What can be seen from (17) is that the commutation voltage drop can actually be modeled with a resistor, labeled with R σ , which allows one to derive the averaged TRG model depicted in Fig. 12b. The diode D preserves the unidirectional nature of the circuit.
The advantage of the proposed model lies in the reduction in the number of switching components used to model a TRG. Namely, in a circuit with M TRGs, the number of statespace matrices that an employed real-time simulator must handle equals 2 (6×M ) in case the model from Fig. 12a is used. If, however, the model from Fig. 12b is employed, the above mentioned number equals 2 M , which contributes to a significant reduction in the model computational requirements, and thus, the step-size used to run the simulation in real-time.
It must be stressed that 12-, 18or even 24-pulse rectifiers are sometimes considered preferable in MV applications [47]. Notwithstanding, the proposed modeling approach does not change. Conversely, the expression (17) can be generalized as while values of coefficients k 1 and k 2 change depending on whether a group of DRs is connected in series or in parallel, as presented in Tab. 5. What can be seen from (18) and Tab. 5 is that the nature of rectification system does not alter the structure of the model depicted in Fig. 12b. On the contrary, it only affects its multiplication constants, meaning that a single TRG model can be used for all the systems listed in Tab. 5. Fig. 13a present equivalent circuit of an MMC seen from its DC terminals [48]. In the case considered here, it is assumed that currents of the railway network are controlled by the trains. Therefore, as long as the MMC DC current is controlled by an external entity, the voltage component labeled with V DC in Fig. 13a can be adjusted such that the voltage seen between the converter DC terminals corresponds to its reference value V * MMC . Consequently, in case the MMC is modeled in the same real-time simulator as the rest of the railway network, it can be approximated with a controlled voltage source, as illustrated in Fig. 13b.

B. MMCs
In this work, however, real-time models of two MMCs are running on separate HIL units described in [15], [16] and referred to as MMC HIL 1 and 2. The model of the railway network discussed above runs on an independent HIL unit referred to as the Railway HIL. On these terms, the voltage across an MMC DC terminal should be measured and delivered to the Railway HIL, while current measurements from the Railway HIL should be sent back to the associated MMC HILs, as illustrated in Fig. 14. In other words, the model of the whole railway system is distributed (split) among several simulators.
When two parts of the model, created through the splitting procedure, must exchange the information on voltage, splitting the circuit at a place containing a capacitor is considered to be a good practice [17]. However, rather than having a concentrated DC link the MMC relies on the use of distributed DC links, making the voltage information exchange rather non-trivial. Nonetheless, the MMC real-time model can be extended by a small decoupling capacitor, labeled with C d in Fig. 14, which circumvents the aforementioned challenge. As long as the capacitance C d is selected sufficiently low, it does not alter the functionality of the circuit it is included in. In this work, the value C d = 50 µF was adopted. Fig. 15 presents the HIL system used for verification of results presented throughout this paper.

A. HIL PLATFORM DESCRIPTION
Real-time models of two MMCs run on two independent HIL units, a detailed description of which can be found in [15], [16]. In short, the employed MMC HILs rely on the use of the RT Box 1 from Plexim. Six RT Boxes are used for simulation of six MMC branches, each containing up to N = 8 cells. A seventh RT Box contains the model of an AC grid the MMC is connected to, along with an application the MMC is serving. On the back, an ABB PEC800 industrial controller was installed [15], [16]. In this way, the controller governing the real MMC prototype, described in [14], [49], [50], is used in this work, which adds a whole new level of reliability when compared with pure offline simulations.
Model of the railway network discussed above, contains eight sectors, meaning that sixteen trains circulate around it in accordance with the order provided by the block named Scheduler. As shown in Fig. 15, the model of the relevant railway network resides in the RT Box 3, which exchanges the information with two MMCs by means of two SFP links. In total, fifteen independent small-scale real-time simulators (2 × 7 RT Box 1 for two MMC HILs + 1 × RT Box 3 for the Railway HIL) were connected together to emulate the behavior of an MVDC railway system. Scheduler controls the network traffic through the use of two FSMs, each controlling a group of trains moving in forward and reverse directions, respectively. By using the information on trains' speeds, and therefore positions, the Scheduler provides every sector with references for the overhead line and rail resistances/conductances. It is assumed that all the trains moving in the same direction have the same speed, however, such an organization of schedule does not affect the model generality.
Last but not least, the Railway HIL can send DC voltage references, labeled with V 1 and V 2 to both MMC HILs. In this way, the railway network power flow can be optimized with the aim of maximizing the system efficiency. However,        Fig. 16a includes the positions, pantograph voltages and powers of two trains moving in opposite directions and numbered with 4 and 12. It can be noticed that the pantograph voltages of both trains remain within the boundaries defined in Tab. 4, which confirms the validity of the design adopted for this study.
However, checking the accuracy of the presented modeling approach requires a comparison with offline simulations, given the unlikelihood of realizing the whole railway system in laboratory conditions. Thus, Fig. 16b provides relative errors in pantograph voltages, locomotive powers, substation voltages and substation powers. In case voltage errors are observed, a normalization was performed with the substation open circuit voltage equal to V oc = 10.5 kV, while MMC and TRG power normalizations were performed with values of 40 MW and 30 MW, respectively. In the offline model, MMC substations were modeled as ideal voltage sources connected in series with a resistance equal to R DC = 2 3 R br = 80 mΩ. Fig. 16b reveals an outstanding matching between the results obtained by means of real-time and offline simulations during periods excluding trains' braking. Around time instants equal to 6 min and 14 min, a slight mismatch between the two types of simulation can be observed and such an error can be attributed to the following reason. Namely, in the chosen railway network, node voltages are affected by the dynamics at which the MMCs can control their DC terminal voltages.
As already stated, in offline simulations, the adopted MMC model matches the one illustrated in Fig. 13b, with the reference being fixed to 10.5 kV. However, MMC HILs rely on detailed, switched, MMC models [16] governed by industrial controllers, which makes the MMC DC side dynamics slightly different compared to a stiff voltage source. As a results, a negligible error (< 2.5% at all times) can be observed in substations' voltages.
Although of minor importance at first glance, even a 0.5 % voltage error causes the VLUs activation at different time instants. Consequently, powers demanded by the locomotives differ, resulting in the error displayed above. Notwithstanding, once the braking phase is over, the difference between the results from real-time and offline simulations nearly vanishes. It must be emphasized, however, that real-time simulations were performed with the MMC HILs using real industrial controllers, therefore, they are considered to be more realistic compared with the offline model considering the MMCs to be stiff voltage sources.
Figs. 17a and 17b contain similar analysis, however, with a delay of T d = 4 min introduced between schedules of trains moving in the opposite directions. As a result, two trains moving through the same sector do not brake at the same time, meaning that braking energy of one train can be used by its counterpart moving in the opposite direction. Conclusions identical to the ones related to Figs. 16a and 16b can be made here -except during braking phases, results obtained from two models match to a very high extent. However, errors occurring during the above mentioned braking can be alleviated in case a more-detailed MMC offline simulation model is used for comparison purpose, which falls out of this work's interest.

VII. CONCLUSION
This paper provides an in-detail view of steps taken in modeling of all the parts belonging to an MVDC railway system of the future. Given that mechanical system dynamics can be neglected compared to the speed of real-time simulators, a set of simplifications was introduced allowing one to construct an efficient and fast simulation model, which is found extremely convenient in case system load-flow studies are to be carried out. In this way, the potential of replacing some of traditionally employed TRGs with MMCs can be examined, however, this subject can be considered a continuation of the work presented above. What is more, the presented modeling approach transforms a time-varying railway network into a time-invariant topology, which enables real-time simulations on simulators incapable of handling time-varying circuits. By introducing the concept of sector, which can be perceived as a main building block of the analyzed network, synthesis of an arbitrary size railway grid can be performed in an effortless manner. Model verification was performed on a large scale HIL system comprising fifteen small-scale realtime simulators, making the results presented above reliable and valuable from the system modeling standpoint.