switch to generic hk function

This commit is contained in:
Markus Kranz 2022-05-19 18:14:38 +02:00
parent 72de2d99ca
commit d53e26b589
2 changed files with 70 additions and 19 deletions

View File

@ -16,9 +16,6 @@ from gomspace.gomspace_common import *
from config.object_ids import P60_DOCK_HANDLER from config.object_ids import P60_DOCK_HANDLER
HK_SET_ID = 0x3
class P60OpCodes: class P60OpCodes:
STACK_3V3_ON = ["stack-3v3-on", "1"] STACK_3V3_ON = ["stack-3v3-on", "1"]
STACK_3V3_OFF = ["stack-3v3-off", "2"] STACK_3V3_OFF = ["stack-3v3-off", "2"]

View File

@ -1,42 +1,96 @@
from tmtccmd.config import QueueCommands from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_3_fsfw_hk import * from tmtccmd.tc.pus_3_fsfw_hk import *
from config.object_ids import BPX_HANDLER_ID 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 pus_tc.devs.bpx_batt import BpxSetIds
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"]
PCDU_FT = ["pcdu-ft"]
class Info: class Info:
HEATER = "heater procedure" HEATER = "heater procedure"
BAT_FT = "battery functional test" BAT_FT = "battery functional test"
PCDU_FT = "pcdu functional test"
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]
tc_queue.appendleft( tc_queue.appendleft(
( (QueueCommands.PRINT, f"Executing {device} Procedure ({device})")
QueueCommands.PRINT,
f"Executing Battery functional test Procedure ({OpCodes.BAT_FT})",
) )
) sid = make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)
tc_queue.appendleft((QueueCommands.PRINT, f"Enabling periodic HK for Battery"))
cmd_tuple = enable_periodic_hk_command_with_interval( listen_to_hk_for_x_seconds(
diag=False, diag=False,
sid=make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET), device=device,
sid=sid,
interval_seconds=10.0, interval_seconds=10.0,
ssc=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: for cmd in cmd_tuple:
tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft(cmd.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 120.0))
tc_queue.appendleft((QueueCommands.PRINT, "Disabling periodic HK for Battery")) tc_queue.appendleft((QueueCommands.WAIT, collection_time))
tc_queue.appendleft((QueueCommands.PRINT, f"Disabling periodic HK for {device}"))
tc_queue.appendleft( tc_queue.appendleft(
disable_periodic_hk_command( disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple()
diag=False, sid=make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET), ssc=0
).pack_command_tuple()
) )
pass