Sizing electrical wire from Solar Panels
I am assuming that you have 220V going to the barn? As far as wire size, industry standards say to aim for 1 - 2% voltage drop, but running 5000W, 200ft on #8 wire @ 220V results in just under 3% voltage drop. This will probably work just fine but it would work a little better if you were to upgrade it to a #6 or a #4. It is just a matter of weighing the options. During peak performance a system running at 5000W with a 3% drop would be losing around 150W. At 1% drop you would only lose 50W remember, this is only during peak performance; during the morning and evening, your losses are much less.

Here is the question to ask yourself... How much money is it going to cost to upgrade the wire? Is it worth it for a 100W increase?

Credits: I mostly use the Southwire Voltage Drop Calculator for my calculations... I can do it manually but the Vdrop calculator is much easier.

Thanks, Maxfield Solar