(filter) Inserters take wrong items?

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

(filter) Inserters take wrong items?

Post by nuhll »

What could cause this issue?

1.) e.g. iron is requestet, but the first swing pack 100 wrong items, and then iron in it... The inserters have the wrong item from the last train in it.
2.) Sometimes LTN asks for 8000+ items, even the LCC train can only hold 8000... causing unnessary waiting times... solution?

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: (filter) Inserters take wrong items?

Post by nuhll »

Would not rly the problem, but WHY EVER, at the next station where iron gets delivered, he first unload THE WRONG ITEM (via filter inserter) (wtf)

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: (filter) Inserters take wrong items?

Post by Optera »

That's due to unavoidable signal delay between stop output and scripted constant combinator output.
I explained this effect and a solution a few times now for example here: viewtopic.php?f=214&t=56270#p331603
Optera wrote:Yes, there is a short delay of 1-5 ticks before the combinator shows what should remain in the train and another 1tick delay from subtracting that from the stop output.
If you want to make 100% sure inserters don't start unloading the wrong items use a decider combinator behind the arithmic combinator set to "encoded position of locomotive" != 0 then everything: input count.

Image
blueprint

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: (filter) Inserters take wrong items?

Post by nuhll »

Im too dumb for this.

Okay, the circuit needs extra time to set the filter. I do understand this.

But why the filter inserters work BEFORE they get a filter transmitted? Shouldnt they do nothing without a filter set?

Edit: yes, if i place a stack filter inserter (has no filter set) it wont take any item out

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: (filter) Inserters take wrong items?

Post by nuhll »

btw ur fix is working fine, still idont get why its behaiving like this. bug in factorio or in LTN?

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: (filter) Inserters take wrong items?

Post by Optera »

nuhll wrote: Okay, the circuit needs extra time to set the filter. I do understand this.

But why the filter inserters work BEFORE they get a filter transmitted? Shouldnt they do nothing without a filter set?
nuhll wrote:btw ur fix is working fine, still idont get why its behaiving like this. bug in factorio or in LTN?
Inserters get the whole train inventory as filter from the train stop reading the inventory the same tick (or 1 tick after) a train parks at the stop.
The output is scripted and updates when the train event fires. In total that means it'll take 1-3 ticks from script update (I'm not sure if events and setting constant combinators all work on one tick or have some delay) + 1 tick from arithmetic combinator before the correct list of items to unload is ready.
The only 2 ways to prevent inserters from reacting to the uncorrected inventory from train stop is to either delay that signal with 3-4 NOPs e.g arithmetic combinator set to each+0=each, or use a filter set to only open when a signal that only exists in the longest signal path e.g train composition is detected.

pleauser
Inserter
Inserter
Posts: 33
Joined: Wed Sep 06, 2017 7:55 am
Contact:

Re: (filter) Inserters take wrong items?

Post by pleauser »

Optera wrote:
nuhll wrote: Okay, the circuit needs extra time to set the filter. I do understand this.

But why the filter inserters work BEFORE they get a filter transmitted? Shouldnt they do nothing without a filter set?
nuhll wrote:btw ur fix is working fine, still idont get why its behaiving like this. bug in factorio or in LTN?
Inserters get the whole train inventory as filter from the train stop reading the inventory the same tick (or 1 tick after) a train parks at the stop.
The output is scripted and updates when the train event fires. In total that means it'll take 1-3 ticks from script update (I'm not sure if events and setting constant combinators all work on one tick or have some delay) + 1 tick from arithmetic combinator before the correct list of items to unload is ready.
The only 2 ways to prevent inserters from reacting to the uncorrected inventory from train stop is to either delay that signal with 3-4 NOPs e.g arithmetic combinator set to each+0=each, or use a filter set to only open when a signal that only exists in the longest signal path e.g train composition is detected.
I've been reading nuhlls posts and wondering why I haven't had any problems with this, despite have providers with up to 4 different items. Your explanation helped me realize what it is.
Provider.png
Provider.png (1.37 MiB) Viewed 3169 times
what I suspect is happening is that the outputs from the train as negated and thus ignored by the inserters until the train event fires and now some of the results are positive. won't claim I planned it this way, this was my first provider and I like the idea of fewer combinators :)

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: (filter) Inserters take wrong items?

Post by Optera »

Your picture shows a loading station, those will never see this effect.
For loading stations filters are only ever set by the constant combinator. Inventory signals from the stop pass through an inverting combinator making all singals negative and unable to set a filter.

pleauser
Inserter
Inserter
Posts: 33
Joined: Wed Sep 06, 2017 7:55 am
Contact:

Re: (filter) Inserters take wrong items?

Post by pleauser »

Optera wrote:Your picture shows a loading station, those will never see this effect.
For loading stations filters are only ever set by the constant combinator. Inventory signals from the stop pass through an inverting combinator making all singals negative and unable to set a filter.

Indeed it does, lol. my bad. ill give it another go after work :)

edit: finally had time.. yeah i'll never see this problem because all of my requesters empty the train

Post Reply

Return to “Logistic Train Network”