Well, there is also the sidebar, which I generally enjoy but this wouldn't be enough with 40 ships (I can see myself putting them all on the same tab anyway because I am lazy when it comes to switching through stuff in mid-battle). Also, there is an intrisic organization of ships into Flights (or what they ended up being named. Flotillas?) so building off of that, those formation health bars could simply apply one such formation, with no merging and splitting based on zoom factor because the formation is set. Ships still get their own bars if the player is zoomed in, perhaps under a symbol floating over them (that replaces the ship in tactical view and provides an easily seen marker when zoomed out).
The health bar could also be built into such symbols, like a ring around them for example. Or two half-rings if there is a seperate shield display.
One note on shields: I am more fond of "damage reduction" shields than "hit point buffer" shields, or rather prefer shields that protect fully up to a certain level of attack intensity, and then gradually let more damage through, or perhaps special weapons that damage subsystems (which a full shield protects against). Make of that what you will.
Another idea I would like to air is having a formation symbol as described above, and simple outlines of the ships below it (outlines as the sidebar in Sins of a Solar Empire or Nexus) which serve as a hit point display. I still find that there should be changing colors, such as a completely unscathed ship being blue, one that has taken minor damage/still has shields remaining green, shields down/ineffective yellow and nearly destroyed red. It also works if the outline is simply filled up with color which drains out. This would give the composition of a formation at a glance, as well as the status of all ships, but wouldn't fit with the symbols per-ship so much because of clutter. The outlines could instead float over/overlay the ships, still providing the damage indicator. The choice between the two suggestions is mainly cosmetic, since they provide the same function in effect.
While having a green line float in space may be functional, I don't think it is terribly nice to look at. Symbols where all the information is gathered in one place gives a better sense of order, which can also serve the atmosphere - fiction militaries have fancy glowing unit symbols all over the place, and games, particularly those with lots of units that aren't always easy to spot, do that quite often nowadays.