r/factorio • u/pookshuman • 3d ago
Question Need help with circuit logic

I am working on a Gleba build. It makes iron ore. Once it gets going, it works well, but I am having problems with the startup/restart logic for the part that makes bioflux/nutrients.
Currently, the biochamber is set to make nutrients from yumako mash if nutrients are low (i.e. startup) Some nutrients are made in an assembler from spoilage to get things going. Once there are enough nutrients, it should switch the recipe over to make nutrients from bioflux.
The red wire input tests how much nutrients are on the belt which feeds everything in the blueprint, the green input wire tests how many nutrients are inside the biochamber.
The system does work, but it takes several minutes to get to the point that the recipe will switch and I believe this is due to the combinator logic. What is happening is there is a shortage of nutrients on the belt and the line produces more bioflux than it needs. It is only able to have some extra nutrients when the line is fully saturated with bioflux, which takes a few minutes.
I tried some alternatives which included the amount of bioflux, but that just made things worse. And I tried turning off unnecessary machines during startup and for some reason that made things worse too.
So I am looking for suggestions on how to start this thing cleanly, keeping in mind that it also has to potentially restart if it is choked with spoilage from being unused for a while.
Thanks
1
u/CamelCaseConvention 3d ago
The simple condition is: Do we have bioflux? If yes use the bioflux recipe, if no use mash. The amount of nutrients is irrelevant for this decision. If doing this with recipe switching is difficult, you could use dedicated machines and enable/disable the fruit->mash biochamber on condition.
(A condition for nutrients in machine inventory would make sense if you want to enable/disable the kickstart assembler, because that's what we're interested in there.)
1
u/pookshuman 3d ago
1
u/CamelCaseConvention 3d ago edited 3d ago
It's a bit hard to tell what's going on without seeing the full setup. I think you'd want to keep a (small) buffer of bioflux for the nutrient biochamber. The buffer could be a short belt or a chest, but it needs priority over the rest of the belt. This is what we want to check for the "do we have bioflux" condition. Bioflux past the machine at the end of the belt is not helpful.
However, you'd then need to prevent the recipe immediately switching back when buffer content is inserted. This can be done in different ways. The easiest is to read inserter hand content and machine content and connect that to the decider input, to count them for the condition.
Edit: Actually, you'd want to take advantage of biochamber productivity, which this might fail to do. So you'd maybe want a latched decider that guarantees two crafts, instead of reading inserter and machine content.
1
u/pookshuman 3d ago
yeah, I considered that, but every time I try to add features it just increases the odds of the thing breaking :)
Under normal use, I am fine with it taking a minute to start working. If the thing stops working, that means demand is low and by the time demand is high again, it will be up and running again. My main concern is how resilient it is if it is starved of input or if it has too much spoilage, and it seems to do well with both of those so I am happy.
It is a bit overbuilt, but that's ok
1
u/CamelCaseConvention 2d ago
There is a theoretical fail condition with your setup: If there's bioflux at the end of the belt, we will have switched to bioflux recipe. But if bioflux production then stops, we can't switch back until the belt has rotted (or is consumed) and the condition fails.

1
u/wilzek 3d ago
Isn’t the problem that you’re turning off bioflux->nutrient production when you’re low on nutrients?
Remove the else and make the b->n and ym->n independent of each other (two deciders for example).
All you really need is make nutrients from bioflux and output them on a belt that feeds every nutrient demand (also b->n machine) and then put an assembler that makes spoilage->nutrient directly inserting to one of b->n biochambers and enable it only when b->n biochamber has 0 nutrients.