HK Parsing and TC PROC Tests #76

Merged
muellerr merged 7 commits from mueller/hk-parsing into develop 2022-05-19 19:30:20 +02:00
4 changed files with 73 additions and 37 deletions
Showing only changes of commit e15d3a0b7a - Show all commits

View File

@ -948,10 +948,12 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
def add_proc_cmds(cmd_dict: ServiceOpCodeDictT): def add_proc_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.system.proc import OpCodes, Info from pus_tc.system.proc import OpCodes, KAI
op_code_dict = dict() op_code_dict = dict()
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.HEATER, info=Info.HEATER) add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.HEATER, info=KAI.HEATER[1]
)
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,
name=CustomServiceList.PROCEDURE.value, name=CustomServiceList.PROCEDURE.value,
@ -959,7 +961,15 @@ def add_proc_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_entry=op_code_dict, op_code_entry=op_code_dict,
) )
op_code_dict = dict() op_code_dict = dict()
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.BAT_FT, info=Info.BAT_FT) add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.BAT_FT, info=KAI.BAT_FT[1]
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.PCDU_FT, info=KAI.PCDU_FT[1]
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.CORE_FT, info=KAI.CORE_FT[1]
)
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,
name=CustomServiceList.PROCEDURE.value, name=CustomServiceList.PROCEDURE.value,

View File

@ -7,55 +7,79 @@ from config.object_ids import (
PDU_1_HANDLER_ID, PDU_1_HANDLER_ID,
PDU_2_HANDLER_ID, PDU_2_HANDLER_ID,
ACU_HANDLER_ID, ACU_HANDLER_ID,
CORE_CONTROLLER_ID,
) )
import config.object_ids as oids
from pus_tc.devs.bpx_batt import BpxSetIds from pus_tc.devs.bpx_batt import BpxSetIds
from pus_tc.system.core import SetIds as CoreSetIds
from gomspace.gomspace_common import SetIds as GsSetIds from gomspace.gomspace_common import SetIds as GsSetIds
class OpCodes: class OpCodes:
HEATER = ["0", "heater"] HEATER = ["0", "heater"]
BAT_FT = ["bat-ft"] BAT_FT = ["bat-ft"]
CORE_FT = ["core-ft"]
PCDU_FT = ["pcdu-ft"] PCDU_FT = ["pcdu-ft"]
class Info: class KeyAndInfo:
HEATER = "heater procedure" HEATER = ["Heater", "heater procedure"]
BAT_FT = "battery functional test" BAT_FT = ["BPX Battery", "battery functional test"]
PCDU_FT = "pcdu functional test" PCDU_FT = ["PCDU", "PCDU functional test"]
CORE_FT = ["OBC", "OBC functional test"]
KAI = KeyAndInfo
PROC_INFO_DICT = {
KAI.BAT_FT[0]: [OpCodes.BAT_FT, KAI.BAT_FT[1], 120.0, 10.0],
KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KeyAndInfo.PCDU_FT[1], 120.0, 10.0],
KAI.CORE_FT[0]: [OpCodes.CORE_FT, KeyAndInfo.CORE_FT[1], 120.0, 10.0],
}
def generic_print(tc_queue: TcQueueT, key: str):
info = PROC_INFO_DICT[key]
tc_queue.appendleft(
(QueueCommands.PRINT, f"Executing {info[0]} Procedure (OpCodes: {info[1]})")
)
def pack_generic_hk_listening_cmds(
tc_queue: TcQueueT, proc_key: str, sid: bytes, diag: bool
):
generic_print(tc_queue=tc_queue, key=proc_key)
listen_to_hk_for_x_seconds(
diag=diag,
tc_queue=tc_queue,
device=proc_key,
sid=sid,
interval_seconds=10.0,
collection_time=120.0,
)
def pack_proc_commands(tc_queue: TcQueueT, op_code: str): def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.BAT_FT: if op_code in OpCodes.BAT_FT:
device = Info.BAT_FT.split()[0] key = KAI.BAT_FT[0]
tc_queue.appendleft(
(QueueCommands.PRINT, f"Executing {device} Procedure ({device})")
)
sid = make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) sid = make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)
pack_generic_hk_listening_cmds(
listen_to_hk_for_x_seconds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
diag=False,
device=device,
sid=sid,
interval_seconds=10.0,
collection_time=120.0,
) )
if op_code in OpCodes.PCDU_FT: if op_code in OpCodes.PCDU_FT:
device = Info.PCDU_FT.split()[0] key = KAI.PCDU_FT[0]
tc_queue.appendleft(
(QueueCommands.PRINT, f"Executing {device} Procedure ({device})")
)
sid = make_sid(P60_DOCK_HANDLER, GsSetIds.P60_CORE) sid = make_sid(P60_DOCK_HANDLER, GsSetIds.P60_CORE)
pack_generic_hk_listening_cmds(
listen_to_hk_for_x_seconds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
diag=False,
device=device,
sid=sid,
interval_seconds=10.0,
collection_time=120.0,
) )
pass if op_code in OpCodes.CORE_FT:
key = KAI.CORE_FT[0]
sid = make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
def listen_to_hk_for_x_seconds( def listen_to_hk_for_x_seconds(

View File

@ -26,19 +26,21 @@ def handle_mgm_lis3_hk_data(
fmt_str, hk_data[0 : 0 + inc_len] fmt_str, hk_data[0 : 0 + inc_len]
) )
pw.dlog(f"Received MGM LIS3 from object {object_id}") pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog(f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}") pw.dlog(
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
)
pw.dlog(f"Temperature {temp} C") pw.dlog(f"Temperature {temp} C")
def handle_mgm_rm3100_hk_data( def handle_mgm_rm3100_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id == MgmRm3100SetIds.CORE_HK: if set_id == MgmRm3100SetIds.CORE_HK:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
fmt_str = f"!fff" fmt_str = f"!fff"
inc_len = struct.calcsize(fmt_str) inc_len = struct.calcsize(fmt_str)
(field_x, field_y, field_z) = struct.unpack( (field_x, field_y, field_z) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
fmt_str, hk_data[0 : 0 + inc_len]
)
pw.dlog(f"Received MGM LIS3 from object {object_id}") pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog(f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}") pw.dlog(
f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}"
)

@ -1 +1 @@
Subproject commit bca6440dba775b4691e693551e29849f2ab6542f Subproject commit cf0afec762de4077f89b8da1f43b98e993fca6d0