TCS CTRL Info Set #215
@ -12,3 +12,16 @@ class CtrlSetId(enum.IntEnum):
|
|||||||
class TcsSubmode(enum.IntEnum):
|
class TcsSubmode(enum.IntEnum):
|
||||||
DEFAULT = 0
|
DEFAULT = 0
|
||||||
NO_HEATER_CTRL = 1
|
NO_HEATER_CTRL = 1
|
||||||
|
|
||||||
|
|
||||||
|
class Heater(enum.IntEnum):
|
||||||
|
HEATER_0_PLOC_PROC_BRD = 0
|
||||||
|
HEATER_1_PCDU_BRD = 1
|
||||||
|
HEATER_2_ACS_BRD = 2
|
||||||
|
HEATER_3_OBC_BRD = 3
|
||||||
|
HEATER_4_CAMERA = 4
|
||||||
|
HEATER_5_STR = 5
|
||||||
|
HEATER_6_DRO = 6
|
||||||
|
HEATER_7_SYRLINKS = 7
|
||||||
|
NUMBER_OF_SWITCHES = 8
|
||||||
|
NONE = 0xFF
|
||||||
|
@ -7,6 +7,7 @@ import enum
|
|||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import get_object_ids
|
from eive_tmtc.config.object_ids import get_object_ids
|
||||||
|
from eive_tmtc.tmtc.tcs.defs import Heater
|
||||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
@ -20,18 +21,6 @@ from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
|||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
|
|
||||||
|
|
||||||
class Heater(enum.IntEnum):
|
|
||||||
HEATER_0_PLOC_PROC_BRD = 0
|
|
||||||
HEATER_1_PCDU_BRD = 1
|
|
||||||
HEATER_2_ACS_BRD = 2
|
|
||||||
HEATER_3_OBC_BRD = 3
|
|
||||||
HEATER_4_CAMERA = 4
|
|
||||||
HEATER_5_STR = 5
|
|
||||||
HEATER_6_DRO = 6
|
|
||||||
HEATER_7_SYRLINKS = 7
|
|
||||||
NUMBER_OF_SWITCHES = 8
|
|
||||||
|
|
||||||
|
|
||||||
HEATER_LOCATION = [
|
HEATER_LOCATION = [
|
||||||
"PLOC Processing Board",
|
"PLOC Processing Board",
|
||||||
"PCDU PDU",
|
"PCDU PDU",
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import dataclasses
|
||||||
|
import datetime
|
||||||
import enum
|
import enum
|
||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
|
from eive_tmtc.tmtc.tcs.defs import Heater
|
||||||
from tmtccmd.fsfw import validity_buffer_list
|
from tmtccmd.fsfw import validity_buffer_list
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from .defs import CtrlSetId
|
from .defs import CtrlSetId
|
||||||
@ -40,6 +43,17 @@ class ThermalComponent(enum.IntEnum):
|
|||||||
NUM_ENTRIES = 24
|
NUM_ENTRIES = 24
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass
|
||||||
|
class TcsCtrlComponentInfo:
|
||||||
|
component: ThermalComponent
|
||||||
|
# Heater on or off?
|
||||||
|
state: bool
|
||||||
|
used_sensor_idx: int
|
||||||
|
used_heater: Heater
|
||||||
|
start_time: datetime.datetime
|
||||||
|
end_time: datetime.datetime
|
||||||
|
|
||||||
|
|
||||||
def handle_thermal_controller_hk_data(
|
def handle_thermal_controller_hk_data(
|
||||||
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
@ -149,7 +163,49 @@ def handle_thermal_controller_hk_data(
|
|||||||
current_draw = struct.unpack("!H", hk_data[8:10])[0]
|
current_draw = struct.unpack("!H", hk_data[8:10])[0]
|
||||||
print(f"Heater Power Channel Current Draw: {current_draw} mA")
|
print(f"Heater Power Channel Current Draw: {current_draw} mA")
|
||||||
elif set_id == CtrlSetId.TCS_CTRL_INFO:
|
elif set_id == CtrlSetId.TCS_CTRL_INFO:
|
||||||
pw.dlog("Received TCS CTRL set")
|
pw.dlog("Received TCS CTRL information set")
|
||||||
pass
|
current_idx = 0
|
||||||
|
heater_states = hk_data[0 : ThermalComponent.NUM_ENTRIES]
|
||||||
|
current_idx += ThermalComponent.NUM_ENTRIES
|
||||||
|
used_sensor_idx = hk_data[
|
||||||
|
current_idx : current_idx + ThermalComponent.NUM_ENTRIES
|
||||||
|
]
|
||||||
|
current_idx += ThermalComponent.NUM_ENTRIES
|
||||||
|
used_heater_idx = hk_data[
|
||||||
|
current_idx : current_idx + ThermalComponent.NUM_ENTRIES
|
||||||
|
]
|
||||||
|
current_idx += ThermalComponent.NUM_ENTRIES
|
||||||
|
start_and_end_time_fmt_str = "!IIIIIIIIIIIIIIIIIIIIIIII"
|
||||||
|
data_len = struct.calcsize(start_and_end_time_fmt_str)
|
||||||
|
start_times = struct.unpack(
|
||||||
|
start_and_end_time_fmt_str, hk_data[current_idx : current_idx + data_len]
|
||||||
|
)
|
||||||
|
current_idx += data_len
|
||||||
|
end_times = struct.unpack(
|
||||||
|
start_and_end_time_fmt_str, hk_data[current_idx : current_idx + data_len]
|
||||||
|
)
|
||||||
|
current_idx += data_len
|
||||||
|
component_list = []
|
||||||
|
for i in range(ThermalComponent.NUM_ENTRIES):
|
||||||
|
info = TcsCtrlComponentInfo(
|
||||||
|
component=ThermalComponent(i),
|
||||||
|
state=bool(heater_states[i]),
|
||||||
|
used_sensor_idx=used_sensor_idx[i],
|
||||||
|
used_heater=Heater(used_heater_idx[i]),
|
||||||
|
start_time=datetime.datetime.fromtimestamp(
|
||||||
|
start_times[i], datetime.timezone.utc
|
||||||
|
),
|
||||||
|
end_time=datetime.datetime.fromtimestamp(
|
||||||
|
end_times[i], datetime.timezone.utc
|
||||||
|
),
|
||||||
|
)
|
||||||
|
component_str = f"{info.component!r}".ljust(46)
|
||||||
|
state_str = "ON" if info.state else "OFF"
|
||||||
|
pw.dlog(
|
||||||
|
f"{component_str}: {state_str.ljust(4)} | Sensor Index "
|
||||||
|
f"{info.used_sensor_idx} | {info.used_heater!r} | Start "
|
||||||
|
f"{info.start_time} | End {info.end_time}"
|
||||||
|
)
|
||||||
|
component_list.append(info)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(f"Unimplemented set ID {set_id}")
|
_LOGGER.warning(f"Unimplemented set ID {set_id}")
|
||||||
|
Loading…
Reference in New Issue
Block a user