There are regions where the grid and the plants powering that are separate from the maingrid. (West-)Germany was like that, still is. For historical reasons, like different frequency of 16 2/3Hz. It's called 'Bahnstrom'.
If your'e wondering wtf!? 16 2/3Hz at all, that was because at the time of early electrification with AC (less transmission loss over longer distances), that frequency produced less sparks/arcing with the then available electro-motors for that single phase of AC, RPM, lack of advanced (mobile(power))electronics, and so on. Legacy...
DC had different trade-offs.
Since you wrote freight-trains, which isn't light-rail, which also had its own power-plants and grids, and mostly still has?
There are regions where the grid and the plants powering that are separate from the maingrid. (West-)Germany was like that, still is. For historical reasons, like different frequency of 16 2/3Hz. It's called 'Bahnstrom'.
https://de.wikipedia.org/wiki/Bahnstrom
Same applies to Austria and the Swiss. (D-A-CH)
https://de.wikipedia.org/wiki/Liste_von_Bahnstromanlagen_in_...
The former (East-)Germany did it different, while needing the same frequency.
They used something like this, decentrally https://de.wikipedia.org/wiki/Bahnstrom#/media/Datei:DR_Umfo... to convert from the 50Hz maingrid to 16 2/3Hz, where they had no coverage from the 'Bahnstrom-'grid.
If your'e wondering wtf!? 16 2/3Hz at all, that was because at the time of early electrification with AC (less transmission loss over longer distances), that frequency produced less sparks/arcing with the then available electro-motors for that single phase of AC, RPM, lack of advanced (mobile(power))electronics, and so on. Legacy...
DC had different trade-offs.
Since you wrote freight-trains, which isn't light-rail, which also had its own power-plants and grids, and mostly still has?