No way. Given just a differential, just a pair of connections, there's no way for a circuit to tell which is which.
If you had access to phase information about the grid, you might be able to do it, but as the mains frequency isn't terribly constant, you would not be able to rely on predicting this. Your device would have to get information about the present phase angle of the mains from someplace.
However, if you do have a real earth-ground reference from some place, you could build a circuit to look at the voltage of each supply line with respect to ground. One will be a small drop below the full 120 (or whatever the local mains supply) whereas the other will be slightly above ground. (Neutral return current vs your neutral run's resistance). This would just let you know which leg was 'hot', and you could swap your output polarity accordingly.
A Second Thought
If the power supply has only four connections with the world, two from the mains plug, and two to output the DC, there's no way I can think of that you could deterministically set output polarity based on plug orientation.
BUT
if you're willing to make your otherwise simple supply a lot more complex, you could conceivably make it so that if you pulled the plug and flipped it, and plugged it back in straight away, the output would flip.
Here's the idea: You stuff some kind of micro-controller in the box, that monitors the line voltage, and determines when rising-crossing-zero (or some other phase point) happens on one of the legs. You'd have to reference this to the midpoint of the two supply legs via a voltage divider. The micro could then anticipate when the next such phase point would occur. Now you'd also have to put some kind of super-cap in the box and pick a low power micro that could live off the super-cap long enough for the user to flip the plug. When power comes back, either the anticipated phase change happens when you expect, or half-way between. Half-way between means the user flipped the plug, so your micro flips the output polarity.
Of course, that still would be problematic. If the thing had been unplugged for a while, the micro would be dead, and you'd have to make an assumption about what the output polarity should be. Finding a micro that could last maybe 10 seconds on a cap's worth power while actively chugging away could be easier said than done. Last and not least, this would really only be a novelty gadget.
First of all you need to realize that a 12V SLA battery is not, ever 12V, if it's charging then it sits around 14.3V (but that's dependent on chemistry and temperature) when it's discharging then it can be as low as 10V.
The most robust solution is to make sure that all the equipment can tolerate 10-15 V, because that will allow you to get rid of any output regulator which will waste some energy while on battery.
Almost all electronics that says 12V will easily tolerate 10-15V, much of it will be happy with 8-24V as well, the main exception are computers that feed the 12V input directly to harddisks, those devices really like a regulated 12V.
A good charger will be needed that regulates the float voltage according to temperature and also limits the charging current.
One solution would be:
- A beefy AC/DC off-the-shelf mains supply, a 19V power brick for a laptop could do.
- A Buck DC/DC converter handling charging, but a simple LM317 could also be used.
- A Buck DC/DC converter handling the on-line output regulation.
- A switch (2 FETs) which switches over to battery if the output of the online-converter drops out of regulation.
Buck converters tend to be simpler and more efficient than buck/boost converters, so that's a good reason to prefer those in a design, but if you really want a regulated 12V output then there is no way to avoid a buck/boost converter and the plan becomes:
- A beefy AC/DC off-the-shelf mains supply, a 19V power brick for a laptop would do nicely.
- A Buck DC/DC converter handling charging, but a simple LM317 could also be used, especially if the battery is stored at a fixed temperature, (look up "SLA charger lm317).
- A switch (an opamp controllring two 2 FETs) which switches the input of the output regulator from the primary input DC over to battery if it drops below the battery voltage or simply two diodes.
- A Buck/boost DC/DC converter handling the output regulation.
A good buck/boost converter topology is SEPIC, because you only need one FET and a single coil, so it's cheaper than two converters back-to-back: http://dren.dk/carpower.html the linked design will output the same voltage no matter what the input voltage is (8-24 V)
... or, if you are lucky, you can just buy one:
http://www.mini-box.com/micro-UPS-load-sharing
Best Answer
Going with the maximum given, 1 Amp, 12V, you can have up to 20 per rail. 17 or 18 as to not drive the rail to the limit. And that's if the combined 12V output is actually 480W, as there might be a limit. If the combined output is limited to say 360W, that means you are allowed 240W on Rail A, or 240W on Rail B, but not at the same time. And 12W is fine on 20AWG