Jump to content

A workaround for the power shutoff bug that plagues switching battery setups


Recommended Posts

I know some people use a clock to reset the circuit once a cycle, and while that's fine, this has the drawback of forcing the shutoffs into a certain configuration for 2 seconds. This might cause a power interruption if the cycling occurs at the wrong time; not to mention the fact that if you're feeding a highly loaded circuit from the battery pair, this power interruption is certain to occur; with > 10kW load, your batteries cycle faster than 2 seconds.

So I came up with this. It's not terrible, but also not without its own drawbacks. 

image.png.443674d3bbb892fdf9291e6da31b13ee.pngimage.png.5c0eb66fa38150d07d1d6b257c32334c.pngimage.png.918c00d0306f318adad1bdcc453a1cab.png

The storage bin is set to store 1kg of something - make sure this is high priority so it doesn't get removed for a project. When the bug hits, it may interrupt a discharge-side shutoff, in which case the bin loses power, starts outputting a red signal, which through the NOT and XOR gates, will force the shutoffs to cycle. If the bug hits a charge-side shutoff, the batteries will eventually drain and the bin will lose power, etc.

Okay, so drawbacks:

- It's 6 wide instead of 4. 1 of this is automation-only so you can put a statue or whatever next to it. :)

- It has a constant draw of 60 watts, which, if you're using many of these, adds up quickly. I've rationalized this as the price to pay for a power backbone that's easy to route and has infinite capacity.

- You can't get at the combined logic outputs of both batteries that you may use as an indicator to, say, control generators. But you're better off doing that with dedicated batteries anyway.

- If you DO lose power for whatever reason other than the bug, and your batteries drain, the bin will force the wrong state on the system. This requires a manual reset after power is restored. I've included a hydro sensor for this above - just cycle it once and you're done. You can also do this by setting the left battery sliders to 0/0 (or 100/100, depending on which state the system is stuck in), and then resetting them to your original config, presumably 100/10. If you're willing to do this the hydro sensor is unnecessary. 

If you're wondering about the seemingly useless OR gate, it's just to force even timing on the shutoffs. 

 

 

Link to comment
Share on other sites

The one I've been using only gets stuck when you first build it and I haven't noticed it get stuck ever since, Maybe that is because my power generation is pretty evenly split between all generators and consumers and I hardly run out of power, but it could be anyone's guess. I use 90/60 on my batteries.

Spoiler

 

 

Link to comment
Share on other sites

1 hour ago, BLACKBERREST3 said:

The one I've been using only gets stuck when you first build it

You're just lucky. The bug has to do with shutoffs and their automation, and not the battery switching setup itself. It's just a very likely place for it to pop up. If the game is saved while a shutoff is being enabled by automation (that is, the automation signal is green but the shutoff hadn't responded to it yet), and then that saved game is loaded, the shutoff will never complete the transition and will show "inactive, enabled by automation" until it's set to off and then on again.

Link to comment
Share on other sites

 

15 minutes ago, BLACKBERREST3 said:

I'm about to change your world

Would you mind explaining your thinking a bit? I mean I think this won't work but I'd rather look a bit dim by asking for clarification, instead of looking downright stupid by telling you why it doesn't work if it in fact does. I get the OR gate going to the mech doors and I think that part is brilliant AF, but I don't get how this is a switching battery pair?

Link to comment
Share on other sites

Ah, no problem man. 2 things

1. that's an AND gate

2. that's not the original design, this is what it's supposed to work with

Spoiler

jhhbjfh.png.570620ac835949ec626b6f038aae3362.pngjhhjmhf.png.d65d9c3516d53586b7c74227803302bf.png

 

the problem was that the system wouldn't reset when both sides of the switch became active (green), so the and gate is to make sure the doors reset the batteries making them have a red automation signal. The bottom pic does have an or gate, but that  is for a different purpose.

Link to comment
Share on other sites

6 minutes ago, BLACKBERREST3 said:

the and gate is to make sure the doors reset

AND gate duh. That's what I meant. :) But you'd still need to include the NOT gate in your design for these to be switching batteries, and if you do, the AND inputs are never going to be green at the same time*. The bug doesn't change automation signals, it just breaks a shutoff that's in the process of activating. It's not possible to tell this state with automation, other than observing the power flowing through it - it doesn't, when it should.

*To be pedantic, your initial design has a timing problem in that it takes 1 tick to process the NOT gate so the directly-wired shutoffs would be in the same state as the ones wired through NOT, for this one tick. This could be a circuit overload on your feed, or no power on your output, depending on how the power lines are wired.

 

Link to comment
Share on other sites

 

40 minutes ago, biopon said:

But you'd still need to include the NOT gate in your design for these to be switching batteries, and if you do, the AND inputs are never going to be green at the same time

Not sure what you mean by this, Maybe some pics will help, but the problem I have with switching is that sometimes the shutoffs will be active at the same time which makes me manually set them to 0/0 or 100/100 to reset them. This is only happens when I first build them however.

40 minutes ago, biopon said:

To be pedantic, your initial design has a timing problem in that it takes 1 tick to process the NOT gate so the directly-wired shutoffs would be in the same state as the ones wired through NOT, for this one tick. This could be a circuit overload on your feed, or no power on your output, depending on how the power lines are wired.

I'll have to test this, I match my generators to their respective transformers so my feed never really gets overloaded. I'll have to test this without transformers and see if I can catch the 1-tick in action.

 

40 minutes ago, biopon said:

The bug doesn't change automation signals, it just breaks a shutoff that's in the process of activating

Ah, maybe I haven't experienced this bug yet. So for clarification, the shutoff has a chance to break either when it is toggled on or off and automation is not affected at all by this. If only we had a volt meter in oni, the smart storage works too.

I had to read your post a second time through, I thought we were having the same bug, but this is slightly different. my solution works for occasionally getting stuck on a slow traffic battery while yours works on higher traffic.

4 hours ago, biopon said:

If you DO lose power for whatever reason other than the bug, and your batteries drain, the bin will force the wrong state on the system. This requires a manual reset after power is restored.

That's a really nice feature to have, like a breaker switch so it doesn't constantly try to drain your system so you can recover

Another question, how are you getting >10kw load out of your system without overloading?

Spoiler

gfsgffsg.png.0d8e0f7b277cbc453560a51e590418e7.png

 

you're probably doing something like this I presume, the wires threw me off for a sec.

Spoiler

kjgfdkjdsfns.thumb.png.cc27018ef972b344105a510aeb0f8cfb.png

 

Link to comment
Share on other sites

6 minutes ago, BLACKBERREST3 said:

Not sure what you mean by this, Maybe some pics will help, but the problem I have with switching is that sometimes the shutoffs will be active at the same time which makes me manually set them to 0/0 or 100/100 to reset them. This is only happens when I first build them however.

Maybe we're using these for a different reason - but I wire mine so that 2 shutoffs control the charging leads (and are always in a state opposite to each other), and 2 shutoffs control the discharging leads (and are always in an opposite state to each other). This way I can charge the batteries with a regular strand of wire, instead of heavy; since charging batteries do not constitute load for overload calculation purposes, I can have as much power coming from the generators on this wire as I can produce.

When you build the underlying automation wire first, and then the shutoff, it will also get stuck until cycled. This may or may not be the same bug as the one affecting game load. Build them the other way around and you should be fine. I just cycle them instead, I don't like babysitting builds if I can avoid. :)

 

13 minutes ago, BLACKBERREST3 said:

see if I can catch the 1-tick in action

The 1-tick processing of automation gates is a fact in ONI that's a curse (in this case we need an OR gate to match the NOT gate's speed) and a blessing (some automation tricks like edge detectors are super easy to build). Overload isn't an issue for 1 tick, I'm pretty sure the game gives you some leeway with how long a wire is overloaded for, before giving you trouble - losing power for just 1 automation tick (which is separate from the game as a whole) may not be a problem either. But it feels better to build the battery the right way. :)

 

18 minutes ago, BLACKBERREST3 said:

So for clarification, the shutoff has a chance to break either when it is toggled on or off and automation is not affected at all by this.

Yes. From what I've seen it only gets stuck in the activating, and not the deactivating phase. The latter would be an issue as well, since it'd bridge the copper wire & conductive wire sides, and surely cause an overload, and I've never seen that happen. And given how frequently the bug comes up, it might have a 100% chance of occurring.

 

Link to comment
Share on other sites

I'm really trying to replicate the bug, but I just can't seem to do it, they don't want to get stuck even at 50/50.

Spoiler

 

I did some more testing after the vid, it takes 18 Batteries to buffer a 50kw load on 50/50 or around 2.78kw/Bat. take away any more and the system will slowly drain because the not gate and shutoffs cannot keep up. I'm going to do another test to see how much draw I can put on just two batteries, stand by.

2 hours ago, biopon said:

some automation tricks like edge detectors are super easy to build

I'm going to have do my homework on edge detectors cause that sounds interesting.

Quick question for you, what is the max load that you are able to get out of two batteries with your setup?

test 50kw.sav

Link to comment
Share on other sites

I really recommend synchronizing your switches as biopon has described. Your design has an open circuit to the main line when switching.

If you want to reproduce the bug just make a rapid on/off oscillator and attach it to a power switch then save and reload a few times.

Link to comment
Share on other sites

1 hour ago, BLACKBERREST3 said:

max load that you are able to get out of two batteries

I've tested 36 tepidizers, so almost 33kW. This was with 100/50, I did not play with this more because it seemed like enough. :)

 

1 hour ago, BLACKBERREST3 said:

edge detectors

For starters, this gives you a blip at the AND's output when the incoming signal goes red. You can then buffer that, or whatever. The only reason this works is because the NOT gate adds a 1-tick delay to the AND's top input.

image.png.64ccbe982b778e701f2aa9efa8ce7a54.png

Link to comment
Share on other sites

I did another test and got some interesting results. The left battery cycles from near 0 to 20kw while the right is at a near constant 20kw. I guess it is beneficial to make more battery switches rather than more battery buffers. It also seems like it's reliant on how much power you input into the system to begin with. Looks like you beat me by 3kw.

Spoiler

kjhdskjfdjhgkj.thumb.png.ce0c2cf5d530362460aee226e43e5a7e.png

I finally got the bug. I get it now :beaten:

Spoiler

yes.thumb.png.88f6b9847dd6285b5701227875f3623d.pngThis.thumb.png.2f4f793cf67c6b49bdc518c7bb38f7b8.pnghappened.thumb.png.dfc2fa3b90b87283652d1d403567691e.png

 

3 hours ago, nakomaru said:

I really recommend synchronizing your switches as biopon has described. Your design has an open circuit to the main line when switching.

Ah, didn't really notice it at first. I get what you guys mean by 1 tick now. You're right it could overload the system, but I don't remember if there was ever a time where it had. If it did occur, it might have been every hundred cycles or so.

Would another way to get around the shutoff bug be to just spread out your switches so you don't have too much traffic going through one?

Also, this might work as well. The shutoff consumes 0 energy even though it says 10. You could probably turn this into a breaker with a memory toggle.

Spoiler

5d8b106b85d6b_switchresetautomation.thumb.png.772cedee89cc0b84e310e751b7014a0a.png

 

I should probably describe how it works. liquid valve set to some number, 1000kg maybe. When power shuts off to the shutoff valve, no liquid can pass through. the packets then back up; turning on the and gate for a short time to open the doors and reset the system.

Edge Detectors are cool

Spoiler

5d8b13054daf0_edgedetector.thumb.png.4819ee24a79d1012847b80106e66785b.png

Has anyone made anything with these yet?  Should have read the quantum clock post more thoroughly.

Link to comment
Share on other sites

And your build has the advantage of being instantaneous which is important for sensitive or high traffic battery switching. I also figured out the bug can occur at any point in time thanks to a power shutoff psa video. Even low traffic switching is not safe, but it is less likely to occur. That's why I've never noticed it before. Welp...I learned a lot today.

Link to comment
Share on other sites

4 hours ago, biopon said:

I've tested 36 tepidizers, so almost 33kW. This was with 100/50, I did not play with this more because it seemed like enough. :)

 

For starters, this gives you a blip at the AND's output when the incoming signal goes red. You can then buffer that, or whatever. The only reason this works is because the NOT gate adds a 1-tick delay to the AND's top input.

image.png.64ccbe982b778e701f2aa9efa8ce7a54.png

I think you meant to wire the bottom input to the NOT's input, not its output? 

Link to comment
Share on other sites

I had a gut feeling so I ran with it. Is there any reason this wouldn't work.

Spoiler

5d8b9275cb490_UnstickBatterySwitcher.thumb.png.611be610069068e34727e3e0ef99138b.pngtemp3.thumb.png.e308e3124d8409dedfa3bd6b382153b1.png5d8b90715be60_UnstickBatterySwitcher.thumb.png.34a7c96cb6260624291b4f062eff7da8.png

So, there are two options here.

Option 1 Left Side: on the left is for when the right battery crosses a certain low threshold, so if it goes past this, it cycles the system.

Option 2 Right Side: Very similar, only difference is that you can set the low threshold to 99 on the far right battery as you never want your battery switcher to run out of power. The middle battery will drain first then activate the low threshold and then reset the system.

Also, is there any point to having an overlapping port notification, this is really annoying when using the blueprints mod and it doesn't seem to change the function of the automation. I might need a mod to get rid of that.

Link to comment
Share on other sites

2 hours ago, BLACKBERREST3 said:

So, there are two options here.

Smart, even though you're overdoing it with 3 batteries and a transformer. :)

Sadly, no cigar. Yes, it'd be ideal to use the batteries themselves as indicators, but what if a discharge-side shutoff gets borked? The batteries will be charged and happy for a very long time (until the control battery naturally drains and cycles the system). You can't tell why nobody's drawing any power - in fact you don't even know they don't. 

If you REALLY wanted to avoid the 60w cost of the bin, a clock sensor might be the way to go. You will be forced in one state for 2 seconds every day, but if you set the batteries to 100/50, you get a 10kJ buffer. This is is 5kW over 2 seconds; more than you could draw with conductive lines.

 

Link to comment
Share on other sites

On 9/25/2019 at 3:17 PM, biopon said:

but what if a discharge-side shutoff gets borked?

I see what you're talking about, I hadn't thought about that. so it can get stuck on both red and green signals. I think the low threshold of a battery could still work, but it needs to be on the consuming end separated by the transformer to work if that were the case. I modified it by switching the XOR and AND gate around. Now it will send a pulse whenever the right battery crosses the low threshold regardless of what state the shutoffs are in and should not get stuck. I use a similar setup for my power grid already, so all I have to do is a add a battery and some more automation to transition from my old build.

Spoiler

image.thumb.png.fcc4f12229c102b4e20aab8d5c1fea8a.png

thanks for sticking with me through this, I'm not an expert in logic by any means so most of my attempts are trial and error. let me know if this can fail a save/load. It's not efficient because it uses an extra battery, but I couldn't find anything else with little to no power loss that is as speedy as the smart storage as a detection besides using another battery. The advantage of having an extra battery is so you do not lose power if the charging side gets "borked" while also providing a slight buffer while the system recovers. The downside is that it wastes 400J/cycle, but that isn't that much considering a 10w light full time is 6000J/cycle. As long as you have a decent over production in power then the system will recover. If not, then it may take too long and the right battery will drain causing power loss before a switch can take place to charge the consuming end again (or just add more batteries on the consuming end).

Just to compile a list of what can detect and/or reset a system in case of the shutoff bug. I couldn't find a way to solely use automation from the 2 batteries to restart the system.

Spoiler
  • Clock sensor - set in the morning when auto saves come around and avoid manually saving.
  • Water/Gas Shutoff connected to the consuming end of the circuit with a liquid valve and liquid element sensor combo.
  • Smart storage when they have power loss outputs a red signal
  • Doors - doors open under batteries which causes them to output a red signal
  • Reservoir-Door-Liquid Element Sensor combo
  • Smart Batteries
  • Any system or chain of events that occur as a result of power loss/difference that can be detected and translated to an automation signal

Also, does anyone know the math behind what I should set my battery ranges to, I'm always guessing. sometimes 60/90, sometimes it's 50/50, 20/80, or 40/60. This seems like it depends on how much draw you have. I always opt for high numbers so the batteries can charge to that when idle. I never want it to go to zero, but what is the downside for a 100 high threshold.

Link to comment
Share on other sites

3 hours ago, BLACKBERREST3 said:

so it can get stuck on both red and green signals

As far as I know the bug only hits on a shutoff activating on green, I haven't seen it on red yet. What I mean is... you have 4 shutoffs. 2 control access to the generator side, 2 control access to the consumers. Any one of these 4 can fail. If one from the first group fails, your battery depletes, never gets charged, and you lose power on the consumer side. If a consumer-facing shutoff fails, the consumers lose power, but the battery stays charged. This will fix itself with time I think, as the battery passively depletes, does a switch, and power is restored on the consumer side, but it takes a long time.

3 hours ago, BLACKBERREST3 said:

let me know if this can fail

I'm pretty sure it can, for the aforementioned reason. I don't see your electric wiring so I'm not sure exactly what's going on with the transformer and 3rd battery, but I think you're trying to provide power in case a charge shutoff fails? It won't help, as per above.

 

3 hours ago, BLACKBERREST3 said:

Also, does anyone know the math behind what I should set my battery ranges to, I'm always guessing. sometimes 60/90, sometimes it's 50/50, 20/80, or 40/60. This seems like it depends on how much draw you have. 

I think it depends on how much power you're generating. My batteries charge in a blink so I feel OK with 100/10 usually. I am not sure why you'd use anything other than 100 for the first number though. Wouldn't you always want the battery fully charged after it comes online from a switch?

Link to comment
Share on other sites

13 hours ago, biopon said:

Wouldn't you always want the battery fully charged after it comes online from a switch?

Yes, in most cases you would, but sometimes I have to match exactly how much power I generate with how much I consume in early game where I have to set up food first and then worry about power later (I always go for carnivore). In that case, then something like 10/100, 50/100, or 90/100 does not work for me, but 60/40 or 50/50 does and I do not know why. It probably has to do with drain/charge rate and the fact that my generators shutoff when I'm not using them. The time it take for my generators to start up again is probably the culprit, I will add a buffer gate and see if that fixes it. It doesn't help that only the left battery controls the switching and not both of them, but that is how I have set mine up to work.

 

13 hours ago, biopon said:

I don't see your electric wiring so I'm not sure exactly what's going on with the transformer and 3rd battery

The third battery on the right is on the consuming end. I set that to 99/100. The left battery controls the switching and the middle battery is not involved. The first power bridge on the left is your power input and the second bridge on the right is your power output.

Spoiler

image.thumb.png.99e4a36c0b771b48bdfb94dd33947136.png

image.thumb.png.013c4c80969b900152bca852b51e5314.png

image.thumb.png.83d678069dd05e0b3e50f9ea2e9f85b6.png

 

 

13 hours ago, biopon said:

Any one of these 4 can fail. If one from the first group fails, your battery depletes, never gets charged, and you lose power on the consumer side. If a consumer-facing shutoff fails, the consumers lose power, but the battery stays charged. This will fix itself with time I think, as the battery passively depletes, does a switch, and power is restored on the consumer side, but it takes a long time.

Whether the batteries are fully charged or not, if that third battery changes from 100 to 99 at any time, it will cycle all of the shutoffs. for example, if the first group is stuck which should end up looking like (green-red-red-green), the second battery will drain first and then the third battery will start to drain after that. Like I said before if the third battery changes state, it will send a 1-tick green pulse with the edge detector. to flip the shutoffs. If the second group gets stuck (red-green-green-red) then only the third battery will start to drain in which case it will then reset the system as I have stated above. This works because of the XOR gate I am using. Whether the battery on the left is outputting a green or a red signal, the battery on the right will trigger the shutoffs. This should not get stuck in any state as long as the third battery is fully charged.

 

On 9/25/2019 at 2:40 AM, biopon said:

I've tested 36 tepidizers, so almost 33kW.

How much power were you generating for you to achieve this? I got 29kw max load drom 50kw of power with my test.

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...