Furnace Setup: 4 mixed product

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Furnace Setup: 4 mixed product

Post by johnwhile »

Hi all, this is my first try to make a four mixed product furnace setup.
The goal it's to use only one furnaces factory to satisfy variable request of Brick, Iron Plate, Cooper Plate and Steel:
It's a work in progress, I prefer to explain in detail my proposal by splitting the whole system in several post.
Multi Smelting System, work in progess...
Last edited by johnwhile on Sun Jun 17, 2018 8:11 pm, edited 4 times in total.
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Re: Furnace Setup: 4 mixed product

Post by johnwhile »

Product request calculation
The main task is to calculate which products are needed and which priority. The easiest solution is to read how many products are stored in the chests during production, fewer objects there are means more demand.

The first simplest solution is to calculate how many objects are missing to reach an imposed limit. In this blueprint I put the limit to 100 objects so:
1. Convert each signals into its related raw materials
2. For each signal find the distance from the limit
3. Calculate the percentage
4. Convert the percentage to the number of furnaces groups. In this case i set 4 furnace group.
Storage calculation with limit
The second simplest solution is to calculate how many objects are missing relative to the sum, without limits. This allows you to do a continuous but balanced production. For example, when the quantity is the same for all 4 products, each furnaces groups will continue to produce maintaining the ratio.
1. Convert each signals into its related raw materials
2. For each signal find the maximum value
3. Calculate the percentage related to maximum
4. Convert the percentage to the number of furnaces groups.
Storage calculation maintaining the ratio
Since factorio uses only integers, many combinators are needed to make a correct fractional calculation
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Re: Furnace Setup: 4 mixed product

Post by johnwhile »

Signal Encoder (2bit)
Once the number of furnace groups necessary for each product has been obtained, the signal must be distributed to each group. To avoid using one wire for each group I thought to compressing the signals into a single number. This also allows me to greatly simplify the number of combinators.
The idea is simple, convert each product according to this binary table:

Iron Plate = 00 (0)
Cooper Plate = 01 (1)
Brick = 10 (2)
Steel = 11 (3)

For iron plates, using the zero signal implies a great simplification that you will see later.
In the example I have a signal that requires 3 groups of furnace to make bricks and one to make iron plates. The signal creation is done by concatenating each group of furnaces in a single number, 2 bits per group.
Image

The easiest way to get these groups of numbers for each type of product is to calculate a fairly large number (example x10 furnaces groups) and use right bit shift:

Signal 0 x10 = not necessary
Signal 1 x10 = ‭01 01 01 01 01 01 01 01 01 01 = ‬‭349525‬
Signal 2 x10 = ‭‭10 10 10 10 10 10 10 10 10 10 = ‬‭699050‬
Signal 3 x10 = ‭11 11 11 11 11 11 11 11 11 11 = ‬‭349525‬+‬‭699050‬ = 1048575‬

example: the number that contain 3 furnaces group for brick is

Code: Select all

S = Signal3 >> (20-3*2)
The construction of the final signal is done chaining/sum these 3 signals each moved by the left bit shift operation.
The advantage of using the zero signal for the iron plates is that an operation can be eliminated and if some furnaces are not used they are activated anyway to produce the plates. Besides, this method does not need to have the number of furnaces. The disadvantage is that if you need to use more than 10 groups of furnaces per type you have to recalculate manualy the values.
Signal Encoder 2bit - max 10 furnace per type
Signal Encoder (3bit)
Same, but to transmit the stop signal (zero):
Iron Plate = 001
Cooper Plate = 010
Brick = 011
Steel = 100
Signal Encoder 3bit - max 6 furnace per type
Last edited by johnwhile on Sun Jun 17, 2018 5:03 pm, edited 3 times in total.
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Re: Furnace Setup: 4 mixed product

Post by johnwhile »

Signal Decoder (2bit)
Each group of furnaces needs to know which object must smelting. Decode the main signal is the easiest part done with a bit mask operation (11b = 3), just provide the current group number (zero base so from 0 for first to N-1 for last).
Signal Decoder 2bit version
Signal Decoder (3bit)
the zero is the stop signal, use the bit mask 7 (111b)
Signal Decoder 3bit version
Last edited by johnwhile on Sun Jun 17, 2018 5:07 pm, edited 2 times in total.
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Re: Furnace Setup: 4 mixed product

Post by johnwhile »

Furnaces Group
The first problem of furnace is the steel and brick product that require more than one raw material, before changing product the furnace must be emptied. This is not necessary for iron and copper plates. Two memory cells store the current raw material inside furnace minus the quantity to complete the products. The stack size of filter inserter must be =1.

1. The input line send to inserter the raw material signal
2. The memory cell count the inserted objects
3. Now input line change the request. It can't be use "Stack Filter Inserter" because allows only one signal and the "Filter Inserter" is enough fast.
4. If memory cells return a not-zero value, the inserter add to furnace only necessary objects to complete the smelting.

The two last arithmetic combinator and the constant combinator are necessary only to output to the main red wire the exact amount of required objects to empty all furnaces. This calculation will be used only to optimize the amount of objects to put on the belt. Is possible to use the output of memory cells as request but you will insert a large amount of unnecessary objects before all furnaces are emptied.

Image
Furnace Groups tile
Last edited by johnwhile on Sun Jun 17, 2018 11:51 am, edited 8 times in total.
johnwhile
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue May 08, 2018 10:01 pm
Contact:

Re: Furnace Setup: 4 mixed product

Post by johnwhile »

Waste Recirculations and Raw materials line
The purpose of recycling is to reuse resources that have not been used by furnaces instead using the main line.
Recycler
Post Reply

Return to “Combinator Creations”