integrated pcu, acu and p60 dock tests
This commit is contained in:
121
pus_tc/tmtcc_tc_acu.py
Normal file
121
pus_tc/tmtcc_tc_acu.py
Normal file
@ -0,0 +1,121 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_acu.py
|
||||
@brief ACU tests
|
||||
@author J. Meier
|
||||
@date 21.12.2020
|
||||
"""
|
||||
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from gomspace.gomspace_common import *
|
||||
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
|
||||
|
||||
|
||||
class ACUTestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the ACU.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
all = False
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
gnd_wdt_reset = False
|
||||
ping = False
|
||||
read_temperature1 = False
|
||||
read_temperature2 = False
|
||||
read_temperature3 = True
|
||||
read_mppt_mode = True
|
||||
read_vboost = True
|
||||
read_vbat_max_hi = True
|
||||
read_vbat_max_lo = True
|
||||
read_ov_mode = True
|
||||
|
||||
|
||||
class ACUConfigTable:
|
||||
mppt_mode = TableEntry(bytearray([0x00, 0x00]), TableEntry.uint8_size)
|
||||
mppt_d_mode = TableEntry(bytearray([0x00, 0x01]), TableEntry.uint8_size)
|
||||
vboost = TableEntry(bytearray([0x00, 0x02]), TableEntry.uint16_size)
|
||||
vbat_max_hi = TableEntry(bytearray([0x00, 0x10]), TableEntry.uint16_size)
|
||||
vbat_max_lo = TableEntry(bytearray([0x00, 0x12]), TableEntry.uint16_size)
|
||||
ov_mode = TableEntry(bytearray([0x00, 0x1A]), TableEntry.uint8_size)
|
||||
|
||||
|
||||
class ACUHkTable:
|
||||
temperature1 = TableEntry(bytearray([0x00, 0x1C]), TableEntry.uint16_size)
|
||||
temperature2 = TableEntry(bytearray([0x00, 0x1D]), TableEntry.uint16_size)
|
||||
temperature3 = TableEntry(bytearray([0x00, 0x1E]), TableEntry.uint16_size)
|
||||
# Ground WDT value (remaining seconds until reboot)
|
||||
wdt_gnd_left = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint32_size)
|
||||
|
||||
|
||||
def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing ACU"))
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Enabling ACU connected to X1 slot (channel 0)"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_0.parameter_address,
|
||||
P60DockConfigTable.out_en_0.parameter_size, Channel.on)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if ACUTestProcedure.all or ACUTestProcedure.reboot:
|
||||
tc_queue.appendleft(("print", "ACU: Reboot"))
|
||||
command = pack_reboot_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft(("print", "ACU: Reading ground watchdog timer value"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.wdt_gnd_left.parameter_address,
|
||||
ACUHkTable.wdt_gnd_left.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft(("print", "ACU: Testing ground watchdog reset"))
|
||||
command = pack_gnd_wdt_reset_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.ping:
|
||||
tc_queue.appendleft(("print", "ACU: Ping Test"))
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
command = pack_ping_command(object_id, ping_data)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_temperature3:
|
||||
tc_queue.appendleft(("print", "ACU: Reading temperature 3"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.temperature3.parameter_address,
|
||||
ACUHkTable.temperature3.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_vboost:
|
||||
tc_queue.appendleft(("print", "ACU: Reading vboost value"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vboost.parameter_address,
|
||||
ACUConfigTable.vboost.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi:
|
||||
tc_queue.appendleft(("print", "ACU: Reading vbat_max_hi"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_hi.parameter_address,
|
||||
ACUConfigTable.vbat_max_hi.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo:
|
||||
tc_queue.appendleft(("print", "ACU: Reading vbat_max_lo"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_lo.parameter_address,
|
||||
ACUConfigTable.vbat_max_lo.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode:
|
||||
tc_queue.appendleft(("print", "ACU: Reading ov_mode"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.ov_mode.parameter_address,
|
||||
ACUConfigTable.ov_mode.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Turning off ACU"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_0.parameter_address,
|
||||
P60DockConfigTable.out_en_0.parameter_size, Channel.off)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
141
pus_tc/tmtcc_tc_p60dock.py
Normal file
141
pus_tc/tmtcc_tc_p60dock.py
Normal file
@ -0,0 +1,141 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_p60dock.py
|
||||
@brief P60 Dock tests
|
||||
@author J. Meier
|
||||
@date 13.12.2020
|
||||
"""
|
||||
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from gomspace.gomspace_common import *
|
||||
|
||||
|
||||
class P60DockTestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the P60Dock.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
all = True
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
gnd_wdt_reset = False
|
||||
ping = False
|
||||
channel_3_off = False # pdu2
|
||||
read_temperature1 = False
|
||||
read_channel_3_state = False # pdu2
|
||||
read_cur_lu_lim_0 = False
|
||||
channel_3_on = False # pdu2
|
||||
invalid_table_id_test = False # Test to check if software properly handles invalid table ids
|
||||
invalid_address_test = False # Test to check if software properly handles invalid addresses
|
||||
invalid_parameter_size_test = True
|
||||
|
||||
|
||||
class P60DockConfigTable:
|
||||
out_en_0 = TableEntry(bytearray([0x00, 0x68]), TableEntry.uint8_size) # ACU
|
||||
out_en_1 = TableEntry(bytearray([0x00, 0x69]), TableEntry.uint8_size) # PDU1
|
||||
out_en_2 = TableEntry(bytearray([0x00, 0x6A]), TableEntry.uint8_size)
|
||||
out_en_3 = TableEntry(bytearray([0x00, 0x6B]), TableEntry.uint8_size) # PDU2
|
||||
# When channel consumes more than cur_lu_lim, channel is turned of immediately
|
||||
cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size)
|
||||
|
||||
|
||||
class P60DockHkTable:
|
||||
temperature1 = TableEntry(bytearray([0x00, 0x44]), TableEntry.uint16_size)
|
||||
temperature2 = TableEntry(bytearray([0x00, 0x46]), TableEntry.uint16_size)
|
||||
# Ground WDT value (remaining seconds until reboot)
|
||||
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
|
||||
|
||||
|
||||
def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Reboot"))
|
||||
command = pack_reboot_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Reading ground watchdog timer value"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing ground watchdog reset"))
|
||||
command = pack_gnd_wdt_reset_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.ping:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Ping"))
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
command = pack_ping_command(object_id, ping_data)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing setting output channel 3 off"))
|
||||
parameter = 0 # set channel off
|
||||
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size, parameter)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing temperature reading"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing Output Channel 3 state (PDU2)"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Reading current limit value of output channel 0"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing setting output channel 3 on"))
|
||||
parameter = 1 # set channel on
|
||||
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size, parameter)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing invalid table id handling"))
|
||||
table_id_invalid = 5
|
||||
command = pack_get_param_command(object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing invalid address handling in get param command"))
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
command = pack_get_param_command(object_id, TableIds.hk, invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing invalid address handling in set param command"))
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
parameter_size = 2
|
||||
parameter = 1
|
||||
command = pack_set_param_command(object_id, invalid_address, parameter_size, parameter)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing handling of invalid parameter sizes in get-param command"))
|
||||
invalid_size = 5
|
||||
command = pack_get_param_command(object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address,
|
||||
invalid_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(("print", "P60 Dock: Testing handling of invalid parameter size in set-param command"))
|
||||
parameter = 1
|
||||
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, invalid_size,
|
||||
parameter)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
@ -13,6 +13,12 @@ from tmtc_core.utility.tmtcc_logger import get_logger
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_tc_service5_event import pack_service5_test_into
|
||||
from tmtc_core.pus_tc.tmtcc_tc_service17_test import pack_service17_ping_command
|
||||
from pus_tc.tmtcc_tc_p60dock import pack_p60dock_test_into
|
||||
from pus_tc.tmtcc_tc_pdu2 import pack_pdu2_test_into
|
||||
from pus_tc.tmtcc_tc_pdu1 import pack_pdu1_test_into
|
||||
from pus_tc.tmtcc_tc_acu import pack_acu_test_into
|
||||
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
||||
from config.tmtcc_object_ids import ObjectIds
|
||||
|
||||
LOGGER = get_logger()
|
||||
|
||||
@ -22,6 +28,18 @@ def pack_service_queue_user(service: Union[int, str], op_code: int, service_queu
|
||||
return pack_service5_test_into(service_queue)
|
||||
if service == ServiceList.SERVICE_17:
|
||||
return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
|
||||
if service == ServiceList.P60DOCK:
|
||||
object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
||||
return pack_p60dock_test_into(object_id, service_queue)
|
||||
if service == ServiceList.PDU1:
|
||||
object_id = get_object_id(ObjectIds.PDU1_HANDLER_ID)
|
||||
return pack_pdu1_test_into(object_id, service_queue)
|
||||
if service == ServiceList.PDU2:
|
||||
object_id = get_object_id(ObjectIds.PDU2_HANDLER_ID)
|
||||
return pack_pdu2_test_into(object_id, service_queue)
|
||||
if service == ServiceList.ACU:
|
||||
object_id = get_object_id(ObjectIds.ACU_HANDLER_ID)
|
||||
return pack_acu_test_into(object_id, service_queue)
|
||||
LOGGER.warning("Invalid Service !")
|
||||
|
||||
|
||||
|
48
pus_tc/tmtcc_tc_pdu1.py
Normal file
48
pus_tc/tmtcc_tc_pdu1.py
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_pdu1.py
|
||||
@brief PDU2 tests
|
||||
@author J. Meier
|
||||
@date 17.12.2020
|
||||
"""
|
||||
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from gomspace.gomspace_common import *
|
||||
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
|
||||
from gomspace.gomspace_pdu_definitions import *
|
||||
|
||||
|
||||
class PDU1TestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the PDU2.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
all = True
|
||||
reboot = False
|
||||
ping = False
|
||||
read_temperature = False
|
||||
|
||||
|
||||
def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing PDU1"))
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Enabling PDU1"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_1.parameter_address,
|
||||
P60DockConfigTable.out_en_1.parameter_size, Channel.on)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
|
||||
tc_queue.appendleft(("print", "PDU1: Ping Test"))
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
command = pack_ping_command(object_id, ping_data)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
|
||||
tc_queue.appendleft(("print", "PDU1: Testing temperature reading"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
98
pus_tc/tmtcc_tc_pdu2.py
Normal file
98
pus_tc/tmtcc_tc_pdu2.py
Normal file
@ -0,0 +1,98 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_pdu2.py
|
||||
@brief PDU2 tests
|
||||
@author J. Meier
|
||||
@date 17.12.2020
|
||||
"""
|
||||
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from gomspace.gomspace_common import *
|
||||
from gomspace.gomspace_pdu_definitions import *
|
||||
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
|
||||
|
||||
|
||||
class PDU2TestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the PDU2.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
all = True
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
gnd_wdt_reset = False
|
||||
ping = False
|
||||
channel_2_off = False # TCS Heater
|
||||
read_temperature = False
|
||||
read_channel_2_state = False # TCS Heater
|
||||
read_cur_lu_lim_0 = False # OBC
|
||||
channel_2_on = False # TCS Heater
|
||||
invalid_table_id_test = False # Test to check if software properly handles invalid table ids
|
||||
invalid_address_test = False # Test to check if software properly handles invalid addresses
|
||||
invalid_parameter_size_test = True
|
||||
|
||||
|
||||
def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing PDU2"))
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Enabling PDU2"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size, Channel.on)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
|
||||
tc_queue.appendleft(("print", "PDU2: Reboot"))
|
||||
command = pack_reboot_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft(("print", "PDU2: Reading ground watchdog timer value"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address,
|
||||
PDUHkTable.wdt_gnd_left.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft(("print", "PDU2: Testing ground watchdog reset"))
|
||||
command = pack_gnd_wdt_reset_command(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.ping:
|
||||
tc_queue.appendleft(("print", "PDU2: Ping Test"))
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
command = pack_ping_command(object_id, ping_data)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
|
||||
tc_queue.appendleft(("print", "PDU2: Testing setting output channel 2 on (TCS Heater)"))
|
||||
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature1:
|
||||
tc_queue.appendleft(("print", "PDU2: Testing temperature reading"))
|
||||
command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
|
||||
tc_queue.appendleft(("print", "PDU2: Reading output channel 2 state (TCS Heater)"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
|
||||
tc_queue.appendleft(("print", "PDU2: Reading current limit value of output channel 0 (OBC)"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_size)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
|
||||
tc_queue.appendleft(("print", "PDU2: Testing setting output channel 2 off"))
|
||||
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return tc_queue
|
Reference in New Issue
Block a user