Production limit design.

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
User avatar
firestar246
Inserter
Inserter
Posts: 29
Joined: Sun Feb 19, 2017 11:25 am
Contact:

Production limit design.

Post by firestar246 »

So I'm a long time factorio player (probably around 1,000 hours since the 0.14 version) but have never really delved into the circuit side of things besides very basic liquid control for oil refining. I decided it was about time to teach myself. I've done a bit of block coding and real coding, but soon realized that the circuit network is a bit different and I have to think differently in order to get them to work. After a short time I got a counter setup to count how many iron plates I've made.

After a bit more of building up my factory, I decided my next challenge would be cleaning up my mall. My malls have always been a messy short bus with each item in it's own chest and spaghetti belts everywhere. It soon gets hard for me to find everything I need. So I decided to use one chest (or silo from Angel's warehouses) to store every item I need to have on hand. So I needed to create some sort of circuit network so that the assemblers would only deliver x amount of an item and not just fill up the entire silo with it. The easy way would be just to have an inserter read the contents from the silo and stop working if x amount is already in. Two problems with that:

1. Depending on the distance from the silo to assembler, a few extra items could already be making their way across the belts before the x amount gets put into the silo. I like even stacks and don't want a few spaces wasted by a couple extra items.

2. That's too easy. :) I wanted to make it a bit more challenging simply so I could try to learn the circuit system better.

So my goal became that if I wanted a stock of, say, 200 medium telephone poles in the silo, the assembler would only make 200 and take exactly the amount of materials needed, storing no extra inside itself. With the mods I have enabled, one ingredient is 2x steel, so I want the assembler to only take 400 steel. Then once I pull the poles out of the silo into my inventory, it resets and takes another 400. After about 2-3 hours of experimenting and trying things out, this is what I came up with:
Screenshot (2).png
Screenshot (2).png (2.43 MiB) Viewed 1366 times
So how does this work?

The top three combinators are each attached to an inserter. The next three combinators are the counters, and are each attached to the combinator above, and the inserters are each attached to a counter. As the inserter grabs materials, it sends the signal to counter, which keeps track of how many the inserter has grabbed in total, which is then sent to the combinator above. That combinator checks to see if the inserter has grabbed enough materials to craft 200 poles. So more the middle one that is attached to the inserter grabbing steel, it waits until the inserter has grabbed 400 steel, then outputs the signal "A", stopping the inserter from working.

And it worked! The inserters would stop after collecting the required materials and I'd get exactly 200 poles. The problem came when I needed the counters to reset after I grabbed the poles from the chest. That is where that last decider combinator comes in. It reads the contents from the chest and sends the signal "R" if the poles = 0 and sends it to the counters. The counters were set where they only count if "R" = 0; and that was the big problem.

They would reset correctly, but wouldn't start counting again until the first pole reached the chest, so the counters wouldn't count the materials for that one or any others that had already been made before that first one got to the destination.

Hence, the arithmetic combinator. I switched the counters to work so that instead of "R" = 0, that "R" != 1. The arithmetic combinator multiplies the "R" value by 2, then sends it to the counters. So when the chest is emptied of poles, for one tick the R value is 1, resetting the counter, before the arithmetic counter kicks in and sends another R value of 2, so that the counters are receiving an R value of 3, making them work again. When the first pole gets put into the chest, the one combinator stops sending its signal on the first tick, resulting in the counters getting a value of 2 from the arithmetic one. Once the 2nd tick happens, the arithmetic combinator stops sending its signal, so the counters aren't receiving R at all. Since R didn't equal 1 at any point during the decrease, it doesn't reset.

And that's it. Hopefully the explanation isn't confusing. :) It almost works as intended. I will get the exact required items that I want, but sometimes the inserters will put in a couple extra materials into the assembler, which I can't figure out. I had this setup for belts, undergrounds, and poles (with Bob's recipes). The belt assembler will get three extra gears, the underground one gets 4 extra plates, and the poles don't get anything extra.

The plus to this setup is that:

1. The chest gets exactly the amount I ask for, so it doesn't fill up a valuable space with 1 or 2 extra of an item.

The con is:
You need to take everything of the one item out of the chest before the assembler starts working again. That isn't a big deal if you're putting them all at once into your personal inventory, but if bots are taking them at a slower rate, the chest will have to run out before the assembler starts making them again.


All in all, it was a fun thing to design and helped me understand a bit of how this stuff works. Though I'm not even close though to being able to design the crazy stuff I've seen :)
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord.
Post Reply

Return to “Combinator Creations”