somoe more restructuring

This commit is contained in:
Robin Müller 2022-08-27 16:28:33 +02:00
parent efc8e3b4b2
commit ce837353ca
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
6 changed files with 393 additions and 369 deletions

View File

@ -5,7 +5,11 @@
""" """
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtc.power.common_power import add_gomspace_cmds, add_gomspace_cmd_defs from tmtc.power.common_power import (
add_gomspace_cmds,
add_gomspace_cmd_defs,
req_hk_cmds,
)
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.config.tmtc import tmtc_definitions_provider
@ -53,6 +57,7 @@ class Info:
def add_acu_cmds(defs: TmtcDefinitionWrapper): def add_acu_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry() oce = OpCodeEntry()
add_gomspace_cmd_defs(oce) add_gomspace_cmd_defs(oce)
oce.add(keys=OpCodes.TEST, info=Info.TEST) oce.add(keys=OpCodes.TEST, info=Info.TEST)
defs.add_service( defs.add_service(
name=CustomServiceList.ACU.value, name=CustomServiceList.ACU.value,
@ -64,9 +69,16 @@ def add_acu_cmds(defs: TmtcDefinitionWrapper):
def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str): def pack_acu_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
q.add_log_cmd("Handling ACU command") q.add_log_cmd("Handling ACU command")
add_gomspace_cmds("ACU", object_id, q, op_code) add_gomspace_cmds("ACU", object_id, q, op_code)
acu_req_hk_cmds(q, op_code)
pack_test_cmds(object_id=object_id, q=q) pack_test_cmds(object_id=object_id, q=q)
def acu_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds(
"ACU", q, op_code, ACU_HANDLER_ID, [gs.SetIds.ACU_CORE, gs.SetIds.ACU_AUX]
)
class ACUTestProcedure: class ACUTestProcedure:
""" """
@brief Use this class to define the tests to perform for the ACU. @brief Use this class to define the tests to perform for the ACU.

View File

@ -1,12 +1,8 @@
import enum
from config.object_ids import PDU_1_HANDLER_ID, PDU_2_HANDLER_ID
from gomspace.gomspace_common import ( from gomspace.gomspace_common import (
pack_set_param_command, pack_set_param_command,
Channel, Channel,
GomspaceOpCodes, GomspaceOpCodes,
GsInfo, GsInfo,
SetIds,
GomspaceDeviceActionIds, GomspaceDeviceActionIds,
prompt_and_pack_set_param_command, prompt_and_pack_set_param_command,
prompt_and_pack_get_param_command, prompt_and_pack_get_param_command,
@ -24,56 +20,12 @@ from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
class Pdu1ChIndex(enum.IntEnum):
TCS = 0
SYRLINKS = 1
STR = 2
MGT = 3
SUS_N = 4
SCEX = 5
PLOC = 6
ACS_A = 7
class Pdu1InfoBase:
TCS = "Switch TCS Board"
SYRLINKS = "Switch Syrlinks (COM)"
STR = "Switch Startracker"
MGT = "Switch Magnetorquer"
SUS_N = "Switch Sun Sensor Board Nominal"
SCEX = "Switch Solar Cell Experiment"
PLOC = "Switch Payload On-Board Computer"
ACS_A = "Switch ACS Board A-Side"
class Pdu2InfoBase:
PL_PCDU_BAT_NOM = "Switch PL PCDU Nominal Battery Channel"
RW = "Switch Reaction Wheel"
HEATER = "Switch Heater"
SUS_R = "Switch Sun Sensor Board Redundant"
SOLAR_ARRAY_DEPL = "Switch Solar Array Deployment"
PL_PCDU_BAT_RED = "Switch PL PCDU Redundant Battery Channel"
ACS_B = "Switch ACS Board B-Side"
PL_CAM = "Switch Payload Camera"
class PowerInfo: class PowerInfo:
INFO_CORE = "Core Information" INFO_CORE = "Core Information"
INFO_AUX = "Auxiliary Information" INFO_AUX = "Auxiliary Information"
INFO_ALL = "All Information" INFO_ALL = "All Information"
class Pdu2ChIndex(enum.IntEnum):
PL_PCDU_BAT_NOM = 1
RW = 2
HEATER = 3
SUS_R = 4
SOLAR_ARRAY_DEPL = 5
PL_PCDU_BAT_RED = 6
ACS_B = 7
PL_CAM = 8
class PowerOpCodes: class PowerOpCodes:
# PDU 1 # PDU 1
TCS_ON = ["tcs-on"] TCS_ON = ["tcs-on"]
@ -116,78 +68,6 @@ class PowerOpCodes:
INFO_ALL = ["info-all"] INFO_ALL = ["info-all"]
def info_on_pdu1(base: str) -> str:
return "PDU1: " + base + " on"
def info_off_pdu1(base: str) -> str:
return "PDU1: " + base + " off"
def info_on_pdu2(base: str) -> str:
return "PDU2: " + base + " on"
def info_off_pdu2(base: str) -> str:
return "PDU2: " + base + " off"
def add_pdu1_common_defs(oce: OpCodeEntry):
oce.add(keys=PowerOpCodes.TCS_ON, info=info_on_pdu1(Pdu1InfoBase.TCS))
oce.add(keys=PowerOpCodes.TCS_OFF, info=info_off_pdu1(Pdu1InfoBase.TCS))
oce.add(keys=PowerOpCodes.STAR_TRACKER_ON, info=info_on_pdu1(Pdu1InfoBase.STR))
oce.add(keys=PowerOpCodes.STAR_TRACKER_OFF, info=info_off_pdu1(Pdu1InfoBase.STR))
oce.add(keys=PowerOpCodes.SUS_N_ON, info=info_on_pdu1(Pdu1InfoBase.SUS_N))
oce.add(keys=PowerOpCodes.SUS_N_OFF, info=info_off_pdu1(Pdu1InfoBase.SUS_N))
oce.add(keys=PowerOpCodes.ACS_A_ON, info=info_on_pdu1(Pdu1InfoBase.ACS_A))
oce.add(keys=PowerOpCodes.ACS_A_OFF, info=info_off_pdu1(Pdu1InfoBase.ACS_A))
oce.add(keys=PowerOpCodes.SYRLINKS_ON, info=info_on_pdu1(Pdu1InfoBase.SYRLINKS))
oce.add(keys=PowerOpCodes.SYRLINKS_OFF, info=info_off_pdu1(Pdu1InfoBase.SYRLINKS))
oce.add(keys=PowerOpCodes.MGT_ON, info=info_on_pdu1(Pdu1InfoBase.MGT))
oce.add(keys=PowerOpCodes.MGT_OFF, info=info_off_pdu1(Pdu1InfoBase.MGT))
oce.add(keys=PowerOpCodes.PLOC_ON, info=info_on_pdu1(Pdu1InfoBase.PLOC))
oce.add(keys=PowerOpCodes.PLOC_OFF, info=info_off_pdu1(Pdu1InfoBase.PLOC))
oce.add(keys=PowerOpCodes.SCEX_ON, info=info_on_pdu1(Pdu1InfoBase.SCEX))
oce.add(keys=PowerOpCodes.SCEX_OFF, info=info_off_pdu1(Pdu1InfoBase.SCEX))
def add_pdu2_common_defs(oce: OpCodeEntry):
oce.add(keys=PowerOpCodes.ACS_B_ON, info=info_on_pdu2(Pdu2InfoBase.ACS_B))
oce.add(keys=PowerOpCodes.ACS_B_OFF, info=info_off_pdu2(Pdu2InfoBase.ACS_B))
oce.add(keys=PowerOpCodes.SUS_R_ON, info=info_on_pdu2(Pdu2InfoBase.SUS_R))
oce.add(keys=PowerOpCodes.SUS_R_OFF, info=info_off_pdu2(Pdu2InfoBase.SUS_R))
oce.add(keys=PowerOpCodes.RW_ON, info=info_on_pdu2(Pdu2InfoBase.RW))
oce.add(keys=PowerOpCodes.RW_OFF, info=info_off_pdu2(Pdu2InfoBase.RW))
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_NOM_ON,
info=info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_NOM_OFF,
info=info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_RED_ON,
info=info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_RED_OFF,
info=info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
)
oce.add(keys=PowerOpCodes.HEATER_ON, info=info_on_pdu2(Pdu2InfoBase.HEATER))
oce.add(keys=PowerOpCodes.HEATER_OFF, info=info_off_pdu2(Pdu2InfoBase.HEATER))
oce.add(
keys=PowerOpCodes.SOLAR_ARRAY_DEPL_ON,
info=info_on_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
)
oce.add(
keys=PowerOpCodes.SOLAR_ARRAY_DEPL_OFF,
info=info_off_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
)
oce.add(keys=PowerOpCodes.PL_CAM_ON, info=info_on_pdu2(Pdu2InfoBase.PL_CAM))
oce.add(keys=PowerOpCodes.PL_CAM_OFF, info=info_off_pdu2(Pdu2InfoBase.PL_CAM))
def add_gomspace_cmds( def add_gomspace_cmds(
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
): ):
@ -217,238 +97,23 @@ def add_gomspace_cmds(
q.add_pus_tc(pack_request_config_command(object_id.as_bytes)) q.add_pus_tc(pack_request_config_command(object_id.as_bytes))
def pdu1_cmds(q: DefaultPusQueueHelper, op_code: str): def req_hk_cmds(
if op_code in PowerOpCodes.TCS_ON: prefix: str,
tcs_on_cmd(q) q: DefaultPusQueueHelper,
elif op_code in PowerOpCodes.TCS_OFF: op_code: str,
tcs_off_cmd(q) obj_id: bytes,
elif op_code in PowerOpCodes.SYRLINKS_ON: set_id_pair: [int, int],
syrlinks_on_cmd(q) ):
elif op_code in PowerOpCodes.SYRLINKS_OFF:
syrlinks_off_cmd(q)
elif op_code in PowerOpCodes.STAR_TRACKER_ON:
startracker_on_cmd(q)
elif op_code in PowerOpCodes.STAR_TRACKER_OFF:
startracker_off_cmd(q)
elif op_code in PowerOpCodes.MGT_ON:
mgt_on_cmd(q)
elif op_code in PowerOpCodes.MGT_OFF:
mgt_off_cmd(q)
elif op_code in PowerOpCodes.SUS_N_ON:
sun_sensor_nominal_on_cmd(q)
elif op_code in PowerOpCodes.SUS_N_OFF:
sun_sensor_nominal_off_cmd(q)
elif op_code in PowerOpCodes.SCEX_ON:
solar_cell_experiment_on_cmd(q)
elif op_code in PowerOpCodes.SCEX_OFF:
solar_cell_experiment_off_cmd(q)
elif op_code in PowerOpCodes.PLOC_ON:
ploc_on_cmd(q)
elif op_code in PowerOpCodes.PLOC_OFF:
ploc_off_cmd(q)
elif op_code in PowerOpCodes.ACS_A_ON:
acs_board_a_on_cmd(q)
elif op_code in PowerOpCodes.ACS_A_OFF:
acs_board_a_off_cmd(q)
def pdu2_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
pl_pcdu_bat_nom_on_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:
pl_pcdu_bat_nom_off_cmd(q)
elif op_code in PowerOpCodes.RW_ON:
reaction_wheel_on_cmd(q)
elif op_code in PowerOpCodes.RW_OFF:
reaction_wheel_off_cmd(q)
elif op_code in PowerOpCodes.HEATER_ON:
heater_on_cmd(q)
elif op_code in PowerOpCodes.HEATER_OFF:
heater_off_cmd(q)
elif op_code in PowerOpCodes.SUS_R_ON:
sus_red_on_cmd(q)
elif op_code in PowerOpCodes.SUS_R_OFF:
sus_red_off_cmd(q)
elif op_code in PowerOpCodes.SOLAR_ARRAY_DEPL_ON:
solar_array_deployment_on_cmd(q)
elif op_code in PowerOpCodes.SOLAR_ARRAY_DEPL_OFF:
solar_array_deployment_off_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_RED_ON:
pl_pcdu_bat_red_on_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_RED_OFF:
pl_pcdu_bat_nom_off_cmd(q)
elif op_code in PowerOpCodes.ACS_B_ON:
acs_board_b_side_on_cmd(q)
elif op_code in PowerOpCodes.ACS_B_OFF:
acs_board_b_side_off_cmd(q)
elif op_code in PowerOpCodes.PL_CAM_ON:
payload_camera_on_cmd(q)
elif op_code in PowerOpCodes.PL_CAM_OFF:
payload_camera_off_cmd(q)
def pdu1_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
q.add_log_cmd(f"PDU1: {GsInfo.REQUEST_CORE_HK_ONCE}") q.add_log_cmd(f"{prefix}: {GsInfo.REQUEST_CORE_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_CORE) hk_sid = make_sid(object_id=obj_id, set_id=set_id_pair[0])
q.add_pus_tc(generate_one_diag_command(sid=hk_sid)) q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE: if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
q.add_log_cmd(f"PDU1: {GsInfo.REQUEST_AUX_HK_ONCE}") q.add_log_cmd(f"{prefix}: {GsInfo.REQUEST_AUX_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_AUX) hk_sid = make_sid(object_id=obj_id, set_id=set_id_pair[1])
q.add_pus_tc(generate_one_hk_command(sid=hk_sid)) q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
def pdu2_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
q.add_log_cmd(f"PDU2: {GsInfo.REQUEST_CORE_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_CORE)
q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
q.add_log_cmd(f"PDU2: {GsInfo.REQUEST_AUX_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2_AUX)
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
def tcs_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
def syrlinks_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
def syrlinks_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
def startracker_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
def startracker_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
def mgt_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
def mgt_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
def sun_sensor_nominal_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
def solar_cell_experiment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
def solar_cell_experiment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
def ploc_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
def ploc_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
def acs_board_a_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
def acs_board_a_off_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
def pl_pcdu_bat_nom_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_NOM, Pdu2ChIndex.PL_PCDU_BAT_NOM
)
def pl_pcdu_bat_nom_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_NOM, Pdu2ChIndex.PL_PCDU_BAT_NOM
)
def reaction_wheel_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def reaction_wheel_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def heater_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def heater_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def sus_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def sus_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def solar_array_deployment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def solar_array_deployment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def pl_pcdu_bat_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def pl_pcdu_bat_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def acs_board_b_side_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def acs_board_b_side_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def payload_camera_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
def payload_camera_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
def generic_on_cmd( def generic_on_cmd(
object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int object_id: bytes, q: DefaultPusQueueHelper, info_str: str, out_idx: int
): ):

View File

@ -5,16 +5,9 @@
@author J. Meier @author J. Meier
@date 13.12.2020 @date 13.12.2020
""" """
from tmtc.power.common_power import add_gomspace_cmds from tmtc.power.common_power import add_gomspace_cmds, req_hk_cmds
from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
make_sid,
generate_one_diag_command,
)
from gomspace.gomspace_common import ( from gomspace.gomspace_common import (
GsInfo,
GomspaceOpCodes,
TableEntry, TableEntry,
Channel, Channel,
pack_set_param_command, pack_set_param_command,
@ -22,12 +15,10 @@ from gomspace.gomspace_common import (
pack_get_param_command, pack_get_param_command,
pack_gnd_wdt_reset_command, pack_gnd_wdt_reset_command,
pack_ping_command, pack_ping_command,
GomspaceDeviceActionIds,
pack_reboot_command, pack_reboot_command,
SetIds, SetIds,
) )
from config.object_ids import P60_DOCK_HANDLER from config.object_ids import P60_DOCK_HANDLER
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.util import ObjectIdU32 from tmtccmd.util import ObjectIdU32
@ -104,6 +95,8 @@ class P60DockHkTable:
def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str): def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
objb = object_id.as_bytes objb = object_id.as_bytes
add_gomspace_cmds("P60 Dock", object_id, q, op_code)
p60_dock_req_hk_cmds(q, op_code)
if op_code in P60OpCodes.STACK_3V3_ON: if op_code in P60OpCodes.STACK_3V3_ON:
q.add_log_cmd(P60Info.STACK_3V3_ON) q.add_log_cmd(P60Info.STACK_3V3_ON)
q.add_pus_tc( q.add_pus_tc(
@ -144,7 +137,6 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
Channel.off, Channel.off,
) )
) )
add_gomspace_cmds("P60 Dock", object_id, q, op_code)
if P60DockTestProcedure.all or P60DockTestProcedure.reboot: if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
q.add_log_cmd("P60 Dock: Reboot") q.add_log_cmd("P60 Dock: Reboot")
q.add_pus_tc(pack_reboot_command(object_id)) q.add_pus_tc(pack_reboot_command(object_id))
@ -271,3 +263,9 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
parameter, parameter,
) )
) )
def p60_dock_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds(
"P60 Dock", q, op_code, P60_DOCK_HANDLER, [SetIds.P60_CORE, SetIds.P60_AUX]
)

View File

@ -3,11 +3,40 @@
@author J. Meier @author J. Meier
@date 17.12.2020 @date 17.12.2020
""" """
import gomspace.gomspace_common as gs from config.object_ids import PDU_1_HANDLER_ID
from tmtc.power.common_power import pdu1_cmds, pdu1_req_hk_cmds, add_gomspace_cmds from tmtc.power.common_power import (
add_gomspace_cmds,
req_hk_cmds,
PowerOpCodes,
generic_on_cmd,
generic_off_cmd,
)
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from gomspace.gomspace_pdu_definitions import * from gomspace.gomspace_pdu_definitions import *
from tmtccmd.config import OpCodeEntry
class Pdu1InfoBase:
TCS = "Switch TCS Board"
SYRLINKS = "Switch Syrlinks (COM)"
STR = "Switch Startracker"
MGT = "Switch Magnetorquer"
SUS_N = "Switch Sun Sensor Board Nominal"
SCEX = "Switch Solar Cell Experiment"
PLOC = "Switch Payload On-Board Computer"
ACS_A = "Switch ACS Board A-Side"
class Pdu1ChIndex(enum.IntEnum):
TCS = 0
SYRLINKS = 1
STR = 2
MGT = 3
SUS_N = 4
SCEX = 5
PLOC = 6
ACS_A = 7
class PDU1TestProcedure: class PDU1TestProcedure:
@ -87,3 +116,135 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
Channel.off, Channel.off,
) )
) )
def pdu1_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds(
"PDU1", q, op_code, PDU_1_HANDLER_ID, [SetIds.PDU_1_CORE, SetIds.PDU_1_AUX]
)
def info_on_pdu1(base: str) -> str:
return "PDU1: " + base + " on"
def info_off_pdu1(base: str) -> str:
return "PDU1: " + base + " off"
def pdu1_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in PowerOpCodes.TCS_ON:
tcs_on_cmd(q)
elif op_code in PowerOpCodes.TCS_OFF:
tcs_off_cmd(q)
elif op_code in PowerOpCodes.SYRLINKS_ON:
syrlinks_on_cmd(q)
elif op_code in PowerOpCodes.SYRLINKS_OFF:
syrlinks_off_cmd(q)
elif op_code in PowerOpCodes.STAR_TRACKER_ON:
startracker_on_cmd(q)
elif op_code in PowerOpCodes.STAR_TRACKER_OFF:
startracker_off_cmd(q)
elif op_code in PowerOpCodes.MGT_ON:
mgt_on_cmd(q)
elif op_code in PowerOpCodes.MGT_OFF:
mgt_off_cmd(q)
elif op_code in PowerOpCodes.SUS_N_ON:
sun_sensor_nominal_on_cmd(q)
elif op_code in PowerOpCodes.SUS_N_OFF:
sun_sensor_nominal_off_cmd(q)
elif op_code in PowerOpCodes.SCEX_ON:
solar_cell_experiment_on_cmd(q)
elif op_code in PowerOpCodes.SCEX_OFF:
solar_cell_experiment_off_cmd(q)
elif op_code in PowerOpCodes.PLOC_ON:
ploc_on_cmd(q)
elif op_code in PowerOpCodes.PLOC_OFF:
ploc_off_cmd(q)
elif op_code in PowerOpCodes.ACS_A_ON:
acs_board_a_on_cmd(q)
elif op_code in PowerOpCodes.ACS_A_OFF:
acs_board_a_off_cmd(q)
def add_pdu1_common_defs(oce: OpCodeEntry):
oce.add(keys=PowerOpCodes.TCS_ON, info=info_on_pdu1(Pdu1InfoBase.TCS))
oce.add(keys=PowerOpCodes.TCS_OFF, info=info_off_pdu1(Pdu1InfoBase.TCS))
oce.add(keys=PowerOpCodes.STAR_TRACKER_ON, info=info_on_pdu1(Pdu1InfoBase.STR))
oce.add(keys=PowerOpCodes.STAR_TRACKER_OFF, info=info_off_pdu1(Pdu1InfoBase.STR))
oce.add(keys=PowerOpCodes.SUS_N_ON, info=info_on_pdu1(Pdu1InfoBase.SUS_N))
oce.add(keys=PowerOpCodes.SUS_N_OFF, info=info_off_pdu1(Pdu1InfoBase.SUS_N))
oce.add(keys=PowerOpCodes.ACS_A_ON, info=info_on_pdu1(Pdu1InfoBase.ACS_A))
oce.add(keys=PowerOpCodes.ACS_A_OFF, info=info_off_pdu1(Pdu1InfoBase.ACS_A))
oce.add(keys=PowerOpCodes.SYRLINKS_ON, info=info_on_pdu1(Pdu1InfoBase.SYRLINKS))
oce.add(keys=PowerOpCodes.SYRLINKS_OFF, info=info_off_pdu1(Pdu1InfoBase.SYRLINKS))
oce.add(keys=PowerOpCodes.MGT_ON, info=info_on_pdu1(Pdu1InfoBase.MGT))
oce.add(keys=PowerOpCodes.MGT_OFF, info=info_off_pdu1(Pdu1InfoBase.MGT))
oce.add(keys=PowerOpCodes.PLOC_ON, info=info_on_pdu1(Pdu1InfoBase.PLOC))
oce.add(keys=PowerOpCodes.PLOC_OFF, info=info_off_pdu1(Pdu1InfoBase.PLOC))
oce.add(keys=PowerOpCodes.SCEX_ON, info=info_on_pdu1(Pdu1InfoBase.SCEX))
oce.add(keys=PowerOpCodes.SCEX_OFF, info=info_off_pdu1(Pdu1InfoBase.SCEX))
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
def tcs_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)
def syrlinks_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
def syrlinks_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SYRLINKS, Pdu1ChIndex.SYRLINKS)
def startracker_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
def startracker_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.STR, Pdu1ChIndex.STR)
def mgt_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
def mgt_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.MGT, Pdu1ChIndex.MGT)
def sun_sensor_nominal_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
def sun_sensor_nominal_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SUS_N, Pdu1ChIndex.SUS_N)
def solar_cell_experiment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
def solar_cell_experiment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.SCEX, Pdu1ChIndex.SCEX)
def ploc_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
def ploc_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.PLOC, Pdu1ChIndex.PLOC)
def acs_board_a_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)
def acs_board_a_off_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.ACS_A, Pdu1ChIndex.ACS_A)

View File

@ -6,9 +6,39 @@
@author J. Meier @author J. Meier
@date 17.12.2020 @date 17.12.2020
""" """
from tmtc.power.common_power import pdu2_cmds, pdu2_req_hk_cmds, add_gomspace_cmds from config.object_ids import PDU_2_HANDLER_ID
from tmtc.power.common_power import (
add_gomspace_cmds,
req_hk_cmds,
PowerOpCodes,
generic_on_cmd,
generic_off_cmd,
)
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from gomspace.gomspace_pdu_definitions import * from gomspace.gomspace_pdu_definitions import *
from tmtccmd.config import OpCodeEntry
class Pdu2InfoBase:
PL_PCDU_BAT_NOM = "Switch PL PCDU Nominal Battery Channel"
RW = "Switch Reaction Wheel"
HEATER = "Switch Heater"
SUS_R = "Switch Sun Sensor Board Redundant"
SOLAR_ARRAY_DEPL = "Switch Solar Array Deployment"
PL_PCDU_BAT_RED = "Switch PL PCDU Redundant Battery Channel"
ACS_B = "Switch ACS Board B-Side"
PL_CAM = "Switch Payload Camera"
class Pdu2ChIndex(enum.IntEnum):
PL_PCDU_BAT_NOM = 1
RW = 2
HEATER = 3
SUS_R = 4
SOLAR_ARRAY_DEPL = 5
PL_PCDU_BAT_RED = 6
ACS_B = 7
PL_CAM = 8
class PDU2TestProcedure: class PDU2TestProcedure:
@ -117,3 +147,165 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table: if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
q.add_log_cmd("PDU2: Requesting housekeeping table") q.add_log_cmd("PDU2: Requesting housekeeping table")
q.add_pus_tc(pack_request_full_hk_table_command(object_id)) q.add_pus_tc(pack_request_full_hk_table_command(object_id))
def pdu2_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
pl_pcdu_bat_nom_on_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:
pl_pcdu_bat_nom_off_cmd(q)
elif op_code in PowerOpCodes.RW_ON:
reaction_wheel_on_cmd(q)
elif op_code in PowerOpCodes.RW_OFF:
reaction_wheel_off_cmd(q)
elif op_code in PowerOpCodes.HEATER_ON:
heater_on_cmd(q)
elif op_code in PowerOpCodes.HEATER_OFF:
heater_off_cmd(q)
elif op_code in PowerOpCodes.SUS_R_ON:
sus_red_on_cmd(q)
elif op_code in PowerOpCodes.SUS_R_OFF:
sus_red_off_cmd(q)
elif op_code in PowerOpCodes.SOLAR_ARRAY_DEPL_ON:
solar_array_deployment_on_cmd(q)
elif op_code in PowerOpCodes.SOLAR_ARRAY_DEPL_OFF:
solar_array_deployment_off_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_RED_ON:
pl_pcdu_bat_red_on_cmd(q)
elif op_code in PowerOpCodes.PL_PCDU_VBAT_RED_OFF:
pl_pcdu_bat_nom_off_cmd(q)
elif op_code in PowerOpCodes.ACS_B_ON:
acs_board_b_side_on_cmd(q)
elif op_code in PowerOpCodes.ACS_B_OFF:
acs_board_b_side_off_cmd(q)
elif op_code in PowerOpCodes.PL_CAM_ON:
payload_camera_on_cmd(q)
elif op_code in PowerOpCodes.PL_CAM_OFF:
payload_camera_off_cmd(q)
def info_on_pdu2(base: str) -> str:
return "PDU2: " + base + " on"
def info_off_pdu2(base: str) -> str:
return "PDU2: " + base + " off"
def add_pdu2_common_defs(oce: OpCodeEntry):
oce.add(keys=PowerOpCodes.ACS_B_ON, info=info_on_pdu2(Pdu2InfoBase.ACS_B))
oce.add(keys=PowerOpCodes.ACS_B_OFF, info=info_off_pdu2(Pdu2InfoBase.ACS_B))
oce.add(keys=PowerOpCodes.SUS_R_ON, info=info_on_pdu2(Pdu2InfoBase.SUS_R))
oce.add(keys=PowerOpCodes.SUS_R_OFF, info=info_off_pdu2(Pdu2InfoBase.SUS_R))
oce.add(keys=PowerOpCodes.RW_ON, info=info_on_pdu2(Pdu2InfoBase.RW))
oce.add(keys=PowerOpCodes.RW_OFF, info=info_off_pdu2(Pdu2InfoBase.RW))
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_NOM_ON,
info=info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_NOM_OFF,
info=info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_NOM),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_RED_ON,
info=info_on_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
)
oce.add(
keys=PowerOpCodes.PL_PCDU_VBAT_RED_OFF,
info=info_off_pdu2(Pdu2InfoBase.PL_PCDU_BAT_RED),
)
oce.add(keys=PowerOpCodes.HEATER_ON, info=info_on_pdu2(Pdu2InfoBase.HEATER))
oce.add(keys=PowerOpCodes.HEATER_OFF, info=info_off_pdu2(Pdu2InfoBase.HEATER))
oce.add(
keys=PowerOpCodes.SOLAR_ARRAY_DEPL_ON,
info=info_on_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
)
oce.add(
keys=PowerOpCodes.SOLAR_ARRAY_DEPL_OFF,
info=info_off_pdu2(Pdu2InfoBase.SOLAR_ARRAY_DEPL),
)
oce.add(keys=PowerOpCodes.PL_CAM_ON, info=info_on_pdu2(Pdu2InfoBase.PL_CAM))
oce.add(keys=PowerOpCodes.PL_CAM_OFF, info=info_off_pdu2(Pdu2InfoBase.PL_CAM))
def pdu2_req_hk_cmds(q: DefaultPusQueueHelper, op_code: str):
req_hk_cmds(
"PDU2", q, op_code, PDU_2_HANDLER_ID, [SetIds.PDU_2_CORE, SetIds.PDU_2_AUX]
)
def pl_pcdu_bat_nom_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_NOM, Pdu2ChIndex.PL_PCDU_BAT_NOM
)
def pl_pcdu_bat_nom_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_NOM, Pdu2ChIndex.PL_PCDU_BAT_NOM
)
def reaction_wheel_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def reaction_wheel_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.RW, Pdu2ChIndex.RW)
def heater_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def heater_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.HEATER, Pdu2ChIndex.HEATER)
def sus_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def sus_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.SUS_R, Pdu2ChIndex.SUS_R)
def solar_array_deployment_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def solar_array_deployment_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.SOLAR_ARRAY_DEPL, Pdu2ChIndex.SOLAR_ARRAY_DEPL
)
def pl_pcdu_bat_red_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def pl_pcdu_bat_red_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(
PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_PCDU_BAT_RED, Pdu2ChIndex.PL_PCDU_BAT_RED
)
def acs_board_b_side_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def acs_board_b_side_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.ACS_B, Pdu2ChIndex.ACS_B)
def payload_camera_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)
def payload_camera_off_cmd(q: DefaultPusQueueHelper):
generic_off_cmd(PDU_2_HANDLER_ID, q, Pdu2InfoBase.PL_CAM, Pdu2ChIndex.PL_CAM)

View File

@ -1,20 +1,16 @@
from gomspace.gomspace_common import GsInfo from gomspace.gomspace_common import GsInfo, GomspaceOpCodes
from tmtc.power.common_power import ( from tmtc.power.common_power import (
PowerOpCodes, PowerOpCodes,
add_pdu1_common_defs,
add_pdu2_common_defs,
PowerInfo, PowerInfo,
pdu1_cmds,
pdu2_cmds,
pdu1_req_hk_cmds,
pdu2_req_hk_cmds,
add_gomspace_cmd_defs, add_gomspace_cmd_defs,
) )
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from tmtc.power.pdu1 import pdu1_req_hk_cmds, pdu1_cmds, add_pdu1_common_defs
from tmtc.power.pdu2 import pdu2_req_hk_cmds, add_pdu2_common_defs, pdu2_cmds
from tmtccmd import get_console_logger from tmtccmd import get_console_logger
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from tmtc.power.p60dock import P60OpCodes, GomspaceOpCodes, P60Info from tmtc.power.p60dock import P60OpCodes, P60Info
from tmtc.power.acu import add_acu_cmds from tmtc.power.acu import add_acu_cmds
from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc import DefaultPusQueueHelper