continued update to new API
This commit is contained in:
@ -1,19 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import struct
|
||||
import time
|
||||
from datetime import timedelta
|
||||
from typing import List
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
from config.object_ids import get_object_ids
|
||||
from pus_tc.system.tcs import pack_tcs_sys_commands
|
||||
from tmtccmd.config import (
|
||||
QueueCommands,
|
||||
ServiceOpCodeDictT,
|
||||
add_op_code_entry,
|
||||
add_service_op_code_entry,
|
||||
)
|
||||
from tmtccmd.tc.definitions import TcQueueT
|
||||
|
||||
from tmtccmd.tc import QueueHelper
|
||||
from tmtccmd.tc.pus_11_tc_sched import (
|
||||
generate_time_tagged_cmd,
|
||||
generate_enable_tc_sched_cmd,
|
||||
@ -126,10 +121,8 @@ class GenericHkListeningCfg:
|
||||
return GenericHkListeningCfg(False, False, False)
|
||||
|
||||
|
||||
def generic_print(tc_queue: TcQueueT, info: dict):
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, f"Executing {info[1]} Procedure (OpCodes: {info[0]})")
|
||||
)
|
||||
def generic_print(q: QueueHelper, info: dict):
|
||||
q.add_log_cmd(f"Executing {info[1]} Procedure (OpCodes: {info[0]})")
|
||||
|
||||
|
||||
def add_proc_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
@ -147,7 +140,7 @@ def add_proc_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
|
||||
|
||||
def pack_generic_hk_listening_cmds(
|
||||
tc_queue: TcQueueT,
|
||||
q: QueueHelper,
|
||||
proc_key: str,
|
||||
sid_list: list[bytearray],
|
||||
diag_list: list[bool],
|
||||
@ -155,83 +148,77 @@ def pack_generic_hk_listening_cmds(
|
||||
):
|
||||
info = PROC_INFO_DICT[proc_key]
|
||||
collection_time = info[2]
|
||||
generic_print(tc_queue=tc_queue, info=info)
|
||||
generic_print(q=q, info=info)
|
||||
|
||||
for i in range(len(sid_list)):
|
||||
enable_listen_to_hk_for_x_seconds(
|
||||
diag=diag_list[i],
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
device=proc_key,
|
||||
sid=sid_list[i],
|
||||
interval_seconds=info[3],
|
||||
)
|
||||
if not cfg.use_tc_sched:
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 2.0))
|
||||
q.add_wait_seconds(2.0)
|
||||
|
||||
if cfg.mgt:
|
||||
activate_mgts_alternately(
|
||||
tc_queue=tc_queue,
|
||||
)
|
||||
activate_mgts_alternately(q)
|
||||
|
||||
elif cfg.one_rw:
|
||||
activate_all_rws_in_sequence(
|
||||
tc_queue=tc_queue, test_speed=20000, test_ramp_time=10000, init_ssc=0
|
||||
q=q, test_speed=20000, test_ramp_time=10000, init_ssc=0
|
||||
)
|
||||
elif cfg.two_rws:
|
||||
activate_all_rws_two_consecutively(tc_queue=tc_queue, init_ssc=0)
|
||||
activate_all_rws_two_consecutively(q=q)
|
||||
else:
|
||||
pass
|
||||
|
||||
if not cfg.use_tc_sched:
|
||||
tc_queue.appendleft((QueueCommands.WAIT, collection_time))
|
||||
q.add_wait_seconds(collection_time)
|
||||
disable_cmd_list = []
|
||||
for i in range(len(sid_list)):
|
||||
disable_cmd_list.append(
|
||||
gen_disable_listen_to_hk_for_x_seconds(
|
||||
diag=diag_list[i],
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
device=proc_key,
|
||||
sid=sid_list[i],
|
||||
)
|
||||
)
|
||||
if cfg.one_rw or cfg.two_rws:
|
||||
activate_all_rws_in_sequence(
|
||||
tc_queue=tc_queue, test_speed=0, test_ramp_time=5000, init_ssc=0
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 60))
|
||||
activate_all_rws_in_sequence(q=q, test_speed=0, test_ramp_time=5000, init_ssc=0)
|
||||
q.add_wait_seconds(60.0)
|
||||
current_time = time.time()
|
||||
current_time += collection_time
|
||||
if not cfg.use_tc_sched:
|
||||
for cmd in disable_cmd_list:
|
||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||
q.add_pus_tc(cmd)
|
||||
else:
|
||||
for cmd in disable_cmd_list:
|
||||
tc_queue.appendleft(
|
||||
q.add_pus_tc(
|
||||
generate_time_tagged_cmd(
|
||||
release_time=struct.pack("!I", int(current_time)),
|
||||
tc_to_insert=cmd,
|
||||
ssc=0,
|
||||
release_time=struct.pack("!I", int(current_time)), tc_to_insert=cmd
|
||||
)
|
||||
)
|
||||
|
||||
if not cfg.use_tc_sched:
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 60))
|
||||
q.add_wait_seconds(60.0)
|
||||
sid_list.clear()
|
||||
diag_list.clear()
|
||||
|
||||
|
||||
def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
def pack_proc_commands(q: QueueHelper, op_code: str):
|
||||
sid_list = []
|
||||
obj_id_dict = get_object_ids()
|
||||
if op_code in OpCodes.RESET_SCHED:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Resetting/Clearing TC schedule"))
|
||||
tc_queue.appendleft(generate_reset_tc_sched_cmd().pack_command_tuple())
|
||||
q.add_log_cmd("Resetting/Clearing TC schedule")
|
||||
q.add_pus_tc(generate_reset_tc_sched_cmd())
|
||||
if op_code in OpCodes.BAT_FT:
|
||||
key = KAI.BAT_FT[0]
|
||||
sid_list.append(make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET))
|
||||
diag_list = [False]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
@ -243,7 +230,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK))
|
||||
diag_list = [False]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
@ -279,7 +266,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
set_id = pcdu_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
@ -291,7 +278,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.HK))
|
||||
diag_list = [False]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
@ -300,20 +287,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
|
||||
if op_code in OpCodes.TV_SETUP_TCS_FT_ON:
|
||||
# Enable scheduling
|
||||
tc_queue.appendleft(generate_enable_tc_sched_cmd(ssc=22).pack_command_tuple())
|
||||
q.add_pus_tc(generate_enable_tc_sched_cmd())
|
||||
# check whether tcs_assembly also has to be commanded to NORMAL Mode
|
||||
pack_tcs_sys_commands(
|
||||
tc_queue=tc_queue, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0]
|
||||
)
|
||||
pack_cmd_ctrl_to_nml(
|
||||
tc_queue=tc_queue, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID)
|
||||
)
|
||||
pack_tcs_sys_commands(q=q, op_code=TcsOpCodes.TCS_BOARD_ASS_NORMAL[0])
|
||||
pack_cmd_ctrl_to_nml(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
|
||||
|
||||
if op_code in OpCodes.TV_TEARDOWN_TCS_FT_OFF:
|
||||
# TCS board should always be on anyway, do not command it off here
|
||||
pack_cmd_ctrl_to_off(
|
||||
tc_queue=tc_queue, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID)
|
||||
)
|
||||
pack_cmd_ctrl_to_off(q=q, object_id=obj_id_dict.get(oids.THERMAL_CONTROLLER_ID))
|
||||
|
||||
if op_code in OpCodes.ACS_FT:
|
||||
key = KAI.ACS_FT[0]
|
||||
@ -333,23 +314,23 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
]
|
||||
d_side_pairs = a_side_pairs + b_side_pairs
|
||||
diag_list = [False, False, True, False, False]
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
|
||||
pack_acs_command(q=q, op_code="acs-a")
|
||||
|
||||
for a_side_dev in a_side_pairs:
|
||||
oid = a_side_dev[0]
|
||||
set_id = a_side_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-b")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-b")
|
||||
|
||||
sid_list.clear()
|
||||
diag_list = [False, False, True, False, False]
|
||||
@ -359,16 +340,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
set_id = b_side_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
|
||||
sid_list.clear()
|
||||
|
||||
@ -389,14 +370,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
False,
|
||||
]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
|
||||
if op_code in OpCodes.MGT_FT:
|
||||
key = KAI.MGT_FT[0]
|
||||
@ -412,24 +393,24 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
]
|
||||
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="1")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5))
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
q.add_wait_seconds(5.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="2")
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
|
||||
for imtq_dev in imtq_pairs:
|
||||
oid = imtq_dev[0]
|
||||
set_id = imtq_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="0")
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
|
||||
if op_code in OpCodes.MGT_FT_DP:
|
||||
key = KAI.MGT_FT_DP[0]
|
||||
@ -468,12 +449,12 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
True,
|
||||
True,
|
||||
]
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
|
||||
pack_acs_command(q=q, op_code="acs-d")
|
||||
# Command MGT to mode on
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="1")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 20))
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="1")
|
||||
q.add_wait_seconds(20.0)
|
||||
# Command MGT to normal mode
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="2")
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="2")
|
||||
|
||||
for d_side_and_imtq_dev in d_side_and_imtq_pairs:
|
||||
oid = d_side_and_imtq_dev[0]
|
||||
@ -483,20 +464,20 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
cfg = GenericHkListeningCfg.default()
|
||||
cfg.mgt = True
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=cfg,
|
||||
)
|
||||
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=tc_queue, op_code="0")
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="acs-off")
|
||||
pack_imtq_test_into(oids.IMTQ_HANDLER_ID, q=q, op_code="0")
|
||||
pack_acs_command(q=q, op_code="acs-off")
|
||||
|
||||
if op_code in OpCodes.SUS_FT:
|
||||
key = KAI.SUS_FT[0]
|
||||
|
||||
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-nom")
|
||||
pack_sus_cmds(q=q, op_code="sus-nom")
|
||||
|
||||
sus_n_ids = [
|
||||
oids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||
@ -527,16 +508,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
for nom_sus in sus_n_ids:
|
||||
sid_list.append(make_sid(nom_sus, SetIds.HK))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="sus-off")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
|
||||
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-red")
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-red")
|
||||
|
||||
diag_list = [
|
||||
True,
|
||||
@ -551,16 +532,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
for red_sus in sus_r_ids:
|
||||
sid_list.append(make_sid(red_sus, SetIds.HK))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="sus-off")
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
|
||||
pack_sus_cmds(tc_queue=tc_queue, op_code="sus-d")
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
q.add_wait_seconds(5.0)
|
||||
pack_sus_cmds(q=q, op_code="sus-d")
|
||||
|
||||
# SUSs
|
||||
for nom_sus in sus_n_ids:
|
||||
@ -582,36 +563,32 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
True,
|
||||
]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_acs_command(tc_queue=tc_queue, op_code="sus-off")
|
||||
pack_acs_command(q=q, op_code="sus-off")
|
||||
|
||||
if op_code in OpCodes.STR_FT:
|
||||
key = KAI.STR_FT[0]
|
||||
|
||||
pack_star_tracker_commands(
|
||||
object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="2"
|
||||
)
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="2")
|
||||
|
||||
# STR
|
||||
sid_list.append(make_sid(oids.STAR_TRACKER_ID, StrSetIds.TEMPERATURE))
|
||||
diag_list = [False]
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg.default(),
|
||||
)
|
||||
|
||||
pack_star_tracker_commands(
|
||||
object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="3"
|
||||
)
|
||||
pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, q=q, op_code="3")
|
||||
|
||||
if op_code in OpCodes.RW_FT_ONE_RW:
|
||||
key = KAI.RW_FT_ONE_RW[0]
|
||||
@ -644,7 +621,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
|
||||
# RW HK für alle RWs nur einzeln
|
||||
for rw_dev in rw_pairs:
|
||||
@ -652,14 +629,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
set_id = rw_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=True, two_rws=False),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
|
||||
# ass command with 2 rws to speed
|
||||
if op_code in OpCodes.RW_FT_TWO_RWS:
|
||||
@ -701,7 +678,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
False,
|
||||
]
|
||||
# RW NORMAL
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="nml")
|
||||
|
||||
# RW
|
||||
for rw_dev in rw_pairs:
|
||||
@ -709,190 +686,162 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
|
||||
set_id = rw_dev[1]
|
||||
sid_list.append(make_sid(oid, set_id))
|
||||
pack_generic_hk_listening_cmds(
|
||||
tc_queue=tc_queue,
|
||||
q=q,
|
||||
proc_key=key,
|
||||
sid_list=sid_list,
|
||||
diag_list=diag_list,
|
||||
cfg=GenericHkListeningCfg(mgt=False, one_rw=False, two_rws=True),
|
||||
)
|
||||
# RW OFF
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off")
|
||||
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, q=q, op_code="off")
|
||||
|
||||
|
||||
def enable_listen_to_hk_for_x_seconds(
|
||||
tc_queue: TcQueueT,
|
||||
q: QueueHelper,
|
||||
diag: bool,
|
||||
device: str,
|
||||
sid: bytes,
|
||||
interval_seconds: float,
|
||||
):
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Enabling periodic HK for {device}"))
|
||||
q.add_log_cmd(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())
|
||||
q.add_pus_tc(cmd)
|
||||
|
||||
|
||||
def gen_disable_listen_to_hk_for_x_seconds(
|
||||
tc_queue: TcQueueT,
|
||||
q: QueueHelper,
|
||||
diag: bool,
|
||||
device: str,
|
||||
sid: bytes,
|
||||
) -> PusTelecommand:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Disabling periodic HK for {device}"))
|
||||
return disable_periodic_hk_command(diag=diag, sid=sid, ssc=0)
|
||||
q.add_log_cmd(f"Disabling periodic HK for {device}")
|
||||
return disable_periodic_hk_command(diag=diag, sid=sid)
|
||||
|
||||
|
||||
def activate_mgts_alternately(
|
||||
tc_queue: TcQueueT,
|
||||
q: QueueHelper,
|
||||
):
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=2000,
|
||||
y_dipole=0,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=2000,
|
||||
y_dipole=0,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=-2000,
|
||||
y_dipole=0,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=-2000,
|
||||
y_dipole=0,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=2000,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=2000,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=-2000,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=-2000,
|
||||
z_dipole=0,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=0,
|
||||
z_dipole=2000,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=0,
|
||||
z_dipole=2000,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
command = pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=0,
|
||||
z_dipole=-2000,
|
||||
duration=30000,
|
||||
q.add_pus_tc(
|
||||
pack_dipole_command(
|
||||
object_id=oids.IMTQ_HANDLER_ID,
|
||||
x_dipole=0,
|
||||
y_dipole=0,
|
||||
z_dipole=-2000,
|
||||
duration=30000,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 40.0))
|
||||
q.add_wait_seconds(40.0)
|
||||
|
||||
|
||||
def rw_speed_cmd_single(
|
||||
tc_queue: TcQueueT, oid: bytes, init_ssc: int, speed: int, ramp_time: int
|
||||
) -> int:
|
||||
command = pack_set_speed_command(
|
||||
object_id=oid, speed=speed, ramp_time_ms=ramp_time, ssc=init_ssc
|
||||
def rw_speed_cmd_single(q: QueueHelper, oid: bytes, speed: int, ramp_time: int):
|
||||
q.add_pus_tc(
|
||||
pack_set_speed_command(object_id=oid, speed=speed, ramp_time_ms=ramp_time)
|
||||
)
|
||||
init_ssc += 1
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
|
||||
command = pack_set_speed_command(
|
||||
object_id=oid, speed=0, ramp_time_ms=ramp_time, ssc=init_ssc
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return init_ssc + 1
|
||||
q.add_wait(timedelta(seconds=70.0))
|
||||
q.add_pus_tc(pack_set_speed_command(object_id=oid, speed=0, ramp_time_ms=ramp_time))
|
||||
|
||||
|
||||
def rw_speed_up_cmd_consec(
|
||||
tc_queue: TcQueueT, obids: List[bytes], init_ssc: int, speed: int, ramp_time: int
|
||||
) -> int:
|
||||
q: QueueHelper, obids: List[bytes], speed: int, ramp_time: int
|
||||
):
|
||||
for oid in obids:
|
||||
command = pack_set_speed_command(
|
||||
object_id=oid, speed=speed, ramp_time_ms=ramp_time, ssc=init_ssc
|
||||
q.add_pus_tc(
|
||||
pack_set_speed_command(object_id=oid, speed=speed, ramp_time_ms=ramp_time)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
init_ssc += 1
|
||||
return init_ssc
|
||||
|
||||
|
||||
def rw_speed_down_cmd_consec(
|
||||
tc_queue: TcQueueT, obids: List[bytes], init_ssc: int, ramp_time: int
|
||||
) -> int:
|
||||
def rw_speed_down_cmd_consec(q: QueueHelper, obids: List[bytes], ramp_time: int):
|
||||
for oid in obids:
|
||||
command = pack_set_speed_command(
|
||||
object_id=oid, speed=0, ramp_time_ms=ramp_time, ssc=init_ssc
|
||||
q.add_pus_tc(
|
||||
pack_set_speed_command(object_id=oid, speed=0, ramp_time_ms=ramp_time)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
init_ssc += 1
|
||||
return init_ssc
|
||||
|
||||
|
||||
def activate_all_rws_in_sequence(
|
||||
tc_queue: TcQueueT, init_ssc: int, test_speed: int, test_ramp_time: int
|
||||
) -> int:
|
||||
q: QueueHelper, init_ssc: int, test_speed: int, test_ramp_time: int
|
||||
):
|
||||
new_ssc = init_ssc
|
||||
# RW1 speed cmd
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 58))
|
||||
new_ssc = rw_speed_cmd_single(
|
||||
tc_queue, oids.RW1_ID, new_ssc, test_speed, test_ramp_time
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 30))
|
||||
new_ssc = rw_speed_cmd_single(
|
||||
tc_queue, oids.RW2_ID, new_ssc, test_speed, test_ramp_time
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 30))
|
||||
new_ssc = rw_speed_cmd_single(
|
||||
tc_queue, oids.RW3_ID, new_ssc, test_speed, test_ramp_time
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 30))
|
||||
new_ssc = rw_speed_cmd_single(
|
||||
tc_queue, oids.RW4_ID, new_ssc, test_speed, test_ramp_time
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 30))
|
||||
q.add_wait(timedelta(seconds=58.0))
|
||||
rw_speed_cmd_single(q, oids.RW1_ID, test_speed, test_ramp_time)
|
||||
q.add_wait_seconds(30.0)
|
||||
rw_speed_cmd_single(q, oids.RW2_ID, test_speed, test_ramp_time)
|
||||
q.add_wait_seconds(30.0)
|
||||
rw_speed_cmd_single(q, oids.RW3_ID, test_speed, test_ramp_time)
|
||||
q.add_wait_seconds(30.0)
|
||||
rw_speed_cmd_single(q, oids.RW4_ID, test_speed, test_ramp_time)
|
||||
q.add_wait_seconds(30.0)
|
||||
return new_ssc
|
||||
|
||||
|
||||
def activate_all_rws_two_consecutively(tc_queue: TcQueueT, init_ssc: int) -> int:
|
||||
new_ssc = init_ssc
|
||||
def activate_all_rws_two_consecutively(q: QueueHelper):
|
||||
# RW1+3 speed cmd
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
|
||||
new_ssc = rw_speed_up_cmd_consec(
|
||||
tc_queue, [oids.RW1_ID, oids.RW3_ID], new_ssc, -20000, 10000
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
|
||||
new_ssc = rw_speed_down_cmd_consec(
|
||||
tc_queue, [oids.RW1_ID, oids.RW3_ID], new_ssc, 10000
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
|
||||
q.add_wait_seconds(5.0)
|
||||
rw_speed_up_cmd_consec(q, [oids.RW1_ID, oids.RW3_ID], -20000, 10000)
|
||||
q.add_wait_seconds(70.0)
|
||||
rw_speed_down_cmd_consec(q, [oids.RW1_ID, oids.RW3_ID], 10000)
|
||||
q.add_wait_seconds(15.0)
|
||||
# RW2+4 speed cmd
|
||||
new_ssc = rw_speed_up_cmd_consec(
|
||||
tc_queue, [oids.RW2_ID, oids.RW4_ID], new_ssc, -20000, 10000
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
|
||||
new_ssc = rw_speed_down_cmd_consec(
|
||||
tc_queue, [oids.RW2_ID, oids.RW4_ID], new_ssc, 10000
|
||||
)
|
||||
tc_queue.appendleft((QueueCommands.WAIT, 15.0))
|
||||
return new_ssc
|
||||
rw_speed_up_cmd_consec(q, [oids.RW2_ID, oids.RW4_ID], -20000, 10000)
|
||||
q.add_wait_seconds(70.0)
|
||||
rw_speed_down_cmd_consec(q, [oids.RW2_ID, oids.RW4_ID], 10000)
|
||||
q.add_wait_seconds(15.0)
|
||||
|
Reference in New Issue
Block a user