Page 1 of 1
Belt Circuit Lock
Posted: Wed Dec 13, 2017 1:50 pm
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?
Re: Belt Circuit Lock
Posted: Wed Dec 13, 2017 2:29 pm
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.
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.
Re: Belt Circuit Lock
Posted: Wed Dec 13, 2017 6:28 pm
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.
Re: Belt Circuit Lock
Posted: Wed Dec 13, 2017 11:41 pm
by DaveMcW
Use negative numbers as a whitelist.
- circuit-lock.jpg (141.58 KiB) Viewed 8538 times
Re: Belt Circuit Lock
Posted: Thu Dec 14, 2017 3:40 pm
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
Re: Belt Circuit Lock
Posted: Thu Dec 14, 2017 6:33 pm
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.
Re: Belt Circuit Lock
Posted: Thu Dec 14, 2017 7:38 pm
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.
Re: Belt Circuit Lock
Posted: Thu Dec 14, 2017 10:49 pm
by Deadly-Bagel
Yeah negative numbers make a lot more sense
Re: Belt Circuit Lock
Posted: Fri Dec 15, 2017 4:03 pm
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)
Re: Belt Circuit Lock
Posted: Fri Dec 15, 2017 6:51 pm
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...
Re: Belt Circuit Lock
Posted: Fri Dec 15, 2017 11:45 pm
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.
Re: Belt Circuit Lock
Posted: Sat Dec 16, 2017 10:39 am
by The Eriksonn
the input is not constant but comes from Another Circuit that output any positive number