heat flow (math!)

Post all other topics which do not belong to any other category.
Post Reply
pichutarius
Fast Inserter
Fast Inserter
Posts: 158
Joined: Mon Feb 27, 2017 12:47 am
Contact:

heat flow (math!)

Post by pichutarius »

0. Disclaimer
1. this thread is created by human, error is inevitable. please point out any mistake u find.
2. this thread is messy and full of math. proceed at ur own risk.
3. this thread mainly consider throughput of heat pipes, ie: it assumes enough nuclear reactors, turbines, full electric load and stable condition.
1. Terminology and Graph
this thread will convert a setup into crappy mspaint art like below.
Untitled.png
Untitled.png (253.02 KiB) Viewed 3210 times
1. reactors will be represent as a green circle, and its temperature will always be 1000C.
2. red line is heat pipes, red bracket number=length.
3. black line is heat pipes attached with exchanger. (7+7) means double row, (7+0) means single row.
4. green is the temperature difference(V) between the end points of pipes. (1000-900=100)
2. Bottleneck
assume stable condition, bottleneck happens if reactor is 1000C while some pipe/exchanger is <=500C.
reactors, pipes, exchanger working temperature is between 500 and 1000, therefore the sum of temperature difference from reactor to each endpoints must be below V=1000-500=500 to prevent bottleneck.

the following formulae show how to estimate the temperature difference. the goal is to keep V < 500.
for red line with length = (r), V = (⅔i+1)r
for single row (i+0) black line, V = (i-1)(i+3) ≈ (i+1)²
for double row (i/2+i/2) black line, V = (i/2-1)(i+3) ≈ i²/2
where V = temperature difference, i = total exchanger down the line, r = length of pipes
*to be more precise, the 2nd and 3rd formula calculates the temperature difference between first and last input tile of exchangers.

some observation:
1. even when no load (i=0) is present, we still have V = (0+1)r = r, this means there is a hard limit in pipe length r=500.
2. higher heat flow (i) means lower pipe length (r)
3. double row is better than single row when minimizing V.

eg1: bottleneck or not?
Untitled2.png
Untitled2.png (14.49 KiB) Viewed 3210 times
the top branch has temperature difference of V = 250+169 = 419 < 500
the bottom branch has temperature difference of V = 250+170+288 = 708 > 500
conclusion, the top branch is fine but the bottom branch is bottlenecked.

eg2: bottleneck or not?
Untitled3.png
Untitled3.png (12.06 KiB) Viewed 3210 times
top branches: V = 262+128 = 390 < 500 (ok)
bottom branches: V = 262+132+128 = 522 > 500 (bottlenecked)

eg3: bottleneck or not?
Untitled4.png
Untitled4.png (12.73 KiB) Viewed 3210 times
top branches: V = 262+200 = 462 < 500 (ok)
bottom branches: V = 262+102+72 = 436 < 500 (ok)

whats interesting is eg2 and eg3 both has equal amount of exchanger, by carefully arrange them, one can "minimize the maximum" V.
in general, branches nearer to reactor should have more exchanger.
3. Bonus
these are some of the findings that did not make it to the original post. they are too hard to explain and too mathy. i decided to put them here in case someone find them useful.

1. heat capacity of pipes, exchangers, reactors are 1MJ/K, 1MJ/K, 10MJ/K respectively.
2. each tick, two adjacent entity transfer ΔQ heat from hotter entity to colder entity.
ΔQ = c * clip[(ΔT-1)/5 , {0,50/3}]
....= c * (ΔT-1)/5 when 1<=ΔT<=84.333
....= c * 16.667 when ΔT > 84.333
....= 0 when ΔT < 1
where c is the heat capacity of hotter entity and ΔT is the temperature difference.
3. if both are reactors, the transfer calculation is done 3 times per tick.
4. deducing temperature difference formula (V) from transfer formula (ΔQ) gives V = (5/6)i + 1, not (2/3)i + 1, the reason is the fact that pipes are not calculate and update simultaneously, but sequentially.

ΔQ forumla is the only empirical result, three of the V formulae are deduced from here using math. the deduction is left to reader as a challenge.
Last edited by pichutarius on Sat Jun 24, 2017 1:48 pm, edited 1 time in total.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: heat flow (math!)

Post by XKnight »

pichutarius wrote: 2. each tick, two adjacent entity transfer ΔQ heat from hotter entity to colder entity.
ΔQ = c * clip[(ΔT-1)/5 , {0,50/3}]
....= c * (ΔT-1)/5 when 1<=ΔT<=84.333
....= c * 16.667 when ΔT > 84.333
....= 0 when ΔT < 1
where c is the heat capacity of hotter entity and ΔT is the temperature difference.
3. if both are reactors, the transfer calculation is done 3 times per tick.
Can you prove reactor-reactor behavior by any experiment? I am especially interested in "3 times per tick" part.

According to my experiments reactor-reactor transfer rate depends on the temperature difference between them not in a linear way:
Mathematica.png
Mathematica.png (5.65 KiB) Viewed 3203 times
Edit: Nevermind, just found that after applying pipe-pipe formula 3 times we receive my reactor-reactor formula.
I hope devs do only one calculation per tick, but your representation is definitely simpler.

XKnight
Filter Inserter
Filter Inserter
Posts: 329
Joined: Thu May 28, 2015 10:40 pm
Contact:

Re: heat flow (math!)

Post by XKnight »

pichutarius wrote: for red line with length = (r), V = (⅔i+1)r
for single row (i+0) black line, V = (i-1)(i+3) ≈ (i+1)²
for double row (i/2+i/2) black line, V = (i/2-1)(i+3) ≈ i²/2
where V = temperature difference, i = total exchanger down the line, r = length of pipes
Found some differences with my own formulas:
1) no questions to V=(2/3i+1)r, this is correct
2) to check this formula we can calculate it with i = 1... wait a minute, temp difference is zero? how is that possible? according to your picture "(1+0)" means next build: pipe-pipe-exchanger, and temperature difference is zero? I don't believe.
Okay, probably this is a corner case, let's check it with i = 2, build:
_______exchanger______exchanger
__________|_____________|
pipe-pipe-piiiiipe-pipe-pipe-pipe
According to (2) V = 1 * 5 = 5. But according to (1) we have: (2/3*2+1)+(2/3*2+1)+(2/3*1+1)+(2/3*1+1)+(2/3*1+1) = 9.66
Looks like there is some mistake.
3) same here, just try to apply you own rules from (1) and you will find the mistake.

pichutarius
Fast Inserter
Fast Inserter
Posts: 158
Joined: Mon Feb 27, 2017 12:47 am
Contact:

Re: heat flow (math!)

Post by pichutarius »

well, thanks for pointing out the part i did not make myself clear.

in my formula, the V is calculated between input heat tile to input heat tile, hence when i = 0, the end points are the same tile, therefore V = 0.
i choose between input heat tile because the formula is nicer this way.
as a consequences, the real V will be larger because we omitted 1~2 pipes.

but when "i" is big enough (when heat flow is something we need to consider), the difference is pretty negligible, especially when mentally calculating (i+1)^2 and i^2/2, those will not give the exact number anyway.

Post Reply

Return to “General discussion”