from tmtccmd.config import QueueCommands from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.pus_3_fsfw_hk import * from config.object_ids import ( BPX_HANDLER_ID, P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, ) from pus_tc.devs.bpx_batt import BpxSetIds from gomspace.gomspace_common import SetIds as GsSetIds class OpCodes: HEATER = ["0", "heater"] BAT_FT = ["bat-ft"] PCDU_FT = ["pcdu-ft"] class Info: HEATER = "heater procedure" BAT_FT = "battery functional test" PCDU_FT = "pcdu functional test" def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.BAT_FT: device = Info.BAT_FT.split()[0] tc_queue.appendleft( (QueueCommands.PRINT, f"Executing {device} Procedure ({device})") ) sid = make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) listen_to_hk_for_x_seconds( diag=False, device=device, sid=sid, interval_seconds=10.0, collection_time=120.0, ) if op_code in OpCodes.PCDU_FT: device = Info.PCDU_FT.split()[0] tc_queue.appendleft( (QueueCommands.PRINT, f"Executing {device} Procedure ({device})") ) sid = make_sid(P60_DOCK_HANDLER, GsSetIds.P60_CORE) listen_to_hk_for_x_seconds( diag=False, device=device, sid=sid, interval_seconds=10.0, collection_time=120.0, ) pass def listen_to_hk_for_x_seconds( tc_queue: TcQueueT, diag: bool, device: str, sid: bytes, interval_seconds: float, collection_time: float, ): """ enable_periodic_hk_command_with_interval( diag: bool, sid: bytes, interval_seconds: float, ssc: int """ """ function with periodic HK generation interval_seconds = at which rate HK is saved collection_time = how long the HK is saved for device = for which device the HK is saved functional_test = diagnostic Hk = yes diagnostic or no diagnostic sid = structural ID for specific device device Hk set ID """ tc_queue.appendleft((QueueCommands.PRINT, f"Enabling periodic HK for {device}")) cmd_tuple = enable_periodic_hk_command_with_interval( diag=diag, sid=sid, interval_seconds=interval_seconds, ssc=0 ) for cmd in cmd_tuple: tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft((QueueCommands.WAIT, collection_time)) tc_queue.appendleft((QueueCommands.PRINT, f"Disabling periodic HK for {device}")) tc_queue.appendleft( disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple() )