Turn on for a range...

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Mr. Tact
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Turn on for a range...

Post by Mr. Tact »

I have a process creating a fluid. I want the process to start when the fluid storage goes under a constant value of X, but I don't want the process turning on and off as the amount fluctuates just over and just under the value X. So, I'd like the process to run until the amount of fluid is X + 5000. I figured out a way to do this by shuffling an item between two chests. When the storage goes under X, an inserter enables putting the item in a chest. The process run as long as the item is in the chest. Another decider and insert shuffles the item back to the other chest at X + 5000, stopping the process.

Is there a cleaner way to do this?
Professional Curmudgeon since 1988.
Nitrah
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Feb 19, 2018 3:10 pm
Contact:

Re: Turn on for a range...

Post by Nitrah »

Look up factorio SR latches on YouTube. You can link a pump to a tank
User avatar
Lav
Filter Inserter
Filter Inserter
Posts: 384
Joined: Mon Mar 27, 2017 10:12 am
Contact:

Re: Turn on for a range...

Post by Lav »

You need not SR latch, but a hysteresis loop. There are a few designs available in this thread: viewtopic.php?f=8&t=32432

I personally prefer the one with decider combinator and reversed multiplication combinator:

1. Storage Tank ---> Decider combinator: IF resource >= top_limit OUTPUT S=1 ---> Producing Facility: active IF S=0.
2. Arithmetic combinator: S * diff ---> resource. It feeds from decider's output and into decider's input, possibly with a different wire color to prevent signal contamination in the original network.

If you want amount to oscillate between 10K and 13K, then your top_limit=13K and diff=3K.

It's functionality is extremely simple. Producing facility is active until resource reaches the top_limit. At this moment decider outputs S=1, which stops the production AND feeds an extra resource=diff signal into decider's input. Because of this, decider continues to output the S=1 signal until real amount of your resource drops below top_limit-diff.

The beauty of this design is that you can place simple "flickering" switches at first, simply to prevent the storage tank overflow, and then just slap another combinator on top of an already functional scheme to convert it to a hysteresis loop.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Turn on for a range...

Post by Optera »

I prefer using a memory cell with dedicated set and reset combinators over the promoted 2 combinator hysteresis for the following reasons:
- thresholds can be set directly and can be compares to actual values at a glance
- threshold for set and reset can be made from entirely different signals
- multiple set and reset thresholds can be easily combined

For example my oil refineries turn on when either petrol, light oil or heavy oil is < 50% and turn off either of them is > 90%
Mr. Tact
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Re: Turn on for a range...

Post by Mr. Tact »

Optera wrote:I prefer using a memory cell with dedicated set and reset combinators over the promoted 2 combinator hysteresis for the following reasons:
- thresholds can be set directly and can be compares to actual values at a glance
- threshold for set and reset can be made from entirely different signals
- multiple set and reset thresholds can be easily combined

For example my oil refineries turn on when either petrol, light oil or heavy oil is < 50% and turn off either of them is > 90%
A "memory cell"? I like your description, can you be more specific? Or perhaps provide an example blueprint?
Professional Curmudgeon since 1988.
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Turn on for a range...

Post by Optera »

It's what the combinator tutorial calls an RS Latch.
https://wiki.factorio.com/Tutorial:Circ ... er_version

I didn't want to use that name as some still think of the terrible unstable 2 decider latch modelled after electronic circuits shown below the good version in the tutorial.
Mr. Tact
Filter Inserter
Filter Inserter
Posts: 461
Joined: Sat Mar 26, 2016 3:37 pm
Contact:

Re: Turn on for a range...

Post by Mr. Tact »

Cool. Thanks for pointing me at what I was looking for.
Professional Curmudgeon since 1988.
Nitrah
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Feb 19, 2018 3:10 pm
Contact:

Re: Turn on for a range...

Post by Nitrah »

Lav wrote:You need not SR latch, but a hysteresis loop. There are a few designs available in this thread: viewtopic.php?f=8&t=32432

<snip>
This is an SR latch.
Post Reply

Return to “Gameplay Help”