I want to achieve 8 hours of use, at 40 amps, to run lights, tv, fridge, etc. on a houseboat.
Its a 24 volt system, so how do I figure out how many batteries are needed?
8 hours * 40 amps = 320Ah (amp hours).
If you want the batteries to last any reasonable length of time, you'll only use the top 20% of capacity:
320Ah / 0.2 = 1600Ah
You might be able to stretch it a bit to (say) 30%:
320Ah / 0.3 = 1060Ah
That's still pretty big. For example, here's a picture of my 24V/1000Ah battery bank:
To give you a sense of scale, the frame for the rack is 2"x4" timber. The whole set weighs about 1500kg.
How are you planning to charge these?
Assuming that you're recharging these with solar, and you have 5 "peak sun" hours per day, you'll need 320Ah / 5 hours = 64 Amps of charging.
Under real-world conditions, each of my 140W solar panels puts out about 4.5A into the battery bank while in full sun. You'd need 14 of them. They're each roughly the size of a standard house door:
If you're planning to charge your batteries with a windmill I'll let someone more knowledgable do the calcs, but I expect you'll need something like a 12-foot windmill.
If you're planning to charge via a generator/battery charger it'll have to be pretty substantial too.
Also note that this doesn't allow for cloudy days (reduces your energy harvest by ~80%), batery inefficiency (you'll get out about 90% of what you put in) or inverter inefficiency (another 15% loss of power.
320Ah at 24V is 7.7kWh. If you're serious about using renewables, you'll need to get it down to a more manageable 1kWh - 2kWh first.
BTH