[1.0] RedistHeat (Oct 29, v50) Ported to 1.0

Started by Morgloz, July 19, 2016, 02:19:23 PM

Previous topic - Next topic

PreDiabetic

This mod is on my wish list. As soon as NaNc bug fixed I'm on train. Good luck.

Riddle78

Quote from: PixelBitZombie on July 07, 2017, 03:53:59 PM
Snip

Here's the thing; I was using my lab and medical building as a small scale test. Four Industrial Coolers couldn't do jack,either on the network,or set to directly cool a room; My medical freezer had four Industrial Coolers,with vents,and all four had to be set to -50 Celsius (-58 Fahrenheit to the two countries on Earth that still use that baffling system) to get the freezer down to -10 Celsius (+14 F). The hospital and lab were set to 21 Celsius (69.8 F),and the cooling was only a couple of degrees,at best.

Would it be more efficient to have my Industrial Coolers set to cool a room to Plutonian temperatures,while I use intakes to ship that hilariously chilled air around the installation? The same can be asked of the Industrial Heater and solar temperatures.

Quote from: Morgloz on July 07, 2017, 04:26:18 PM
Snip

That's just the thing; The Icebox had two intakes,and the building I was trying to regulate,originally,only had three outlets,which was downsized to two when I got frustrated with the freezer,and isolated it. THAT SAID,I was using the "unofficial" A17 version that was posted a few pages ago,but this was only last night.

My typical freezer size is 11^2. My rooms tend to hover around 5^2,though my lab was bucking that trend; It was large enough to accommodate four High-Tech Research Tables,arranged in a pinwheel around a Multi-Analyzer,with a three-wide walking space all around. One outlet in there. The hospital (Made from an ancient casket room) was about 8*14,with the freezer taking up the rest of the original 14^2 footprint. Three rooms,three outlets,two intakes,and it didn't even make a dent.

To be fair,I always include two intakes in every room; One on the Lower Network (Cold air),and one on the Upper Network (Hot air),because I assumed that air recycling was a thing.

I'll test with the official version,and see if anything's changed.

Morgloz

Quote from: Riddle78 on July 07, 2017, 04:40:30 PM
Quote from: PixelBitZombie on July 07, 2017, 03:53:59 PM
Snip

Here's the thing; I was using my lab and medical building as a small scale test. Four Industrial Coolers couldn't do jack,either on the network,or set to directly cool a room; My medical freezer had four Industrial Coolers,with vents,and all four had to be set to -50 Celsius (-58 Fahrenheit to the two countries on Earth that still use that baffling system) to get the freezer down to -10 Celsius (+14 F). The hospital and lab were set to 21 Celsius (69.8 F),and the cooling was only a couple of degrees,at best.

Would it be more efficient to have my Industrial Coolers set to cool a room to Plutonian temperatures,while I use intakes to ship that hilariously chilled air around the installation? The same can be asked of the Industrial Heater and solar temperatures.

Quote from: Morgloz on July 07, 2017, 04:26:18 PM
Snip

That's just the thing; The Icebox had two intakes,and the building I was trying to regulate,originally,only had three outlets,which was downsized to two when I got frustrated with the freezer,and isolated it. THAT SAID,I was using the "unofficial" A17 version that was posted a few pages ago,but this was only last night.

My typical freezer size is 11^2. My rooms tend to hover around 5^2,though my lab was bucking that trend; It was large enough to accommodate four High-Tech Research Tables,arranged in a pinwheel around a Multi-Analyzer,with a three-wide walking space all around. One outlet in there. The hospital (Made from an ancient casket room) was about 8*14,with the freezer taking up the rest of the original 14^2 footprint. Three rooms,three outlets,two intakes,and it didn't even make a dent.

To be fair,I always include two intakes in every room; One on the Lower Network (Cold air),and one on the Upper Network (Hot air),because I assumed that air recycling was a thing.

I'll test with the official version,and see if anything's changed.

The official version had a lot of balance changes, I made the inlets less strong in terms of net temperature change and the heaters/coolers have been buffed
My mods:
RedistHeat

lperkins2

Quote from: Morgloz on July 07, 2017, 04:18:50 PM
Quote from: lperkins2 on July 07, 2017, 01:46:44 PM
Good to see someone who knows the code is back :)
As for the NaN bug, it's probably caused by an invalid division (it might be cause by the target temperature hitting infinite, I don't know in C# how that plays out, but bad division is much more likely). 

Here's a list of where non-constant division happens, some of them I can see are guarded against division by zero, some of them I don't know.  Hope it helps, and I'll keep poking at it as time allows.

Building/Building_TempControl/Building_IndustrialHeater.cs
ControlTemperatureTempChange count is never checked to ensure non-zero.  If it is reading from the net, the connected net nodes count might be 0?

Industrial cooler has a similar spot, as does Multipurpose Cooler's Equalize method.
Building_DuctComp.cs also uses compAir.connectedNet.nodes.Count without checking if it is 0, and room.CellCount, but I assume for the room to exist its cell count must be positive.

That appears to be everywhere that division is used with unchecked variables. 
Where is the temperature data stored?  A check there if it is being asked to store NANC and a messy error message might be a good idea, since it would identify other mods involved in the stack.  Also, an inelegant be effective solution would be to replace requests to store NANC with some default value.

I found it happens when the CompAir in the heater/cooler is null, but that shouldn't happen and I'm not been able to find out why it does

How can a null compAir cause that?  I would expect it to crash, since it's trying to access attributes on compAir.  Do you mean compAir.connectedNet is null?  Otherwise, the question is how you get an industrial heater/cooler that hasn't had SpawnSetup called, or whose GetComp<CompAirTrader> returns null. 

CheaterEater

I made a few tests with the updated version, here are some numbers for heating/cooling. These were tested in a 5x5 room with single walls in a temperate biome (~24C). If ducting was involved, it was one inlet in ambient air plus one outlet in the room. Industrial coolers had 6 exhaust ports. Heaters and coolers were set to very high/low values to max the output.

One cooler (medium): -36C
One heater (small vanilla): 64C
Industrial heater in room: 146C
Industrial cooler output into room: -105C

Industrial hooked up to ducts: -96C
Industrial cooler ->double thick walls, 5x5 room ->ducts-> single wall 5x5 room: -96C (and the first room was at -108C)
Industrial heater hooked up to ducts: 106C
Duct cooler (ducts only): -80C
Duct cooler exhaust (reversed cooler): 135C

Industrial cooler exhaust duct only (the cooler exhaust hooked up the ducts exhaust into a room): exhaust room reaches ~240C, cooler room reduced to 15C (so the ducted exhaust can't keep up)
Industrial cooler exhausted into a room: exhaust room reaches 156C
Industrial cooler exhausted into duct (ambient): exhaust room is at ambient, ducts take all heat. Cooled room reaches -36C. Bumping up to 4 outlets in ambient lets cooled room reach -85C.

And power usage:
Cooler (vanilla) & duct cooler: 200W
Heater (small vanilla): 100W
Industrial heater: 500W
Industrial Cooler + 6 exhausts: 400W for cooler, 100W per exhaust = 1,000W.

So overall, I would say the duct cooler is a little too powerful, as it reaches -86C for the same power cost as the vanilla cooler reaching -36C. Its exhaust is also too powerful as it's better than the industrial heater. The industrial cooler exhaust is too much as well, but the cooler itself seems good. The industrial heater could put more heat into the ducts to get closer to its in-room
performance. The ducts are still way better than before, they will be much more useful.

One final note: I got the NaNC bug in the unofficial version in my ducts coming from a steam vent and in the vent. I flipped the output of the duct off and on a few times and the problem fixed itself, even at the vent. Hope that helps.

Morgloz

Quote from: CheaterEater on July 07, 2017, 07:48:48 PM

So overall, I would say the duct cooler is a little too powerful, as it reaches -86C for the same power cost as the vanilla cooler reaching -36C.


Okay I'll nerf it a bit

Quote from: CheaterEater on July 07, 2017, 07:48:48 PM
The industrial cooler exhaust is too much as well, but the cooler itself seems good.

Technically it has the same power to cool as the industrial heater has to heat, but cooling generates a positive heat gain. That's why it generates so much heat.

Quote from: CheaterEater on July 07, 2017, 07:48:48 PM
The industrial heater could put more heat into the ducts to get closer to its in-room performance.

Ok, I'll buff it a bit.

Quote from: CheaterEater on July 07, 2017, 07:48:48 PM
The ducts are still way better than before, they will be much more useful.

Glad to hear that, took me a while to figure out what numbers had to be changed.

Quote from: CheaterEater on July 07, 2017, 07:48:48 PM
One final note: I got the NaNC bug in the unofficial version in my ducts coming from a steam vent and in the vent. I flipped the output of the duct off and on a few times and the problem fixed itself, even at the vent. Hope that helps.

There were other mods installed?
There were any industrial heaters/coolers connected to that network?
And, (of this one I almost know the answer) Did it happened on colony load?
My mods:
RedistHeat

Morgloz

Quote from: lperkins2 on July 07, 2017, 06:47:29 PM
How can a null compAir cause that?  I would expect it to crash, since it's trying to access attributes on compAir.  Do you mean compAir.connectedNet is null?  Otherwise, the question is how you get an industrial heater/cooler that hasn't had SpawnSetup called, or whose GetComp<CompAirTrader> returns null.

It hapens on colony load and I don't know why, but I'm been trying to reproduce the bug in my computer so I can fix it.
My mods:
RedistHeat

PixelBitZombie

So I didn't realize Intakes could be used on the outside, probably better used that way too.
So I used two, and incorporated 3 Out-takes (outlets) non smart, at 64f air non-stop. With 12 central cooling units filling a very large living quarter at 70-73 all throughout the quarter. Maybe I need more units, maybe I'm not doing it right. But at 64f I figured 3 outlets would push it to 64f instead of 70f.

http://imgur.com/a/QDZ3z
"When logic and proportion have fallen sloppy dead
And the White Knight is talking backwards
And the Red Queen's off with her head"


CheaterEater

Quote from: Morgloz on July 07, 2017, 08:57:30 PM
Technically it has the same power to cool as the industrial heater has to heat, but cooling generates a positive heat gain. That's why it generates so much heat.

There were other mods installed?
There were any industrial heaters/coolers connected to that network?
And, (of this one I almost know the answer) Did it happened on colony load?

Moreso I meant that it seemed easier to build a cooler and run it in reverse than a heater. If the heat out is the same on both sides then that's right. I guess the balance is in the cost.

On load the temperature in the vent room was 0C, after which it became NaNC. I don't remember if the duct was at NaNC. Tons of other mods installed, of course, so I don't have any idea which one it could be. No other heaters/cooler connected to the network, only inlets and one outlet.


Morgloz

Okay, I finally fixed the NaNC bug! I updated the download link.
My mods:
RedistHeat

Canute

You made another exam at bughunting !! ? :-)

SpaceDorf

Can't a guy play one hour in peace without having a mod update again ? ;D
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

Morgloz

Quote from: SpaceDorf on July 08, 2017, 12:49:46 PM
Can't a guy play one hour in peace without having a mod update again ? ;D

Well, I stacked two changes because before making a new release, because I know that feeling  ;)
Actually, I think that mod management is the only advantage that the Steam version has over the DRM-free version
My mods:
RedistHeat

SpaceDorf

Quote from: Morgloz on July 08, 2017, 03:23:54 PM
Quote from: SpaceDorf on July 08, 2017, 12:49:46 PM
Can't a guy play one hour in peace without having a mod update again ? ;D

Well, I stacked two changes because before making a new release, because I know that feeling  ;)
Actually, I think that mod management is the only advantage that the Steam version has over the DRM-free version

Which still does not outweigh the disadvantages in my eyes :)
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

faltonico

Thanks a lot for squashing that bug!
You forgot to remove the debug log though:
RedistHeat: DuctOutlet count 138 pushers 48 pullers 12 force 4 result -0.51491
Verse.Log:Message(String)
RedistHeat.Building_DuctComp:Equalize()
RedistHeat.Building_DuctComp:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()

Also, can you make it so it ticks as rarely as possible? For performance sake?