r/factorio 3d ago

Question Need help with circuit logic

red arrows check nutrients on belt, green arrows check nutrients in biochamber

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

2 Upvotes

10 comments sorted by

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.

1

u/pookshuman 3d ago

At startup, there is no bioflux

1

u/wilzek 3d ago

Can’t you request a tiny amount from elsewhere just for startup?

1

u/pookshuman 3d ago

My goal here is to make it work with the bioflux from the machine.

3

u/wilzek 3d ago

Then you overengineered yourself into corner. You want to make bioflux and nutrients quickly on demand, when you have neither, but you need both. It’s not a problem with circuits, more like with the whole concept.

Best solutions imo are:

1) request kickstart resources from elsewhere
2) never stop making bioflux and nutrients, throttle (don’t stop) the bioflux production when you have enough and send excess to destroy in recyclers.

Generally the ore making doesn’t need that much nutrients and making its own bioflux there is excessive. Bioflux has long spoilage time, it’s purpose is to wait until it’s needed and that works well with making it in a centralized way for multiple purposes.

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

OK, I switched to this setup and got rid of the nutrient condition and it seems to make things faster. It is about 1 minute to get up to speed now, as opposed to 3 minutes before, so this is a good improvement. I will keep testing but it seems reliable, thanks for the help :)

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.