Backup power toggle help

Post all other topics which do not belong to any other category.
RexTheCapt
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sun Jul 10, 2016 3:57 pm
Contact:

Backup power toggle help

Post by RexTheCapt »

I am trying to get an backup power to be toggled when the main power is not enough. I am using an accumulator to check the power level and want it to turn on at 25 and stop at 80. I am trying to toggle an power switch to let power thru to the system and close when the accumulator is full enough.
BlakeMW
Filter Inserter
Filter Inserter
Posts: 952
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: Backup power toggle help

Post by BlakeMW »

A simple way (that requires no electricity!) is belt logic

You have a loop of 4 belts and a token on the belt (say, a pistol) then set up each of the 4 belts as follows:

1: Enabled: A < 25
2: Read Contents (Hold) -> if this outputs pistol = 1, then flick the switch!
3: Enabled: A > 80
4: just loops back to 1
Selvek
Fast Inserter
Fast Inserter
Posts: 238
Joined: Fri May 06, 2016 4:04 am
Contact:

Re: Backup power toggle help

Post by Selvek »

You can also do it with only circuit network using an SR latch. Check out:

https://wiki.factorio.com/Tutorial:Circ ... f_SR_latch
User avatar
Laogeodritt
Inserter
Inserter
Posts: 26
Joined: Wed Jun 14, 2017 6:35 pm
Contact:

Re: Backup power toggle help

Post by Laogeodritt »

Terminology: what you're looking for is a system with "hysteresis". Basically, below 25% it turns on, above 80% it turns off—that means that between 25% and 80% it just keeps whatever state (on/off) it had before. Classic hysteresis scenario.

You'd want to use an SR latch, as Selvek said, along with decider combinators for the turn-on and turn-off condition detection (that turns the latch on/off). This is because the system has "memory" (the hysteresis range, between 25% and 80%, needs memory since it's not purely based on accumulator condition now but also its history), so you need a memory cell (= the latch in this case) to remember the current state when you're in that hysteresis range.

Belt/item/chest-based systems are equivalent, just a different implementation.
User avatar
OdinYggd
Fast Inserter
Fast Inserter
Posts: 200
Joined: Wed May 25, 2016 12:55 pm
Contact:

Re: Backup power toggle help

Post by OdinYggd »

I've done both the combinator based hysteresis, and the belt based.

The belt based hysteresis performs better for one simple reason:

Combinators behave erratically during a brownout. Their output stays enabled in the last-known state, and they will not update their state until they are fully powered.

This leads to problems in creating brownout protection apparatus because the combinators intended to shed load or connect additional power sources will malfunction and fail to operate when called upon.

Whereas the belt-based hysteresis will always work with or without external power.
In my mind, Steam is the eternal king of the railway.
User avatar
Laogeodritt
Inserter
Inserter
Posts: 26
Joined: Wed Jun 14, 2017 6:35 pm
Contact:

Re: Backup power toggle help

Post by Laogeodritt »

OdinYggd wrote:Combinators behave erratically during a brownout. Their output stays enabled in the last-known state, and they will not update their state until they are fully powered.

This leads to problems in creating brownout protection apparatus because the combinators intended to shed load or connect additional power sources will malfunction and fail to operate when called upon.
This is a good point.

My solutions to for combinators, though, is to create a separate power domain consisting only of one accumulator and one solar panel for the control system, and keep its power connectors separate from the actual grid so that it's only ever powering the control system. Combinators are pretty low-power, a single solar panel is good enough for small quantities—I don't remember the limit offhand. It's a bit more complex, but might be good when you need fast (couple of ticks) or more advanced control systems (i.e. not just a backup power hysteresis controller).

(If the logic system is too close, you can shift-click power poles to disconnect their copper wires, and then run copper wire manually to create domain separation.)
User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Backup power toggle help

Post by impetus maximus »

if you have enough accumulators to power you factory for a short while a SR latch works well.
here is a good instructional video for SR latches that Shredguy explains how and why it works.
https://www.youtube.com/watch?v=vEOXGBYR6oM
you can use it on a switch instead of the pumps as he did.
also the wires can be all the same color.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Backup power toggle help

Post by Qon »

A similar topic: viewtopic.php?f=208&t=29302
Using a fixed 25% and 80% limit has some drawbacks. My thread introduces a dynamic system that makes sure that the accumulator reserves don't fall below "expected" values. It makes sure accumulators are full at dusk and allows the accumulators to drain to 0% only at dawn when solar panels can completely satisfy the needs of you base again.

It could easily be modified to instead/also turn on backup power on a less aggressive limit to make sure that your base keeps producing on backup power if possible and only shutting down your base if necessary.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
d4rkpl4y3r
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Wed Apr 27, 2016 8:24 pm
Contact:

Re: Backup power toggle help

Post by d4rkpl4y3r »

Qon wrote:A similar topic: viewtopic.php?f=208&t=29302
Using a fixed 25% and 80% limit has some drawbacks. My thread introduces a dynamic system that makes sure that the accumulator reserves don't fall below "expected" values. It makes sure accumulators are full at dusk and allows the accumulators to drain to 0% only at dawn when solar panels can completely satisfy the needs of you base again.

It could easily be modified to instead/also turn on backup power on a less aggressive limit to make sure that your base keeps producing on backup power if possible and only shutting down your base if necessary.
I did independently develop a similar system which compares main grid accumulator values to optimal accumulator values. The optimal value is obtained by a simple grid with 25 solar panels, 21 accus, 3 radars, 6 idle laser turrets and 6 arithmetic combinators. My reddit post about that: https://www.reddit.com/r/factorio/comme ... kup_power/
milo christiansen
Fast Inserter
Fast Inserter
Posts: 106
Joined: Thu Jul 30, 2015 7:11 pm
Contact:

Re: Backup power toggle help

Post by milo christiansen »

My factory has 1 accumulator. If it reaches 90% charge the entire factory (except the defenses) turns off and an alarm sounds. This worked really well back when everything was boiler powered, as sometimes I would run low on coal if I wasn't paying attention.

Basically my system is the same as described here (hysteresis and power switch), except I had some extra logic to require manual intervention to reset the circuit.
BlakeMW
Filter Inserter
Filter Inserter
Posts: 952
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: Backup power toggle help

Post by BlakeMW »

milo christiansen wrote: This worked really well back when everything was boiler powered, as sometimes I would run low on coal if I wasn't paying attention.
Another good way to manage running low on coal is to wire the final belt feeding the boilers (configured to read contents: hold) to a speaker tower, then if there is no coal on final belt piece raise an alarm. This is nice because it's a preemptive warning but it also won't be a false alarm - there is only two reasons that the coal buffer will run out, either there aren't enough functioning mining drills to provide enough coal, in which case some new ones need to be built, or the power is low which is lowering the output of the miner drills - this results in a severe feedback loop where as each boiler runs out of the fuel the coal miners produce even less coal.
Post Reply

Return to “General discussion”