Page 1 of 1
Backup power toggle help
Posted: Mon Jun 26, 2017 4:15 pm
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.
Re: Backup power toggle help
Posted: Mon Jun 26, 2017 6:25 pm
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
Re: Backup power toggle help
Posted: Mon Jun 26, 2017 6:57 pm
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
Re: Backup power toggle help
Posted: Tue Jun 27, 2017 1:00 am
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.
Re: Backup power toggle help
Posted: Tue Jun 27, 2017 2:08 am
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.
Re: Backup power toggle help
Posted: Tue Jun 27, 2017 3:16 am
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.)
Re: Backup power toggle help
Posted: Tue Jun 27, 2017 4:38 am
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.
Re: Backup power toggle help
Posted: Wed Jun 28, 2017 7:52 pm
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.
Re: Backup power toggle help
Posted: Wed Jun 28, 2017 10:11 pm
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/
Re: Backup power toggle help
Posted: Fri Jun 30, 2017 1:36 am
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.
Re: Backup power toggle help
Posted: Fri Jun 30, 2017 9:30 am
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.