Belt Circuit Lock
- Ranakastrasz
- Smart Inserter
- Posts: 2173
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Belt Circuit Lock
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?
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
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Belt Circuit Lock
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.
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.
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.
Re: Belt Circuit Lock
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.
- Ranakastrasz
- Smart Inserter
- Posts: 2173
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Belt Circuit Lock
I suppose i have to aske. Where is the negative number?DaveMcW wrote:Use negative numbers as a whitelist.
@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
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Re: Belt Circuit Lock
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.
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.
- Ranakastrasz
- Smart Inserter
- Posts: 2173
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Belt Circuit Lock
Oh. I couldn't see the - sign because it blended in. Is obvious now that you said that.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.
Makes sense as well.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
- Deadly-Bagel
- Smart Inserter
- Posts: 1498
- Joined: Wed Jul 13, 2016 10:12 am
- Contact:
Re: Belt Circuit Lock
Yeah negative numbers make a lot more sense
Money might be the root of all evil, but ignorance is the heart.
- Ranakastrasz
- Smart Inserter
- Posts: 2173
- Joined: Thu Jun 12, 2014 3:05 am
- Contact:
Re: Belt Circuit Lock
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)
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
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
-
- Fast Inserter
- Posts: 230
- Joined: Wed Jun 08, 2016 6:16 pm
- Contact:
Re: Belt Circuit Lock
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...
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...
Re: Belt Circuit Lock
"Everything < 11" on the beltThe 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)
"Item = 10" in the constant combinator.
-
- Fast Inserter
- Posts: 230
- Joined: Wed Jun 08, 2016 6:16 pm
- Contact:
Re: Belt Circuit Lock
the input is not constant but comes from Another Circuit that output any positive number