Nuclear power UPS optimizations

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Nuclear power UPS optimizations

Post by AngledLuffa »

TL;DR Nuclear is valuable for medium sized bases, but useless for megabases as it kills UPS. Please optimize!

A specific suggestion for doing this: there will be a lot of setups which eventually reach a steady state.

For example, consider a setup which has water pumps, water pipes and tanks, turbines, exchangers, steam pipes and tanks, heat pipes, and reactors. Suppose that all the water pipes are connected with each other, all the steam pipes are connected with each other, and there are enough water pumps for all of the exchangers in question. In this case, assuming the reactors always have fuel, the heat pipes, water pipes and steam pipes will all eventually reach an equilibrium. The % engagement of the turbines will determine whether the total steam is increasing or decreasing, and as long as the steam in the system is greater than 0, the turbines will be able to perform at their desired efficiency. Once the steam reaches 0, the turbines will have their efficiency limited by how quickly the exchangers can produce steam.

In this particular example, only a few numbers will be needed to fully explain the current behavior of the nuclear setup: the fraction of steam in the system and the desired efficiency of the turbines. Everything else can be treated as a steady state and will not need to be calculated every tick.

This does abstract away the fact that individual pipes will have more or less water and steam depending on how recently the machine in question collected that resource, but in the assumption that the entire system has enough resources to stay powered, those individual calculations are not actually very helpful.

If anything about the system changes, such as new heat pipes are connected or a reactor runs out of fuel, the optimization would be turned off and each individual entity would be calculated as before.

There are probably more complicated setups which could be treated the same way, such as if there are a few separate pipe networks of steam connected to different groups of turbines. Each group of turbines and steam pipes would then have their own performance and steam fraction numbers. It would still be a substantial optimization over the current method of calculating each entity individually.

fiery_salmon
Fast Inserter
Fast Inserter
Posts: 128
Joined: Wed Dec 13, 2017 1:20 pm
Contact:

Re: Nuclear power UPS optimizations

Post by fiery_salmon »

Do you have any evidence of disproportionate effect of nuclear on UPS? Can you provide saves that were used to verify this?

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Nuclear power UPS optimizations

Post by eradicator »

AngledLuffa wrote: In this case, assuming the reactors always have fuel, the heat pipes, water pipes and steam pipes will all eventually reach an equilibrium.
You're missing a very important factor here: Energy demand. The whole factory would need to have a constant stable energy consumption for the reactor to reach equilibrium, and that's never going to happen.

AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Re: Nuclear power UPS optimizations

Post by AngledLuffa »

I don't think it's necessary for the whole factory to reach an equilibrium. All that needs to happen in that case is to keep track of how much excess steam is available in the pipes and tanks. As long as it's positives, all of the turbines should be able to run at full power, and once it reaches 0, the turbines are limited by how much steam is produced by the exchangers.

I don't have saves with before and after nuclear plant for the same factory, although I could provide one if it helps the developers. I think the effect of nuclear power on UPS has been well known for quite some time, though. Here is an example of someone who found that on his machine, 8G of power used 3.5ms per tick:

https://www.reddit.com/r/factorio/comme ... _to_solar/

dood
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Mar 21, 2018 8:36 am
Contact:

Re: Nuclear power UPS optimizations

Post by dood »

The UPS would probably already be helped if you used an accumulator field instead of steam tanks.
Continuing from there, treating directly connected turbines as 1 entity should do the trick.
I don't know off-hand how many fully consume 1 pipe of steam but you could have a row of twice that amount and lead steam into both ends for maximum UPS friendliness.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Nuclear power UPS optimizations

Post by eradicator »

Is there even any data about what parts of "nuclear" actually require all those UPS? Because i'd be suprised if it's the turbines and not the (heat-)pipes. Because most reactor designs have gridded heat-pipe layouts where the heat flows in eternal circles every tick. And you have a lot more pipe than turbines usually ;).

AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Re: Nuclear power UPS optimizations

Post by AngledLuffa »

That's my suspicion as well. Heat pipes, water pipes, and steam pipes add up to a lot of entities, each being updated each tick. The differences between ticks will be minimal after some amount of time, though, and things like the heat pipes can be treated as a single steady state after they converge.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Nuclear power UPS optimizations

Post by eradicator »

AngledLuffa wrote:things like the heat pipes can be treated as a single steady state after they converge.
There were once plans to always treat all connected (fluid-)pipes as a single fluidbox, but no clue what became of those plans. Wasn't in 0.16...so i'm hoping they didn't give the idea up and it's gonna be in 0.17.

@Rseding: Any update on that idea?

fiery_salmon
Fast Inserter
Fast Inserter
Posts: 128
Joined: Wed Dec 13, 2017 1:20 pm
Contact:

Re: Nuclear power UPS optimizations

Post by fiery_salmon »

eradicator wrote:
AngledLuffa wrote:things like the heat pipes can be treated as a single steady state after they converge.
There were once plans to always treat all connected (fluid-)pipes as a single fluidbox, but no clue what became of those plans. Wasn't in 0.16...so i'm hoping they didn't give the idea up and it's gonna be in 0.17.

@Rseding: Any update on that idea?
.17 has possibiliy of fluid optimization (see roadmap)

AngledLuffa
Fast Inserter
Fast Inserter
Posts: 187
Joined: Fri Jan 05, 2018 5:18 pm
Contact:

Re: Nuclear power UPS optimizations

Post by AngledLuffa »

That would be excellent. It would remove the water and steam pipes as UPS concerns. I believe the heat pipes can be ignored once they reach their steady state (or close enough to it) as long as that particular network doesn't change. At that point, the majority of the entities in the nuclear setup will be much more UPS friendly and it might be feasible to use nuclear reactors in a large base.

bobucles
Smart Inserter
Smart Inserter
Posts: 1669
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Nuclear power UPS optimizations

Post by bobucles »

Unfortunately the factorio nuclear system doesn't have a steady state. Every time the power demand changes the equilibrium point of all the components will change. Every time the fuel turns off or on the equilibrium point changes. There will never be a simple single equation that describes the nuclear system in motion, at least not for ordinary levels of math.

The water demands of energy are vastly higher than for any other water demand in factorio. I do think it would be nice if input water could transform into a larger quantity of steam. So for example 1 water in generates 10 steam out. This would somewhat reduce the amount of water that players need to shuffle around and let players have more options for long distance water transfer.
Is there even any data about what parts of "nuclear" actually require all those UPS? Because i'd be suprised if it's the turbines and not the (heat-)pipes. Because most reactor designs have gridded heat-pipe layouts where the heat flows in eternal circles every tick. And you have a lot more pipe than turbines usually ;).
Is there any hard data? None that I know of. But every single heat pipe and steam component has its flow calculations performed every tick. Even if the calculations are simple you're looking at the old belt mechanics level of efficiency at best.

Technically you can dramatically increase UPS efficiency by doubling the flow rate and calculating every other tick. The functional mechanics would stay very similar except for extreme cases where more than 50% of a pipe's capacity is moved per tick (such as with pumps). An unequal CPU demand per tick might make some odd stuttering issues, but this can be partially addressed by running fluid calculations on odd ticks and heat pipe calculations on even ticks. It's still a pretty hacky solution and the fluid network would still be the largest demand by far.

dood
Filter Inserter
Filter Inserter
Posts: 360
Joined: Wed Mar 21, 2018 8:36 am
Contact:

Re: Nuclear power UPS optimizations

Post by dood »

Wasn't there a time at which heatpipes transferred heat indefinitely and they patched it to fall off?
If the cost of that was a performance loss because each individual heatpipe segment has to constantly calculate, I don't think that was worth it and should be undone.
Heatpipes aren't widely used enough to worry about exploiting their infinite range imo and people go for the most compact design anyway.

bobucles
Smart Inserter
Smart Inserter
Posts: 1669
Joined: Wed Jun 10, 2015 10:37 pm
Contact:

Re: Nuclear power UPS optimizations

Post by bobucles »

The only thing I remember is that the transfer rate was inconsistent and depended on what order that heat pipes were built. That part got fixed so they'd work the same in any configuration.

Post Reply

Return to “Ideas and Suggestions”