Rework switch / Voltage / Current commands #23

Merged
meierj merged 8 commits from mueller/rework-switch-cmds into develop 2021-09-24 17:29:04 +02:00
8 changed files with 103 additions and 66 deletions

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="P60 Dock Commanding" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<configuration default="false" name="P60 Dock Commanding" type="PythonConfigurationType" factoryName="Python" folderName="Core">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />

View File

@ -90,6 +90,8 @@ class EiveHookObject(TmTcHookBase):
def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
from pus_tc.pdu1 import Pdu1OpCodes
from pus_tc.pdu2 import Pdu2OpCodes
from pus_tc.p60dock import P60OpCodes
from gomspace.gomspace_common import GomspaceOpCodes
from pus_tc.gps import GpsOpCodes
op_code_dict = {
'reboot': ('Reboot with Prompt', {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -125,8 +127,12 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
op_code_dict_srv_p60 = {
"0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}),
P60OpCodes.STACK_3V3_ON.value:
("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}),
P60OpCodes.STACK_3V3_OFF.value:
("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}),
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
("P60 Dock: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_p60_tuple = ("P60 Device", op_code_dict_srv_p60)
@ -135,29 +141,37 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
Pdu1OpCodes.STAR_TRACKER_ON.value:
("PDU1: Turn star tracker on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PDU1: Get switch state of star tracker", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.SUS_NOMINAL_ON.value:
("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.STAR_TRACKER_OFF.value:
("PDU1: Turn star tracker off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PDU1: Turn SUS nominal off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.SUS_NOMINAL_OFF.value:
("PDU1: Turn SUS nominal off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.ACS_A_SIDE_ON.value:
("PDU1: Turn ACS Side A on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.ACS_A_SIDE_OFF.value:
("PDU1: Turn ACS Side A off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.PRINT_SWITCH_STATE.value:
("PDU1: Print switch states", {OpCodeDictKeys.TIMEOUT: 2.0})
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0})
}
service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1)
op_code_dict_srv_pdu2 = {
"0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("PDU2: Turn ACS Side A on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PDU2: Turn ACS Side A off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.PRINT_SWITCH_STATE.value:
("PDU1: Print switch states", {OpCodeDictKeys.TIMEOUT: 2.0})
Pdu2OpCodes.ACS_SIDE_B_ON.value:
("PDU2: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu2OpCodes.ACS_SIDE_B_OFF.value:
("PDU2: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu2OpCodes.SUS_REDUNDANT_ON.value:
("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu2OpCodes.RW_ON.value:
("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu2OpCodes.RW_OFF.value:
("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}),
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0})
}
service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2)

View File

@ -19,7 +19,11 @@ class GomspaceDeviceActionIds(enum.IntEnum):
PARAM_SET = 255
WDT_RESET = 9
REQUEST_HK_TABLE = 16
PRINT_SWITCH_STATE = 17
PRINT_SWITCH_V_I = 32
class GomspaceOpCodes(enum.Enum):
PRINT_SWITCH_V_I = "32"
class TableIds:

View File

@ -4,22 +4,29 @@ from tmtccmd.pus.service_list import PusServices
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
from tmtccmd.tc.packer import PusTelecommand
from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID
from pus_tc.pdu1 import pack_pdu1_commands, Pdu1OpCodes
from pus_tc.pdu2 import pack_pdu2_commands, Pdu2OpCodes
class AcsOpCodes(enum.Enum):
ALL_ON = "0"
ALL_OFF = "1"
POWER_CYCLE = "2"
# Switch on A side
ON_MGM_0 = "0"
ON_MGM_1 = "1"
ON_GYRO_0 = "2"
ON_GYRO_1 = "3"
ON_MGM_0 = "12"
ON_MGM_1 = "13"
ON_GYRO_0 = "14"
ON_GYRO_1 = "15"
# Switch on B side
ON_MGM_2 = "4"
ON_MGM_3 = "5"
ON_GYRO_2 = "6"
ON_GYRO_3 = "7"
ON_MGM_2 = "16"
ON_MGM_3 = "17"
ON_GYRO_2 = "18"
ON_GYRO_3 = "19"
def pack_acs_command(tc_queue: TcQueueT, op_code: str):
if op_code == AcsOpCodes.ALL_ON:
pass
if op_code == AcsOpCodes.ON_MGM_0.value:
app_data = pack_mode_data(object_id=MGM_0_HANDLER_ID, mode=Modes.ON, submode=0)
# return PusTelecommand(service=PusServices.SERVICE_200_MODE, subservice=)

View File

@ -7,10 +7,15 @@
"""
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
from gomspace.gomspace_common import *
class P60OpCodes(enum.Enum):
TEST = "0"
STACK_3V3_ON = "1"
STACK_3V3_OFF = "2"
class P60DockTestProcedure:
"""
@brief Use this class to define the tests to perform for the P60Dock.
@ -57,27 +62,30 @@ class P60DockHkTable:
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
if op_code == "1":
def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == P60OpCodes.STACK_3V3_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on"))
command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, Channel.on
)
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if op_code == "2":
return
if op_code == P60OpCodes.STACK_3V3_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off"))
command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, Channel.off
)
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
return
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
return
if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot"))
command = pack_reboot_command(object_id)

View File

@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
"""
@file tmtcc_tc_pdu1.py
@brief PDU2 tests
@details PDU2 is mounted on the X4 slot of the P60 dock
"""PDU2 is mounted on the X4 slot of the P60 dock
@author J. Meier
@date 17.12.2020
"""
@ -18,10 +15,11 @@ from gomspace.gomspace_pdu_definitions import *
class Pdu1OpCodes(enum.Enum):
STAR_TRACKER_ON = "1"
SUS_NOMINAL_ON = "3"
STAR_TRACKER_OFF = "4"
SUS_NOMINAL_OFF = "5"
ACS_A_SIDE_ON = "6"
ACS_A_SIDE_OFF = "7"
PRINT_SWITCH_STATE = "17"
class PDU1TestProcedure:
@ -40,7 +38,7 @@ class PDU1TestProcedure:
turn_channel_3_off = False
def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1"))
if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value:
@ -48,7 +46,7 @@ def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.on)
@ -58,10 +56,12 @@ def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.off)
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.off
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on"))
@ -77,26 +77,26 @@ def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
PDUConfigTable.out_en_7.parameter_size, Channel.off
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.PRINT_SWITCH_STATE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switch Status"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATE
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8":
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.on
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9":
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.off
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))

View File

@ -15,7 +15,10 @@ from gomspace.gomspace_pdu_definitions import *
class Pdu2OpCodes(enum.Enum):
ACS_SIDE_B_ON = "1"
ACS_SIDE_B_OFF = "2"
PRINT_SWITCH_STATE = "17"
SUS_REDUNDANT_ON = "3"
SUS_REDUNDANT_OFF = "4"
RW_ON = "5"
RW_OFF = "6"
class PDU2TestProcedure:
@ -40,7 +43,7 @@ class PDU2TestProcedure:
request_hk_table = False
def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2"))
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
@ -59,31 +62,32 @@ def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if op_code == "3":
if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.on)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.off)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
if op_code == Pdu2OpCodes.RW_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address, PDUConfigTable.out_en_2.parameter_size, Channel.on
object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
if op_code == Pdu2OpCodes.RW_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.PRINT_SWITCH_STATE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switch Status"))
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_STATE
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -12,8 +12,8 @@ from tmtccmd.tc.service_17_test import pack_service17_ping_command
from pus_tc.service_200_mode import pack_service200_test_into
from pus_tc.p60dock import pack_p60dock_test_into
from pus_tc.pdu2 import pack_pdu2_test_into
from pus_tc.pdu1 import pack_pdu1_test_into
from pus_tc.pdu2 import pack_pdu2_commands
from pus_tc.pdu1 import pack_pdu1_commands
from pus_tc.acu import pack_acu_test_into
from pus_tc.imtq import pack_imtq_test_into
from pus_tc.tmp1075 import pack_tmp1075_test_into
@ -50,10 +50,10 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PDU1.value:
object_id = PDU_1_HANDLER_ID
return pack_pdu1_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
return pack_pdu1_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PDU2.value:
object_id = PDU_2_HANDLER_ID
return pack_pdu2_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
return pack_pdu2_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.ACU.value:
object_id = ACU_HANDLER_ID
return pack_acu_test_into(object_id=object_id, tc_queue=service_queue)