OrderedSet86 / gtnh-flow

Factory Optimization Flowcharts for Gregtech: New Horizons
MIT License
84 stars 24 forks source link

Question: Technical processes in which air is used #8

Open Eldrinn-Elantey opened 1 year ago

Eldrinn-Elantey commented 1 year ago

Hello

Recently, a friend built a benzene production plant and I decided to calculate its parameters using your script. It turned out this:

- m: industrial coke oven
  tier: HV
  I:
    oak wood: 4
    nitrogen: 250
  O:
    charcoal: 5
    wood tar: 375
  eut: 96
  dur: 3.2
  number: 1
- m: fluid extractor
  tier: MV
  I:
    charcoal: 1
  O:
    ashes: 0.1
    wood tar: 100
  eut: 16
  dur: 1.5
- m: distillery
  tier: MV
  I:
    wood tar: 200
  O:
    benzene: 80
  eut: 64
  dur: 0.8
- m: centrifuge
  tier: MV
  I:
    air: 10000
  O:
    nitrogen: 3900
    oxygen: 1000
  eut: 7
  dur: 80  
- m: compressor
  tier: MV
  I:
  O:
    air: 2000
  eut: 2
  dur: 15

poisoniks_benzene

The question arose why air was supplied from the outside if its production was prescribed in the process. Did I describe the process incorrectly or is it a feature of the script?

OrderedSet86 commented 1 year ago

@Eldrinn-Elantey This is a feature, it is meant to reduce the complexity of the problem so it can be solved as a "linear program". While this may make some steps unnatural (you would pull cells from "source" instead of "air"), the recycling still ultimately works and the summary node is still accurate (0 net air).

For technical details - I try and avoid cycles in the graph, which means I run an algorithm that removes "back edges" and forces the graph into being a "directed acyclic graph" before I run anything else. You can see the method for this in src/graph/_preProcessing:95 (removeBackEdges).

I suppose I should make the documentation clearer by explaining a process fully, so I will leave this ticket open until I do that.