Page 1 of 1

Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 2:34 pm
by LoneSimba
Hey guys, I've been thinking about this problem, and google'ed it, but haven't found anything.
Trouble
I have some amount of chests (presume: 4 steel chests), filled with item (uran, c1=15, c2=2, c3=52, c4=2400), and i need to enable output inserter at chest with lowest count of items. In program code it would look like:
Code
Why i need this?
I'm building some weird storage system, with multiple "cells" each containing 6 chests, fillind one after another (i.e. if cell1 is full, items from return belt pass to cell 2 and so on)
There's screenshot of it:
Schemas

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 3:48 pm
by quyxkh
Does it have to be the very lowest, or would you settle for just anything below the average count? That you can get with a single combinator, google factorio balanced chest loading.

For picking the absolute lowest, best I can do takes either 3n-3 combinators and linear time or tricky wiring and log time with nearly as many combinators, probably not what you want.

But since you're just trying to fill the chests in order, how about disabling belt segments on the loading side if the upstream chest isn't full?

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 4:07 pm
by LoneSimba
Well, I've read this and this, but not quite sure, how to use them on my "cellular" storage... And, yea, i'm talking about unloading, not filling. I may told not quite correct thing, I wanted more like this: This thing fills cells one by one, and what i want is to unload them in opposite order. 1->2->3->4->5->6 for load and 1<-2<-3<-4<-5<-6 for unload. Just compared cells to single chests at test storage.

Like, Cetrifuge is needing uran, sends signal to unload some from storage, and storage turns on output inserters at cell with lowest item count (but, it's shouldn't be less than 1, logics breaks below that point)

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 4:42 pm
by quyxkh
Something like this (wooden chests used for demo so you don't have to wait so long)

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 4:57 pm
by LoneSimba
Can you make this w/o mods? Just playing vanilla....

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 5:02 pm
by quyxkh
That's vanilla, infinity chests and loaders and electric energy interfaces, `/c game.player.insert'electric-energy-interface' game.player.insert'express-loader' game.player.insert'infinity-chest'` to get them, or use your own suppllies/sinks for power and items.

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 5:20 pm
by LoneSimba
Thx for reminding about Lua console. After looking at your build in-depth i've figured out, how it works (yep, I'm a Slowpoke), I'll try it on my cellular system (I guess, arithmetic combinator and two deciders on each cell), I'll post on progress.

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 7:41 pm
by LoneSimba
Wellp, I failed to adapt your method to my installation... Can you debug it? (Cells 5-6 were testing with your method)
Blueprint

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 8:54 pm
by quyxkh
If I understand this properly, you're after a mass storage buffer but don't like the daisy-chained-insertion behavior the usual FIFO designs get, and want to be able to buffer/saturate a yellow belt, yes? I'd do that starting from this:
snap@T12878768=1360x1280-46+25.25,z2.jpg
snap@T12878768=1360x1280-46+25.25,z2.jpg (96.65 KiB) Viewed 4041 times
with the early chests' bars set low so you quickly get burst-unload capacity. Depending on your stack size bonus you'll need more or less inserters total to saturate an empty belt, anyway you don't need circuitry for this, maybe just a little wiring to keep nearer-the-exit inserters from trying to unload on to a belt that's already filled by the farther ones.

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 9:26 pm
by LoneSimba
'Kay, i guess, i'll have to explain from scratch. I'm newbie, it's my first Factorio world, and my factory does not have any kind of Main Bus. I just was inspired by RAM configuration, so called main IN-OUT buses. My idea:
6 Cells, no matter how many chests in them. Loading cells from #0 to #5, unloading from #5 to #0.
And yea, i have a big truble communicating with people, and really sesitive about my faults. I'ts hard to me to explain properly my idea sometimes, espessially in english, since i'm russian and don't know it perfectly (even after passing most test with C1 level).

Re: Selecting chest with lowerest item count

Posted: Sun Sep 30, 2018 9:52 pm
by quyxkh
I didn't have trouble understanding your earlier descriptions and my understanding matched your blueprint, so your English is accurate enough, I suppose I knew you're not a native English speaker but it didn't cause any difficulty at all.

I was just trying to simplify the design to something that'd be easier for a newbie to work with, that also still does what yours is attempting, buffering overflow and supplying the buffered items to satisfy underruns. You don't need combinators or even wiring to achieve that, plug what's in the picture into your centrifuges' main supply line and the effect will be the same„ the only thing to configure is the splitter settings. If you're going for a single-belt design, where your factory output includes supply items that got missed by distracted loading inserters, plug this in in place of your blueprinted design and wire the request-overflow signal to a single enable-if-requested output at the exit, you're done.