Last Friday I was a train parked in S. Camden NJ. It has several coal cars on it. The cars had solar panel on the sides! One 2’ x 3’ panel on the side on one end. I don’t know if there was a panel on the other side.
Seriously, I wish a lot of advances in railroading like electronic air brakes and positive train separation could take place this quickly. It was about ten years ago that I started seeing solar panels on some of UP’s ballast cars, then read an article in Railway Age or somewhere about how UP was using radio-controlled dumping to keep employees well away from the tracks during the operation, reducing the dust-breathing problem and avoiding the slips, trips, and falls connected with cascading ballast. This eventually expanded to entire systems like Herzog’s ballast train, which uses GPS and computerized controls to dump precisely controlled amounts of ballast at precise specific locations from a moving train. Herzog rebuilt a number of old steel coal gondolas into ballast hoppers for these trains.
Mudchicken mentions a couple of other applications that would use solar panels on freight cars. However, since you said you saw “coal cars” I suspect that it had more to do with ballast.