Using one turbine to control an arbitrarily large number of nuclear reactors

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
foamy
Filter Inserter
Filter Inserter
Posts: 375
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

I've been experimenting with tankless nuclear reactor design and wondering if there's a way to simultaneously get the benefits of a tankless/pumpless design (minimal power use, reduced footprint, reduced fluidboxes) and the benefit of a tank-ed design to control fuel insertion.

And I think I've worked out a monitoring system that uses an absolutely tiny amount of stuff, and can control any given number of nuclear installations (with each installation being capable of having thousands of individual reactors within it).

The fundamental basis of it is that all turbines, given adequate steam, will consume it at the same rate. Therefore, if you have a reliable measure of how much steam one turbine consumes, you know how much every turbine is consuming.

Measuring this requires one tank, and two pumps. Either boiler->pump->tank->pump->2x steam engine or heat exchanger -> pump -> tank -> pump -> turbine will work, but note that if you're using boiler steam you have to use steam engines and not a turbine, because turbines on boiler steam have (functionally) a higher priority than turbines on nuclear steam.

The pumps are configured to supply steam into the tank if it's less than some threshold (I usually set 1000) and to remove it from the tank if it is at or above that threshold. This way the tank is only ever doing one thing at a time, draining or filling. Because a turbine's maximum draw is 1 steam/tick, and a pump going entity->tank is ~200/tick (slowing as the tank fills), the vast majority of the tank's time is spent in drain mode. The tank is wired to a negative-edge detection, which outputs the differential between the tank's current value and its value on the last tick, so long as that's less than zero.

That's the instrumentation. It functionally is measuring the steam consumption of any given steam-powered turbine or steam engine on that particular grid.

To turn it into a useful reactor control, a bit more math is needed. You need to work out how much steam a given turbine will use in order to consume an entire fuel cell cycle, which in turn depends on the number of reactors and turbines. The formula for this, for a 2xN layout, is 12000 steam * 160 MW * (# of reactors - 1) / (5.8 MW * # of turbines). The 12000 steam comes from the number of ticks in a cycle (12000) and the amount of steam a turbine consumes at full draw (1 steam/tick).

The constants, once combined, work out to ~331,034.5, which limits the number of reactors this piece of it can control to around 6000. Past that, you'd need to sacrifice precision, or use more bignum circuitry, or build a second reactor.

In any case, 331034 * (# of reactors - 1) / # of turbines is the amount of steam required to fully extract (or almost so, anyway) the entire energy of a fuel cell. The outputs from the pilot turbine measurements are summed in a memory cell and, as they're all negative, summed against that value. Once it drops below zero, the prior fuel cell has been fully consumed, which means it is time to insert a new one. At that point -- provided a standard clock mechanism also agrees --, the memory cell resets, to prevent error accumulations, and the cycle restarts.



Q: What if there isn't enough steam to drive the main turbines?
A: The steam-consumed measurement will be higher than the actual steam consumed, meaning that the total energy contained in the system will climb. Either that will solve the steam issue, or the reactor design has throughput issues you need to fix.

Q: What if the pilot turbine/steam engine doesn't have enough steam?
A: You need to figure out why your fuel delivery or pump power broke.

Q: Why use this instead of just measuring a tank?
A: A few reasons. Aside from likely saving on fluid boxes, particularly for very large systems, this setup is as far as I can figure the earliest possible way to detect a complete fuel cell consumption, and therefore the one that makes for the most responsive system. In particular, setups that rely on measuring steam tanks are vulnerable to a demand shock: If draw is low, most of the heat in the reactors and heat pipes will be consumed before the heat exchangers stop keeping up. If draw then spikes up to full load, it can take quite a while before all the exchangers are once again producing, potentially leading to unexpected brownouts. This system, while still rationing cells, will keep the potential for 100% exchanger operation at a moment's notice.

Q: Where's the blueprints???
A:

Steam flow meter:


Threshold calculator & memory cell:

farcast
Inserter
Inserter
Posts: 23
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by farcast »

Very clever, I'm definitely going to use this trick.

I have a few notes about it I'd like to share.
  1. Your blueprints don't include the actual mechanism for resetting the memory cell.
  2. I don't see why the flow meter and memory cell shouldn't already be connected in a single blueprint.
  3. During the time when the reactor input inserters should be enabled, up to and including the one tick when the memory cell is being reset, the steam flow measurements are discarded. This error actually accumulates as a slow loss of maximum total heat in the reactors, until there's not enough heat to supply all of the turbines between fuel cell insertions, power production decreases due to lack of steam, and, like you said, the measured flow becomes too large, creating a net positive accumulation of total heat until steam production catches up.
  4. Steam turbines actually produce 5.82 MW of power according to the wiki, the game just doesn't display the third digit. Using 5.8 MW in the formula gives a result that's too high, which also causes periodic brown-outs like the previous point. Here's the corrected formula assuming a 2xN reactor setup:

    Code: Select all

    329,896 * (# of reactors - 1) / (# of turbines)
    = Steam to be consumed by the pilot turbine before inserting another fuel cell.
  5. Pumps have an output buffer that gets forced out even if the pump is disabled. During one tick when switching from filling to emptying, steam is pumped out of the tank while steam from the buffer of the disabled pump is also being pumped in, so the measured flow is too small, again leading to periodic brown-outs.
  6. Despite fixing all of the above problems, my 4 reactor / 82 turbine test setup was still showing periodic dips of ~150kW... until it suddenly wasn't, and I have no idea why. So I'm just going to blame floating point error and advise you to subtract a few points from the result of the formula since it's better for it to be too low than too high.
  7. Most reactor designs try to be as close to the ideal ratio of turbines to reactors as possible, so aside from extreme(ly impractical) edge cases, the result of the formula will always be around 12,000. It'll be slightly below 12,000 if there are too many turbines, and slightly above if there are too few, so you could just calculate the formula outside the game and keep the result in a constant combinator. That way this trick can control any number of reactors, not just 6,000.
Here's the blueprint with all of the problems fixed, including an inserter with the settings to use on the fuel inserters. It uses steam engines instead of turbines because then you can tell if there's a problem just by looking at the power graph when the steam engine graph doesn't have the same shape as the turbine graph.

edit: Updated the bp so that if the reactor was starved for a long time, the controller won't flood the reactors with fuel cells. Changed the formula in the bp description to include a 0.5% safety margin.

edit 2: Added extra logic to adjustably increase fuel consumption at low power usage to compensate for energy lost due to too small of an energy buffer, preventing periodic black-outs. Input is the percentage of the energy produced in one fuel cycle that can be buffered. From what I can tell, any descent reactor design will inevitably be able to buffer at least 60% of a fuel cycle. Now it can safely be used to improve the fuel efficiency of reactors that weren't designed to be fuel efficient!

Reactor Pilot Controller
Last edited by farcast on Mon Aug 24, 2020 11:15 pm, edited 2 times in total.
Efficient inefficient design.

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by burninghey »

Very nice. So this little electronics could control all the reactors at the map?

farcast
Inserter
Inserter
Posts: 23
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by farcast »

That's right! As long as they all have the same design, one controller is all you need. If you use a mix of different designs (eg. a 4x reactor and an 8x reactor, or a 4x with 80 turbines and a 4x with 82), then you need a separate controller for each design.

After some more testing, it seems a reactor still needs to be able to buffer an entire fuel cycle of energy in some form (heat, steam, accumulators) to completely avoid demand shock. Since we don't need to read from tanks anymore, this can be done entirely with heat pipes that have a higher energy storage density than steam tanks (exact numbers can be found on the wiki). It's also easier to share heat with all of the turbines than it is to share steam. Keep in mind that the steam in the pipes and turbines, and the heat in heat exchangers and reactors all count towards the energy buffer.

edit: So what I thought was demand shock was actually black-outs caused by low power usage & too small of an energy buffer. Energy was lost when the reactor temperature maxed out, the circuit didn't account for that, so it waited too long before inserting another fuel cell, causing periodic black-outs. It's not a problem if the reactor has a big enough buffer, but I wanted to be able to use any reactor with this controller. I've updated my blueprint with a way to compensate for any lost energy.
Efficient inefficient design.

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

farcast wrote:
Fri Aug 21, 2020 8:05 am
Very clever, I'm definitely going to use this trick.

I have a few notes about it I'd like to share.
  1. Your blueprints don't include the actual mechanism for resetting the memory cell.
  2. I don't see why the flow meter and memory cell shouldn't already be connected in a single blueprint.
  3. During the time when the reactor input inserters should be enabled, up to and including the one tick when the memory cell is being reset, the steam flow measurements are discarded. This error actually accumulates as a slow loss of maximum total heat in the reactors, until there's not enough heat to supply all of the turbines between fuel cell insertions, power production decreases due to lack of steam, and, like you said, the measured flow becomes too large, creating a net positive accumulation of total heat until steam production catches up.
All of these stem from the same root cause: My intent was to have a separate memory cell for any given reactor, and my reactor controls are designed to generate a one-tick wide pulse, which I use as the reset indicator for both its own internal timing and for the memory cell posted here. There is a discard during the reset signal, and it would be possible, if you wanted exact precision, to cache the incoming signal while the primary cell is being reset, but as it is one tick out of a minimum of 12,000, I considered that error acceptable.

My reactor controls are set up so that all conditions must be go in order to insert fuel. This is typically an explicit timer, a manual override, and something saying cells are needed: tank measurements, accumulator measurements, this power cell setup, or whatever. You can see an example of it here: viewtopic.php?f=208&t=87432. Because of the explicit timer, I don't have the issue with fuel cell flood you discussed; if a reactor hasn't completed its cycle, nothing happens.
  • Steam turbines actually produce 5.82 MW of power according to the wiki, the game just doesn't display the third digit. Using 5.8 MW in the formula gives a result that's too high, which also causes periodic brown-outs like the previous point. Here's the corrected formula assuming a 2xN reactor setup:

    Code: Select all

    329,896 * (# of reactors - 1) / (# of turbines)
    = Steam to be consumed by the pilot turbine before inserting another fuel cell.
  • Pumps have an output buffer that gets forced out even if the pump is disabled. During one tick when switching from filling to emptying, steam is pumped out of the tank while steam from the buffer of the disabled pump is also being pumped in, so the measured flow is too small, again leading to periodic brown-outs.
  • Despite fixing all of the above problems, my 4 reactor / 82 turbine test setup was still showing periodic dips of ~150kW... until it suddenly wasn't, and I have no idea why. So I'm just going to blame floating point error and advise you to subtract a few points from the result of the formula since it's better for it to be too low than too high.
What was your fix for the pump buffer being dumped? I can see some ways the error might be reduced -- extending the range of operation, so the pump toggles less frequently, for example -- but if there's a more exact solution I'm all ears. Good point on the power formula though.
  • Most reactor designs try to be as close to the ideal ratio of turbines to reactors as possible, so aside from extreme(ly impractical) edge cases, the result of the formula will always be around 12,000. It'll be slightly below 12,000 if there are too many turbines, and slightly above if there are too few, so you could just calculate the formula outside the game and keep the result in a constant combinator. That way this trick can control any number of reactors, not just 6,000.
Yeah, could do that. The idea was that you'd just plop down your reactors of whatever size and plug in the numbers assuming a 2xN, but expanding nuclear reactors isn't that common a task so it might just be better to, as you say, reconfigure a constant combinator by hand every now and then.

Thanks for your comments!

farcast
Inserter
Inserter
Posts: 23
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by farcast »

foamy wrote:
Fri Nov 06, 2020 8:40 am
What was your fix for the pump buffer being dumped?
I added a one tick pause in the transition from filling to emptying, where both pumps are disabled. I did this by adding a decider with a seemingly unnecessary condition where the combinator delay is what I actually use, since I couldn't find a way to add this delay without adding another combinator. One tick seems to be enough time for the buffer to empty out completely. At least, I haven't had any problems with it so far.

Interesting note, I noticed that this buffer won't empty out completely if the connected fluid box is filled past a certain point. The arbitrary choice of switching pumps at 1000 fluid is low enough to avoid this being a problem, luckily enough.
Efficient inefficient design.

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

farcast wrote:
Tue Dec 01, 2020 10:36 am
The arbitrary choice of switching pumps at 1000 fluid is low enough to avoid this being a problem, luckily enough.
That's handy. The choice of fluid size wasn't arbitrary, though; I needed inflow to the tank to be as fast as possible (to reduce the number of times it needs to toggle back and forth) but with enough capacity to allow the measurement system to not be bottlenecked. I knew from prior work with fluid flow measurement that as a tank fills, the measured inflow from a pump actually drops below the nominal amount, even when directly connected as here. While it doesn't become substantial until significantly higher fluid levels, there wasn't an real reason to go higher up. Similarly, the flow out declines as the fluid level drops. Fortunately, the required throughput there is far less that on the input side.

In fact, the limit could probably be shoved significantly lower down. Could be worth experimenting with.

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

Ok, did some work on the measurement side of things; it's no longer quite so slapdash:

Image

Now incorporates a direct UPS in the form of a solar panel and accumulator for the pumps, reactor inserters, and combinators, which does not touch the steam turbine; a reactor with independent controls and fuel feed/removal; a buffer steam tank to ensure there's always lots available for the measuring station; a reconfiguration into a square instead of a line; the addition of a one-tick pause between either the input pump or the output pump stopping and the other starting; and a power pole directly next to the turbine for connection to the grid it is measuring.

This system generates negative pulses, each one of which can be regarded as representing one tick of full turbine generation. For using this to control any given reactor design, all you need to know is the output of the reactors, and the output of the steam turbines. The number of ticks of full turbine output before the reactor needs refueling is the reactor output, times 12000, divided by the turbine output. Thus you can capture the negative pulses in a memory cell and use them to count down from that number. When the total hits 0, you need more fuel.

EDIT: Because of the minimum delay of an inserter swing, 26 ticks for a fast-tier inserter operating chest-to-reactor, it is advisable to add a small safety margin here to avoid gradually losing heat.

If you have multiple reactor complexes, regardless of if they have the same design or not, you don't need an additional measuring station -- just an additional memory cells & target numbers.


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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

Something else you can do with this system: Circuit-driven tracking of the actual percentage of your steam generation you're using/not using.

Image

In this case, I charted remaining capacity. It's time to expand my reactor :v

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

Cleaned up the display a bit; here it is post plant expansion:

Image

@farcast: The microbrownouts you described I encountered briefly at the start, but after I added a very small fudge factor to the 'time to insert cells' trigger -- about a 1% safety margin, which means energy gradually accumulates in the system until the excess is lost due to insufficient buffer, which I think is largely acceptable -- that problem went away. System has been happily controlling a substantial nuclear plant for dozens of hours now without issue. In the last 10 hours, consumption of fuel cells has averaged 9.7/m, and steam turbine power production has averaged 5.1 GW. Each cell represents, in the current reactor configuration, ~31.6GJ, so if you run the math you get 5.1GW of fuel cells producing 5.1GW of steam power, which is about 40% the actual sustained generation capacity of the 84 reactors.

So, it looks like that both ta. my reactor layout buffers properly and b. that the gauge does work very effectively as a control system to avoid fuel cell wastage.

farcast
Inserter
Inserter
Posts: 23
Joined: Fri Jul 06, 2018 8:25 am
Contact:

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by farcast »

@foamy: The errors from the problems I listed are indeed small enough that a small fudge factor is enough to deal with them, I just think it's more satisfying to solve the root of the problem.

The blackouts I mentioned in my edit caused by too small of an energy buffer only occur at low power consumption. As for how low is low, that depends on the percentage of energy of one fuel cycle that can't be buffered. For example, a reactor that can buffer 80% of a fuel cycle won't have any blackouts until less than 20% of the max sustainable power output is being used during each fuel cycle. I think I didn't even consider heat pipes when calculating the inevitable 60% energy buffer, or at least not as many as would actually be necessary, so a typical reactor would probably have closer to an 80% buffer. Running your reactor at 40% capacity is probably too high to reproduce this issue. Even if it's a bit unrealistic to assume a reactor is only running at ~10% capacity, I think it can happen while the factory is under construction without researching anything.

Calculating, or even measuring, the actual buffer size a reactor has is really annoying, which is why I'm only mentioning rough percentages.
Efficient inefficient design.

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

Re: Using one turbine to control an arbitrarily large number of nuclear reactors

Post by foamy »

Ah, I see the issue: An unexamined and unstated assumption on my part, which is, specifically, that there is enough buffer capacity to last an entire cycle. If not, then use of it as a controller will be off because while the measurements will accurately track how much energy is removed from the system, to better than 99% precision, they cannot account for energy that was never created in the first place (because of buffer overflow).

At least, not directly. However, if you have a reactor of known buffer capacity and known generation capacity, you can use this to track how much energy was removed specifically during the period of active generation, and from there calculate whether or not there was in fact buffer overflow and use that to adjust when the next cycle should trigger. The circuitry for that's a bit more complicated, but not impossible.

I simply didn't think of it because the reactor designs I use are buffered -- by heat pipes, hence why I wanted to design this in the first place --, so that isn't a source of energy loss. Thus by adding very slightly more than's needed, it tends to a steady state where buffer loss equates to the very slight extra power being added.

One of the interesting things about running this long term in a real game, though, is that I realized I'd over-estimated how much buffer I had.

This is the reactor:

Image

I had calculated the buffer based on the full 500C range, and it has approximately 55.3 heat pipes per reactor (there's 40 heat pipes every 6 tiles in the heat exchanger rows, plus 22 for each reactor to connect to them). At 500MJ per, plus 5GJ for reactor, that'd be just a hair over 32GJ, plus whatever steam is in the system. So from a cold start it can completely buffer a full cycle with no draw.

But that's not how a reactor generally operates and the controller never lets it get that cool. Which is good, because it means the controller's working correctly, but it also means I have noticeably less buffer space than I had imagined if the reactor were to transition to a null load-scenario. While I haven't tested this as yet, because I don't want to disconnect my factory's power source, I think that if it were to go to a null load from a working one (immediately prior to the next fuel insertion), the pipes and reactor would level out at around 600-650C. That means the buffer only has 70-80% of the capacity I had originally planned on.

Still, for a working reactor design, that's plenty. I might go design those compensation circuits, though, just to be sure.

Post Reply

Return to “Combinator Creations”

Who is online

Users browsing this forum: No registered users