Why bother ? Have the solar panels on top of the tram warehouse, use the tram batteries for storage, swap empty ones for full ones when needed. If the solar array is down use the grid. That way you divid points of failure instead of multiplying them

Or... power the tram lines from the grid and feed solar power into the grid somewhere else.

Trams use fixed infrastructure, including overhead power lines. I'm sure they must exist somewhere, but battery-powered trams are not popular.

> I'm sure they must exist somewhere, but battery-powered trams are not popular.

Yes, they do exist. The Alstom Citadis at Rio de Janeiro, which I take often, uses a supercapacitor for small pieces of its route (mostly crossings where the third rail would be damaged too often by vehicle traffic, or be impractical); according to the Wikipedia article (https://en.wikipedia.org/wiki/Alstom_Citadis), the Alstom Citadis at Nice uses batteries for parts of its route (https://www.railway-technology.com/projects/nice-trams/). I'm sure there are others.