Smart Furnace - Setting Filters

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.
Post Reply
Mullematsch
Inserter
Inserter
Posts: 22
Joined: Fri Apr 01, 2016 11:31 pm
Contact:

Smart Furnace - Setting Filters

Post by Mullematsch »

I have been messing around with the new mechanic that inserters can automatically have their filters set.
Using this, it is very easy to set up a smart furnace which can smelt copper/iron as well as stone bricks and steel. Also could smelt more if they would add ores or you would build this in modded.
By using negative values, we can enable the filters if x amount of an item is in the chest. This way, we can make sure that the inserter to the furnace does not take the iron plates, unless there are five in the chest and does not take the stone ore unless there are two.
You need to have all the inserter upgrades otherwise it will not take five at once.
Of course that is easy to fix by triggering the inserter twice if iron = 5!
Excuse my painting skills
I have not tested this throughfully but as far as I can tell there are no problems with it. I am going to build this in my world soon and deal with any issues that might come up. Also probably going to implement a light show, beacons (which turn off if not in use) as well as indicators for what and how much is getting smelted.

Feel free to checkout the video in which I showcase the design (starts at: 17:21):
https://www.youtube.com/watch?v=6Wvr-0KvFz4

What do you guys think - seems like a pretty neat design to me!? :mrgreen:
Join me in my Factorio Let´s Play: https://www.youtube.com/user/Mulematsch

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

The problem with this is that the buffer chest may get overfilled with items because there is no prevention for that in your build.

And once the chest has more than >5 items the Filter Stack Inserter won't give a damn about the fact that there are too many items in the chest... meaning it will enter 6-13 items in one go as well if there's enough in the buffer chest (which is going to happen if your ore belt piles up with items).


Currently there is no reliable way to 100% gurantee the correct amount of items being entered into a chest/machine/whatever. It's just not possible in a convenient way. At some point the setup will freak out either from overcomittment, starvation, inserter time outs and other stuff like that.

I even tried using 3 inserters... 1 putting items into the chest as long as there < 5 plates in the chest, 1 putting into the furnace if =5 and the third takes the wrong count crap out of the chest again and puts it back on the belt if <5 or >5. And still I couldn't really get it to work because of how it takes a lot of tries until the number matches 5.


The only real way to fix the issue is waiting for the Devs to add an option to use the filter signal as stack size. There is already a thread suggesting that because it's a huge issue for count perfect systems: viewtopic.php?f=6&t=27673

Mullematsch
Inserter
Inserter
Posts: 22
Joined: Fri Apr 01, 2016 11:31 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by Mullematsch »

MeduSalem wrote:The problem with this is that the buffer chest may get overfilled with items because there is no prevention for that in your build.

And once the chest has more than >5 items the Filter Stack Inserter won't give a damn about the fact that there are too many items in the chest... meaning it will enter 6-13 items in one go as well if there's enough in the buffer chest (which is going to happen if your ore belt piles up with items).


Currently there is no reliable way to 100% gurantee the correct amount of items being entered into a chest/machine/whatever. It's just not possible in a convenient way. At some point the setup will freak out either from overcomittment, starvation, inserter time outs and other stuff like that.

I even tried using 3 inserters... 1 putting items into the chest as long as there < 5 plates in the chest, 1 putting into the furnace if =5 and the third takes the wrong count crap out of the chest again and puts it back on the belt if <5 or >5. And still I couldn't really get it to work because of how it takes a lot of tries until the number matches 5.


The only real way to fix the issue is waiting for the Devs to add an option to use the filter signal as stack size. There is already a thread suggesting that because it's a huge issue for count perfect systems: viewtopic.php?f=6&t=27673
You can for sure build smart furnaces and have them work reliably. Build one design in my modded world which has been working flawlessly and one in vanilla as well. The only problem I see is what you mentioned, the buffer chest filling up and then the inserter taking for example five stone at once and that way getting the furnace stuck. Should be an easy fix though since the inserter which puts stuff in the buffer chest has no wires attached to it so I can just add some logic for that.

I will build this design in my world soon and then post the final version again! :)
Join me in my Factorio Let´s Play: https://www.youtube.com/user/Mulematsch

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

Re: Smart Furnace - Setting Filters

Post by siggboy »

Mullematsch wrote:Should be an easy fix though since the inserter which puts stuff in the buffer chest has no wires attached to it so I can just add some logic for that.
I will build this design in my world soon and then post the final version again! :)
The inserter that is loading the buffer chest has the same limitation. Depending on research, it will insert 1-3 items into the buffer, and you can not control this.

This is not 0.12 anymore, where inserters pick up 1 item for a belt, and the stack limit is 5 (you are wrong about that BTW in your OP).

Also, why do you loop the loading belt back to itself? That does absolutely nothing (except waste space).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Mullematsch
Inserter
Inserter
Posts: 22
Joined: Fri Apr 01, 2016 11:31 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by Mullematsch »

siggboy wrote:
Mullematsch wrote:Should be an easy fix though since the inserter which puts stuff in the buffer chest has no wires attached to it so I can just add some logic for that.
I will build this design in my world soon and then post the final version again! :)
The inserter that is loading the buffer chest has the same limitation. Depending on research, it will insert 1-3 items into the buffer, and you can not control this.

This is not 0.12 anymore, where inserters pick up 1 item for a belt, and the stack limit is 5 (you are wrong about that BTW in your OP).

Also, why do you loop the loading belt back to itself? That does absolutely nothing (except waste space).
You can detect how many items the inserter picked up by checking the chest.
All I meant is that if you have no inserter upgrades the design will not work unless you activate the second inserter twice for iron.

I am looping it so there is no way that anything gets stuck. Probably not necessary but since I will add some logic to prevent the first inserter of picking up too many items, they might clock up at the end while the first furnaces are done with smelting already.

I see the problems that you are mentioning: not being able to influence how many items the inserter picks up but I am pretty sure I can fix that. We will see! ;)
Join me in my Factorio Let´s Play: https://www.youtube.com/user/Mulematsch

Mullematsch
Inserter
Inserter
Posts: 22
Joined: Fri Apr 01, 2016 11:31 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by Mullematsch »

Managed to get it to work even if the belt is completely filled up:
Have the two inserters on a clock so that way I can detect the item count in the chest and guarantee that the furnace does not get stuck.
Definitely works but there should be a better way to fix this issue. Might attempt to use the mechanic that we can send to the circuit network how many items the inserter picks up.
I will play around with it some more once I build this in my world (and find some spare time). :)
Join me in my Factorio Let´s Play: https://www.youtube.com/user/Mulematsch

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

Mullematsch wrote:Managed to get it to work even if the belt is completely filled up:
Have the two inserters on a clock so that way I can detect the item count in the chest and guarantee that the furnace does not get stuck.
Definitely works but there should be a better way to fix this issue. Might attempt to use the mechanic that we can send to the circuit network how many items the inserter picks up.
I will play around with it some more once I build this in my world (and find some spare time). :)
The clock is still problematic.

Imagine with the clock checking in each tick if the chest is filled up... the inserter will continue to work as long as the chest contents are below <5 Iron Plates for example. It will pick up 3 items... insert into the chest. Then it will pick up another 3 items (since you basically can't prevent the inserter from doing so with that approach) and there you have it. 6 items in the chest and the inserter stops working and the thing becomes deadlocked.


The only other way is to use the amount of items the inserter is currently holding... but that means you have to turn on/off the filter signal once it reaches a certain threshold. I'll look into that later. Some other people experimented with that already, though that approach had some problems of its own with inserters timing out when the items are too sparse on the belt or something.


At least all the combinator + buffer chest mess is not really worth it when you ask me. It takes so much space that you can't fit the crap between beacons. And when you can't fit it between beacons it doesn't make much sense to have smart furnaces in my opinion because the additional space wasted by all the combinator mess would be better spend on additional furnaces then.

Point is that back when I helped founding the idea of having Smart Furnaces it was with the goal in mind to eventually use the setups together with Beacons for one reason: Beacons consume energy wether the furnaces are smelting something or not. So it was the intention to make them work on multiple input items at once so that when one source item runs out or output item reaches a buffer limit it can switch to a different recipe, without the Beacons becoming idle power hogs. It was never really intented to use the stuff without Beacons because the effort for such a setup kills the purpose otherwise. :s

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

Re: Smart Furnace - Setting Filters

Post by siggboy »

MeduSalem wrote:So it was the intention to make them work on multiple input items at once so that when one source item runs out or output item reaches a buffer limit it can switch to a different recipe, without the Beacons becoming idle power hogs. It was never really intented to use the stuff without Beacons because the effort for such a setup kills the purpose otherwise. :s
Well, the power hog problem can now be more easily solved by flipping the power switch on the furnace column while you don't need it.

However, I still think that Smart Furnaces have their place, because power usage of the factory is not everything (in fact, especially the solar users probably don't care). If you have to build fewer furnaces, because they're smart, then you also need to craft fewer speed modules, lay fewer belts, etc. Everything becomes more compact and a bit more manageable on a large scale.

If your goal is to make x rockets/minute, and you have done the math, then you should know pretty much exactly how many iron/copper/steel furnaces you need, respectively. In that case, Smart Furnace really does not do a lot for you.

It's probably something nice and tidy to be proud of for your main factory that makes the stuff which then makes the rockets later on.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

siggboy wrote:Well, the power hog problem can now be more easily solved by flipping the power switch on the furnace column while you don't need it.
True... I'm already doing that based on demand. I'm still using a Iron/Copper Ore Smart Furnace until there is a way to add Stone Ore/Iron Plates back into the mix.

For the Iron/Copper Ore Smart Furnace I'm already using combinators to check if both Iron Plates and Copper Plates are below a certain threshold and if so then distribute the Furnace Rows accordingly using the Set Filter option of Inserters ("Iron AND Copper < Limit": 1/2 of the Array for each resource, "Iron OR Copper < Limit": Use entire array for the missing resource). And if both limits are met then switch off the entire array of Beacons/Furnaces with a Power Switch.

So yeah the Power Switch basically changes certain paradigms, can't deny that.
siggboy wrote:However, I still think that Smart Furnaces have their place, because power usage of the factory is not everything (in fact, especially the solar users probably don't care). If you have to build fewer furnaces, because they're smart, then you also need to craft fewer speed modules, lay fewer belts, etc. Everything becomes more compact and a bit more manageable on a large scale.
I agree... less idle sitting furnaces may also be interesting for people without power problems due to how they don't have to build as many furnaces then. But currently I don't think that with all the combinator/chest crap necessary it would be more compact. Less idle furnaces though, but not really compact.
siggboy wrote:If your goal is to make x rockets/minute, and you have done the math, then you should know pretty much exactly how many iron/copper/steel furnaces you need, respectively. In that case, Smart Furnace really does not do a lot for you.

It's probably something nice and tidy to be proud of for your main factory that makes the stuff which then makes the rockets later on.
x rockets/minute is something that adds a 24/7 drain on your resources anyways so in such cases the furnaces won't be idle that much... so you can't really save on the amount of Furnaces necessary anyways with a Smart Furnace.

For applications like that a setup using PM3s in furnaces and SM3s in Beacons might be the best approach to profit from the speed and make everything more compact. But then again it costs more energy.

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

Re: Smart Furnace - Setting Filters

Post by siggboy »

MeduSalem wrote:For the Iron/Copper Ore Smart Furnace I'm already using combinators to check if both Iron Plates and Copper Plates are below a certain threshold and if so then distribute the Furnace Rows accordingly using the Set Filter option of Inserters ("Iron AND Copper < Limit": 1/2 of the Array for each resource, "Iron OR Copper < Limit": Use entire array for the missing resource). And if both limits are met then switch off the entire array of Beacons/Furnaces with a Power Switch.
That's an approach that I would use myself -- it's not trying to make it better than it needs to be. It would still help because you don't have to build separate areas for iron and copper smelting. It's all just one big smelting area, with every furnace having access to both ores, and then you just do a simple allocation to get both kinds of plates when you need them.

Steel is something that you only need in large quantities for one thing: Low Density Structure. So it should be pretty clear how many furnaces you need to make steel; and you simply stop feeding them while your output buffers are full. I don't see how integrating the steel smelting with the other furnaces does help (aside from overengineering to feed your inner demon).

Steel for other stuff like science (doesn't matter for post-end game) and some things like rails can simply be smelted in place, close to where it's consumed (same is true for stone bricks, although if you have a high demand for concrete you'll probably make all the stone products in your main furnace area).
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

siggboy wrote:(aside from overengineering to feed your inner demon).
Well... If we didn't overengineer stuff we wouldn't have any purpose of continuing to play the game after so many playthroughs. So my inner demon is restless. :P

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

Sorry for double posting... but I wrote earlier that I would try something:
MeduSalem wrote:The only other way is to use the amount of items the inserter is currently holding... but that means you have to turn on/off the filter signal once it reaches a certain threshold. I'll look into that later. Some other people experimented with that already, though that approach had some problems of its own with inserters timing out when the items are too sparse on the belt or something.
I did now... incorporating BlakeMW's approach from this thread over there: viewtopic.php?f=8&t=28842


My result looks as following (don't mind the mess... I experimented around a lot until I got it to work):
Smart Furnace - Test.jpg
Smart Furnace - Test.jpg (164.88 KiB) Viewed 8190 times
This build is pretty much deadlock free.


How it works more or less:

The constant combinator is holding the individual Stack Sizes.
The Arithmetic combinators then substract the Contents of the Buffer chest from the Individual Stack Sizes.
The output signal from the first 4 of Arithmetic combinators then get added to the fifth Arithmetic combinator which outputs the each signal which multiplies the Hold Signal from the Inserter with -3.. (don't ask me why that works, that's BlakeMWs genius work.)

Basically it dynamically adjusts the Stacksize to match with "the missing" amount of items in the buffer chest.

The Inserter inserting from the Buffer chest into the furnace works when Each = 10. That ensures that either 10 Iron/Copper ore or 10 Iron Plates or 10 Stone get inserted, which leaves no residuals.

The other Filter inserter that connects Input Buffer Chest and Output Buffer Chest is there because sometimes really odd things happen which I can't explain. But it basically works when Eaach > 10, meaning it moves some items out of the Input Buffer if there are too many for some reason.


The only problem that occured to me was when the Insert Buffer chest lacks a certain resource and when the inserter got the filter signal to enter more it may become deadlocked with a single signal if the belt never brings the item it expects.
So with other words you have to ensure a steady stream of mixed items circling around so that the inserter can top off the chest or otherwise the inserter may sit there waiting forever.

It's a problem because I tried using Stack Filter Inserters and they only support 1 Filter. The problem doesn't occure with regular Filter Inserters but I don't know if a regular Filter Inserter can keep up with the Furnace Speed I tried to work with.
That said it's somehow dumb that the Filter Stack Inserter doesn't support 5 filters as well then this wouldn't be an issue at all.


It's a ridiculous contraption but it really works without any issues.


Maybe there's a way to optimize the 4 arithmetic combinators with some sort of Each stuff or implicit adding, I don't know. I found the simplest solution to have one for each resource type.

Edit: I found a way to minimize the amount of arithmetic combinators by multiplying the chest contents Each with -1 before implicitely adding them to stack sizes specified with the constant combinator:
Variant 2
Also changed the Stack Filter Inserter to a regular Filter Inserter. It's barely fast enough to pick up from the belt in time... Resolves the above mentioned problem of getting stuck with a particular filter once items on the belt run low.

BlakeMW
Filter Inserter
Filter Inserter
Posts: 950
Joined: Thu Jan 21, 2016 9:29 am
Contact:

Re: Smart Furnace - Setting Filters

Post by BlakeMW »

My latest invention in Take 5 magic involves sending a "wooden chest" signal as the "drop" signal. This simplifies logic because you can use a simple decider such as "Iron Plates = 5; output Wooden Chest = 1" instead of needing to multiply by a magical number to directly negate signals.

Image

The top decider sends an "iron plates" signal if there are at least 6 iron plates incoming or already in the hand, to hopefully guarantee it won't pick up fewer than 5 (you should account for the possibility of missed grabs, hence checking for 6-7 rather than only 5)
The bottom decider sends a wooden chest "drop!" signal is there are 5 iron plates in the hand.

The trickiest part was ensuring the inserter could pick up only 1 item at once. My latest method involves staggering the items on the belt, in this case I take a single lane and put it into a splitter as a lane balancer - but you notice one of the lanes goes around a corner and so the items in that lane end up being vertically offset by a few pixels and the iron plates end up staggered in a "diamond" pattern, the stack inserter can pick up two items which are next to each other either horizontally or vertically but it can't pick up items which aren't adjacent. So as long as the belt never backs up (which can be guaranteed with circuit belt conditions) the inserter should reliably pick up items slowly enough that the combinators can keep up.

This setup seems reliable. Obviously I haven't tested it to infinity but I've tried various kinds of mixed inputs and ran it at higher game.speed settings and it seems to reliably take 5

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Smart Furnace - Setting Filters

Post by Optera »

I was under the wrong impression filters always prioritize higher numbers. Your build proofs they go thorough signals and pick the first one they see.
It's quite funny to see how unsorted the item list actually is by changing wooden chest to other items.

User avatar
MeduSalem
Smart Inserter
Smart Inserter
Posts: 1475
Joined: Sun Jun 08, 2014 8:13 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by MeduSalem »

Optera wrote:I was under the wrong impression filters always prioritize higher numbers. Your build proofs they go thorough signals and pick the first one they see.
It's quite funny to see how unsorted the item list actually is by changing wooden chest to other items.
They really don't go for any priority and rather after the internal list of items. I only realized it's a problem after using Filter Stack Inserters where you can only have one filter... which is a really weird, seemingly arbitrary balancing choice by the Devs I don't understand.

By the way I realized it after I noticed that the chronological order at which filter signals appear/disappear from the circuit network doesn't matter to the Inserter. It always picks Stone before Iron Ore before Copper Ore before Iron Plates, no matter what signal has higher values, no matter in which order the signals appeared.

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

Re: Smart Furnace - Setting Filters

Post by siggboy »

MeduSalem wrote:It always picks Stone before Iron Ore before Copper Ore before Iron Plates
I'm sure it's the same order that is shown in the resources tab, when you set the filter manually.

The game probably has those resources in a table, in the same order that they're shown in the tab, and it just iterates over all signals present in that order and then picks the first one (that has a positive value) to set the filter.

Which would be much less of a problem if we could do the same thing in a combinator, ie. take a number of signals, and reduce them to one signal in the same way the filter inserter does.

XKnight has proposed to add an "Anything" output to the decider combinator, that would do exactly that. It would also help in various other advanced cases.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Smart Furnace - Setting Filters

Post by Optera »

siggboy wrote:
MeduSalem wrote:It always picks Stone before Iron Ore before Copper Ore before Iron Plates
I'm sure it's the same order that is shown in the resources tab, when you set the filter manually.
Not quite. It uses the order of the item-prototypes. For example Burner Inserters, Long Handed Inserters come before copper ore but inserters, Filter Inserters, Stack Inserters come after it.
Anything added by mods is always after vanilla items.

Acarin
Long Handed Inserter
Long Handed Inserter
Posts: 94
Joined: Thu Sep 01, 2016 3:58 pm
Contact:

Re: Smart Furnace - Setting Filters

Post by Acarin »

Because I want to, damnit! :P

I have a fairly compact factory (mostly using the PnP Modular layout), and I am currently equipped with a 120-furnace array which is "semi-smart" - it will switch between iron, copper or off for 100 of the furnaces, depending on logistic network stock levels (in groups of 10, so at max capacity, for example, I might be using 60 furnaces for iron and 40 for copper, or vice versa). The other 20 furnaces are dedicated to steel, and switch on and off in pairs according to demand.

This doesn't quite fulfil my inner OCD demon, however, and also can't currently deal with brick production.

I am working very hard at the moment (and watching the various forum and Reddit threads) to try and design a "fully"-smart array, capable of switching between any of the 4 smelting production types. I have a theoretical model for the furnace layout (up to 9 blocks of 24 furnaces), but I am now trying to work out the logic required to run the thing without hang ups in steel or stone production. As far as I can work out, it appears to be a case of only allowing a steel recipe to start when the input chest contains a multiple of 5 plates (and contains at least 10, to allow for additional stocking by bots while the process is running but after the "switch off" trigger is activated.

If I can work this out (or get someone else with better experience of the circuit network than I have ;) ) then I will have a Main Bus input which can provide up to 216 furnaces of finished product, in whatever ratio I require (actually only 180 furnaces at 100% stone smelting, due to the exigencies of my layout). And it will be compact enough to maintain as a full logistics-bot supply chain head, which I like!

So keep throwing out these ideas and builds - I, for one, am thoroughly enjoying watching the ideas develop :)

Post Reply

Return to “Combinator Creations”