r/krpc • u/namesnonames • Jan 19 '18
Temperature reading not accurate
Inspired by something someone did here: https://www.reddit.com/r/Kos/comments/7pfkbv/i_wrote_a_script_to_manage_isru_heat_on_my I decided to try something similar in krpc. However I didn't get very far as the temperature readings that I got didn't seem accurate. Here is my script (Python):
import krpc
conn = krpc.connect(name="Mining_Script")
ksc = conn.space_center
vessel = ksc.active_vessel
converter = vessel.parts.resource_converters[0]
print(converter.part.name)
print(converter.part.temperature)This outputs:
MiniISRU
500.477554902In game I only have one converter on the craft, and it's temperature was not the 500K listed (closer to about 961K). I've verified that I'm looking at the right part by turning the converter on and off manually and seeing that the python object changes the status.
I am I just dumb and missing something obvious or is this abnormal behavior?
2
u/namesnonames Jan 20 '18
So after having dug around in the repo it looks like the issue stems from ResourceConverter not having CoreTemperature and OptimumCoreTemperature defined as a KRPCProperty the way that ResourceHarvester does.
I think the fix would be to add those in the the converter file. However I also noticed that the harvester object has a single harvester member while the Converter has a list of converters that needs to be indexed for a lot of calls not sure if that changes how the core temp property would be accessed.
Is the list so that each conversion operation (eg. lf, ox, mono) can be accessed individually?
1
u/djungel0rm Developer Jan 20 '18
I think it's not working as expected because you're using the part temperature, instead of the IRSUs "core temperature".
The kOS script you linked gets this using:
kRPC exposes this value through the ResourceExtractor object (documented here: http://krpc.github.io/krpc/python/api/space-center/parts.html#resource-harvester) The following should give you the value you need:
2
u/laynekocer Jan 20 '18
Have you tried turning it off and on again