somoe more restructuring
This commit is contained in:
@ -6,9 +6,39 @@
|
||||
@author J. Meier
|
||||
@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_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:
|
||||
@ -117,3 +147,165 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
|
||||
q.add_log_cmd("PDU2: Requesting housekeeping table")
|
||||
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)
|
||||
|
Reference in New Issue
Block a user