Jump to content

Best Current Battery-Switching Rig?


Recommended Posts

Folks...

I'm wanting to try both battery flipping in general and specifically the @Gamers Handbook transformer-flipper at the producer(s).

The forums are vast, reddit is vast, youtube is vast, and I can't seem to find any straightforward answers to these questions:

1) Is the power-shutoff bug still extant?

2) If so, is there a standard automation fix for it?

3) For transformer-flipping with a source like solar, which is all-or-nothing, what's the best practice for combining a large battery bank with the scheme?

I would love to see our best current designs.

Please note:

a) I am a bear of little brain, and will need wiring and automation diagrams, too.

b) I am not interested in debating either the benefit of light-wire power grids or the question of what is or isn't an exploit.

Thanks, as usual, to all: this game and its community have given me great pleasure over the last three years, more than at any time since good ol' Civ3, and I hope it continues long into the future.

Cheers!
GeePaw

For reference, this is my current default battery flipper, which, as is, would be subject to the power-shutoff bug.

 

 

20211209171431_1.jpg

20211209171435_1.jpg

20211209171458_1.jpg

Link to comment
Share on other sites

1 hour ago, Jann5s said:

Isn’t this an exploit?

No, it's engineering.

1 hour ago, GeePaw said:

1) Is the power-shutoff bug still extant?

2) If so, is there a standard automation fix for it?

Yes, and yes. For the longest time the reason for the bug eluded me but I finally found the reason. If the power siwtch is turned on or off for less than than two ticks they can get stuck. That can also happen duiring a reload. So what you need to have is a mechanism that makes sure that power switches stay on or off for at least 2 ticks, ie. 0.2s. And you must have a reload detector, usually done by a wattage sensor that makes sure the power switches are kept in the state they are reloaded in until automation initialization is complete so it doesn't try to switch during this time which usually takes less than a second but depends on how much stuff is in your base. Having accounted for both of these cases the power switches can't get stuck, and thus the tbattery switcher won't stop working. 

Link to comment
Share on other sites

The below design still reproduces the bug after saving. (Sorry, I originally said it was fixed, but it was an error in my test - it's still broken). The bug occurs when a queued logic gate switches on a Power Shutoff 0.1 seconds after reloading. I believe this also proves there is no special condition about switching frequency.
image.png.b48b7236cf10f4d85bb6f2c6d20973

You can get away with this dumb system to fix it.
CUBfgRDNae.gif.fc6d2e9d0f6ad0b200f409f8b

If you want a smart system that can never fail (for more than a second), you'll need to use a wattage detector and dedicated consumer. Example:

Spoiler

qOY7gd8slD.gif.373b17b3b1b92bfb8573c62c9

Link to comment
Share on other sites

Thank you, @Saturnus and @nakomaru, great answers, as usual from you two!

Follow-up questions:

1) I've not seen the ribbon reader used for a single signal before, and had no idea that would work. Are these integral, in the sense that they're providing the needed extra ticks?

2) As I understand it, the dumb system is simply switching via timer, not bothering to wait for a battery signal. This would seem to be the right answer on every consumer-end, regardless of what we use on the producer end. Is that correct? I further assume that timer could be set to just about anything, and controls how long we might be stuck.

3) In the smart solution, I see us XOR'ing on either the timer or the battery, but I don't see how the wattage meter is even connected, so I'm wondering what I'm not understanding here.

4) The rationale for the @Gamers Handbook transformer-flipper is the distributed priority, the fact that we can prioritize the order our generator pools are used in. That would seem to require the smart solution, with the non-signaling battery enabling/disabling the generators. Is there a way to use the dumb solution and still achieve the distributed priority?

Sorry for so many questions, I swear I've done my due diligence, I just keep getting lost in the weeds.

Thanks again, for this and for so many great contributions to the community! -- GeePaw

 

 

Link to comment
Share on other sites

6 hours ago, GeePaw said:

1) I've not seen the ribbon reader used for a single signal before, and had no idea that would work. Are these integral, in the sense that they're providing the needed extra ticks?

If you want to synchronize all four switches, you need to use something like an AND or OR gate, or a Ribbon Reader. These will delay the positive signal by the same amount that the NOT gate does. However, you don't usually need to sync them if you don't feel like it. The main line is able to handle 1 tick of being connected to consumers, and consumers can handle 1 tick of being disconnected, probably.

6 hours ago, GeePaw said:

2) As I understand it, the dumb system is simply switching via timer, not bothering to wait for a battery signal. This would seem to be the right answer on every consumer-end, regardless of what we use on the producer end. Is that correct? I further assume that timer could be set to just about anything, and controls how long we might be stuck.

That's right. If you are only using up to 2kW consumers, you just need to have it switch less than every 10 seconds (20kJ capacity minus discharge). If you need up to 40kW you can use jumbos swapping every second.

6 hours ago, GeePaw said:

3) In the smart solution, I see us XOR'ing on either the timer or the battery, but I don't see how the wattage meter is even connected, so I'm wondering what I'm not understanding here.

Sorry, the wattage sensor is (was?) too fat to show the wires. Here's how it is connected.
image.thumb.png.0dcdfc4b7446881b6d81781cfd6eaee9.png
The wattage sensor holds a green signal while there is no power outage, which hard-wire ORs with the timer, effectively disabling it. When the wattage goes to zero, the timer is allowed to send its panic signal to the NOT→XOR which forces shutoff cycles until the wattage is sensed again.

6 hours ago, GeePaw said:

the fact that we can prioritize the order our generator pools are used in. That would seem to require the smart solution, with the non-signaling battery enabling/disabling the generators. Is there a way to use the dumb solution and still achieve the distributed priority?

I'm not interested in that particular design so I can't help much there. However, if you want alternative ways to prioritize generators, here are some hints.

Spoiler
  1. Generators always drain before transformers.
  2. Transformers always drain before batteries.
  3. Generators drain in the order they are built.
  4. Transformers drain in the order they are built.

Simple way: basically one solution is to have your high priority (solar) array have a bunch of 4kW transformers that output to the main line. They should be able to charge any switching battery in 1 frame, so if you charge your batteries at 16kJ, you will need 5 Transformers (800J per tick each = 4000J). With this design your solar array will charge any individual switch before any other generator station, assuming you build those transformers after (just deconstruct/reconstruct). Only when the solar array can't keep up, the lower priority stations will donate power. You can have as many stages as you want.

Complex way. Have your high priority generators (solar/turbines) directly connected to the main line, then have a switching battery bank somewhere else. Have your low priority generators using transformers towards the main line. You can scale this design down, since you probably don't need 50kW capacity. https://forums.kleientertainment.com/forums/topic/123870-switching-battery-issues/page/3/?tab=comments#comment-1413368

Extra: if you want to read some discussion about whether a dedicated consumer is needed in smart solutions (I still believe it is needed if you want to avoid all cases of the bug), see here.

Link to comment
Share on other sites

I made this two battery switching that I'm using to power stuff on a regular wire:

battery-flip-flop.png

Haven't noticed any issues with this, and to be honest don't know how to test if it blocks or not. Would appreciate if someone could either tell me how to test it or tell me the results directly. :)

Edit: And here's a smaller version that takes less space:

battery-flop.png

Link to comment
Share on other sites

I am also very curious about the answers re: solar panels.

That said, I have a 2000+ cycle save that I've been using a battery flipper backbone in, so I have a whole library of different flipper designs for different situations. That 4x3 version above is pretty nice. I'm not sure why they've hooked up both batteries and integrated an AND gate, though.

Link to comment
Share on other sites

14 hours ago, cezarica said:

to be honest don't know how to test if it blocks or not. Would appreciate if someone could either tell me how to test it or tell me the results directly

This is kind of funny - on the one hand, of course it fails. But in 33% of failures, only the top right fails (pictured below), and it will end up recovering after a short brownout. This is because it's out of sync, so it won't ever fail at the same time as the bottom left. And since this is the charging side, it will cycle one more time once the consumer end runs out.

6LrtGyemoV.thumb.png.a57705d260924d5ba2f4500bf9e11de7.png
(inactive, yet enabled - if you want to easily reproduce it, put a pausing Notifier as shown, and reload on pause)

Unfortunately, in 33% of cases the top left and bottom right will fail, and you will be stuck forever. In the remaining 33% of failures, only the bottom left will fail, and you will be stuck for a very long time (until natural discharge puts the battery below the limit again).

Link to comment
Share on other sites

14 hours ago, thegroundbelow said:

I am also very curious about the answers re: solar panels.

That said, I have a 2000+ cycle save that I've been using a battery flipper backbone in, so I have a whole library of different flipper designs for different situations. That 4x3 version above is pretty nice. I'm not sure why they've hooked up both batteries and integrated an AND gate, though.

The role of the AND gate is that only only one battery at a time is being charged and only one at a time is being actively drained. The battery that has the regular wires on it's side (be it left, right or top) is the backup one and the other is the active one, hence the conductive wires.

@nakomaru I've used this setup for quite some time and never noticed any of the shutoffs in a wrong position and no burnouts.To be fair I use this for metal refinery and that drains the batteries rally fast and they cycle quite frequently, hence why I guess i didn't notice the blocking. Either way, thanks for testing. Will add the notification thingy and test on my own. Thanks. :)

Link to comment
Share on other sites

16 hours ago, cezarica said:

The role of the AND gate is that only only one battery at a time is being charged and only one at a time is being actively drained. The battery that has the regular wires on it's side (be it left, right or top) is the backup one and the other is the active one, hence the conductive wires.

I mean, I get that, I just don't know that it's necessary. You only need to know the status of one of the batteries to know when to "flip."

For reference, here's one of the flipper designs I use pretty regularly: rO1Ca9h.png

The buffer gates may not strictly be necessary, they're just there so all power shutoffs get their signals on the same tick (as each signal goes through the same number of gates)

Here's how I'd do your flipper:

WiznZ3n.png

 

Link to comment
Share on other sites

Can someone explain to me how this would work? I guess you have up to 2k load on one side of each of these and a backbone on the other. And as I understand, the backbone uses a 2k wire too, how does this not burn out? What’s the benefit compared to a transformer battery setup?

Link to comment
Share on other sites

47 minutes ago, Jann5s said:

Can someone explain to me how this would work? I guess you have up to 2k load on one side of each of these and a backbone on the other. And as I understand, the backbone uses a 2k wire too, how does this not burn out? What’s the benefit compared to a transformer battery setup?

You got it right, except the backbone has no limit. This is because batteries do not count as consumers for load calculations. So you can transmit any wattage over 1kW wire for your whole base.

Link to comment
Share on other sites

23 hours ago, nakomaru said:

You got it right, except the backbone has no limit. This is because batteries do not count as consumers for load calculations. So you can transmit any wattage over 1kW wire for your whole base.

Interesting, today I learned something 

Link to comment
Share on other sites

I haven't tried actually building one yet but I have a theory for a good solar battery with the switching network.  Connect all solar directly to the backbone wire and somewhere else have a half a dozen jumbo batteries or so with a shutoff to tie them to the backbone to charge, and a pair of transformers to discharge them to the backbone.  Have a transformer flipper just like you do with other generators only use its control signal to flip the battery bank between charge and discharge mode.  Set that flipper to the highest charge level so that it will only put the battery bank in charge mode when all other generators have already been turned off, and otherwise keep the bank in discharge mode.

 

Link to comment
Share on other sites

On 12/9/2021 at 4:16 PM, GeePaw said:

3) For transformer-flipping with a source like solar, which is all-or-nothing, what's the best practice for combining a large battery bank with the scheme?

I've done something adjacent to what you're asking. When operating a large bunker door installation I create two separate banks of jumbos that store excess power for opening and closing. The bank is fed off the main line with transformers and discharged through a second set of transformers. Switches control which transformers are active.

Where I used a signal from the space scanner to know when the doors were operating you could just use a simple cycle sensor to discharge at night.

Link to comment
Share on other sites

On 12/9/2021 at 3:56 PM, nakomaru said:

The below design still reproduces the bug after saving. (Sorry, I originally said it was fixed, but it was an error in my test - it's still broken). The bug occurs when a queued logic gate switches on a Power Shutoff 0.1 seconds after reloading. I believe this also proves there is no special condition about switching frequency.

Will the design below fail when a queued logic gate switches on a Power Shutoff 0.1 seconds after reloading?

By adding the timer sensor, instead of the smart battery port, is the only known preventive fix? 

Since only one automation port is being used. It doesn't look it will fail on the condition above.

On 12/11/2021 at 10:04 PM, tuxii said:

Here is my best version.

batt.png

 

Link to comment
Share on other sites

5 hours ago, Eduardo12 said:

Will the design below fail when a queued logic gate switches on a Power Shutoff 0.1 seconds after reloading?

Yes, this is the most basic switching design possible. Let's walk through it.

  • Left is main line, right is consumer.
  • Consider the case where the left battery is discharging.
    image.thumb.png.366d4d9306fdc03049ff9922adbb153a.png
  • We save/reload just before the battery sends a positive signal. You can do this very easily by:
    • Use 100/0 thresholds
    • Pause at <50% charge
    • Set the lower threshold to >50%
    • Save and reload
  • When you reload, the game is paused in this state
    image.thumb.png.3530f740c487ad158d12f2653e83435c.png
  • When you unpause, the game will be in a continuous state like this:
     image.thumb.png.23cb800f8bdb84d6b95b2842454b0ff9.png

The reverse case should also bug, I leave it to you to test.

5 hours ago, Eduardo12 said:

By adding the timer sensor, instead of the smart battery port, is the only known preventive fix?

I also showed this solution, which uses the smart battery most of the time, and uses a dedicated consumer to detect a blackout. But it does use a timer to trigger the panic signal in the end. There are alternative solutions that will reduce but not outright prevent the bug, as far as I understand.
qOY7gd8slD.gif.373b17b3b1b92bfb8573c62c9

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...