Controlling item flow by counting

Post all other topics which do not belong to any other category.
Post Reply
ray4ever
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sun Jan 12, 2014 9:22 am
Contact:

Controlling item flow by counting

Post by ray4ever »

Hi everyone,

as 0.12 is making combinators available for use i thought what use they might have.
When I started the game long ago I envisioned my factory as something where the "raw" items are coming in on one belt and the "final" item is coming out. In between I envisioned one assembly line with one belt where the needed items are drawn from and the intermediate products are put on. At the end, only the final item would be left on the belt. Before 0.12 this kind of behavior wasn't possible and the two most common factory setups currently are the "main bus layout" and the "huge number of bots doing everything" layout.

To put my vision of a factory into action a controlled (=timed) flow of the items on the main belt is needed. Thus you have to control your input to the belt. One way to do this is by counting the items you put on it.

The basic setup is shown below: The smart inserter is putting a defined number of items (D) on the belt. For demonstrating purposes these items are then added back to the chest. As the inserter itself isn't acting as a sensor (what a shame), you have to count the number of items you take out of the chest. Thus a variable signal 0 (s0) (combinator 1) is created which is holding the current amount or items in the chest (circuits in this case). Combinator 2 than subtracts the current amount from the amount of the old timestep (s0). If the difference (combinator 2) is greater than 0 (so a item was took out and not in; if you change it to smaller than you would count the items put into the chest) the signal is put through.
Combinator 4 and 5 are a simple time generator counting up from 0 to E (400). Combinator 6 it generating a reset signal based on the time input. So every time the cycle is reset the amount of items you want to put on a the belt (D) is incremented by one and thus resetting your item counter.
Combinator 7 is where the magic happens: If the number of items drawn from the chest (s0) is smaller than the amount of wanted items (D) the signal is put through. As we will see soon, the inserter will stop working when this condition isn't true anymore. Therefore the manual incrementation of D by one through the timer is needed.
Combinator 8 and 9 are then generating the signal for the inserter which is working if D = 1.
FactorioItemCount.jpg
FactorioItemCount.jpg (67.21 KiB) Viewed 14345 times
As you can see at the bottom of the picture you can put it all into a neat 4 times 6 square so it doesn't need to much space. Also you can see a small addition to the systems which is checking if there are enough items in the box for the cycle. If this condition is true F (time step of the timer) is set es 1 (you have to change F in the first constant combinator to 0).

With this very basic control method it should be possible to build a factory where nearly everything can be build on one single belt and no items are "wasted" in big belt buffers. Also you save a lot of spaghetti belts :)

Now I would like to hear your thoughts on my vision and my try on finding a design solution for it!

Tinyboss
Fast Inserter
Fast Inserter
Posts: 205
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Controlling item flow by counting

Post by Tinyboss »

This is very interesting and I'm looking forward to trying it out! So far we have main bus, all bots, and logistical loop paradigms. Anytime another one shows up it's exciting!

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Controlling item flow by counting

Post by XKnight »

I was insipired by your idea, and I tried to create something similiar.

Another way to calculate flow of the items is to measure time (V = S / T).
My idea is very simple: just add some token to the belt, and then measure time spended on the belt.

Image

ray4ever
Long Handed Inserter
Long Handed Inserter
Posts: 86
Joined: Sun Jan 12, 2014 9:22 am
Contact:

Re: Controlling item flow by counting

Post by ray4ever »

That's a great idea! One problem with my idea is that it is hard to count large amounts of items. With your solution you can measure the belt throughput. I like it alot!

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Controlling item flow by counting

Post by XKnight »

I've made this sensor a little bit complicated, now it works even if belt is stuck.

Green signal is an output signal, which shows the amount of time when token was on the belt.
Sensor stores measured value and updates if token come to the end of the region, or if current measurement is already larger than previous measurement.
This allows to use sensor even if no one is consuming items.

Image

voyta
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Thu Jul 23, 2015 10:29 pm
Contact:

Re: Controlling item flow by counting

Post by voyta »

Am I missing something or is the token just measuring the speed of the belt, rather than the flow of materials on it in all cases when the output of the belt is not blocked? That means e.g. from 0 items on belt until belt completely full, I get the same token speed, as long as whatever is consuming non-token items off the belt is consuming them at rate equal to (or higher than) the maximum belt throughput.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: Controlling item flow by counting

Post by XKnight »

voyta wrote:Am I missing something or is the token just measuring the speed of the belt, rather than the flow of materials on it in all cases when the output of the belt is not blocked? That means e.g. from 0 items on belt until belt completely full, I get the same token speed, as long as whatever is consuming non-token items off the belt is consuming them at rate equal to (or higher than) the maximum belt throughput.
Token measures only the speed of the belt, not density of items. You can use this kind of measuring only if you are sure that belt always has maximum density. Otherwise, to measure throughput you need to measure density with speed separately, and multiply them.
Density measuring is the same as speed measuring, but any item should be considered as token.

Post Reply

Return to “General discussion”