Page 1 of 1

How to calculate assembling time?

Posted: Tue Jun 11, 2013 7:41 pm
by ssilk
I found the receipes in the directory base/prototypes.

{
type = "recipe",
name = "science-pack-3",
enabled = "false",
energy_required = 20,
ingredients =
{
{"rocket", 1},
{"steel-plate", 1},
{"smart-inserter", 1},
{"advanced-circuit", 1}
},
result = "science-pack-3"
}

What I want to know: How is the time calculated, that it needs for a factory to produce such an item? For example copper-wire is very quickly produced science-pack-3 needs some time... Is the production time for all factories the same?

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 3:26 am
by pmnox
Oh, that's easy.
I make an assumption that 1 Basic Inserter moves 1 item every 1s (in reality it's 1 item every 1.2s) and base all of my equations based on relative speed.

All factories produce 1 item every 1s.
There are some exceptions, for example copper wires and basic belts are produced in pairs, so one pair is produced every 1s. That means 1 item every 0.5s. So better use two basic inserters for outputting products or one fast one.

Other items like science packs are x times slower depending on the time field that is visible in the gui(energy-required property in the file)
so:
science-pack-1 one item every 5s
science-pack-2 one item every 10s
science-pack-3 one item every 20s
rocket one item every 15s
burner mining drill 4
electric mining drill 5
rocket launcher 10
regular magazine 2
underground belt 2
lab 10
and a few others


However, most items take exactly 1s to produce, provided that you supply enough materials.

Burner Inserter moves 1 item every 1.4s
Basic Inserter //long hand Inserter moves 1 item every 1s.
Fast Inserter moves 1 item every 0.5s
Filter/smart Inserter moves 1 item every 0.4s.

Stone furnace produces one item every 3.1s. (iron, copper, coal with mining hardness of 0.9).
Burner mining drill produces one item every 3.1s. (iron, copper, coal with mining hardness of 0.9).
Burner mining drill produces one item every 2.38 - 2.43s (stone with mining hardness of 0.4).
Electric mining drill produces one item every 1.8-1.82s. (iron, copper, coal with mining hardness of 0.9).
Electric mining drill produces one item every 1.48s. (stone with mining hardness of 0.4).






So if you want to produce 1 electronic circuit every 1s then you have to supply 3 copper cables and 1 iron every 1s. So you need 4 basic insertions to do that or some other combination of inserters.

So 2 electronic circuit factories and 1 basic belt factory is enough to fully support 20 science-pack-2 factories.

I hope that this will help you.
note that 1 basic factory produces 50 items per minute not 60, so all times above should be multiplied by 1.2

EDIT:
I redid the tests. This time I used a more accurate method measuring the time in a more accurate way.

Basic Inserter transports 514 items in 10 minutes (51.4 per minute vs 50 using old method).
Fast Inserter transports 530 items in 5 minutes (106 per minutes vs 100 using old method).

Burner mining drill produces 161 items in 10 minutes. (16.1 per minute vs 17.85 using old method)
Electric mining drill produces 283 items in 10 minutes. (28.3 per minute vs 27.7 using old method)

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 7:53 am
by MF-
I though that assembling machines have a "speed" property, which is higher for the advanced one.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 7:55 am
by wrtlprnft
Also, different ores have a different “mining hardness”, so that has to account for something.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 9:14 am
by MF-
wrtlprnft wrote:Also, different ores have a different “mining hardness”, so that has to account for something.
I would expect that to affect mining time. (Unrelated to assembling time)

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 9:50 am
by wrtlprnft
MF- wrote:I would expect that to affect mining time. (Unrelated to assembling time)
Yeah, of course, but pmnox's post also contains numbers for the output rate of mining drills.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 11:00 am
by MF-
wrtlprnft wrote: Yeah, of course, but pmnox's post also contains numbers for the output rate of mining drills.
Oh, I didn't notice that the "paragraph about furnaces" speaks about mining drills as well.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 11:05 am
by pmnox
Hmm. I just made a test comparing stone and iron mining speed and I didn't notice any difference.
I'm not sure what "mining hardness stands for". Besides, every resource has "mining speed = 2" property.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 11:23 am
by wrtlprnft
Maybe it just refers to the amount of damage your pick will sustain by manually mining it (and possibly the energy consumption of the mining drill).

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 11:30 am
by pmnox
wrtlprnft wrote:Maybe it just refers to the amount of damage your pick will sustain by manually mining it (and possibly the energy consumption of the mining drill).
It probably does, I will check that later.
I'll also check what the mining speed is when using a pixaxe as well.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 12:04 pm
by pmnox
pmnox wrote:
wrtlprnft wrote:Maybe it just refers to the amount of damage your pick will sustain by manually mining it (and possibly the energy consumption of the mining drill).
It probably does, I will check that later.
I'll also check what the mining speed is when using a pixaxe as well.
Mining hardness may also affect the amount of coal/energy required to extract resources.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 1:04 pm
by ssilk
Very good answers… so this is fixed in the code?

I've also some suggestions, but I make them into another post.

Re: How to calculate assembling time?

Posted: Wed Jun 12, 2013 10:34 pm
by kovarex
About the mining hardness vs mining time:

Every tool or drill has mining speed.

Every tick when mining, the amount of mined is (MiningSpeedOfTool - HardnessOfMaterial).

The item is mined, when the mined amount reaches the mining time of the item.


Items that have low hardness and big mining time will be minable with all tools and the difference of speed will not be so big.
Items with hardness close to the hardness of best tool will be mined much faster with better tool, and not minable at all with all tools that have not big enough mining speed.

Re: How to calculate assembling time?

Posted: Thu Jun 13, 2013 6:11 am
by wrtlprnft
Very interesting, thanks for the clarification. I'd have thought the mining hardness was a factor by itself.

Also, I just noticed that copper, iron and coal have a hardness of .9, only stone has a hardness of .4, so the actual mining time is the same for all resources that are needed in a large quantity.

Re: How to calculate assembling time?

Posted: Thu Jun 13, 2013 11:13 am
by pmnox
kovarex wrote:About the mining hardness vs mining time:

Every tool or drill has mining speed.

Every tick when mining, the amount of mined is (MiningSpeedOfTool - HardnessOfMaterial).

The item is mined, when the mined amount reaches the mining time of the item.


Items that have low hardness and big mining time will be minable with all tools and the difference of speed will not be so big.
Items with hardness close to the hardness of best tool will be mined much faster with better tool, and not minable at all with all tools that have not big enough mining speed.
I missing speed of every tool hidden?
I can see that the Iron Pixaxe has iron power of 2.5, but I don't see mining speed written anywhere.
Besides, electronic mining drill has speed of 0.75.
So the amount mined is (0.75 (MiningSpeedofTool) - 0.9(HardnessOfMaterial)) = -0.15 every tick?
A negative value, seriously?

Re: How to calculate assembling time?

Posted: Thu Jun 13, 2013 11:49 am
by pmnox
wrtlprnft wrote:Very interesting, thanks for the clarification. I'd have thought the mining hardness was a factor by itself.

Also, I just noticed that copper, iron and coal have a hardness of .9, only stone has a hardness of .4, so the actual mining time is the same for all resources that are needed in a large quantity.
I was mistaken, there is some mining speed difference.

Re: How to calculate assembling time?

Posted: Thu Jun 13, 2013 12:47 pm
by wrtlprnft
Just for reference, the mining speeds of different tools:
  • iron axe: 2.5
  • steel axe: 4.0
  • burner drill: 2.5
  • electric drill: 3.0
There's still something off with the math, for example coal mined with an electric drill should take 2 / (3.0 - 0.9) = 0.952381 (what unit? seconds? probably not ticks), which does not match pmnox's numbers. Also, the player entity has a property mining_speed = 0.01, which can't be the number for bare hands, as that would mean the player can't mine anything without a tool, but he can just barely mine coal, so I guess the mining speed for bare hands is around 1.0.

Re: How to calculate assembling time?

Posted: Sat Jun 15, 2013 3:01 am
by pmnox
wrtlprnft wrote:Just for reference, the mining speeds of different tools:
  • iron axe: 2.5
  • steel axe: 4.0
  • burner drill: 2.5
  • electric drill: 3.0
There's still something off with the math, for example coal mined with an electric drill should take 2 / (3.0 - 0.9) = 0.952381 (what unit? seconds? probably not ticks), which does not match pmnox's numbers. Also, the player entity has a property mining_speed = 0.01, which can't be the number for bare hands, as that would mean the player can't mine anything without a tool, but he can just barely mine coal, so I guess the mining speed for bare hands is around 1.0.
According to my tests of electric mining drilll is 75 % faster than burner mining drill.
283/161 = 1.7577

Those are mining powers of each tool:
  • iron axe: 2.5
  • steel axe: 4.0
  • burner drill: 2.5
  • electric drill: 3.0
Further more we know that electric drill has speed of 0.75
and burner drill has speed of 0.5625.

Also mining hardness of iron/coal/copper is 0.9.

So if you take both speed of the drill and mining power and mining hardness into account then you get the following equation:
(performance of electric mining drill / performance of burner mining drill) =
(0.75 * (3-0.9)) / (0.5625 * (2.5 - 0.9)) = 1.75

So those equations match perfectly the results of tests that I conducted.

Electric mining drill with iron/coal/copper (0.9) should have performance of (0.75 * (3-0.9))x = 1.575x
Electric mining drill with stone (0.4) should have performance of (0.75 * (3-0.4))x = 1.95x
Burner mining drill with iron/coal/copper (0.9) should have performance of (0.5625 * (2.5 - 0.9))x = 0.9x
Burner mining drill with stone (0.4) should have performance of (0.5625 * (2.5 - 0.4))x = 1.18125

1.575x = 28.3 items per minutes
x = 17.96

So if all my equations are correct we get:

Electric mining drill with iron/coal/copper (0.9) should have performance of (0.75 * (3-0.9))x = 1.575x = 28.3
Electric mining drill with stone (0.4) should have performance of (0.75 * (3-0.4))x = 1.95x = 35.02
Burner mining drill with iron/coal/copper (0.9) should have performance of (0.5625 * (2.5 - 0.9))x = 0.9x = 16.16
Burner mining drill with stone (0.4) should have performance of (0.5625 * (2.5 - 0.4))x = 1.18125x = 21.21


I guess the developer confused the mining power, which is the amount of resource you get every tick, with the mining speed, which is how often do those ticks occur.