Page 1 of 1

Proposal: Factory Metrics

Posted: Mon Nov 18, 2019 10:09 am
by Hermitude
This is an idea thread for a mod project. It's open to thoughts or contributions from everyone.

The basic premise is that most people have only a few ways to "measure" their factory's operations. Usually it's SPM or rockets or some other item production rate. If you like building megabases, then UPS is a technical benchmark.

But what about factory efficiency? Is there a way to build a factory that is lean and efficient? Here are some ideas, feel free to add more:
  • Theoretical production capacity versus actual consumption. This would be a measure of how much excess infrastructure you dedicate to a given item production, usually ores but not limited to those.
  • Train idle time as a percentage. Logistic bot idle time as a percentage. These are also "excess" measures targeted toward transport machines.
  • Rail segment contention (1): for each rail segment, add any occupant train's acceleration or decelleration into an accumulator. Use a low-pass filter on that, then render accumulator values overlaid on the rail network to view which stops are causing trains to slow down / speed up.
  • Rail segment contention (2): for each rail segment, if it goes from green to red, add 1 to an accumulator. Again, use a low-pass filter to get a finite score. Render accumulator values as with (1).
  • Bottleneck identification: can this be done with Lua over transport belt segments, inserters, loaders, splitters, etc?
  • Space efficiency(1): given for each item; take its production rate and divide by the total space occupied by all your factory's structures. This gives a vector of "spatial efficiencies" one for each item. You can also take weighted combinations of these to get a family of factory space efficiency metrics.
  • Space efficiency(2): similar to the (1), but divide by the space of the convex hull of your factory. (Not for factories with numerous satellites.)
I'll revise these as I think of new metrics -- I just don't have the time to start writing the mod for a few weeks yet, and don't want to forget these before then.

Re: Proposal: Factory Metrics

Posted: Mon Nov 18, 2019 3:44 pm
by Amarula
I am all about the data (and visualizing that data!) This is a great start.
While not directly related to efficiency, metrics on pollution would be a very useful addition to this suite of metrics.

Re: Proposal: Factory Metrics

Posted: Mon Nov 18, 2019 4:56 pm
by pleegwat
Average distance any item is transported in its lifetime.

Re: Proposal: Factory Metrics

Posted: Mon Nov 18, 2019 11:35 pm
by Hermitude
Amarula wrote:
Mon Nov 18, 2019 3:44 pm
I am all about the data (and visualizing that data!) This is a great start.
While not directly related to efficiency, metrics on pollution would be a very useful addition to this suite of metrics.
This is a neat one. My initial impression is that it's difficult to expand on the existing pollution map. It's also difficult for a user to control pollution since it is always directly proportional to each crafting machine's products. So, a base that produces x products then produces c*x pollution. The only factors that a player controls outside of x are the layout, the belt buses, the logistics, and circuit logic etc. These factors aren't big contributors to pollution (to my knowledge, I could be wrong) so it's hard to see how a user would be able to use this information.

Mostly I'm trying to derive metrics that a player could use to optimize their factory. So it should be something they can control directly without simply producing at a slower rate.

Re: Proposal: Factory Metrics

Posted: Mon Nov 18, 2019 11:37 pm
by Hermitude
pleegwat wrote:
Mon Nov 18, 2019 4:56 pm
Average distance any item is transported in its lifetime.
This is a great one. It might be difficult to implement since the "life" of an item is difficult to define when it enters a stack. Maybe a way to implement this would be to measure the paths between the assemblers in a supply chain.

Re: Proposal: Factory Metrics

Posted: Tue Nov 19, 2019 5:27 pm
by pleegwat
Hermitude wrote:
Mon Nov 18, 2019 11:37 pm
pleegwat wrote:
Mon Nov 18, 2019 4:56 pm
Average distance any item is transported in its lifetime.
This is a great one. It might be difficult to implement since the "life" of an item is difficult to define when it enters a stack. Maybe a way to implement this would be to measure the paths between the assemblers in a supply chain.
I don't think you actually want to keep track for each item separately - just aggregate it per type, and divide by production, consumption, or the average of those. Not doable in lua since you don't have the events (and performance would be horrible if you did). In C++, trains should be easy enough and inserters are trivial especially if you ignore any chasing in the metric, but belts might be tricky.