Nullius


In this Factorio prequel, you're an android terraforming planets and seeding them with life. Replaces all recipes and technology. No life means no coal, oil, wood, biters, or free oxygen, requiring varied renewable energy sources. For reliability, you'll focus on abundant elements from the air, sea, or common minerals such as iron ore, bauxite, sandstone, and calcite. Advanced technology enables asteroid mining of rarer elements.

Overhaul
9 months ago
1.1
33.6K
Environment Mining Fluids Manufacturing Power

g Wind Power Cycle

1 year, 6 months ago

So I wanted to figure out how much Hydrogen/Oxygen Tanks I needed per Wind turbine to ensure consistent power. For that, I needed a good idea of how wind turbines generate power, whether it was random, randomwalk, or what. It does produce tons, or average, or die out mostly or entirely, and isn't blatantly obvious from playing. I mostly want to know if I am correct.

Looking at the code, it is somewhat complex, but can be split into a few sections. Surprisingly, it is almost perfectly slaved to the Day-night cycle.
The first section is a 4-part composite sin-wave. It pretty much matches the day-night cycle, with it dropping during night and growing during the day, offset somewhat, to counter the smoothing that occurs later.
The other 3 wave parts are over tiny durations making the wave extremely jagged and irregular, causing wind to constantly jump around, but not really change the overall yield.
There are two random factors, a noise generator which adds a bell-curve random number, and a Momentum factor, which random-walks while having a weak gravity pulling it back to zero.

The Wave and the Momentum factor both average zero. While wave can give a +- 3.95 value depending on how the interfereance occurs, it cancels out on average. the momentum can, theoretically get a ridiculous +-50 modifier, though since it move such a tiny distance, that is an infinitesimal chance. It can still occasionally heavily increase or decrease wind yield. And it also has a decay function moving it towards zero.

Noise is rand(3) + rand(5), so a bell curve of some description. Average of 4.
Adding those together can give a huge range, but will mostly range from -4 to 8, averaging +4.
Then subtract 0.1 and divde by 6, for average of 0.65
The current wind factor is interpolated towards the new value, at a variable rate of 5% to 30%. This whole thing also runs every 2 ish seconds.

At this point, I have a bit of trouble. Depending on the resulting factor, it does some other equations, clamping and downscaling for above values of 1. Within 0-1 range however, it squares the value before downscaling, which throws my ability to visualize the distribution, because I can't just look at the average anymore.

That final value is the new wind rate, ranging from 0 to 1, multiplied by the max wind yield. It looks like it should average ~42% of max yield, instead of the 40% the tooltip claims. However, since I am rather fuzzy on the logic, and am pretty sure it gets distorted by the square root, am almost certainly wrong here.

Is any of this wrong, and is it actually very closely tied to the solar cycle? Such that it mostly yields 100% during the day and 0% during the night, roughly following Solar mechanics, albiet both more smoothly and more turbulently?

Would I be safe in assuming that, mostly, it cycles between 0 and 100% yield daily, averaging 40%?

Basic, t1 Hydrogen/Oxygen storage cells seems to be ~12.8% efficient. Using 42.2 KJ to produce 1 steam, worth 5.6 kj in a turbine.

At this point, I am uncertain how to continue. I was going to try and use the solar calculator, but it assumes 100% efficient storage, and also that trapezoid wave.

1 year, 6 months ago
(updated 1 year, 6 months ago)

Tldr I want to know how much roughly how much time spent charging vs discharging with wind power storage via hydrogen/oxygen. How many tanks, how many turbines, how many electrolyzers and average power yield. I can do it by feel, but that always sucks.

I looked at the code, and did my best to figure out the behaviour, but I have no idea if I did it correctly or how to tell, or if the random turbulence modifiers are enough to make an approximation useless.

1 year, 6 months ago

Some of those cycles are much longer than an in game day, leading to good days and bad days, and occasional very good or very bad days. I wouldn't dismiss them as having no effect. The day night cycle is pretty noticeable.

There's a lot of complexity to the equations that we can't assume just cancel out on average due to their interaction with one another. It's a good idea to verify the actual average empirically over a long period on an isolated electrical network with no battery and enough draw to use more than the max possible power output. You can get a better sense of the variation by looking at the electrical network graph under those circumstances. You can also stick a couple of solar panels on the network so the graph has a day night cycle graph to compare the wind to.

It is tuned to actually be very slightly above 40%, to leave a margin of error in the players favor, but I don't know that it's as high as 42%. It can go as low as 0%, but usually doesn't, and it's bounded how long it can be below average. It can briefly peak out at 100%, but not everyday.

You should probably overbuild wind turbines a little compared to any calculated optimum, because they're cheap, and the more you have the less storage you need. You can also use surge electrolyzers in your production areas as long as you buffer the input and output to allow for down times. This makes your overall factory consumption more flexible so you can utilize peak energy production with less dedicated storage. Otherwise you have electrolyzers running just to power other electrolyzers, which is less efficient.

In a battery system, the 3 elements are scaled differently to different factors, so you can tune them independently. The electrolyzers scale to be able to handle the max possible wind turbine production at 100%. The number of turbines scale with how much power you'd need to replace if wind was zero. The number of tanks scale with the maximum amount of time that wind could be below your needs. The combustion chambers either scale with electrolyzers or turbines, depending on how you structure your battery. It's more energy dense to store in the form of hydrogen and oxygen tanks rather than steam (especially later when you get compressed hydogen, but even without that). If you build with a clean tileable design and leave room to expand, you should be able to expand different parts of your battery as necessary when you notice that they're inadequate. It does take a bit of understanding of the game mechanics to figure out which part of your energy system is the actual bottleneck. At a certain point your number of wind turbines may start to fall behind your needs, but it may look as if it's the battery that's failing, even though the battery never gets enough power anymore to actually fill up.

1 year, 6 months ago
(updated 1 year, 6 months ago)

@Cycles. The daynight cycle appears to be a thing, and pretty obvious, but the other three equations appear to all be extremely short cycles, as in tiny fractions of a second short. I graphed it in Desmos. I suppose I could have gotten it wrong, and ofc it doesn't include either the random part or the other stuff, but it should give the first composite wave in terms of days.
https://www.desmos.com/calculator/ylfap7pu1z
You do get something like what you described if you set k=x instead of k=25000x.

@Averages. True enough, you can add, subtract, or multiply by constants and preserve the average, but squares, square roots, or conditions all break that relationship, Since both conditions and squares are involved, after that point you get a bad result. And yea, testing it over a duration is an obvious solution. Having done so, I do see the good days and bad days, but have no idea if that is actually the waveform or if the two random factors are largely responsible.

@40% Well, I got 42%, but that is ignoring the effects of the noise and momentum factors, and using average incorrectly as said above. Average of all three components gives 4. (4-0.1)/6)^2 = 0.4225.

@Overbuild. Yea, I plan to do so. I mostly wanted a vague idea of reasonable ratios so I could remove the guesswork though, or the iterative adjustment. It is so much easier to just plop down a 21:25 Accumulator:Solar farm than just dropping solars and then accumulators and actually having to watch them deplete or fill up, because someone did the math and that gives a constant 42W yield.
And yea, surge whatevers as part of the design helps, though It would still be helpful to know the rough cycle length to know how much storage to use, instead of guessing and adjusting.

@Battery. Yep. Enough Surges to soak up all excess power, or all power generated depending. Enough storage to fit the produced buffer over the expected surge duration, and enough backup generators to consume from full to empty over the expected slump. Plus some extra because redundancy.
If Power runs out during slump, then if storage not empty, need more turbines. If empty, several possiblities. Need more storage, need more electrolizers/Windmills. If tanks empty during slump and fill during surge, probably need more storage. If tanks don't fill up, probably need more windmills and electrolizers. That part at least is easy to figure out, albiet dependent on observing the system over significant duration. And, again, means I end up doing it by feel instead of having a rough ratio to follow.

1 year, 6 months ago

Don't try to simulate it, just create an isolated system and look at the actual graph. You're getting something wrong with your understanding of the cycles.

local wave4 = math.sin(discretize(((game.tick % 1023487) * 0.000055251) + 4.4))

The term (game.tick % 1023487) cycles approximately every 1 million ticks, and there are 60 ticks per second, so this has a period of around 4.7 hours. Multiplied by .000055251, that ranges from 0 to 56.5, or around 18pi. math.sin is in radians, so it repeats itself every 2pi. So really this cycle is 4.7 hours / 9 or 31 minutes.

1 year, 6 months ago
(updated 1 year, 6 months ago)

I edited the script to remove the random factors, and confirmed that I screwed up something in my equations, but I have no idea what. Fi....

I just realized I was taking percentages, because that webside wasn't designed with common programming languages. % there means taking x % of y. No wonder it all failed so badly.
https://www.desmos.com/calculator/kpwzbq6igr
And I got the aprox 5 humps per day, and it looks like the same kind of graph I got ingame after removing the randomness.

1 year, 6 months ago

I don't know the syntax for the website you were using, but it wasn't performing the modulus operation as intended. No idea what it's doing with it. These modulus operations should not have a significant effect on the overall graph, especially not at low values. If you strip them out entirely it looks more reasonable.

1 year, 6 months ago
(updated 1 year, 6 months ago)

.So yea, the first wave is a full day, the second is ~5 times a day, third is ~2 days, and the fourth is ~4.5 days. Given that, worst interference from the predictable factor should last ~1.25 days.

1 year, 6 months ago
(updated 1 year, 6 months ago)

On your graph though, you can see periods of a few days that are pretty bad on average or a few days in a row that are pretty good. Any of the 4 waves are enough to make a substantial impact on their own, including the 4.5 day one. You are guaranteed to get at least some predictable minimum amount of power every day, and can only have so many bad days in a row, but you can have a few bad days. Some of the waves can temporarily reinforce or counteract one another, leading to more or less volatility, and those interactions can play out over even longer periods than the longest wave, since their periods are not evenly divisible by one another.

New response