From b8e61b38b0f1b712361108407286efb14d0e0096 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Fri, 20 May 2022 16:40:58 +0200 Subject: [PATCH 01/11] extended tv test procedures --- pus_tc/system/proc.py | 111 ++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 31 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index edd2c29..2f82c3d 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -1,6 +1,7 @@ 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, @@ -9,10 +10,14 @@ from config.object_ids import ( ACU_HANDLER_ID, CORE_CONTROLLER_ID, ) +""" import config.object_ids as oids 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 pus_tc.devs.rad_sensor import CommandIds as RadSetIds +from pus_tc.system.tcs import pack_tcs_sys_commands +from pus_tc.system.controllers import pack_controller_commands class OpCodes: @@ -20,56 +25,57 @@ class OpCodes: BAT_FT = ["bat-ft"] CORE_FT = ["core-ft"] PCDU_FT = ["pcdu-ft"] + RAD_SEN_FT = ["rad-sen-ft"] + TCS_FT = ["tcs-ft-on"] class KeyAndInfo: HEATER = ["Heater", "heater procedure"] BAT_FT = ["BPX Battery", "battery functional test"] - PCDU_FT = ["PCDU", "PCDU functional test"] CORE_FT = ["OBC", "OBC functional test"] + PCDU_FT = ["PCDU", "PCDU functional test"] + RAD_SEN_FT = ["Radiation Sensor", "Radiation Sensor functional test"] + TCS_FT = ["TCS Act.", "TCS functional test activation"] 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], + KAI.CORE_FT[0]: [OpCodes.CORE_FT, KAI.CORE_FT[1], 120.0, 10.0], + KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0], + KAI.RAD_SEN_FT[0]: [OpCodes.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0], + KAI.TCS_FT[0]: [OpCodes.TCS_FT, KAI.TCS_FT[1], 1800.0, 10.0], + + } -def generic_print(tc_queue: TcQueueT, key: str): - info = PROC_INFO_DICT[key] +def generic_print(tc_queue: TcQueueT, info: dict): tc_queue.appendleft( - (QueueCommands.PRINT, f"Executing {info[0]} Procedure (OpCodes: {info[1]})") + (QueueCommands.PRINT, f"Executing {info[1]} Procedure (OpCodes: {info[0]})") ) 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) + info = PROC_INFO_DICT[proc_key] + generic_print(tc_queue=tc_queue, info=info) 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, + interval_seconds=info[3], + collection_time=info[2], ) def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.BAT_FT: key = KAI.BAT_FT[0] - sid = make_sid(BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - - if op_code in OpCodes.PCDU_FT: - key = KAI.PCDU_FT[0] - sid = make_sid(P60_DOCK_HANDLER, GsSetIds.P60_CORE) + sid = make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) @@ -81,6 +87,63 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) +# PCDU + + if op_code in OpCodes.PCDU_FT: + key = KAI.PCDU_FT[0] + + sid = make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_CORE) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_CORE) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_CORE) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + +# AUX und 2er + sid = make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_AUX) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_AUX) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_AUX) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + if op_code in OpCodes.RAD_SEN_FT: + key = KAI.CORE_FT[0] + sid = make_sid(oids.RAD_SENSOR_ID, RadSetIds.READ_CONVERSIONS) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + if op_code in OpCodes.TCS_FT: + pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") + pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") + + key = KAI.CORE_FT[0] +# Ids for TCS Board missing. No HK generation? + sid = make_sid(oids.TCS_BOARD_ASS_ID, RadSetIds.READ_CONVERSIONS) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") + pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") + def listen_to_hk_for_x_seconds( tc_queue: TcQueueT, @@ -90,20 +153,6 @@ def listen_to_hk_for_x_seconds( 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( From b3751004a6f5ebe2a4bbbcf0fdbb3f590b2eb4e8 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Mon, 23 May 2022 11:53:31 +0200 Subject: [PATCH 02/11] added acs functional test --- pus_tc/system/proc.py | 125 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 3 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 2f82c3d..0837ad8 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -16,8 +16,15 @@ 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 pus_tc.devs.rad_sensor import CommandIds as RadSetIds +from pus_tc.devs.mgms import MgmLis3SetIds as MgmSetIds_0_2 +from pus_tc.devs.mgms import MgmRm3100SetIds as MgmSetIds_1_3 +from pus_tc.devs.gyros import AdisGyroSetIds as GyroSetIds_0_2 +from pus_tc.devs.gyros import L3gGyroSetIds as GyroSetIds_1_3 + + from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.controllers import pack_controller_commands +from pus_tc.system.acs import pack_acs_command class OpCodes: @@ -27,6 +34,7 @@ class OpCodes: PCDU_FT = ["pcdu-ft"] RAD_SEN_FT = ["rad-sen-ft"] TCS_FT = ["tcs-ft-on"] + ACS_FT = ["acs-ft"] class KeyAndInfo: @@ -35,7 +43,8 @@ class KeyAndInfo: CORE_FT = ["OBC", "OBC functional test"] PCDU_FT = ["PCDU", "PCDU functional test"] RAD_SEN_FT = ["Radiation Sensor", "Radiation Sensor functional test"] - TCS_FT = ["TCS Act.", "TCS functional test activation"] + TCS_FT = ["TCS", "TCS functional test"] + ACS_FT = ["ACS", "ACS functional test"] KAI = KeyAndInfo @@ -46,6 +55,7 @@ PROC_INFO_DICT = { KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0], KAI.RAD_SEN_FT[0]: [OpCodes.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0], KAI.TCS_FT[0]: [OpCodes.TCS_FT, KAI.TCS_FT[1], 1800.0, 10.0], + KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0] } @@ -124,17 +134,18 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): ) if op_code in OpCodes.RAD_SEN_FT: - key = KAI.CORE_FT[0] + key = KAI.RAD_SEN_FT[0] sid = make_sid(oids.RAD_SENSOR_ID, RadSetIds.READ_CONVERSIONS) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) if op_code in OpCodes.TCS_FT: +# does not work with .WAIT pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") - key = KAI.CORE_FT[0] + key = KAI.TCS_FT[0] # Ids for TCS Board missing. No HK generation? sid = make_sid(oids.TCS_BOARD_ASS_ID, RadSetIds.READ_CONVERSIONS) pack_generic_hk_listening_cmds( @@ -144,6 +155,114 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") + if op_code in OpCodes.ACS_FT: + key = KAI.ACS_FT[0] + + pack_acs_command(tc_queue=tc_queue, op_code="acs-a") + + sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + +# GNSS0 missing + + + 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") + + sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + +# GNSS1 missing + + 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") + + sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + +# GNSS0+1 missing + + pack_acs_command(tc_queue=tc_queue, op_code="acs-off") + def listen_to_hk_for_x_seconds( tc_queue: TcQueueT, From bcaac870c1f0c28e3a498a01c5cb0335af73b5c5 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Mon, 23 May 2022 15:28:41 +0200 Subject: [PATCH 03/11] changed tcs and acs tv test proc --- pus_tc/system/proc.py | 97 +++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 31 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 0837ad8..1cf7a1f 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -15,11 +15,14 @@ import config.object_ids as oids 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 pus_tc.devs.rad_sensor import CommandIds as RadSetIds +from pus_tc.devs.rad_sensor import SetIds as RadSetIds from pus_tc.devs.mgms import MgmLis3SetIds as MgmSetIds_0_2 from pus_tc.devs.mgms import MgmRm3100SetIds as MgmSetIds_1_3 from pus_tc.devs.gyros import AdisGyroSetIds as GyroSetIds_0_2 from pus_tc.devs.gyros import L3gGyroSetIds as GyroSetIds_1_3 +from pus_tc.devs.gps import Gnss0SetIds as GnssSetIds_0 +from pus_tc.devs.gps import Gnss1SetIds as GnssSetIds_1 +from pus_tc.devs.imtq import ImtqSetIds from pus_tc.system.tcs import pack_tcs_sys_commands @@ -33,8 +36,11 @@ class OpCodes: CORE_FT = ["core-ft"] PCDU_FT = ["pcdu-ft"] RAD_SEN_FT = ["rad-sen-ft"] - TCS_FT = ["tcs-ft-on"] + TCS_FT_ON = ["tcs-ft-on"] + TCS_FT_OFF = ["tcs-ft-off"] ACS_FT = ["acs-ft"] + MGT_FT = ["mgt-ft"] + MGT_FT_DP = ["mgt-ft-dp"] class KeyAndInfo: @@ -43,8 +49,11 @@ class KeyAndInfo: CORE_FT = ["OBC", "OBC functional test"] PCDU_FT = ["PCDU", "PCDU functional test"] RAD_SEN_FT = ["Radiation Sensor", "Radiation Sensor functional test"] - TCS_FT = ["TCS", "TCS functional test"] + TCS_FT_ON = ["TCS Act.", "TCS functional test activation"] + TCS_FT_OFF = ["TCS Deact.", "TCS functional test deactivation"] ACS_FT = ["ACS", "ACS functional test"] + MGT_FT = ["MGT", "MGT functional test"] + MGT_FT_DP = ["MGT dipole", "MGT functional test with dipole"] KAI = KeyAndInfo @@ -54,8 +63,9 @@ PROC_INFO_DICT = { KAI.CORE_FT[0]: [OpCodes.CORE_FT, KAI.CORE_FT[1], 120.0, 10.0], KAI.PCDU_FT[0]: [OpCodes.PCDU_FT, KAI.PCDU_FT[1], 120.0, 10.0], KAI.RAD_SEN_FT[0]: [OpCodes.RAD_SEN_FT, KAI.RAD_SEN_FT[1], 120.0, 10.0], - KAI.TCS_FT[0]: [OpCodes.TCS_FT, KAI.TCS_FT[1], 1800.0, 10.0], - KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0] + KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0], + KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0], + KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], } @@ -97,8 +107,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# PCDU - if op_code in OpCodes.PCDU_FT: key = KAI.PCDU_FT[0] @@ -118,8 +126,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - -# AUX und 2er sid = make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_AUX) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -135,24 +141,17 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.RAD_SEN_FT: key = KAI.RAD_SEN_FT[0] - sid = make_sid(oids.RAD_SENSOR_ID, RadSetIds.READ_CONVERSIONS) + sid = make_sid(oids.RAD_SENSOR_ID, RadSetIds.RAD_SEN_CORE) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - if op_code in OpCodes.TCS_FT: -# does not work with .WAIT - pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") + if op_code in OpCodes.TCS_FT_ON: + # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") - key = KAI.TCS_FT[0] -# Ids for TCS Board missing. No HK generation? - sid = make_sid(oids.TCS_BOARD_ASS_ID, RadSetIds.READ_CONVERSIONS) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - - pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") + if op_code in OpCodes.TCS_FT_OFF: + # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") if op_code in OpCodes.ACS_FT: @@ -160,6 +159,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-a") +# MGMs sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -168,7 +168,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - +# Gyros sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -181,14 +181,17 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - -# GNSS0 missing - +# GNSS0 + sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) 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") +# MGMs sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -197,7 +200,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - +# Gyros sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -210,13 +213,17 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - -# GNSS1 missing +#GNSS1 + sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) 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") +# MGMs sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -233,7 +240,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - +# Gyros sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -258,11 +265,39 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - -# GNSS0+1 missing +# GNSS0+1 + sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") + if op_code in OpCodes.MGT_FT: + key = KAI.MGT_FT[0] + + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + +# mgt 1: imtq und hk +# mgt 2.: imtq + dual side + dipole + + def listen_to_hk_for_x_seconds( tc_queue: TcQueueT, From 181e6d62ad09c6f6dc57cc0eeac47bc203800d5b Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Mon, 23 May 2022 16:42:27 +0200 Subject: [PATCH 04/11] n --- pus_tc/system/proc.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 1cf7a1f..5b54a7f 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -297,6 +297,26 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): # mgt 1: imtq und hk # mgt 2.: imtq + dual side + dipole + if op_code in OpCodes.MGT_FT_DP: + key = KAI.MGT_FT[0] + pack_acs_command(tc_queue=tc_queue, op_code="acs-a") + + + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) + + + pack_acs_command(tc_queue=tc_queue, op_code="acs-off") def listen_to_hk_for_x_seconds( From c9f5a5652ebf1b4577d235b4450f97d49478d869 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 23 May 2022 18:33:35 +0200 Subject: [PATCH 05/11] run afmt --- pus_tc/prompt_parameters.py | 29 +++++++++++++++++++---------- pus_tc/system/controllers.py | 8 ++++++-- pus_tc/system/proc.py | 28 ++++++++++++---------------- tmtcgui.py | 9 +++++---- 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/pus_tc/prompt_parameters.py b/pus_tc/prompt_parameters.py index aa7dacb..feca256 100644 --- a/pus_tc/prompt_parameters.py +++ b/pus_tc/prompt_parameters.py @@ -1,5 +1,11 @@ from PyQt5.QtWidgets import ( - QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QGroupBox, QGridLayout, QLineEdit + QDialog, + QDialogButtonBox, + QVBoxLayout, + QLabel, + QGroupBox, + QGridLayout, + QLineEdit, ) from PyQt5 import QtCore @@ -16,12 +22,13 @@ class Parameter: self.widget = widget self.value = self.defaultValue self.widget.setPlaceholderText(self.defaultValue) - + def reset(self): self.value = self.defaultValue self.widget.setPlaceholderText(self.defaultValue) self.widget.setText("") + class ParameterDialog(QDialog): def __init__(self): super().__init__() @@ -42,7 +49,7 @@ class ParameterDialog(QDialog): self.rootLayout.addWidget(self.group) self.rootLayout.addWidget(self.buttonBox) self.setLayout(self.rootLayout) - + self.groupLayout = QGridLayout() self.group.setLayout(self.groupLayout) @@ -59,7 +66,6 @@ class ParameterDialog(QDialog): self.parameters[name] = parameter - def _reset(self): for value in self.parameters.values(): value.reset() @@ -80,14 +86,13 @@ class ParameterDialog(QDialog): super().reject() - - - """Prompt the user to specify additional Parameters :param parameterList: array of dictionaries with name and defaultValue attributes :return: dict with all names as key and user supplied input as value string """ + + def prompt_parameters(parameterList): gui = get_global(CoreGlobalIds.GUI) mode = get_global(CoreGlobalIds.MODE) @@ -95,9 +100,10 @@ def prompt_parameters(parameterList): # gui only works in cont mode right now if gui and mode == CoreModeList.CONTINUOUS_MODE: return _gui_prompt(parameterList) - else: + else: return _cli_prompt(parameterList) + def _gui_prompt(parameterList): dialog = ParameterDialog() for parameter in parameterList: @@ -105,11 +111,14 @@ def _gui_prompt(parameterList): dialog.exec_() return dialog.getParameters() + def _cli_prompt(parameterList): result = {} for parameter in parameterList: - userInput = input("Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])) + userInput = input( + "Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"]) + ) if userInput == "": userInput = parameter["defaultValue"] result[parameter["name"]] = userInput - return result \ No newline at end of file + return result diff --git a/pus_tc/system/controllers.py b/pus_tc/system/controllers.py index 1f44f32..b7949d2 100644 --- a/pus_tc/system/controllers.py +++ b/pus_tc/system/controllers.py @@ -18,8 +18,12 @@ class Info: def pack_controller_commands(tc_queue: TcQueueT, op_code: str): - parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, { - "name": "Submode", "defaultValue": "0"}]) + parameters = prompt_parameters( + [ + {"name": "Mode", "defaultValue": "2"}, + {"name": "Submode", "defaultValue": "0"}, + ] + ) mode = int(parameters["Mode"]) if mode < 0 or mode > 2: print("Invalid Mode, defaulting to OFF") diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 5b54a7f..2d4f02f 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -1,6 +1,7 @@ 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, @@ -66,8 +67,6 @@ PROC_INFO_DICT = { KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0], KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0], KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], - - } @@ -159,7 +158,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-a") -# MGMs + # MGMs sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -168,7 +167,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# Gyros + # Gyros sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -181,7 +180,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# GNSS0 + # GNSS0 sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -191,7 +190,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue.appendleft((QueueCommands.WAIT, 5.0)) pack_acs_command(tc_queue=tc_queue, op_code="acs-b") -# MGMs + # MGMs sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -200,7 +199,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# Gyros + # Gyros sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -213,7 +212,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -#GNSS1 + # GNSS1 sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -223,7 +222,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue.appendleft((QueueCommands.WAIT, 5.0)) pack_acs_command(tc_queue=tc_queue, op_code="acs-d") -# MGMs + # MGMs sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -240,7 +239,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# Gyros + # Gyros sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -265,7 +264,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) -# GNSS0+1 + # GNSS0+1 sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -293,15 +292,13 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - -# mgt 1: imtq und hk -# mgt 2.: imtq + dual side + dipole + # mgt 1: imtq und hk + # mgt 2.: imtq + dual side + dipole if op_code in OpCodes.MGT_FT_DP: key = KAI.MGT_FT[0] pack_acs_command(tc_queue=tc_queue, op_code="acs-a") - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False @@ -315,7 +312,6 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - pack_acs_command(tc_queue=tc_queue, op_code="acs-off") diff --git a/tmtcgui.py b/tmtcgui.py index 6366d6f..b36f61c 100755 --- a/tmtcgui.py +++ b/tmtcgui.py @@ -2,10 +2,11 @@ """TMTC commander for EIVE""" from tmtcc import tmtcc_post_args, tmtcc_pre_args from tmtccmd.config.args import ( - create_default_args_parser, - add_gui_tmtccmd_args, - parse_gui_input_arguments, - ) + create_default_args_parser, + add_gui_tmtccmd_args, + parse_gui_input_arguments, +) + def main(): hook_obj = tmtcc_pre_args() From 4b762328c53ffbe8f892b90cd89dec581b478dee Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Tue, 24 May 2022 14:58:13 +0200 Subject: [PATCH 06/11] changed to new procedure --- pus_tc/system/proc.py | 57 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 2d4f02f..158808b 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -77,10 +77,22 @@ def generic_print(tc_queue: TcQueueT, info: dict): def pack_generic_hk_listening_cmds( - tc_queue: TcQueueT, proc_key: str, sid: bytes, diag: bool + tc_queue: TcQueueT, proc_key: str, sid_list: bytes, diag: bool ): info = PROC_INFO_DICT[proc_key] generic_print(tc_queue=tc_queue, info=info) + + for sid in sid_list: + enable_listen_to_hk_for_x_seconds( + diag=diag, + tc_queue=tc_queue, + device=proc_key, + sid=sid, + interval_seconds=info[3], + ) + + +""" OLD listen_to_hk_for_x_seconds( diag=diag, tc_queue=tc_queue, @@ -89,9 +101,10 @@ def pack_generic_hk_listening_cmds( interval_seconds=info[3], collection_time=info[2], ) - +""" def pack_proc_commands(tc_queue: TcQueueT, op_code: str): + sid_list = [] if op_code in OpCodes.BAT_FT: key = KAI.BAT_FT[0] sid = make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) @@ -101,9 +114,9 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.CORE_FT: key = KAI.CORE_FT[0] - sid = make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK) + sid_list += make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) if op_code in OpCodes.PCDU_FT: @@ -121,7 +134,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) - sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU) + sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_CORE) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) @@ -137,6 +150,10 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid=sid, diag=False ) + sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_AUX) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + ) if op_code in OpCodes.RAD_SEN_FT: key = KAI.RAD_SEN_FT[0] @@ -337,3 +354,33 @@ def listen_to_hk_for_x_seconds( tc_queue.appendleft( disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple() ) + + +def enable_listen_to_hk_for_x_seconds( + tc_queue: TcQueueT, + diag: bool, + device: str, + sid: bytes, + interval_seconds: float, +): + 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, 2.0)) + + +def disable_listen_to_hk_for_x_seconds( + tc_queue: TcQueueT, + diag: bool, + device: str, + sid: bytes, +): + 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() + ) + From 095cf822ee5c9cac47dc195bb19f41f65d2d97d7 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Tue, 24 May 2022 15:26:08 +0200 Subject: [PATCH 07/11] cleaned new addition --- pus_tc/system/proc.py | 211 +++++++++++++----------------------------- 1 file changed, 64 insertions(+), 147 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 158808b..a6aeda8 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -77,9 +77,10 @@ def generic_print(tc_queue: TcQueueT, info: dict): def pack_generic_hk_listening_cmds( - tc_queue: TcQueueT, proc_key: str, sid_list: bytes, diag: bool + tc_queue: TcQueueT, proc_key: str, sid_list: list[bytearray], diag: bool ): info = PROC_INFO_DICT[proc_key] + collection_time = info[2] generic_print(tc_queue=tc_queue, info=info) for sid in sid_list: @@ -91,6 +92,18 @@ def pack_generic_hk_listening_cmds( interval_seconds=info[3], ) + tc_queue.appendleft((QueueCommands.WAIT, collection_time)) + + for sid in sid_list: + disable_listen_to_hk_for_x_seconds( + diag=diag, + tc_queue=tc_queue, + device=proc_key, + sid=sid, + ) + + sid_list.clear() + """ OLD listen_to_hk_for_x_seconds( @@ -103,63 +116,42 @@ def pack_generic_hk_listening_cmds( ) """ + def pack_proc_commands(tc_queue: TcQueueT, op_code: str): sid_list = [] if op_code in OpCodes.BAT_FT: key = KAI.BAT_FT[0] - sid = make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET) + sid_list.append(make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) if op_code in OpCodes.CORE_FT: key = KAI.CORE_FT[0] - sid_list += make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK) + sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)) pack_generic_hk_listening_cmds( tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) if op_code in OpCodes.PCDU_FT: key = KAI.PCDU_FT[0] - - sid = make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_CORE) + sid_list.append(make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_CORE)) + sid_list.append(make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_CORE)) + sid_list.append(make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_CORE)) + sid_list.append(make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_CORE)) + sid_list.append(make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_AUX)) + sid_list.append(make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_AUX)) + sid_list.append(make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_AUX)) + sid_list.append(make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_AUX)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_CORE) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_CORE) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_CORE) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.P60_DOCK_HANDLER, GsSetIds.P60_AUX) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.PDU_1_HANDLER_ID, GsSetIds.PDU_1_AUX) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_AUX) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_AUX) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) if op_code in OpCodes.RAD_SEN_FT: key = KAI.RAD_SEN_FT[0] - sid = make_sid(oids.RAD_SENSOR_ID, RadSetIds.RAD_SEN_CORE) + sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.RAD_SEN_CORE)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) if op_code in OpCodes.TCS_FT_ON: @@ -176,31 +168,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-a") # MGMs - sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK)) # Gyros - sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK)) + sid_list.append(make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK)) # GNSS0 - sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) + sid_list.append(make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -208,31 +185,16 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-b") # MGMs - sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK)) # Gyros - sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK)) + sid_list.append(make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK)) # GNSS1 - sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) + sid_list.append(make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -240,55 +202,22 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-d") # MGMs - sid = make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.MGM_0_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.MGM_1_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK)) + sid_list.append(make_sid(oids.MGM_2_LIS3_HANDLER_ID, MgmSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.MGM_3_RM3100_HANDLER_ID, MgmSetIds_1_3.CORE_HK)) # Gyros - sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) + sid_list.append(make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.GYRO_0_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK)) + sid_list.append(make_sid(oids.GYRO_1_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK)) + sid_list.append(make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CORE_HK)) + sid_list.append(make_sid(oids.GYRO_2_ADIS_HANDLER_ID, GyroSetIds_0_2.CFG_HK)) + sid_list.append(make_sid(oids.GYRO_3_L3G_HANDLER_ID, GyroSetIds_1_3.CORE_HK)) # GNSS0+1 - sid = make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK) + sid_list.append(make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)) + sid_list.append(make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -296,17 +225,11 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.MGT_FT: key = KAI.MGT_FT[0] - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET)) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) # mgt 1: imtq und hk @@ -316,17 +239,11 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): key = KAI.MGT_FT[0] pack_acs_command(tc_queue=tc_queue, op_code="acs-a") - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET)) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False - ) - sid = make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET) - pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid=sid, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") From 931cbe26e6a994b3adf0656a5201ffd754bc5de8 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Tue, 24 May 2022 16:59:05 +0200 Subject: [PATCH 08/11] changes to imtq (added dipole command packing as PUS) and proc (added MGT proc) --- pus_tc/devs/imtq.py | 4 +- pus_tc/system/proc.py | 90 ++++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 28 deletions(-) diff --git a/pus_tc/devs/imtq.py b/pus_tc/devs/imtq.py index 7c1f136..3784167 100644 --- a/pus_tc/devs/imtq.py +++ b/pus_tc/devs/imtq.py @@ -211,7 +211,6 @@ def pack_imtq_test_into( z_dipole = 0 duration = 0 # ms command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration) - command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "0" or op_code == "8": @@ -225,7 +224,7 @@ def pack_imtq_test_into( def pack_dipole_command( object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int -) -> bytearray: +) -> PusTelecommand: """This function packs the command causing the ISIS IMTQ to generate a dipole. @param object_id The object id of the IMTQ handler. @param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000) @@ -242,4 +241,5 @@ def pack_dipole_command( command.extend(y_dipole.to_bytes(length=2, byteorder="big")) command.extend(z_dipole.to_bytes(length=2, byteorder="big")) command.extend(duration.to_bytes(length=2, byteorder="big")) + command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) return command diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index a6aeda8..b1a5e78 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -29,6 +29,7 @@ from pus_tc.devs.imtq import ImtqSetIds from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.controllers import pack_controller_commands from pus_tc.system.acs import pack_acs_command +from pus_tc.devs.imtq import pack_dipole_command class OpCodes: @@ -67,6 +68,8 @@ PROC_INFO_DICT = { KAI.TCS_FT_ON[0]: [OpCodes.TCS_FT_ON, KAI.TCS_FT_ON[1], 120.0, 10.0], KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0], KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], + KAI.MGT_FT[0]: [OpCodes.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0], + KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 120.0, 10.0], } @@ -77,7 +80,7 @@ def generic_print(tc_queue: TcQueueT, info: dict): def pack_generic_hk_listening_cmds( - tc_queue: TcQueueT, proc_key: str, sid_list: list[bytearray], diag: bool + tc_queue: TcQueueT, proc_key: str, sid_list: list[bytearray], diag: bool, mgt: bool, ): info = PROC_INFO_DICT[proc_key] collection_time = info[2] @@ -92,6 +95,15 @@ def pack_generic_hk_listening_cmds( interval_seconds=info[3], ) + if mgt is True: + activate_mgts_alternately( + tc_queue=tc_queue, + ) + + else: + pass + +# collection_time maybe be reduced as a full 120seconds is not needed after MGTs are tested tc_queue.appendleft((QueueCommands.WAIT, collection_time)) for sid in sid_list: @@ -105,32 +117,20 @@ def pack_generic_hk_listening_cmds( sid_list.clear() -""" OLD - listen_to_hk_for_x_seconds( - diag=diag, - tc_queue=tc_queue, - device=proc_key, - sid=sid, - interval_seconds=info[3], - collection_time=info[2], - ) -""" - - def pack_proc_commands(tc_queue: TcQueueT, op_code: str): sid_list = [] 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)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) if op_code in OpCodes.CORE_FT: key = KAI.CORE_FT[0] sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) if op_code in OpCodes.PCDU_FT: @@ -144,14 +144,14 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): sid_list.append(make_sid(oids.PDU_2_HANDLER_ID, GsSetIds.PDU_2_AUX)) sid_list.append(make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_AUX)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) if op_code in OpCodes.RAD_SEN_FT: key = KAI.RAD_SEN_FT[0] sid_list.append(make_sid(oids.RAD_SENSOR_ID, RadSetIds.RAD_SEN_CORE)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) if op_code in OpCodes.TCS_FT_ON: @@ -177,7 +177,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): # GNSS0 sid_list.append(make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -194,7 +194,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): # GNSS1 sid_list.append(make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -217,7 +217,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): sid_list.append(make_sid(oids.GPS_HANDLER_0_ID, GnssSetIds_0.CORE_HK)) sid_list.append(make_sid(oids.GPS_HANDLER_1_ID, GnssSetIds_1.CORE_HK)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -225,27 +225,37 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.MGT_FT: key = KAI.MGT_FT[0] +# missing imtq to ON +# mgt 1: imtq und hk + + # MISSING: imtq board activation to ON (implementation pending by Jakob) + sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)) sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET)) sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False ) - # mgt 1: imtq und hk - # mgt 2.: imtq + dual side + dipole + # MISSING: imtq board deactivation to OFF (implementation pending by Jakob) + +# missing imtq to ON +# mgt 2.: imtq + dual side + dipole if op_code in OpCodes.MGT_FT_DP: - key = KAI.MGT_FT[0] - pack_acs_command(tc_queue=tc_queue, op_code="acs-a") + key = KAI.MGT_FT_DP[0] + pack_acs_command(tc_queue=tc_queue, op_code="acs-d") + + # MISSING: imtq board activation to ON (implementation pending by Jakob) sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.ENG_HK_SET)) sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.CAL_MTM_SET)) sid_list.append(make_sid(oids.IMTQ_HANDLER_ID, ImtqSetIds.RAW_MTM_SET)) pack_generic_hk_listening_cmds( - tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=True ) + # MISSING: imtq board deactivation to OFF (implementation pending by Jakob) pack_acs_command(tc_queue=tc_queue, op_code="acs-off") @@ -301,3 +311,31 @@ def disable_listen_to_hk_for_x_seconds( disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple() ) + +def activate_mgts_alternately( + tc_queue: TcQueueT, +): + + command = 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, 10.0)) + + command = 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, 10.0)) + + command = 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, 10.0)) + + command = 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, 10.0)) + + command = 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, 10.0)) + + command = 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, 10.0)) From 66c3942afbc315da73a58dcb4f8a96b7849bcd5f Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Tue, 24 May 2022 17:03:32 +0200 Subject: [PATCH 09/11] function "listen_to_hk_for_x_seconds" might be deleted --- pus_tc/system/proc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index b1a5e78..2bfc324 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -259,6 +259,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_acs_command(tc_queue=tc_queue, op_code="acs-off") +""" def listen_to_hk_for_x_seconds( tc_queue: TcQueueT, diag: bool, @@ -281,6 +282,7 @@ def listen_to_hk_for_x_seconds( tc_queue.appendleft( disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple() ) +""" def enable_listen_to_hk_for_x_seconds( From c37eb77da3ef257892acd944dd86b9c6dcc2e77c Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Tue, 24 May 2022 17:08:20 +0200 Subject: [PATCH 10/11] minor changes --- pus_tc/system/proc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index 2bfc324..fa45409 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -70,6 +70,7 @@ PROC_INFO_DICT = { KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], KAI.MGT_FT[0]: [OpCodes.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0], KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 120.0, 10.0], +# collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120seconds is not needed after MGTs are tested } @@ -103,7 +104,6 @@ def pack_generic_hk_listening_cmds( else: pass -# collection_time maybe be reduced as a full 120seconds is not needed after MGTs are tested tc_queue.appendleft((QueueCommands.WAIT, collection_time)) for sid in sid_list: @@ -155,10 +155,12 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): ) if op_code in OpCodes.TCS_FT_ON: +# check whether tcs_assembly also has to be commanded to NORMAL Mode # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") if op_code in OpCodes.TCS_FT_OFF: +# check whether tcs_assembly also has to be commanded to OFF Mode # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") From 9c5d16fb7cbaee9697a0c5dc96ee41a5ab53ad4a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 24 May 2022 17:24:09 +0200 Subject: [PATCH 11/11] apply black --- pus_tc/cmd_definitions.py | 1 + pus_tc/system/core.py | 4 ++- pus_tc/system/proc.py | 68 +++++++++++++++++++++++++++++++-------- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 16bd542..357c126 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -324,6 +324,7 @@ def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT): def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): from pus_tc.devs.plpcdu import OpCodes, Info + op_code_dict = dict() add_op_code_entry( op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON diff --git a/pus_tc/system/core.py b/pus_tc/system/core.py index ece17c2..f44ad87 100644 --- a/pus_tc/system/core.py +++ b/pus_tc/system/core.py @@ -133,7 +133,9 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str): ) if op_code in OpCodes.REBOOT_FULL: tc_queue.appendleft((QueueCommands.PRINT, f"Core Command: {Info.REBOOT_FULL}")) - cmd = generate_action_command(object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT) + cmd = generate_action_command( + object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT + ) tc_queue.appendleft(cmd.pack_command_tuple()) if op_code in OpCodes.XSC_REBOOT_SELF: perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index fa45409..c2cb707 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -70,7 +70,7 @@ PROC_INFO_DICT = { KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], KAI.MGT_FT[0]: [OpCodes.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0], KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 120.0, 10.0], -# collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120seconds is not needed after MGTs are tested + # collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120seconds is not needed after MGTs are tested } @@ -81,7 +81,11 @@ def generic_print(tc_queue: TcQueueT, info: dict): def pack_generic_hk_listening_cmds( - tc_queue: TcQueueT, proc_key: str, sid_list: list[bytearray], diag: bool, mgt: bool, + tc_queue: TcQueueT, + proc_key: str, + sid_list: list[bytearray], + diag: bool, + mgt: bool, ): info = PROC_INFO_DICT[proc_key] collection_time = info[2] @@ -155,12 +159,12 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): ) if op_code in OpCodes.TCS_FT_ON: -# check whether tcs_assembly also has to be commanded to NORMAL Mode + # check whether tcs_assembly also has to be commanded to NORMAL Mode # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-normal") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") if op_code in OpCodes.TCS_FT_OFF: -# check whether tcs_assembly also has to be commanded to OFF Mode + # check whether tcs_assembly also has to be commanded to OFF Mode # pack_tcs_sys_commands(tc_queue=tc_queue, op_code="tcs-off") pack_controller_commands(tc_queue=tc_queue, op_code="thermal_controller") @@ -227,8 +231,8 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.MGT_FT: key = KAI.MGT_FT[0] -# missing imtq to ON -# mgt 1: imtq und hk + # missing imtq to ON + # mgt 1: imtq und hk # MISSING: imtq board activation to ON (implementation pending by Jakob) @@ -241,8 +245,8 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): # MISSING: imtq board deactivation to OFF (implementation pending by Jakob) -# missing imtq to ON -# mgt 2.: imtq + dual side + dipole + # missing imtq to ON + # mgt 2.: imtq + dual side + dipole if op_code in OpCodes.MGT_FT_DP: key = KAI.MGT_FT_DP[0] @@ -320,26 +324,62 @@ def activate_mgts_alternately( tc_queue: TcQueueT, ): - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=2000, y_dipole=0, z_dipole=0, duration=30000) + command = 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, 10.0)) - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=-2000, y_dipole=0, z_dipole=0, duration=30000) + command = 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, 10.0)) - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=0, y_dipole=2000, z_dipole=0, duration=30000) + command = 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, 10.0)) - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=0, y_dipole=-2000, z_dipole=0, duration=30000) + command = 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, 10.0)) - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=0, y_dipole=0, z_dipole=2000, duration=30000) + command = 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, 10.0)) - command = pack_dipole_command(object_id=oids.IMTQ_HANDLER_ID, x_dipole=0, y_dipole=0, z_dipole=-2000, duration=30000) + command = 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, 10.0))