KirkMcDonald / kirkmcdonald.github.io

Simple web-based calculator for the game Factorio.
Apache License 2.0
540 stars 148 forks source link

A request for pollution to be added in addition to power #107

Open sawbladex opened 5 years ago

sawbladex commented 5 years ago

Currently, the calculator reports power consumption, but not total pollution (ignoring the pollution of power generation, given that the calculator ignores drain, the fact that solar and nuclear power basically don't produce pollution for power, and pure boiler bases are kinda rare)

Pollution is easily calculatable multiplying power consumption by https://wiki.factorio.com/Pollution with the Pollution per KW per game second (60 ticks) entry in the table. and then multiplying (1+productivity moldule extra pollution.), but it is a pain in the neck to calculate using excel.

For burner furnaces, you can just multiply the number of furnaces by 1.8 or 3.6 depending on the class, or just use the same table, since looking at the CSV, you calculate the power requirements in W before converting into coal per minute time.

I am willing to contribute code for this, if it makes sense.

ajmalk commented 5 years ago

I looked into this. Unfortunately the data files don't seem to have pollution in them. I tried looking through the parser and could really make sense of it. If someone can point me to where in processdata.lua I need to to look at to add the pollution values I'd be happy to contribute that. After you have the data, adding an extra column in the table for pollution should be easy enough.

adrianvanderwal commented 5 years ago

I looked into this. Unfortunately the data files don't seem to have pollution in them.

They do.

{
    type = "furnace",
    name = "electric-furnace",
    <snip>
    energy_usage = "180kW",
    source_inventory_size = 1,
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input",
      emissions_per_minute = 1
    },

The emissions_per_minute is what you want.