Global control (strategic idea)

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
thelordodin
Fast Inserter
Fast Inserter
Posts: 148
Joined: Fri Jan 06, 2017 1:54 am
Contact:

Global control (strategic idea)

Post by thelordodin »

Hello.

My factory is organazed in "towns" with trains for logistics, each town have input and output chests.
I'm trying to figure out some control system, made with circuit networks, which will control the whole factory.

This thing is going to tell each "town" to be ON or OFF.

I thought about several rules to make this system.
And I write this post to verify if this rules are correct and full, or, maybe you'll notice some flaws...

Rules are mathematical and build on variables, so I should at first introduce them.

The goal of the system:
To protect me from overproducing.
Example: too much red circuits when i'm short on iron and on green circuits.

Variables:
(All of them are sets of pairs (item_type : item value) ).
  • StorageSrc = summ of all contents of all chests
  • Reserve - minimal limit of items, i set this with constant combinator
  • Ratio - for items whose StorageSrc > Request i'd like to set ratio.
    For example i have 1M of Iron and no steel - if i set ratio to 5:1 (Iron:Steel)
    then the system should somehow manage to make just 100k of steel and stop production to keep 500k of iron in stock.
    I set this values with constant combinator too.
  • Production - Result. Set of item types to be produced. If an item type is not this set it's production is OFF (Suspended by system).
Assumptions and principles:
  • Chests are big and can hold unlimited number of items.
  • Logistics is out of topic: i'm using Train Logistics with Atomic Locomotives and don't have any issues with it.
  • System should never use reserved items. If reserved item is produced it should be kept and not used in futher production.
The algorithm:
  • Storage = StorageSrc - Reserve, remove any negative values
  • KOEF = Storage / Ratio
  • For each item_type in K
  • Compute item's recepie ingridients
  • If i get some item which type is not in Ratio set, then get it's ingridients instead of it.
  • Recursion here, till all types are ether simples, or in Ratio set. Simple ones are ignored.
  • Ignore counts, just need types, set counts to 1
  • The item type is produced if produce_item.KOEF < recepie_item.KOEF
  • Exclude items if they had negative values on stage 1 (i.e. reserve of this item-type is not fullfilled yet)
Now, if i have made such a system i just attach loading inserter or power switch of a town to "Production", so it will run only if production is needed.

Am i missing something here?... Hmpf...

Post Reply

Return to “Gameplay Help”