Charging 40V battery with solar panels
Lithium Ion batteries require precise current and voltage control during charging.  You cannot (should not) connect solar panels directly to a Lithium Ion battery for charging.  If you do, you are almost certain to seriously damage the battery and possibly start a fire.
Since 40V is not a standard battery voltage for solar charge controllers, you are going to have some difficulty finding a solar charge controller for that battery.