[outdated] Some (maybe) useful tools for factory design

Outdated stuff. Maybe someone can learn from it.
Palpatine
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue May 06, 2014 9:07 pm
Contact:

[outdated] Some (maybe) useful tools for factory design

Post by Palpatine »

I find it a lot of fun to optimize factories, so here is some tools to help with that.
1. factorio.py is a script to convert recipes into flowchart using graphviz. Recipes are entered into a table like factorio.csv, where 1st column is the product, 2nd column is the efficiency modifier (blue assembler has 0.75, furnace has 2, etc.), and the 3rd column is the time cost for 1 product. All the things you want as output belong to the first row. temp.dot is an example from my version of factorio.csv, and temp.svg is the factual flowchart, where the number on the arrows show volume and the number on the nodes show the number of factories your need. I know there is a nice lua script that read directly from the game files, but I cannot make it to run.

Update: I got the recipe directly from the game data so it should be accurate now (except for mining and the oil processing shit). Also raw materials are no at the top and output are now at the bottom, separated. The real improvement is that now you only need to modify the demand.csv file to create your own graph for a specific factory and the script will hide anything that's irrelevant.
Here is an example of a bootstrapping factory to beeline logistic bots.
temp.png
temp.png (379.22 KiB) Viewed 33324 times
2. playground.zip is a just an empty scenario with all the essentials (mines and electricity) so you can design your factory in map editor without doing the essentials yourself.
Attachments
planner.zip
A new version with separate output bubbles. Contains the script and the recipe, and demand list, they must be in the same folder.
(4.48 KiB) Downloaded 617 times
playground.zip
A map with everything
(473.9 KiB) Downloaded 565 times
Last edited by Palpatine on Fri May 23, 2014 7:25 pm, edited 2 times in total.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Some (maybe) useful tools for factory design

Post by MF- »

What is the attached graph actually about?
You chose a pack of things to be made in a fixed ratio?
It would IMO really improve the appearance if you could get rid of that big output node
and get outputs separated.

Also - why the... fractions? Percentages? Why does 0.00<unit> go to the output from the right side?

Also - some lines fork (mmmkay) and some merge (confusing) + there are odd gaps in the lines in there.

Nevertheless, I agree that such tool might indeed be useful for those that want all factories at 100% capacity.
(I don't happen to be one of those, if everything is at 100% capacity, then everything is a bottlenect :D)
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by ssilk »

MF- wrote: if everything is at 100% capacity, then everything is a bottlenect :D)
:lol:
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Palpatine
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue May 06, 2014 9:07 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Palpatine »

MF- wrote:What is the attached graph actually about?
You chose a pack of things to be made in a fixed ratio?
It would IMO really improve the appearance if you could get rid of that big output node
and get outputs separated.

Also - why the... fractions? Percentages? Why does 0.00<unit> go to the output from the right side?

Also - some lines fork (mmmkay) and some merge (confusing) + there are odd gaps in the lines in there.

Nevertheless, I agree that such tool might indeed be useful for those that want all factories at 100% capacity.
(I don't happen to be one of those, if everything is at 100% capacity, then everything is a bottlenect :D)
The set quantity for output is supposed to be unit per second. I didn't round the factory numbers because sometimes fractions helps in case you have speed modules nearby.
I agree having output separated should help with the appearance. I need sometime to modify the script. The 0.00 on the right side just appeared because I set the speed module production at 0.001 per second.
The merge and fork thing is a simple graphviz option, just set the concentration=false at the beginning of the file and it should get fixed. I had the merge on because it sometimes helps with planning belt sharing.
Here is an example of with the merge/fork thing turned off (though I have changed some requirement for my new factory).
temp.png
temp.png (460.57 KiB) Viewed 33662 times
Garm
Filter Inserter
Filter Inserter
Posts: 368
Joined: Mon Nov 18, 2013 9:46 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Garm »

Thank you - this shall be used mercilessly when I will upgrade my manufacturing base.
Bleda
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Sun Feb 02, 2014 6:58 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Bleda »

this script would be perfect for the tight spot challenge. I did that with a pen and paper to get my factories balanced, which is actually the point of these missions, rather than using few space.

It would be great to have it read directly from the game files though. :)
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Some (maybe) useful tools for factory design

Post by MF- »

Ha, much better.
Is it possible to keep "fork" while turning off "merge"?
I don't have anything against forks.

PS: I noticed that Coal input node is rather hidden.
It sure makes the graph more compact, but on the other hand it allows such input to be missed.
I wonder if it would still be compact enough if inputs were forced to the top layer. Or different node border style?
(just a thought, with only a handful of raw materials available it's not that hard to spot something is missing)

one more number question: so.. the number IN the node bubble says how many assembling machines are necessary?
Palpatine
Burner Inserter
Burner Inserter
Posts: 17
Joined: Tue May 06, 2014 9:07 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Palpatine »

MF- wrote:Ha, much better.
Is it possible to keep "fork" while turning off "merge"?
I don't have anything against forks.

PS: I noticed that Coal input node is rather hidden.
It sure makes the graph more compact, but on the other hand it allows such input to be missed.
I wonder if it would still be compact enough if inputs were forced to the top layer. Or different node border style?
(just a thought, with only a handful of raw materials available it's not that hard to spot something is missing)

one more number question: so.. the number IN the node bubble says how many assembling machines are necessary?
Cheers! I got a new version working. I have updated the original post. And yes the number in the bubble means the number of assemblers necessary. It is accurate for furnace and chemical plant but not accurate for oil processing and mining.
MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Some (maybe) useful tools for factory design

Post by MF- »

Cheers!

Does it get weird when you request an intermediate product (as in the picture currently in the OP for the advanced circuits)?

I guess having the output node had some benefits for the graph structure.
I wonder what it would look like if there were dedicated output nodes for each output item.
Would it improve the overall structure and readability of the already great tool?

Currently its not really obvious how many items get produced, which could be nicely improved by labeling those dedicated output nodes like "82x advanced_circuit"


final number question: What does the number on "Water" say? "8.42" seems too much for the offshore pump count
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Choumiko »

Nice tool, thank you for that.

I modified dot_print(items) to show the required assembling machines/ furnaces on the arrows/edges (after items per second) when the item is used in different recipes, makes it easier to create "subfactories" :D
Here's the code if anyone is interested:
Code
And the graph for a factory that produces 1.5 solar panels per second:
temp.png
temp.png (58.08 KiB) Viewed 33232 times
What I'd like to see is a way to tell the script that i want to run x assemblers at 100% capacity, so demand.csv could look like:

Code: Select all

solar_panel,1,basic_accumulator,1,speed_module_3,2
mode=0 <- 0 means assemblers, 1 means items per second
I'd try and do it myself, but I don't know Python :?
nepp95
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Wed Apr 16, 2014 6:48 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by nepp95 »

I don't understand graphviz although I'd like to mathematically optimize my factories :P
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Choumiko »

nepp95 wrote:I don't understand graphviz although I'd like to mathematically optimize my factories :P
I'm not really sure what you don't understand, so here's a quick todo list:
0. download, unzip the archive from OP
1. install python and graphviz
2. edit demand.csv to your liking
3. run factorio.py
4. open the Downloads/temp.dot created by factorio.py with Graphviz
5. profit :mrgreen:

Hope this helps, else let us know what's not working/clear.


As a follow-up to my previous post:

Code: Select all

rocket_defense, 1.5
as demand.csv (1 assembling machine producing the rocket defense non-stop) makes me think this factory is impossible
Graph
Challenge accepted, anyone? :twisted:
just_dont
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu Apr 17, 2014 1:24 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by just_dont »

I'd imagine getting 150 alien artifacts per second would eventually become the biggest problem. Even several largest chests of AAs will get dry very fast (probably even before you can "debug" your layout).
Although ~150K of iron plates per second seems scary, I'm pretty sure it can be parallelized enough.
nepp95
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Wed Apr 16, 2014 6:48 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by nepp95 »

@Choumiko,

Ofcourse I forgot to download python :mrgreen: And I even considered myself a programmer...
I think I get it now :P

-Edit-

The number you put in demand.csv, what should this be if you, for example, want one assembler 2, to produce at max capacity?
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Choumiko »

normaly the numbers is desired items per second, so for 1 assembler lvl 2 it should be x = 1 / crafttime * 0.75
e.g. for SciencePack 1 with craftingtime = 5: 1/5*0.75 = 0.15
put in 0.15 in demand.csv and your good to go
just_dont wrote:Although ~150K of iron plates per second seems scary, I'm pretty sure it can be parallelized enough.
Sure it can, what i menat with impossible is: can Factorio handle the amount of assemblers? (e.g. 6k for speed module 3 assemblers alone :o ) I imagine the engine is going to reach it's limits rather quickly.
Mikenter
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Aug 01, 2014 9:06 am
Contact:

Re: Some (maybe) useful tools for factory design

Post by Mikenter »

And to think I was doing this all by hand... Though this does confuse me a little. For example, why do you need to mine more iron than iron plates? Shouldn't those be the same or am I just missing something super obvious?
Blackence
Fast Inserter
Fast Inserter
Posts: 109
Joined: Thu Jun 05, 2014 4:03 pm
Contact:

Re: Some (maybe) useful tools for factory design

Post by Blackence »

The numbers inside nodes do not describe the number of items you need per second, but the number of furnaces / miners / assembly machines required to produce the required amount of items (the numbers are apparently wrong for oil / chem plants). For the number of "items per second", check the edges. The sum of inputs / outputs add up correctly for the cases where I checked this.
Mikenter
Manual Inserter
Manual Inserter
Posts: 3
Joined: Fri Aug 01, 2014 9:06 am
Contact:

Re: Some (maybe) useful tools for factory design

Post by Mikenter »

Oh okay, so it was something stupid obvious. So you would need 100 something miners for that... Wow. Still this will beat doing to all by hand. Thank you!
Post Reply

Return to “Archive”