Creating a trigger when material ceases running on a belt

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

Hi!

(First post)

I've been trying to find a forum thread that explains belt counters in detail. I want to create a trigger for when the flow of materials on a belt completely ceases (the primary reason being to alert me when mines run out). The nearest I've come to a solution in the image below.
Belt cease trigger
Belt cease trigger
Belt cease trigger.png (402.73 KiB) Viewed 6478 times
A, B & C are Arithmetic Combinators. D is a Decider Combinator. The input for A & B are the two belt counters, set on pulse (IE counts each passing object only once).

Combinator A is set to give a signal of +1, Combinator B is set to give a signal of -3 (I'll explain later). Each of their signals are sent to the input of Combinator C to hold the cumulative value (which is done by running a red wire from Combinator C’s output back into its own input). Decider Combinator D is set to output signal “Red” when the cumulative value in Combinator C falls. For the test I hooked up a light.

I encountered a number of problems, and problems with the numbers

1) Combinator A adds 3 to the count, instead of just 1. (This is why I have to set combinator B to -3)

2) A value of zero sends no signal. Therefore I've set the trigger to any value less than 10, which means you have to carefully prime the belt when you set up. However this doesn't work if the value suddenly becomes negative (which it obviously shouldn't).

3) Placing either of the belt counters directly adjacent to a corner, a splitter or an underground belt results in the belt counters occasionally missing items. (Found out through trial and error)

I've created a blueprint (attached) and nine out of ten times this is working, but now and then I get a belt that just wont behave. Any suggestions for how to improve this? Especially if it can be simplified.
Attachments
Mine empty alert system.txt
Mine empty alert system
(1.08 KiB) Downloaded 108 times

thedarkbunny
Inserter
Inserter
Posts: 46
Joined: Mon Oct 23, 2017 10:46 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by thedarkbunny »

Not in a position to give you a blueprint just now, but:

Two decider combinators, one constant combinator.

Constant: T = 1

Decider 1: If [iron, copper, whatever] = 0, output T (input count)

Decider 2: If T > 60, output Red (1)

Wire a belt (read input, hold) to Decider 1's input with green wire.
Wire the constant combinator to Decider 1's input and output with red wire.
Wire Decider 1's output to Decider 2's input with green wire.

Decider 2 will now output 1 Red whenever the connected belt stays empty for at least 1s (60 ticks)
If you want it to alert on stalled (i.e., full but not moving) belts as well, change the belt read from 'hold' to 'pulse'
Adjust the value of Decider 2 as necessary to change the sensitivity.

Loewchen
Global Moderator
Global Moderator
Posts: 8319
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by Loewchen »

Circuit connect 5 consecutive belts to what ever output device you want, trigger for item=0.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by eradicator »

ozfoxaroo wrote: (the primary reason being to alert me when mines run out).
While circuits are great and awesome, and you should definetly use more of them... some problems have easier solutions:
orecount.jpg
orecount.jpg (100.94 KiB) Viewed 6452 times
For flow-measuring without circuits, you can measure the content of a buffer chest. Though this will only work if the belt isn't moving at full speed:
sidebuffer.jpg
sidebuffer.jpg (26.95 KiB) Viewed 6452 times
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

thedarkbunny wrote:Not in a position to give you a blueprint just now, but:

Two decider combinators, one constant combinator.

Constant: T = 1

Decider 1: If [iron, copper, whatever] = 0, output T (input count)

Decider 2: If T > 60, output Red (1)

Wire a belt (read input, hold) to Decider 1's input with green wire.
Wire the constant combinator to Decider 1's input and output with red wire.
Wire Decider 1's output to Decider 2's input with green wire.

Decider 2 will now output 1 Red whenever the connected belt stays empty for at least 1s (60 ticks)
If you want it to alert on stalled (i.e., full but not moving) belts as well, change the belt read from 'hold' to 'pulse'
Adjust the value of Decider 2 as necessary to change the sensitivity.
Thanks! That worked a treat! :) Blueprint attached for anyone who needs it (500 is the number of ticks I've chosen, but it's at the user's discretion).
Factorio_Belt_Alert_Mk2.png
Factorio_Belt_Alert_Mk2.png (768.13 KiB) Viewed 6412 times
Note: You must be specific about the commodity (iron in this case). I tried "Everything", "Anything" and "Each" signals but they didn't pass along the value of T.
eradicator wrote:
ozfoxaroo wrote: (the primary reason being to alert me when mines run out).
While circuits are great and awesome, and you should definetly use more of them... some problems have easier solutions:
Image

For flow-measuring without circuits, you can measure the content of a buffer chest. Though this will only work if the belt isn't moving at full speed:
Image
Thanks, but I rarely have drills covering an entire ore deposit - too much concentrated pollution. The reason I'm creating an alert system is to let me know when it's time to re-position the drills.

The approach with the buffer chest was my first attempt before I moved on to combinators. I tried a few variations, including having the output inserter move much less than the input inserter, but even that resulted in having an empty chest too frequently.
Attachments
Mine empty alert system Mk2.txt
(1001 Bytes) Downloaded 112 times

mrvn
Smart Inserter
Smart Inserter
Posts: 5709
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by mrvn »

Why not cover the whole ore patch but only use a yellow belt? Then only a few miners work at any time.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

mrvn wrote:Why not cover the whole ore patch but only use a yellow belt? Then only a few miners work at any time.
Tried that in the past but still killed off trees and aggro'ed the locals.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

This approach has worked very well, but with one drawback: the decider combinator has to be set to whatever ore type is being mined. If it's not the ore in the blueprint then I need to wait for the bots to place the combinator before I can change it. That gets tiresome after a while.

Is there a way to configure the circuit using "Everything", "Anything" or "Each"? I've been experimenting but haven't had any luck; the combinator has reported "True" regardless of activity on the belt.

User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by 5thHorseman »

ozfoxaroo wrote:
Sat Sep 21, 2019 8:40 pm
This approach has worked very well, but with one drawback: the decider combinator has to be set to whatever ore type is being mined. If it's not the ore in the blueprint then I need to wait for the bots to place the combinator before I can change it. That gets tiresome after a while.
You could place the combnator yourself.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

5thHorseman wrote:
Sat Sep 21, 2019 10:12 pm
ozfoxaroo wrote:
Sat Sep 21, 2019 8:40 pm
This approach has worked very well, but with one drawback: the decider combinator has to be set to whatever ore type is being mined. If it's not the ore in the blueprint then I need to wait for the bots to place the combinator before I can change it. That gets tiresome after a while.
You could place the combnator yourself.
Explain.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by quyxkh »

Why not just wire up a few belt segments read-hold and bleat on everything = 0?

mmmPI
Smart Inserter
Smart Inserter
Posts: 2743
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by mmmPI »

ozfoxaroo wrote:
Sun Jul 22, 2018 8:11 am
I've been trying to find a forum thread that explains belt counters in detail.
Here you have a "dry ore patch train restrictor", it reads on chest, not on belts, but the use case described is quite similar : it can be used to detect if the miners on a patch needs to be moved ( run dry/ material ceases filling a chest ) , in this case it is used to manage a station open or close but maybe you could adapt it to trigger an alert instead.
viewtopic.php?t=53519

This other one uses many details to explain how to find the " moving average " on a belt, which can be 0 i guess, it was mentionned in the previous thread as an other solution.
viewtopic.php?t=51471

both are meant to be generic and don't require to be set to specific material if it helps having example to fiddle after.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by disentius »

How to translate every signal to T:

-Use an arithmetic combinator
-Set input: "Each + 0"
-set output: "T"

User avatar
5thHorseman
Smart Inserter
Smart Inserter
Posts: 1193
Joined: Fri Jun 10, 2016 11:21 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by 5thHorseman »

ozfoxaroo wrote:
Sun Sep 22, 2019 1:27 am
5thHorseman wrote:
Sat Sep 21, 2019 10:12 pm
ozfoxaroo wrote:
Sat Sep 21, 2019 8:40 pm
This approach has worked very well, but with one drawback: the decider combinator has to be set to whatever ore type is being mined. If it's not the ore in the blueprint then I need to wait for the bots to place the combinator before I can change it. That gets tiresome after a while.
You could place the combnator yourself.
Explain.
Place the blueprint, and then place the combinators exactly where they are in the placed blueprint. The game should place them with any settings from the blueprint.

DerGraue
Fast Inserter
Fast Inserter
Posts: 151
Joined: Mon May 30, 2016 12:12 pm
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by DerGraue »


JimBarracus
Filter Inserter
Filter Inserter
Posts: 365
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by JimBarracus »

ozfoxaroo wrote:
Mon Jul 23, 2018 11:46 am
Tried that in the past but still killed off trees and aggro'ed the locals.
idling miners don't pollute since they have no drain.

Do you use efficienty modules?
This makes mining much easier.

I always use 3 Eff1 Modules on each miner and it reduces pollution by 80%.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

Worked it out. A new combinator is needed in the circuit so that the T counter is interrupted whenever [Everything] != 0 . IE any resource is passing through the belt counter.


JimBarracus wrote:
Mon Sep 23, 2019 7:57 am
ozfoxaroo wrote:
Mon Jul 23, 2018 11:46 am
Tried that in the past but still killed off trees and aggro'ed the locals.
idling miners don't pollute since they have no drain.

Do you use efficienty modules?
This makes mining much easier.

I always use 3 Eff1 Modules on each miner and it reduces pollution by 80%.
I use 3 x Mark 3 Productivity modules because I'm a skinflint.

Pros: Increased yield in each ore/stone patch, less time spent constructing and demolishing mines
Cons: Slower mining, greatly increased pollution, resources spent on manufacturing the modules

My approach means far slower progress in creating the infrastructure, but the advantage manifests in the later stages of the game where far less time is spent setting up new mines and decommissioning them. Once a sufficient number of mines are up and running there's no longer an issue with how slow each individual drill runs. I keep the pollution under control by limiting the number of drills operating in a given area.

JimBarracus
Filter Inserter
Filter Inserter
Posts: 365
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by JimBarracus »

ozfoxaroo wrote:
Mon Sep 23, 2019 11:38 am
My approach means far slower progress in creating the infrastructure, but the advantage manifests in the later stages of the game where far less time is spent setting up new mines and decommissioning them. Once a sufficient number of mines are up and running there's no longer an issue with how slow each individual drill runs. I keep the pollution under control by limiting the number of drills operating in a given area.
interesting.

I think, that letting the miners back up would be much better.
Pollution seems to be a problem for you, but having 30% more output for the pollution of 4 miners seems very inefficient.
Compared to 3xEff1 miners it gets even worse.
One of your miners produces as much pollution as 17 "clean" miners. Thats just insane.

Should be far more effective to invest in mining productivity.

Anyway setting yourself rules makes the gameplay interesting.

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by foamy »

ozfoxaroo wrote:
Mon Sep 23, 2019 11:38 am
I use 3 x Mark 3 Productivity modules because I'm a skinflint.

Pros: Increased yield in each ore/stone patch, less time spent constructing and demolishing mines
Cons: Slower mining, greatly increased pollution, resources spent on manufacturing the modules

My approach means far slower progress in creating the infrastructure, but the advantage manifests in the later stages of the game where far less time is spent setting up new mines and decommissioning them. Once a sufficient number of mines are up and running there's no longer an issue with how slow each individual drill runs. I keep the pollution under control by limiting the number of drills operating in a given area.
I'd sooner fire all those resources you spent on productivity modules into repeated +Mining Productivity research, which is a. free for every miner once researched, b. doesn't come with any kind of penalty at all, and c. very rapidly drowns out the bonus from productivity modules.

User avatar
ozfoxaroo
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 22, 2018 7:46 am
Contact:

Re: Creating a trigger when material ceases running on a belt

Post by ozfoxaroo »

JimBarracus wrote:
Mon Sep 23, 2019 12:35 pm
interesting.

I think, that letting the miners back up would be much better.
Pollution seems to be a problem for you, but having 30% more output for the pollution of 4 miners seems very inefficient.
Compared to 3xEff1 miners it gets even worse.
One of your miners produces as much pollution as 17 "clean" miners. Thats just insane.

Should be far more effective to invest in mining productivity.

Anyway setting yourself rules makes the gameplay interesting.
Like I said, I limit the number of drills operating in a given area. All my drills are linked in sequence using the below blueprints. As each drill is depleted, the next one in sequence begins mining.



foamy wrote:
Mon Sep 23, 2019 8:05 pm
I'd sooner fire all those resources you spent on productivity modules into repeated +Mining Productivity research, which is a. free for every miner once researched, b. doesn't come with any kind of penalty at all, and c. very rapidly drowns out the bonus from productivity modules.
Already researched up to mining productivity 16 and still going. I grab every bit of extra ore I can get my hands on.

Post Reply

Return to “Gameplay Help”