Smart Inserters Should Compare Red vs Green

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
S_Jacob
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed May 18, 2016 1:35 am
Contact:

Smart Inserters Should Compare Red vs Green

Post by S_Jacob »

Request:
Allow smart inserters to compare the quantity of the same material on two different networks (i.e. are there more iron plates on Red Circuit vs Green?)

Questions:

1. Is there any easy way now (or in 0.13) to have a smart inserter compare the quantities of the same item in 2 chests. (i.e. if iron plates in in this chest > then 2nd chest, stop loading)?

2. The high-throughput buffer system I use works best when the chests are balanced, are there other ways to balance that don't require combinators?

Problem:

My smelting system fully loads a single fast transport belt when running at full speed. I then use fast inserters on both sides to load plates into chests which are, in turn, emptied back onto belts that are load balanced and sent into my main factory. This works great as a buffer system, building up supply when my factory isn't producing much and then dumping it out if my smelting operation gets behind (generally cause I haven't been expanding to new resources fast enough!).

A partial implementation is in this photo (note that fully loading a fast transport belt requires 6 inserters on each side):
High Throughput Balancer
The problem is that when there are wide fluctuations in supply, the chests fill unevenly and therefore can't output a fully loaded belt when one is empty even though other chests might have thousands of plates.

Current Solution:
To force them to load evenly, I use smart inserters and tell them to only load if they are less than the next chest in line. But the only comparison you can do with the circuit network is against an absolute value or the value of some other material. As such, my current solution is to use an arithmetic combinator to output the quantity of a chest as a different material (e.g. change iron into copper). Then I can set the smart inserter to only load when the quantity of iron in it's chest is lower than the "copper" in the chest next to it.

This is what a 3 chest system looks like:
Combinator Balancer
The problem is that this requires 11 combinators for a 12 chest system, which is a huge waste of resources and space! I could also do this by switching the 2nd chest's quantity to negative, but it still requires a combinator.

Better Solution/Feature Request:
Allow smart inserters to compare values of the same material on two different circuit networks (red vs green)

Am I missing a better solution? Does anyone know if this will be possible in 0.13? If not, I'm going to submit it as a feature request.

Thanks!

S_Jacob
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed May 18, 2016 1:35 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by S_Jacob »

OK, so I still think that this should be a feature request, however, I have figured out a way to vastly simplify my balancing problem. It still requires two combinators but that's much better than 11!

Having read a few more technical posts about how the combinators work, I discovered that you can actually find the average value of a set of chests using two combinators. If that's possible then you can have a smart inserter only load chests when it's below the average.

So how do you do this? Well, when using "each" on the Decider combinator and "input value" on the output, it outputs the sum of all the inputs that pass the test. So if you use a simple test like "iron plates > 0," you get the sum of all of the iron in however many chests are connected. Then you send that as a random signal (say A) to an Arithmetic combinator that divides by the total number of chests. The output of that is sent to every smart inserter as signal A and can then be easily compared to the value of the iron plates in the chest the inserter is loading.

Example:
Iron plates loading into 4 chests
50 50 50 46

All connected to:
Decider Combinator (Each where iron plate > 0)
Output the input value as A
Output = 196 A

Send to :
Arithmetic Combinator (A/4)
Output = 49

Send to each Smart Inserter, also connected to the chest it's loading
Condition: Load if iron plates < A
In this case the inserter with 46 will keep loading and the value of A will rise to 50

This is the biggest drawback: you must have one fast inserter to keep driving up the average so that everything doesn't stop at 50. However, the more chests you have the more this chest has to load to increase the average by 1 plate. I may be able to get around this at some point but wanted to post this now in case anyone had ideas.
This is an example setup
I still think Smart Inserters should be able to directly compare a Red vs Green signal of the same material, but for now this may be the best way to (almost) perfectly balance chests.

FMTK
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon May 02, 2016 5:17 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by FMTK »

Still @ work. Will post a solution I use for a similar problem tomorrow morning.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by siggboy »

S_Jacob wrote:OK, so I still think that this should be a feature request, however, I have figured out a way to vastly simplify my balancing problem. It still requires two combinators but that's much better than 11!
Probably you've arrived at a solution very similar to this one: 23125
This is the biggest drawback: you must have one fast inserter to keep driving up the average so that everything doesn't stop at 50. However, the more chests you have the more this chest has to load to increase the average by 1 plate. I may be able to get around this at some point but wanted to post this now in case anyone had ideas.
The answer to this problem is in the solution linked above. You might try to figure it out yourself before reading it (it's so easy that it's hard to see :).

I don't think there's an easier way to solve this problem.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

S_Jacob
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed May 18, 2016 1:35 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by S_Jacob »

siggboy wrote:Probably you've arrived at a solution very similar to this one: 23125
Haha, yes, that's exactly it. I was actually almost there on my own. I had added a fixed number to the average but didn't realize I could switch back to all smart inserters. Thnx for the reference.

Interesting that they also balance the output side. That's helpful when your throughput slows down so that only 1 or 2 chests are transferring but I'll need to test that it doesn't prevent my 6 inserter setup from filling the fast transport belts I use.

I still think that inserters should have an option to compare red vs green networks. No only could I do this build without combinators, but I could also make routing decisions based on readings in different parts of factories. But with all the changes in 0.13, I'll wait and see.

Thnx again for the help.
FMTK wrote:Still @ work. Will post a solution I use for a similar problem tomorrow morning.
FMTK, was this similar to your solution? Would love to hear other ideas!

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by siggboy »

S_Jacob wrote:Interesting that they also balance the output side. That's helpful when your throughput slows down so that only 1 or 2 chests are transferring but I'll need to test that it doesn't prevent my 6 inserter setup from filling the fast transport belts I use.
Balancing the belt->chest direction is a lot more useful than the other direction, because it allows you to simply make a long line of inserters along the belt and have the chests loaded evenly. No more hierarchy of splitters just to load a bunch of chests. Of course the main application is loading trains.

This will also still be very valuable in version 0.13 with Rapid Inserters.

The other direction is not so important in my opinion, it's mainly cosmetic. You'd probably use it for buffer chests, maybe at the exit of a furnace column, so they'll unload evenly even after the belt has been backed up for a while (I'm pretty sure that's what you meant). However, as long as your furnaces can meet the demand, it does make no difference if the buffer is even or not -- and when your furnaces run dry, you better fix that instead of worrying about uneven buffers.
I still think that inserters should have an option to compare red vs green networks. No only could I do this build without combinators, but I could also make routing decisions based on readings in different parts of factories. But with all the changes in 0.13, I'll wait and see.
They won't add an option that allow comparing red to green, not in inserters and not anywhere else. It would require a new, and more complex UI for all circuit related functions.

Twinsen is already reluctant to add more combinators to the game, for fear of complexity. Red vs Green is not easy to represent in a UI in a comprehensible way, and designing UI is absolutely not a strength of the Factorio team (they get most other things right, though).

By the way, it's possible to compare red and green network contents, but you need to gate out the signals from the two networks before you compare them. That's not even difficult. It would probably be more difficult in general if you provided extra UI for that (which most of the time would only be in the way).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

S_Jacob
Burner Inserter
Burner Inserter
Posts: 8
Joined: Wed May 18, 2016 1:35 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by S_Jacob »

siggboy wrote:The other direction is not so important in my opinion, it's mainly cosmetic. You'd probably use it for buffer chests, maybe at the exit of a furnace column, so they'll unload evenly even after the belt has been backed up for a while (I'm pretty sure that's what you meant).
Yep, exactly what I meant.
siggboy wrote:Red vs Green is not easy to represent in a UI in a comprehensible way, and designing UI is absolutely not a strength of the Factorio team (they get most other things right, though).
Haha, yes, I've never been impressed with their UIs. They are extremely functional, to the point of sometimes not being very intuitive, forget being pretty. This is made even harder by continually adding new elements (to satisfy people like me!). But that's part of being Early Release and having a ton of things to complete. I do think if they re-designed theme from scratch (which they are starting to for 0.13 and hopefully will do completely before official release), there could be intuitive ways to symbolize Red vs Green. But for now, I agree that gating using combinators is "good enough" and that minimizing the complexity of individual elements is probably best.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: Smart Inserters Should Compare Red vs Green

Post by siggboy »

S_Jacob wrote:
siggboy wrote:The other direction is not so important in my opinion, it's mainly cosmetic. You'd probably use it for buffer chests, maybe at the exit of a furnace column, so they'll unload evenly even after the belt has been backed up for a while (I'm pretty sure that's what you meant).
Yep, exactly what I meant.
Thinking about it, I've found at least one application of the "balanced unloader" that serves a purpose: if you want to create a mixed belt of items at a certain ratio, in order to have a compact feed for an assembly line, then the balanced unloader can be very helpful.

For example, it's possible to feed up to 32 tier-3 assemblers for Advanced Circuits (red circuits) from a single blue belt, because the ratios of the ingredients are 2:1:1. So you can make one half-belt with Copper Wire (2) and another half belt with a 1:1 split of EC and Plastic Bar, then merge the two lanes and run it along the circuit assembly line.

This will work great if you have a constant feed of EC and Plastic Bar, so your lane balancer can create a 1:1 split of these items. However, if one of those items dries up, your lane balancer will create an uneven split (let's say you run out of Plastic Bar, then suddenly the lane will consist of only EC) -- and that's an unrecoverable situation, you have to clear the belt manually to reset it.

So in such a setup it's great if you can unload the two materials in a strict 1:1 ratio; as soon as one of them slows down or dries up entirely, the belt won't be filled at all. Even the lane balancer might not be needed at all.
Haha, yes, I've never been impressed with their UIs. They are extremely functional, to the point of sometimes not being very intuitive, forget being pretty. This is made even harder by continually adding new elements (to satisfy people like me!). But that's part of being Early Release and having a ton of things to complete.
Sorry but I don't think they're that functional. "Functional" is not a synonym for "ugly".

Also, being in "early release" is not an excuse for exquisite blunders. The game is in "alpha" for 4 years now, that's ludicrous. Back in the day when "alpha" meant something in the software world, it used to denote software prototypes or extremely early stage software barely out of the prototype phase. Factorio is not "alpha" software in that sense, at all.

The gaming industry has redefined the phrase "alpha software" to mean something else, namely "please let us work on the game, it's done when it's done, kkhtxbai".

You could even say that "alpha", "beta" in software does not mean anything at all anymore, due to the dilution of semantics, but I wouldn't go so far -- as long as you keep in mind who you're dealing with. Blizzard Entertainment, for example, is renowned for their polished products; they keep software in "beta" for months, when other companies would have long released (when Heroes of the Storm was still in "Alpha" according to them, it was actually a finished product in my eyes).

Getting back to the UI topic: some of the UI in Factorio is a nightmare, for example the train UI and the research screen. That's not lack of polish, that's just bad and should not be in the game after so many years.

The player toolbar is a disaster as well, it does not work like toolbars work in any other game, it's just extremely annoying that the toolbar is part of your inventory and does not show the total count of items that you're holding. Awful, unfortunately it can't be modded or else I'd do it.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Post Reply

Return to “Gameplay Help”