diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index f68b383..e3c350f 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -2,7 +2,7 @@ from pus_tc.devs.scex import add_scex_cmds from pus_tc.system.proc import add_proc_cmds from pus_tc.devs.gps import add_gps_cmds -from pus_tc.devs.pcdu import add_pcdu_cmds +from pus_tc.devs.power import add_pcdu_cmds from pus_tc.devs.plpcdu import add_pl_pcdu_cmds from pus_tc.devs.rad_sensor import add_rad_sens_cmds from pus_tc.system.core import add_core_controller_definitions diff --git a/pus_tc/devs/common_power.py b/pus_tc/devs/common_power.py new file mode 100644 index 0000000..75b0981 --- /dev/null +++ b/pus_tc/devs/common_power.py @@ -0,0 +1,107 @@ +import enum + +from config.object_ids import PDU_1_HANDLER_ID +from gomspace.gomspace_common import pack_set_param_command, Channel +from gomspace.gomspace_pdu_definitions import PDU_CONFIG_LIST +from tmtccmd.tc import DefaultPusQueueHelper +from tmtccmd.util import ObjectIdU32 + + +class PowerOpCodes: + # PDU 1 + TCS_ON = ["tcs-on"] + TCS_OFF = ["tcs-off"] + SYRLINKS_ON = ["syrlinks-on"] + SYRLINKS_OFF = ["syrlinks-off"] + STAR_TRACKER_ON = ["str-on"] + STAR_TRACKER_OFF = ["str-off"] + MGT_ON = ["mgt-on"] + MGT_OFF = ["mgt-off"] + SUS_N_ON = ["sus-on"] + SUS_N_OFF = ["sus-off"] + SCEX_ON = ["sus-on"] + SCEX_OFF = ["sus-off"] + PLOC_ON = ["ploc-on"] + PLOC_OFF = ["ploc-off"] + ACS_A_ON = ["acs-a-on"] + ACS_A_OFF = ["acs-a-off"] + + # PDU 2 + PL_PCDU_VBAT_NOM_ON = ["plpcdu-vbat-nom-on"] + PL_PCDU_VBAT_NOM_OFF = ["plpcdu-vbat-nom-off"] + RW_ON = ["rw-on"] + RW_OFF = ["rw-off"] + HEATER_ON = ["heater-on"] + HEATER_OFF = ["heater-off"] + SUS_R_ON = ["sus-red-on"] + SUS_R_OFF = ["sus-red-off"] + SOLAR_ARRAY_DEPL_ON = ["sa-depl-on"] + SOLAR_ARRAY_DEPL_OFF = ["sa-depl-off"] + PL_PCDU_VBAT_RED_ON = ["plpcdu-vbat-red-on"] + PL_PCDU_VBAT_RED_OFF = ["plpcdu-vbat-red-off"] + ACS_B_ON = ["acs-b-on"] + ACS_B_OFF = ["acs-b-off"] + + INFO_CORE = ["info"] + INFO_AUX = ["info-aux"] + INFO_ALL = ["info-all"] + + +def get_power_obj_id(op_code: PowerOpCodes) -> ObjectIdU32: + pass + + +def pack_power_commands(q: DefaultPusQueueHelper, op_code: str): + if op_code in PowerOpCodes.TCS_ON: + object_id = PDU_1_HANDLER_ID + tcs_on_cmd(object_id, q) + if op_code in PowerOpCodes.TCS_OFF: + object_id = PDU_1_HANDLER_ID + tcs_off_cmd(object_id, q) + if op_code in PowerOpCodes.STAR_TRACKER_ON: + object_id = PDU_1_HANDLER_ID + tcs_on_cmd(object_id, q) + + +def tcs_on_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): + generic_on_cmd(object_id, q, "PDU1: Turn TCS board on", 0) + + +def tcs_off_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): + generic_off_cmd(object_id, q, "PDU1: Turn TCS board off", 0) + + +def str_on_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): + generic_on_cmd(object_id, q, "PDU1: Turn Star Tracker on", 2) + + +def str_off_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): + generic_off_cmd(object_id, q, "PDU1: Turn Star Tracker off", 2) + + +def generic_on_cmd( + object_id: ObjectIdU32, q: DefaultPusQueueHelper, info_str: str, out_idx: int +): + q.add_log_cmd(info_str) + q.add_pus_tc( + pack_set_param_command( + object_id.as_bytes, + PDU_CONFIG_LIST[out_idx].parameter_address, + PDU_CONFIG_LIST[out_idx].parameter_size, + Channel.on, + ) + ) + + +def generic_off_cmd( + object_id: ObjectIdU32, q: DefaultPusQueueHelper, info_str: str, out_idx: int +): + q.add_log_cmd(info_str) + q.add_pus_tc( + pack_set_param_command( + object_id.as_bytes, + PDU_CONFIG_LIST[out_idx].parameter_address, + PDU_CONFIG_LIST[out_idx].parameter_size, + Channel.off, + ) + ) diff --git a/pus_tc/devs/pcdu.py b/pus_tc/devs/pcdu.py deleted file mode 100644 index 05cbc13..0000000 --- a/pus_tc/devs/pcdu.py +++ /dev/null @@ -1,140 +0,0 @@ -from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry - -from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info -from pus_tc.devs.pdu1 import Pdu1OpCodes -from pus_tc.devs.pdu2 import Pdu2OpCodes -from pus_tc.devs.acu import add_acu_cmds -from gomspace.gomspace_common import Info as GsInfo - - -def add_p60_cmds(defs: TmTcDefWrapper): - oce = OpCodeEntry() - oce.add(keys=P60OpCodes.STACK_3V3_ON, info=Info.STACK_3V3_ON) - oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=Info.STACK_3V3_OFF) - oce.add(keys=P60OpCodes.STACK_5V_ON, info=Info.STACK_5V_ON) - oce.add(keys=P60OpCodes.STACK_5V_OFF, info=Info.STACK_5V_OFF) - oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE) - oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE) - oce.add( - keys=GomspaceOpCodes.PRINT_SWITCH_V_I, - info="P60 Dock: Print Switches, Voltages, Currents", - ) - oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="P60 Dock: Print Latchups") - oce.add(keys=P60OpCodes.TEST, info="P60 Tests") - defs.add_service( - name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce - ) - - -def add_pdu1_cmds(defs: TmTcDefWrapper): - oce = OpCodeEntry() - oce.add(keys=Pdu1OpCodes.TCS_BOARD_ON, info="PDU1: Turn TCS board on") - oce.add(keys=Pdu1OpCodes.TCS_BOARD_OFF, info="PDU1: Turn TCS board off") - oce.add(keys=Pdu1OpCodes.STAR_TRACKER_ON, info="PDU1: Turn star tracker on") - oce.add(keys=Pdu1OpCodes.STAR_TRACKER_OFF, info="PDU1: Turn star tracker off") - oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_ON, info="PDU1: Turn SUS nominal on") - oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_OFF, info="PDU1: Turn SUS nominal off") - oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_ON, info="PDU1: Turn ACS A side on") - oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_OFF, info="PDU1: Turn ACS A side off") - oce.add(keys=Pdu1OpCodes.SYRLINKS_ON, info="PDU1: Turn Syrlinks on") - oce.add(keys=Pdu1OpCodes.SYRLINKS_OFF, info="PDU1: Turn Syrlinks off") - oce.add(keys=Pdu1OpCodes.MGT_ON, info="PDU1: Turn MGT on") - oce.add(keys=Pdu1OpCodes.MGT_OFF, info="PDU1: Turn MGT off") - oce.add(keys=Pdu1OpCodes.PLOC_ON, info="PDU1: Turn PLOC on") - oce.add(keys=Pdu1OpCodes.PLOC_OFF, info="PDU1: Turn PLOC off") - oce.add(keys=Pdu1OpCodes.SCEX_ON, info="PDU1: Turn Solar Cell Experiment on") - oce.add(keys=Pdu1OpCodes.SCEX_OFF, info="PDU1: Turn Solar Cell Experiment off") - oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE) - oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE) - oce.add( - keys=GomspaceOpCodes.PRINT_SWITCH_V_I, - info="PDU1: Print Switches, Voltages, Currents", - ) - oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="PDU1: Print Latchups") - oce.add(keys=Pdu1OpCodes.TESTS, info="PDU1 Tests") - oce.add(keys=GomspaceOpCodes.SET_PARAM, info="Set parameter") - defs.add_service( - name=CustomServiceList.PDU1.value, - info="PDU1 Device", - op_code_entry=oce, - ) - - -def add_pdu2_cmds(defs: TmTcDefWrapper): - oce = OpCodeEntry() - oce.add(keys="0", info="PDU2 Tests") - oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_ON, info="PDU2: Turn ACS Side B on") - oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_OFF, info="PDU2: Turn ACS Side B off") - oce.add(keys=Pdu2OpCodes.SUS_REDUNDANT_ON, info="PDU2: Turn SUS redundant on") - oce.add(keys=Pdu2OpCodes.SUS_REDUNDANT_OFF, info="PDU2: Turn SUS redundant off") - oce.add(keys=Pdu2OpCodes.RW_ON, info="PDU2: Turn reaction wheels on") - oce.add(keys=Pdu2OpCodes.RW_OFF, info="PDU2: Turn reaction wheels off") - oce.add( - keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON, - info="PDU2: PL PCDU Switch Channel Nominal (1) on", - ) - oce.add( - keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF, - info="PDU2: PL PCDU Switch Channel Nominal (1) off", - ) - oce.add( - keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON, - info="PDU2: PL PCDU Switch Channel Redundant (1) on", - ) - oce.add( - keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF, - info="PDU2: PL PCDU Switch Channel Redundant (1) off", - ) - oce.add( - keys=Pdu2OpCodes.TCS_HEATER_IN_ON, - info="PDU2: Switch TCS Heater Input on", - ) - oce.add( - keys=Pdu2OpCodes.TCS_HEATER_IN_OFF, - info="PDU2: Switch TCS Heater Input off", - ) - oce.add( - keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON, - info="PDU2: Switch Solar Array Deployment On", - ) - oce.add( - keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF, - info="PDU2: Switch Solar Array Deployment Off", - ) - oce.add( - keys=Pdu2OpCodes.PL_CAMERA_ON, - info="PDU2: Turn payload camera on", - ) - oce.add( - keys=Pdu2OpCodes.PL_CAMERA_OFF, - info="PDU2: Turn payload camera off", - ) - oce.add( - keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, - info=GsInfo.REQUEST_CORE_HK_ONCE, - ) - oce.add( - keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, - info=GsInfo.REQUEST_AUX_HK_ONCE, - ) - oce.add( - keys=GomspaceOpCodes.PRINT_SWITCH_V_I, - info="PDU2: Print Switches, Voltages, Currents", - ) - oce.add( - keys=GomspaceOpCodes.PRINT_LATCHUPS, - info="PDU2: Print Latchups", - ) - defs.add_service( - name="pdu2", - info="PDU2 Device", - op_code_entry=oce, - ) - - -def add_pcdu_cmds(defs: TmTcDefWrapper): - add_p60_cmds(defs) - add_pdu1_cmds(defs) - add_pdu2_cmds(defs) - add_acu_cmds(defs) diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py index de49c37..19b965d 100644 --- a/pus_tc/devs/pdu1.py +++ b/pus_tc/devs/pdu1.py @@ -4,7 +4,7 @@ @date 17.12.2020 """ import gomspace.gomspace_common as gs -from pus_tc.devs.power import tcs_on_cmd, tcs_off_cmd +from pus_tc.devs.common_power import tcs_on_cmd, tcs_off_cmd from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( diff --git a/pus_tc/devs/plpcdu.py b/pus_tc/devs/plpcdu.py index be6a784..8410d83 100644 --- a/pus_tc/devs/plpcdu.py +++ b/pus_tc/devs/plpcdu.py @@ -52,6 +52,7 @@ class OpCodes: class Info: NORMAL = "PL PCDU ADC modules normal" + SWITCH_HPA_ON_PROC = "Switch HPA on procedure" SWITCH_ON = "Switching PL PCDU on" SWITCH_OFF = "Switching PL PCDU off" NORMAL_SSR = f"{NORMAL}, SSR on" @@ -116,6 +117,7 @@ class ParamIds(enum.IntEnum): def add_pl_pcdu_cmds(defs: TmTcDefWrapper): oce = OpCodeEntry() + oce.add(keys=OpCodes.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC) oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON) oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF) oce.add(keys=OpCodes.NORMAL_SSR, info=Info.NORMAL_SSR) @@ -223,6 +225,7 @@ def hpa_on_procedure(q: DefaultPusQueueHelper): f"Starting procedure to switch on PL PCDU HPA with DRO to X8 " f"delay of {delay_dro_to_x8} seconds" ) + q.add_pus_tc(generate_enable_tc_sched_cmd()) pl_pcdu_on = PusTelecommand( service=200, subservice=Subservices.TC_MODE_COMMAND, @@ -288,7 +291,7 @@ def hpa_on_procedure(q: DefaultPusQueueHelper): enb_sched = generate_enable_tc_sched_cmd() - sched_time = current_time + 10 + sched_time = int(round(current_time + 10)) q.add_pus_tc(enb_sched) tagged_on_cmd = generate_time_tagged_cmd( release_time=struct.pack("!I", sched_time), @@ -310,6 +313,7 @@ def hpa_on_procedure(q: DefaultPusQueueHelper): q.add_pus_tc(tagged_dro_cmd) sched_time += delay_dro_to_x8 + sched_time = int(round(sched_time)) tagged_x8_cmd = generate_time_tagged_cmd( release_time=struct.pack("!I", sched_time), tc_to_insert=x8_on ) diff --git a/pus_tc/devs/power.py b/pus_tc/devs/power.py index c663d68..1dc4aa5 100644 --- a/pus_tc/devs/power.py +++ b/pus_tc/devs/power.py @@ -1,126 +1,141 @@ -import enum +from pus_tc.devs.pdu1 import Pdu1OpCodes +from pus_tc.devs.pdu2 import Pdu2OpCodes -from config.object_ids import PDU_1_HANDLER_ID -from gomspace.gomspace_common import pack_set_param_command, Channel -from gomspace.gomspace_pdu_definitions import PduConfigTable, PDU_CONFIG_LIST -from tmtccmd.tc import DefaultPusQueueHelper -from tmtccmd.util import ObjectIdU32 +from config.definitions import CustomServiceList +from tmtccmd.config import TmTcDefWrapper, OpCodeEntry + +from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info +from pus_tc.devs.acu import add_acu_cmds +from gomspace.gomspace_common import Info as GsInfo -class Pdu1OpCodes(enum.Enum): - TCS_BOARD_ON = ["tcs-on", "0"] - TCS_BOARD_OFF = ["tcs-off", "1"] - STAR_TRACKER_ON = ["str-on", "2"] - STAR_TRACKER_OFF = ["str-off", "3"] - SUS_NOMINAL_ON = ["sus-nom-on", "4"] - SUS_NOMINAL_OFF = ["sum-nom-off", "5"] - ACS_A_SIDE_ON = ["acs-a-on", "6"] - ACS_A_SIDE_OFF = ["acs-a-off", "7"] - SYRLINKS_ON = ["syrlinks-on", "8"] - SYRLINKS_OFF = ["syrlinks-off", "9"] - MGT_ON = ["mgt-on", "10"] - MGT_OFF = ["mgt-off", "11"] - # Solar Cell Experiment - SCEX_ON = ["scex-on", "12"] - SCEX_OFF = ["scex-off", "13"] - PLOC_ON = ["ploc-on", "14"] - PLOC_OFF = ["ploc-off", "15"] - - TESTS = "32" - - -class Pdu2OpCodes(enum.Enum): - ACS_SIDE_B_ON = "1" - ACS_SIDE_B_OFF = "2" - SUS_REDUNDANT_ON = "3" - SUS_REDUNDANT_OFF = "4" - RW_ON = "5" - RW_OFF = "6" - PL_PCDU_VBAT_NOM_ON = "7" - PL_PCDU_VBAT_NOM_OFF = "8" - PL_PCDU_VBAT_RED_ON = "9" - PL_PCDU_VBAT_RED_OFF = "10" - TCS_HEATER_IN_ON = "11" - TCS_HEATER_IN_OFF = "12" - SOLAR_ARRAY_DEPL_ON = "13" - SOLAR_ARRAY_DEPL_OFF = "14" - PL_CAMERA_ON = "15" - PL_CAMERA_OFF = "16" - # There is not really a point of the on command, the SW can not be commanded if the OBC is off - Q7S_OFF = "32" - - -class PowerChannels(enum.IntEnum): - TCS = (0,) - COM = (1,) - STR = (2,) - SUS_NOM = 3 - - -Pdu1Dict = {PowerChannels.TCS: (0, "tcs"), PowerChannels.STR: (2, "str")} - - -class PowerOpCodes: - TCS_ON = ["tcs-on"] - TCS_OFF = ["tcs-off"] - STAR_TRACKER_ON = ["str-on"] - STAR_TRACKER_OFF = ["str-off"] - - -Pdu1OpCodeList = [] - - -def get_power_obj_id(op_code: PowerOpCodes) -> ObjectIdU32: - pass - - -def pack_power_commands(q: DefaultPusQueueHelper, op_code: str): - if op_code in PowerOpCodes.TCS_ON: - object_id = PDU_1_HANDLER_ID - tcs_on_cmd(object_id, q) - if op_code in PowerOpCodes.STAR_TRACKER_ON: - object_id = PDU_1_HANDLER_ID - - -def tcs_on_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): - generic_on_cmd(object_id, q, "PDU1: Turn TCS board on", 0) - - -def tcs_off_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): - generic_off_cmd(object_id, q, "PDU1: Turn TCS board off", 0) - - -def str_on_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): - generic_on_cmd(object_id, q, "PDU1: Turn Star Tracker on", 2) - - -def str_off_cmd(object_id: ObjectIdU32, q: DefaultPusQueueHelper): - generic_off_cmd(object_id, q, "PDU1: Turn Star Tracker off", 2) - - -def generic_on_cmd( - object_id: ObjectIdU32, q: DefaultPusQueueHelper, info_str: str, out_idx: int -): - q.add_log_cmd(info_str) - q.add_pus_tc( - pack_set_param_command( - object_id.as_bytes, - PDU_CONFIG_LIST[out_idx].parameter_address, - PDU_CONFIG_LIST[out_idx].parameter_size, - Channel.on, - ) +def add_p60_cmds(defs: TmTcDefWrapper): + oce = OpCodeEntry() + oce.add(keys=P60OpCodes.STACK_3V3_ON, info=Info.STACK_3V3_ON) + oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=Info.STACK_3V3_OFF) + oce.add(keys=P60OpCodes.STACK_5V_ON, info=Info.STACK_5V_ON) + oce.add(keys=P60OpCodes.STACK_5V_OFF, info=Info.STACK_5V_OFF) + oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE) + oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE) + oce.add( + keys=GomspaceOpCodes.PRINT_SWITCH_V_I, + info="P60 Dock: Print Switches, Voltages, Currents", + ) + oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="P60 Dock: Print Latchups") + oce.add(keys=P60OpCodes.TEST, info="P60 Tests") + defs.add_service( + name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce ) -def generic_off_cmd( - object_id: ObjectIdU32, q: DefaultPusQueueHelper, info_str: str, out_idx: int -): - q.add_log_cmd(info_str) - q.add_pus_tc( - pack_set_param_command( - object_id.as_bytes, - PDU_CONFIG_LIST[out_idx].parameter_address, - PDU_CONFIG_LIST[out_idx].parameter_size, - Channel.off, - ) +def add_pdu1_cmds(defs: TmTcDefWrapper): + oce = OpCodeEntry() + oce.add(keys=Pdu1OpCodes.TCS_BOARD_ON, info="PDU1: Turn TCS board on") + oce.add(keys=Pdu1OpCodes.TCS_BOARD_OFF, info="PDU1: Turn TCS board off") + oce.add(keys=Pdu1OpCodes.STAR_TRACKER_ON, info="PDU1: Turn star tracker on") + oce.add(keys=Pdu1OpCodes.STAR_TRACKER_OFF, info="PDU1: Turn star tracker off") + oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_ON, info="PDU1: Turn SUS nominal on") + oce.add(keys=Pdu1OpCodes.SUS_NOMINAL_OFF, info="PDU1: Turn SUS nominal off") + oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_ON, info="PDU1: Turn ACS A side on") + oce.add(keys=Pdu1OpCodes.ACS_A_SIDE_OFF, info="PDU1: Turn ACS A side off") + oce.add(keys=Pdu1OpCodes.SYRLINKS_ON, info="PDU1: Turn Syrlinks on") + oce.add(keys=Pdu1OpCodes.SYRLINKS_OFF, info="PDU1: Turn Syrlinks off") + oce.add(keys=Pdu1OpCodes.MGT_ON, info="PDU1: Turn MGT on") + oce.add(keys=Pdu1OpCodes.MGT_OFF, info="PDU1: Turn MGT off") + oce.add(keys=Pdu1OpCodes.PLOC_ON, info="PDU1: Turn PLOC on") + oce.add(keys=Pdu1OpCodes.PLOC_OFF, info="PDU1: Turn PLOC off") + oce.add(keys=Pdu1OpCodes.SCEX_ON, info="PDU1: Turn Solar Cell Experiment on") + oce.add(keys=Pdu1OpCodes.SCEX_OFF, info="PDU1: Turn Solar Cell Experiment off") + oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE) + oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE) + oce.add( + keys=GomspaceOpCodes.PRINT_SWITCH_V_I, + info="PDU1: Print Switches, Voltages, Currents", ) + oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="PDU1: Print Latchups") + oce.add(keys=Pdu1OpCodes.TESTS, info="PDU1 Tests") + oce.add(keys=GomspaceOpCodes.SET_PARAM, info="Set parameter") + defs.add_service( + name=CustomServiceList.PDU1.value, + info="PDU1 Device", + op_code_entry=oce, + ) + + +def add_pdu2_cmds(defs: TmTcDefWrapper): + oce = OpCodeEntry() + oce.add(keys="0", info="PDU2 Tests") + oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_ON, info="PDU2: Turn ACS Side B on") + oce.add(keys=Pdu2OpCodes.ACS_SIDE_B_OFF, info="PDU2: Turn ACS Side B off") + oce.add(keys=Pdu2OpCodes.SUS_REDUNDANT_ON, info="PDU2: Turn SUS redundant on") + oce.add(keys=Pdu2OpCodes.SUS_REDUNDANT_OFF, info="PDU2: Turn SUS redundant off") + oce.add(keys=Pdu2OpCodes.RW_ON, info="PDU2: Turn reaction wheels on") + oce.add(keys=Pdu2OpCodes.RW_OFF, info="PDU2: Turn reaction wheels off") + oce.add( + keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON, + info="PDU2: PL PCDU Switch Channel Nominal (1) on", + ) + oce.add( + keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF, + info="PDU2: PL PCDU Switch Channel Nominal (1) off", + ) + oce.add( + keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON, + info="PDU2: PL PCDU Switch Channel Redundant (1) on", + ) + oce.add( + keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF, + info="PDU2: PL PCDU Switch Channel Redundant (1) off", + ) + oce.add( + keys=Pdu2OpCodes.TCS_HEATER_IN_ON, + info="PDU2: Switch TCS Heater Input on", + ) + oce.add( + keys=Pdu2OpCodes.TCS_HEATER_IN_OFF, + info="PDU2: Switch TCS Heater Input off", + ) + oce.add( + keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON, + info="PDU2: Switch Solar Array Deployment On", + ) + oce.add( + keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF, + info="PDU2: Switch Solar Array Deployment Off", + ) + oce.add( + keys=Pdu2OpCodes.PL_CAMERA_ON, + info="PDU2: Turn payload camera on", + ) + oce.add( + keys=Pdu2OpCodes.PL_CAMERA_OFF, + info="PDU2: Turn payload camera off", + ) + oce.add( + keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, + info=GsInfo.REQUEST_CORE_HK_ONCE, + ) + oce.add( + keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, + info=GsInfo.REQUEST_AUX_HK_ONCE, + ) + oce.add( + keys=GomspaceOpCodes.PRINT_SWITCH_V_I, + info="PDU2: Print Switches, Voltages, Currents", + ) + oce.add( + keys=GomspaceOpCodes.PRINT_LATCHUPS, + info="PDU2: Print Latchups", + ) + defs.add_service( + name="pdu2", + info="PDU2 Device", + op_code_entry=oce, + ) + + +def add_pcdu_cmds(defs: TmTcDefWrapper): + add_p60_cmds(defs) + add_pdu1_cmds(defs) + add_pdu2_cmds(defs) + add_acu_cmds(defs) diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py index f2ea28a..2865145 100644 --- a/pus_tm/hk_handling.py +++ b/pus_tm/hk_handling.py @@ -21,14 +21,13 @@ from pus_tm.devs.imtq_mgt import ( handle_calibrated_mtm_measurement, handle_raw_mtm_measurement, ) -from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_data +from pus_tm.system.power import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_data from pus_tm.devs.syrlinks import handle_syrlinks_hk_data from pus_tc.devs.imtq import ImtqSetIds from pus_tm.devs.reaction_wheels import handle_rw_hk_data from pus_tm.defs import FsfwTmTcPrinter from pus_tm.system.core import handle_core_hk_data from pus_tm.devs.mgms import handle_mgm_hk_data -from pus_tm.tcp_server_objects import tcp_server_sensor_temperatures import config.object_ids as obj_ids diff --git a/pus_tm/devs/pcdu.py b/pus_tm/system/power.py similarity index 100% rename from pus_tm/devs/pcdu.py rename to pus_tm/system/power.py