To combine 2 DC power sources, you can diode OR them both together. You can't just directly connect them together because their voltage outputs may differ ever-so-slightly, leading to imbalanced currents as well, causing one generator to try and kill the other by driving current into it.
To passively balance the two DC sources, you can add 2 small (small resistance, high power) resistors, one in series with each of the loads, before or after the diode, before the junction of the two.
To actively balance the two DC sources you can use a microcontroller and control logic to PWM the side delivering more current until it delivers identical current to the side delivering less.
But...how the heck do you combine two AC power sources? It seems to me you'd have to synchronize the AC waveforms somehow. Let's look at solar panels on your roof. I hear some microinverters require "5 minutes to synchronize with your house mains power", meaning somehow, they are doing this. But how do you combine the two? If you put one AC wave from the house at 110V RMS on top of another AC wave from the solar panel at 110 V RMS, you'd double the amplitude to an RMS of 220 V, which seems wrong. If you put them out-of-phase you've just neutralized the AC mains power in your house, not added to it....so I don't get it. I have no idea how this works, how to approach the problem, or even how to conceptualize or think about the problem.
Sort of adjacently-related:
- How do you determine the direction of AC current? (ex: whether your solar-powered house is drawing from the city power grid or adding to the grid)
Thought experiment (added 24 Oct. 2022)
From this answer:
The reason you don't get 220 V is that the incoming AC supply and the inverter(s) are wired in parallel, not series.
I think there's more to it than this. One way or another, the solar power needs to feed the grid. That requires a voltage potential into the grid.
As a thought experiment, if you put two 10 V voltage regulators in parallel, and they each output exactly 10 V, then the results will be 10 V. If the total current draw on that voltage output is 1 A, then each regulator will deliver 0.5 A, again, because they are exactly balanced in voltage in our hypothetical example. Now, to try to get one of them to deliver let's say 0.9 A and the other to deliver 0.1 A, you'd have to try to change their voltage output settings to make the 0.9 A one have lower resistance and a higher set-point on its voltage output.
So, to feed the AC grid I think you'd have to do the same: set a set-point slightly greater than the Vrms of the grid. I'd need to think this through some more and analyze it. I'll save that for future work another day. This feels like a multi-day problem.