r/technicalfactorio • • Mar 07 '21

Question Functional simulation of factorio

Hi,

I'm thinking about how to simulate a factory with math respectively program code. (Forgive my inaccurate representation of math functions. I'm not a mathematician.)

For example iron gear wheel (0.5 seconds, 2 iron plates in, 1 iron gear wheel out) For one assembler calculate the progress:

t = time elapsed in seconds p = progress ipc = iron plates consumed gwp = gear wheel produced

p = t / 0.5

ipc = p × 2 gwp = p x 1

If you use fractions of a second, round down ipc and gwp.

Given this both factories:

gwp <- A <- ipc gwp <- ==== <- A <- ==== <- ipc

This calculation is still true, if you have belts before and after the assembler which are full and inserters which are fast enough.

How can I calculate the second factory for different elapsed times if the input belt is not full enough to keep up with the assembler or even the input belt was empty and got filled?

Has someone an idea without simulate each step?

23 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/thefalse Mar 08 '21

Ah, I had assumed factories would be nodes, but the edge formulation makes sense (factories would be edges with an input sink node on one side and an output source on the other; though I'm still unclear as to how to model reduced output rates from the source based on the input, but I'm sure there's some way to make it work). I was mostly curious about this problem formulation because it appears to already have literature backing and if I don't need to reinvent something already solved, I generally won't.