# Help on battery switching / petroleum generator

## Recommended Posts

Just setting up my "after coal" power gen.  Finally figured out the battery switching thing, works really well, except, the petroleum generator does not stop running even when the charging battery is full.  What do I add so that the Petroleum generator only runs when it needs to charge the batteries? I tried adding my usual smart battery to it but then the battery switching does not work.  What am I doing wrong?

##### Share on other sites

For starters they would both need to be smart batteries, secondly you'll need at least four smart batteries (two on each side). Thirdly, you'd need additional automation to turn on/shut off the generators.

I will label the two lower shutoffs from left to right shutoff A and shutoff B, or just A and B. From left to right the batteries are C and D. The additional batteries mentioned above will be C' and D'.

When B is on, D is connected to the generator, when A is on, C is connected to the generator.

Batteries C and D logic output cause the switching to happen, and trigger when empty or low.

The generator kicks on and charges the low batteries while the other side discharges. (this part works already)

Batteries C' and D' logic output is set to trigger green when full (or nearly full). This will tell the generator to take a break.

Run C' through a NOT gate, then AND it with A. Translation: "When battery is NOT full, AND it is connected to the generator".

Send this signal to an OR gate (this is important).

Do the same for D' and B as above, then run to the OR gate.

Run output of OR gate to generator.

Result: (-C' * A) + (-D' * B) = When C' isn't full and it's connected to the generator OR when D' isn't full and it's connected to the generator, then turn on the generator.

The above method gives something that will use both batteries more equally, but there's a simpler setup below:

The battery on the left is set to standby 95% (though it's a matter of preference) and active 5%, while the right battery is set to standby 95% and active 20%, though again, it's a matter of preference. The reason for the simplification is that I forgot that batteries have both a standby and active setting, and you can configure both to create a "window" where the battery will request charging.

Spoiler

##### Share on other sites

Thank you @impyre I found what I needed  towards the end of the excellent electricity tutorial by @martosss   it's not in the original post, it's in a secondary post towards the end of page one.

##### Share on other sites

Excellent, thank you for sharing it.