Page 1 of 2

Creating a trigger when material ceases running on a belt

Posted: Sun Jul 22, 2018 8:11 am
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 8608 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.

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

Posted: Sun Jul 22, 2018 5:22 pm
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.

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

Posted: Sun Jul 22, 2018 5:30 pm
by Loewchen
Circuit connect 5 consecutive belts to what ever output device you want, trigger for item=0.

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

Posted: Sun Jul 22, 2018 6:56 pm
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 8582 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 8582 times

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

Posted: Mon Jul 23, 2018 11:31 am
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 8542 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.

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

Posted: Mon Jul 23, 2018 11:38 am
by mrvn
Why not cover the whole ore patch but only use a yellow belt? Then only a few miners work at any time.

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

Posted: Mon Jul 23, 2018 11:46 am
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.

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

Posted: Sat Sep 21, 2019 8:40 pm
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.

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

Posted: Sat Sep 21, 2019 10:12 pm
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.

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

Posted: Sun Sep 22, 2019 1:27 am
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.

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

Posted: Sun Sep 22, 2019 2:15 am
by quyxkh
Why not just wire up a few belt segments read-hold and bleat on everything = 0?

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

Posted: Sun Sep 22, 2019 7:47 am
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.

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

Posted: Sun Sep 22, 2019 9:07 am
by disentius
How to translate every signal to T:

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

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

Posted: Sun Sep 22, 2019 12:31 pm
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.

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

Posted: Sun Sep 22, 2019 5:10 pm
by DerGraue

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

Posted: Mon Sep 23, 2019 7:57 am
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%.

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

Posted: Mon Sep 23, 2019 11:38 am
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.

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

Posted: Mon Sep 23, 2019 12:35 pm
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.

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

Posted: Mon Sep 23, 2019 8:05 pm
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.

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

Posted: Mon Sep 23, 2019 9:09 pm
by ozfoxaroo
JimBarracus wrote: Mon Sep 23, 2019 12:35 pminteresting.

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 pmI'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.