If I were building a box like that on a suspension bike, I would most definitely first compress the suspension *completely*, before measuring the space required for wheel movement. Then I would leave another extra centimeter or so in case the fork flexes back during braking or impact, just in case.
I can't clearly see your shocks in the pic to tell if they are pneumatic or not, but if they are you could let all the air out to make it easier to fully compress them for this measurement. Then add clamps between the handlebars and the bottom of the crown, compressing until there is no more possible compression of the fork (not just until it's hard to compress, but until it is physically impossible to continue). You could use very large hose clamps, or very big and strong zip ties, (preferably at least a pair of the half-inch-wide ones on each side, in case one breaks or slips).
If you don't allow for *complete* compression of the shocks, then it's likely that one day the predictions of others before me in this thread will come true, and you're not going to enjoy the results.
Remember also that when the shocks are completely compressed, you need to have clearance on the box's bottom forward area for whatever compressed it--right now, even if the box were adjusted to ride higher by the difference in spacing between it's top and the downtube, it looks like the box would strike the ground during full shock compression.
I also would recommend using the triangle for your battery, as in my experience handling is notably better with the weight at most along the axle line, or above it. Depends on the rest of the bike's configuration. The farther away the weight of the bike is from your own, the harder it can be to pivot that mass using the pendulum effect (where your mass is the pendulum end, and the bike is everything between the pendulum pivot (contact patch with road) and the pendulum itself). If your weight is a lot higher than the bike's, it'll be easier, but if you are typical to light weight then it takes more effort by you to use body english to control the bike (which you do whether you realize it or not).
Other than those two things, it looks like an interesting plan, and I would like to see it's finished state. I am interested to see how you install bearings (and which ones you use) on the crankshaft-mounting-point holes in the battery box, and how you tie it to the downtube at the front and along it's length.