First time using circuit network: making a "master" power switch

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
dougabugg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon May 04, 2020 1:30 pm
Contact:

First time using circuit network: making a "master" power switch

Post by dougabugg »

I haven't used the circuit network that much, just copying some stuff from the wiki for petroleum/oil management when needed. I have a factory with multiple power generation sources spread out over the map. One of my "game play techniques" is to sometimes turn off my entire factory to reduce pollution so that biters won't be constantly invading, giving me time to upgrade sections, repair defenses, etc.

My goal is to easily have a way to "toggle" the electricity supply to my factory. At first, I just placed and removed an electric pole, then I started using a single "power switch", but now I have multiple power generation sources separated by a large distance, so I wanted a way to be able to remotely "toggle" all of them at the same time. I have some radars running off of solar/accumulators, and that allows me to select a distant power switch and toggle it on and off. I ran a green wire between my power sources, and set all the power switches to enable/disable if they receive a "check signal". Using a constant combinator, I have all my power sources and switches synchronized.

But I ran into difficulty remotely controlling the "check signal". You can select a distant power switch and toggle it from the map if there's a radar near by, but you can't select a distant constant combinator to toggle it's output. To create a method of toggling the check signal remotely, I ended up creating a "master" power switch, which when enabled, causes an inserter to remove a single item from a chest and onto a belt, and a second inserter continuously moves the item back to the beginning of the belt. When the master power switch is disabled, the interters are no longer powered, and the item is allowed to continue along a belt to another (always powered) inserter that puts the item back in the chest. Then a decider combinator outputs the check signal only if the chest is empty.

This solution works for my needs, but it doesn't feel very... elegant. Is this a good design for implementing a "master" power switch? Is there a better way to implement this?

Thanks!
mmmPI
Smart Inserter
Smart Inserter
Posts: 3812
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by mmmPI »

I think i understood the problem you are facing.

I'm not quite sure i understand the system you describe.

From what i understand you used a power switch and some belt/inserter logic to generate a signal "check" that allows you to toggle ON/OFF certain part of your factory to allow for pollution to be absorbed and defense to get some rest.

I think it's a fun solution :)

I'm not sure it's a "better" way but you can also use train as switch. If you use 2 loco facing opposite direction on a double headed piece of track with a station ON and OFF on each end. Then you can set the train stop to "read train" and output a signal check.( with as number the train ID but it has no consequence). It allow to generate a signal check from something remotely controlable.

You can refine it further and instead of having a 2 position ON/OFF make different station to send the train to generate any signal. ( It helps if your train-switch is able to get to any position from any position).
dougabugg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon May 04, 2020 1:30 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by dougabugg »

Ah, using trains is a great idea! You can access them even without a radar, and they wouldn't waste electricity like inserters do. I haven't played around with connecting train stations to the circuit network, I will try them out in the future though, thanks!
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3724
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: First time using circuit network: making a "master" power switch

Post by DaveMcW »

You can also create blueprints with a constant combinator on and off, and place them to change it. This requires radar.
Tertius
Filter Inserter
Filter Inserter
Posts: 991
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by Tertius »

I understand you need to toggle some circuit signal remotely and need to use a power switch for toggling, because a power switch can be toggled remotely, while a constant combinator cannot.
You need to translate the "I have power" state into a circuit signal.

This is a possible solution with circuit components only:
Screenshot 2021-11-10 022035.png
Screenshot 2021-11-10 022035.png (67.58 KiB) Viewed 6073 times


It works like this:
It checks if a counter is still counting.
The combinator to the right plus the constant combinator is an endless counter.
The middle combinator multiplies the counter value with -1
The combinator to the left is adding the original counter value with the negated value at its input. The resulting value is always +1, because the latency of the negation is 1 tick and the counter increases by 1 every tick. This combinator decouples the counter/multiplier and feeds the resulting value of 1 input into the network.

If you switch off the power switch, the counter stops counting. Since there isn't any more the difference of 1 at the middle combinator, the sum is 0 after 1 tick and that value is fed into the network. If you switch the power switch back on, the difference is again 1.
That means: signal=1: power switch on, signal=0: power switch off.

I'm wondering if this can be done with 2 combinators, but I didn't find a way that late in the night.
dougabugg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon May 04, 2020 1:30 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by dougabugg »

Thanks for suggestions! The blueprint placement is a useful and interesting trick/work around, and I like the powered-counter idea, maybe I'll try building that
GrumpyJoe
Filter Inserter
Filter Inserter
Posts: 496
Joined: Fri Apr 06, 2018 7:10 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by GrumpyJoe »

Since you can toggle a switch remotely and you are used to that, you could use (non constant) combinators that require power behind such a switch, to add a signal to the green wire.
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by disentius »

Hm... How about placing an accumulator behind a powerswitch (the master) and make sure its power is used, a radar would do. then read the A value and send that to the network, and set all other power switches to enable if A > 99.
Tertius
Filter Inserter
Filter Inserter
Posts: 991
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by Tertius »

GrumpyJoe wrote: Thu Nov 11, 2021 6:56 am Since you can toggle a switch remotely and you are used to that, you could use (non constant) combinators that require power behind such a switch, to add a signal to the green wire.
A regular combinator doesn't stop output signals if power is lost. It just stops operating and outputs the last set of signals it generated until power is restored. It just freezes. There is no device that just stops output some signal if power is lost - if there were any, this thread wouldn't exist. You have to get this information indirectly.

A power detector within a pole, activated on demand just like the control that becomes available if you connect a belt with a wire, would be nice that would output a value of 0..100..∞ in percent of how much power demand can be satisfied. 0 is off, 1..99 is a brownout, and if above 100%, there is surplus power that could be stored in an accumulator if one were connected. I bet there is a mod for this.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: First time using circuit network: making a "master" power switch

Post by mrvn »

Tertius wrote: Thu Nov 11, 2021 12:01 pm
GrumpyJoe wrote: Thu Nov 11, 2021 6:56 am Since you can toggle a switch remotely and you are used to that, you could use (non constant) combinators that require power behind such a switch, to add a signal to the green wire.
A regular combinator doesn't stop output signals if power is lost. It just stops operating and outputs the last set of signals it generated until power is restored. It just freezes. There is no device that just stops output some signal if power is lost - if there were any, this thread wouldn't exist. You have to get this information indirectly.

A power detector within a pole, activated on demand just like the control that becomes available if you connect a belt with a wire, would be nice that would output a value of 0..100..∞ in percent of how much power demand can be satisfied. 0 is off, 1..99 is a brownout, and if above 100%, there is surplus power that could be stored in an accumulator if one were connected. I bet there is a mod for this.
Accumulators output their power level. That's the only think that measures electricity in vanilla.
dougabugg
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon May 04, 2020 1:30 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by dougabugg »

Yup, I was so dissapointed that combinators continue to output their "previous signal state" when they lose power, lol. it would have made my setup so simple! Right now, I'm happily using the powered-counter solution posted by Tertius. I'm still wrapping my head around the circuit network mechanics of factorio (red vs green wire, tick latency, auto-summation of signal counts, etc), but I was able to "rebuild" their solution by analyzing the blueprint they pasted. Fascinating stuff!
adam_bise
Filter Inserter
Filter Inserter
Posts: 465
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by adam_bise »

Trains are definitely the way to go.

When you're dealing with a low power situation you need things that work without power such as fluids and train stops
ms.png
ms.png (1.64 MiB) Viewed 5856 times
The master switch combinator controls the remote power switch and turns on the light wirelessly.



Oh, and you can detect no power with a pump between tanks.

Fill one tank to 25k, leave the other empty. Then connect the two tanks with minimal UG pipes and a pump. Connect the two tanks again with several regular pipes forming a circle. The drag from the pipes will make one tank significantly higher than the other. Enable a train stop when the high tanks fluid signal dips below its normal high level.

Another thing I like to do is make an outpost go to sleep when it is not being used. For example, an ore site which delivers ore to enabled train stops. When all of the buffer chests are full and there are no receiving trains, the whole outpost shuts off. Then I measure light oil in a tank and add zero to its signal in a combinator. When enemies approach, flame turrets drain some of the light oil from a tank, while the combinator is frozen at its last signal.

The power switch itself doesn't need power to compare signals, so I compare light oil in the tank vs the frozen signal, and if it's different enable power and kick off a timer.
adam_bise
Filter Inserter
Filter Inserter
Posts: 465
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: First time using circuit network: making a "master" power switch

Post by adam_bise »

Here I stamped BP and removed extra switches.
ms2.png
ms2.png (1.4 MiB) Viewed 5830 times
Post Reply

Return to “Gameplay Help”