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.
Amarula
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Objectives:
Automatically start loading fuel on new construction, or when fuel is restored after a fuel outage.
Only load one fuel cell at a time.
Only load fuel when needed, that is when steam is low.

Last week I accidentally ran out of nuclear fuel cells (its a long story). It was such a pain going to manually reload 70+ reactors that I decided it was time to update my fuel loading blueprint to include auto-start.

Basic idea: count fuel loaded and unloaded. On start, both counts are zero. Load in one cell; after five minutes, the used fuel is unloaded, and both counts are one. Each time the counts are equal, make another fuel cell available to load.

Inserter #1 takes the used fuel out of the reactor; it is connected to an arithmetic combinator to count the number of used fuel cells removed from the reactor. It isn't limited or disabled:
Inserter #1.png (462.95 KiB) Viewed 4362 times
The combinator is a standard counter:
Used fuel counter.png (298.4 KiB) Viewed 4362 times
Inserter #2 places one fuel cell at a time in the loading chest (not a logistic chest, any normal chest will do).
It is connected to a second combinator to count the number of fuel cells made available for loading.
Fuel cell counter.png (323.66 KiB) Viewed 4362 times
This inserter is limited to override any stack size bonuses so only one cell is loaded at a time; it is disabled unless the number of cells loaded is equal to the number unloaded. As extra error-proofing, the test is for less than as well as equal, in case someone say manually loads a cell into the reactor or otherwise boosts the unloaded count.
Inserter #2.png (335.71 KiB) Viewed 4362 times
Inserter #3 loads the fuel cells from the loading chest into the reactor. It is enabled when steam is low:
Inserter #3.png (306.81 KiB) Viewed 4362 times
I use a bot-based system, but it is easy enough to replace the logistic chests with belts and regular chests.
I use a tank to measure steam availability.

The blueprint includes the logistics chests, the loading chest, three inserters, and two combinators. Just add a wire to connect the third inserter to your steam tank and you are good to go.

Blueprint string:
Luck is not a robust control.

mrvn
Smart Inserter
Posts: 4501
Joined: Mon Sep 05, 2016 9:10 am
Contact:

I think my setup is simpler:

1) Each reactor has a buffer chest that gets loaded with 1 fuel cell: inserter connected to the chest set to "fuel = 0" and stack override = 1

Note: With bots there is no "stack override" so you need a decider combinator "fluel > 0 => fuel: 1".

2) Arithmetic combinator connected to all chests set to "fluel / <num reactors> = green".

This gives me a green light when all reactors have fuel ready to insert.

3) Decider combinator connected to the steam tanks set to "steam < 100000 => green: 1".

This gives me a second green light when it's time to make more steam. Adjust the amount to your steam tank size.

4) One reactor is the master (first one you build). It has an inserter to remove fuel connected to the combinators form 2+3 and set to enable on "green > 1" and "read hand content: hold".

The spend fuel cell from the master reactor is only removed if a) every reactor has fuel and b) more steam is needed.

5) All inserters inserting fuel are connected to the inserter from 4 and set to "spend fuel > 0".

With bots don't forget the "stack override = 1".

The system is vulnerable to power loss. I think you can use burner inserters safely. Or put the inserters and combinators on a separate power network powered by solar + accu or a separate steam tank + turbine. A single tank will last hours or days when it only has to power a few inserters. The above will already restart a reactor once it was running but will not auto-start when freshly blueprinted.

If you want to also auto-start from blueprint you need one more thing on the master reactor:

After blueprinting there is no steam yet and no spend fuel cell to trigger fueling the reactor. This inserts fuel into the master reactor loading it full up. Potentially it overloads it wasting a fuel cell or two. I'm assuming you have an inserter bonus so 2 or more spend fuel cells are taken from the master reactor at a time if it was overloaded to get it back to normal operations.

Note: Only the one master reactor is overloaded. All other still only get one fuel cell at a time and only when steam is low. You are probably consuming steam faster than the master reactor can create more so the only waste is some loss of neighbor bonus for a fuel cell or two.

Note 2: If the inserters and combinators ever run out of power or if you don't give them their own power network this will restart the reactor after a hard failure too.

foamy
Filter Inserter
Posts: 380
Joined: Mon Aug 26, 2019 4:14 am
Contact:

My own solution is a decider that will only trigger the inserters (overridden to 1, of course) if there are no blocking conditions that are true (i.e. every signal is zero). One of those blocking conditions is a clock that will count out 200 seconds and then hold there until reset by the inserter trigger signal.

This fairly easily accommodates any logic you want to do on other things, e.g. steam or accumulator charge or fuel counts, and in the status where nothing else is blocking use, will attempt to load a cell every 200 seconds. This is a *bit* of a laggy start to things, but it requires no player intervention to start up.

MBas
Long Handed Inserter
Posts: 63
Joined: Fri Jan 06, 2017 12:57 pm
Contact:

viewtopic.php?f=208&t=48988

Just look at third picture. No combinators. Works as you desire. Ideal for synchronized loading.

mrvn
Smart Inserter
Posts: 4501
Joined: Mon Sep 05, 2016 9:10 am
Contact:

MBas wrote:
Mon Oct 21, 2019 4:37 pm
viewtopic.php?f=208&t=48988

Just look at third picture. No combinators. Works as you desire. Ideal for synchronized loading.
Nope. That won't auto-start at all.

wallE
Burner Inserter
Posts: 19
Joined: Fri Aug 12, 2016 3:15 pm
Contact:

My two cents:
I might have somewhat like a mega - nuclear - facility of now 356 reactors composed in two blocks.
Imgur power array

The reason why i built this was simple: Because i could and i was fed up with recurring power failures.
The drawback of this construction was the enormous waste of uranium. So i was forced to think of some kind of controlling the reaktors.
My solution is autostarting, self regulating and tileable.

I will outline only the most significant parts of my creation.
• Each reactor fill have only 1 fuel cell in it at any time. The outtaking inserter is put on hold by the controller.
• For each pair of reactors there is one controller unit - both reactors will be shutdown or fired up simultanously.
• Parameters for common things like timer signals, power shortage, operation mode (shutdown or start) are inserted only at one point (the mutual "start of line")
• Each Controller is linked to it's successor and predecessor
• There is still space for improvement
The controller is made up of 4 decider and 1 arithmetic combinator and works roughly as follows:
• One decider for each paramter to check: enough steam? am i the next in line to operate? enough power? ... feeding into a RS latch operating the inserter taking used fuel cells out and controlling the steam pumps feeding the turbines
• The arithmetic + decider resets the RS on various conditions like power shortage and refuels the next 2 reactors and restarts the steam turbines
Conclusion:
With my setup i will never ever have to think about power again because if my base tends to use all energy of 356 reactors (roughly 57 Gigs) i just print some more (the next 100 reactors in tiles of 4X4 reactors + exchangers + tanks + turbines ....) somewhere, hook them up to the existing part ( both green and red wires are used for pre and successor ) and forget about it. The reactors will be switched on / off on demand without my intervention.
At any time there are always "just enough" reactors on line and fuelled.

Improvements to come:
I was not able or did not think about it beforehand to have ONE controller operating the whole monstrosity like an addressable power matrix. The backup power production must be capeable to compensate the loss of 2 reactors (roughly 160 MW) quickly. As it now is: the controllers try to shutdown one pair of reactors per timer (generated by a belt loop ) tick. That might cause a power shortage which the backup has to compensate at once.
The refuelling is controlled by the same timer but has to be faster but not TOO fast!!
If the sudden demand inrease is greater than 160 MW than it will take (demand / 160 * timer ticks) time until enough reactors are fired up to cope with your needs. That makes it less usable for factories where whole branches are switched on /off very often.

If you are interested in more details or images or blueprints, please let me know.

PS.: I use a mod to put water where i need it - because i'm sure if someone has a landfill this person is able to remove it again and let the water flow in.
PPS. My reactor blueprint is not fully optimized ( there are steam tanks missing ) but it works good enough.

Amarula
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

wallE wrote:
Tue Mar 31, 2020 11:51 am
The reason why i built this was simple: Because i could and i was fed up with recurring power failures.
Oh I know the pain of recurring power failures! Thanks for sharing your approach. I am pretty happy with what I have, which has been tweaked quite a bit since I posted those blueprints, but I am always looking for ways to make it better.

And for all who could use a laugh, my most recent how to run out of power from last December:
I have a kovarex sector with a handful of centrifuges turning uranium into U238 and U235, which is passed to a centrifuge running kovarex to turn the U238 into U235. There is a factory for creating nuclear fuel cells, and a centrifuge for reprocessing the used fuel.

I have a train based world, so each reactor sector (I am up to 20) has its own train. The trains pick up the used fuel, and take them to my kovarex sector for reprocessing, where they are exchanged for fresh fuel cells. Each reactor sector has 12 reactors, so the train condition to leave is used fuel >= 12. At the kovarex sector, the train condition was used fuel = 0 AND fuel cells >= 12.

So far so good, everything ran fine... until one day... I was doing a series of infinite researches to test out my latest factory expansion to make sure that all my production chains would support 1KSPM. This required a goodly amount of power, so my power usage was up in the range of 80-90% of capacity, rather than standby levels of 35-40%. Which in turn meant that there was a steady stream of used fuel going in to be reprocessed. And I hadn't run the numbers, so I didn't realize that one centrifuge running reprocessing can only support about 100 constantly running reactors. And I had I think 180 reactors at that point.

So when the amount of used fuel exceeded the capacity of the fuel reprocessing centrifuge, the used fuel started to back up... to the point that one of the fuel exchange trains could not unload all its used fuel right away, so it waited... and all the trains behind it waited... and one after another, all my reactor sectors ran out of fuel...

Fortunately I noticed when the power level started to drop, but before all the sectors stopped producing power. I dropped down another chest so all the trains could unload. Very happy with autostart, as soon as the trains delivered fuel, all the waiting reactor sectors started up again (all at the same time which caused other issues but that's another story!)

So I now have 3 centrifuges for reprocessing used fuel, and I know when I get close to 300 reactors I need to add a fourth.

All right now it is your turn! What are the most interesting ways you have found to run out of power?
Luck is not a robust control.

theolderbeholder
Fast Inserter
Posts: 134
Joined: Wed Sep 20, 2017 5:45 pm
Contact:

Completely off-topic but I'm just too curious: you have a 180 reactors going for 1kspm? Not that I have reached above 440spm yet (and struggle with 30spm, terriffic spaghetti), but I certainly remember using 8 cores, maybe 16. Where do you put all that power?

Amarula
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

theolderbeholder wrote:
Tue Mar 31, 2020 6:12 pm
Completely off-topic but I'm just too curious: you have a 180 reactors going for 1kspm? Not that I have reached above 440spm yet (and struggle with 30spm, terriffic spaghetti), but I certainly remember using 8 cores, maybe 16. Where do you put all that power?
Beacons and modules, including beacons and modules to make my beacons and modules. It kind of started out with trying to figure out how they worked (I love math, up to 8 spreadsheets tracking calculations for Factorio), and now all my factory ratios rely on everything having beacons and modules to the max.

More off-topic: I am also curious like Kipling's elephant's child, full of satiable curtiosity, easily distracted (squirrel! did you say squirrel? how many? what is the current rate of squirrel appearances?)

Edit: oh and robots, all those logistic robots flying around so I could fit more into a sector without getting lost in belt spaghetti.
Luck is not a robust control.

theolderbeholder
Fast Inserter
Posts: 134
Joined: Wed Sep 20, 2017 5:45 pm
Contact:

Ok, thanks. Maybe I should keep my hands of beacons. For now.

Amarula
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

SO I ran the numbers for my beacons and modules this morning: 19K beacons ~= 10GW, 80K modules ~= 20GW, the rest of my base 10GW... time to go build some more power plants
Luck is not a robust control.

gGeorg
Fast Inserter
Posts: 176
Joined: Wed Jun 19, 2019 8:06 pm
Contact:

theolderbeholder wrote:
Tue Mar 31, 2020 6:12 pm
Completely off-topic but I'm just too curious: you have a 180 reactors going for 1kspm? Not that I have reached above 440spm yet (and struggle with 30spm, terriffic spaghetti), but I certainly remember using 8 cores, maybe 16. Where do you put all that power?
All the power seems a too much waste somewhere.
Just made a bit math, my decent 60spm base consumes about 500MW.
1kspm is (1000 / 60 = 16,7) about 17 times biigger, so it should consume 17times more power. Which is 500 x 17 = 8500. e.g. 8,5GW should be enough. However he is using about 5 times more.

Somting fishy.

Amarula
Filter Inserter
Posts: 390
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

gGeorg wrote:
Wed Apr 15, 2020 2:54 pm
Somting fishy.
Quite likely!
Some of the extra power is because I have just doubled the size of my base from 1KSPM to 2KSPM (I actually did a test and I was hitting 2.8KSPM very happy about that) which makes 2800/60 = 46 times bigger, 500MW x 46 is about 24GW.

However, beacons and modules make a big difference (you can get the same SPM for a lot less power just using more resources and more factories). How many beacons and modules are in your base?

Also, I really, Really, REALLY do not like running out of power so I tend to overbuild power like crazy
Luck is not a robust control.

gGeorg
Fast Inserter
Posts: 176
Joined: Wed Jun 19, 2019 8:06 pm
Contact:

Amarula wrote:
Wed Apr 15, 2020 11:33 pm
However, beacons and modules make a big difference (you can get the same SPM for a lot less power just using more resources and more factories). How many beacons and modules are in your base?
260 Class 3 assemblers. 100 beacons. I started to use beacons recently. However, it seems when used properly they save power. Modules are used when it makes sense. All production assemblers are full efficiency lvl 3 module. Contrary, I have spare oil resources, so majority off oill industry goes on green lvl1 modules.

wallE
Burner Inserter
Posts: 19
Joined: Fri Aug 12, 2016 3:15 pm
Contact:

If you are going towards a 10k SPM factory you will need about 40 - 45 GW power supply. Fully beaconed btw

mrvn
Smart Inserter
Posts: 4501
Joined: Mon Sep 05, 2016 9:10 am
Contact:

wallE wrote:
Tue Mar 31, 2020 11:51 am
Improvements to come:
I was not able or did not think about it beforehand to have ONE controller operating the whole monstrosity like an addressable power matrix. The backup power production must be capeable to compensate the loss of 2 reactors (roughly 160 MW) quickly. As it now is: the controllers try to shutdown one pair of reactors per timer (generated by a belt loop ) tick. That might cause a power shortage which the backup has to compensate at once.
The refuelling is controlled by the same timer but has to be faster but not TOO fast!!
If the sudden demand inrease is greater than 160 MW than it will take (demand / 160 * timer ticks) time until enough reactors are fired up to cope with your needs. That makes it less usable for factories where whole branches are switched on /off very often.
Shutting down 2 reactors makes no sense. You loose neighbor bonuses that way. Either run all reactors or none and use heat pipes and/or steam tanks to smooth over downtimes.

burninghey
Fast Inserter
Posts: 105
Joined: Fri Sep 14, 2018 2:06 am
Contact:

My (simple) approach: 1 reactor may run more cycles than necessary. Not a big drawback at a 12 reactor setup
At startup more may start unintended, but after steam is reached for the first time there is no more overhead.

Slave:
20200820101803_1.jpg (195.55 KiB) Viewed 1823 times
Master:
20200820102807_1.jpg (109.52 KiB) Viewed 1823 times
20200820101827_1.jpg (99.32 KiB) Viewed 1823 times
20200820101854_1.jpg (57.21 KiB) Viewed 1823 times

Qon
Smart Inserter
Posts: 1633
Joined: Thu Mar 17, 2016 6:27 am
Contact:

mrvn wrote:
Wed Jul 22, 2020 10:44 am
Shutting down 2 reactors makes no sense. You loose neighbor bonuses that way. Either run all reactors or none and use heat pipes and/or steam tanks to smooth over downtimes.
The loss is extremely small though for a long 2xN setups as long as the active part is contiguous. For practical purposes it's not going to be worth worrying about.

mrvn
Smart Inserter
Posts: 4501
Joined: Mon Sep 05, 2016 9:10 am
Contact: