Belt Circuit Lock

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Belt Circuit Lock

Post by Ranakastrasz »

I was trying to mess with belt circuits in an attempt to make a belt stop working if anything but the expected item type was on it. Essentially to stop a belt from getting contaminated by causing it to shut off if something goes wrong.

However, I could not get it to work.
I tried to read the number of stuff, and do a comparison between "All items" and "Item type", and if they were not equal it would stop working. However, it instantly stopped working, even under cases where I expected it to.

Any suggestions on how to do this properly?
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Belt Circuit Lock

Post by Deadly-Bagel »

Hmm, simplest solution off the top of my head would be to output belt contents to both a Decider and an Arithmetic Combinator. The Decider is simply to line up the signals so set it to some condition that is always true and output everything. Set the Arithmetic Combinator to [Desired Item] * -1 outputting [Desired Item]. Output both to a second Decider Combinator configured to [Everything] = 0 output [X] = 1, then output that back to the belt with enabled condition [X] = 1.

What this is doing is taking the desired item and inverting the signal, so that when combined with the original it's cancelled out. Eg if you have 5 Iron and 1 Coal, the AC will output -5 Iron and combine it with the Decider's 5 Iron 1 Coal, cancelling out the Iron and leaving you with a signal of 1 Coal. Because [Everything] no longer equals 0 the second Decider stops outputting [X] and the belt stops working.

Note you can't omit the second Decider, the belt reads its own output as soon as it connects to anything and because Combinators take 1 tick (1/60 of a second) to output the signal the belt will always read its own signal faster.
BLUEPRINT
EDIT: Come to think of it this would be a pretty neat tool for mixed ore deposits...

EDIT2: Note that in the event of a power failure the belt will halt as the Decider can no longer output [X], if this is undesirable you could flip it and output [X] when [Anything] /= 0 and set the belt to work when [X] = 0, but if a bad item passes through during a power failure it will not be scanned.
Money might be the root of all evil, but ignorance is the heart.

Triaxx2
Inserter
Inserter
Posts: 30
Joined: Tue Nov 14, 2017 8:06 pm
Contact:

Re: Belt Circuit Lock

Post by Triaxx2 »

Wouldn't it be simpler to count what's on the belt and if it's less than a full belt worth it stops? Though I'm aware that wouldn't work if you're not getting a full belt worth of whatever it is.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Belt Circuit Lock

Post by DaveMcW »

Use negative numbers as a whitelist.
circuit-lock.jpg
circuit-lock.jpg (141.58 KiB) Viewed 6682 times

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Belt Circuit Lock

Post by Ranakastrasz »

DaveMcW wrote:Use negative numbers as a whitelist.
circuit-lock.jpg
I suppose i have to aske. Where is the negative number?

@Deadly-Bagel darn i was hoping for something more compact. I think I see how it works and will use it.

And yea, its for busses and dirty mining and the forge. Anywhere where contaminationn is likely and infuriating
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

KScorp
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Dec 14, 2017 6:28 pm
Contact:

Re: Belt Circuit Lock

Post by KScorp »

The negative numbers are in the constant combinator. (-10 stone, -10 iron ore, -10 copper ore)

The belt will only work if all signals are less than 1. Normally, this means that if any item is detected, it will stop. However, by adding a constant combinator that creates negative numbers for the items you want, even if those items are detected, the signal will still be less than 1. Thus the belt will keep working for those items.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Belt Circuit Lock

Post by Ranakastrasz »

KScorp wrote:The negative numbers are in the constant combinator. (-10 stone, -10 iron ore, -10 copper ore)

The belt will only work if all signals are less than 1. Normally, this means that if any item is detected, it will stop. However, by adding a constant combinator that creates negative numbers for the items you want, even if those items are detected, the signal will still be less than 1. Thus the belt will keep working for those items.
Oh. I couldn't see the - sign because it blended in. Is obvious now that you said that.

Makes sense as well.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Belt Circuit Lock

Post by Deadly-Bagel »

Yeah negative numbers make a lot more sense
Money might be the root of all evil, but ignorance is the heart.

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Belt Circuit Lock

Post by Ranakastrasz »

Now that I understand it, I made a change. Instead of a constant combinator, I am using an Arithmatic combinator with "All *-10 All", which gets it's data from a chest. I already use a chest at the start of every bus lane, with the resource(s) that the lane is supposed to have. Hence, I can just copy-paste instead of having to manually add the resource values of -10.

Also can link together multiple lanes if needed (in which case -10 isn't enough, but eh, -1000 is fine)
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

The Eriksonn
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Jun 08, 2016 6:16 pm
Contact:

Re: Belt Circuit Lock

Post by The Eriksonn »

Is there a way to reverse it?
I want my belt to stop when a specific item goes on it(so that inserter can grab it without failing)

I managed it with 2 combinators, can it be better?

also, the input is any positive number...

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Belt Circuit Lock

Post by DaveMcW »

The Eriksonn wrote:Is there a way to reverse it?
I want my belt to stop when a specific item goes on it(so that inserter can grab it without failing)
"Everything < 11" on the belt
"Item = 10" in the constant combinator.

The Eriksonn
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Jun 08, 2016 6:16 pm
Contact:

Re: Belt Circuit Lock

Post by The Eriksonn »

the input is not constant but comes from Another Circuit that output any positive number

Post Reply

Return to “Gameplay Help”