Compare commits

...

6 Commits

Author SHA1 Message Date
b4868b78e1 resolved merge conflicts 2021-02-06 16:41:06 +01:00
8a071954af heater wip 2021-02-06 16:35:53 +01:00
361eb39aa1 added init file for gomspace folder 2021-02-03 14:18:00 +01:00
a84d125b4b updated to new tmtc core 2021-02-03 14:14:54 +01:00
be536aca49 core update 2021-02-03 13:58:55 +01:00
7e64595d1a updated core 2021-01-13 22:41:44 +01:00
16 changed files with 187 additions and 81 deletions

View File

@@ -34,6 +34,7 @@ class ServiceList(enum.Enum):
ACU = auto()
TMP1075_1 = auto()
TMP1075_2 = auto()
HEATER = auto()
class SerialConfig(enum.Enum):

View File

@@ -158,6 +158,8 @@ def add_globals_post_args_parsing(args: argparse.Namespace):
service = ServiceList.TMP1075_1
elif service == "tmp1075_2":
service = ServiceList.TMP1075_2
elif service == "heater":
service = ServiceList.HEATER
else:
logger.warning("Service not known! Setting standard service 17")
service = ServiceList.SERVICE_17

View File

@@ -18,6 +18,7 @@ class ObjectIds(enum.Enum):
ACU_HANDLER_ID = auto()
TMP1075_1_HANDLER_ID = auto()
TMP1075_2_HANDLER_ID = auto()
HEATER = auto()
def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
@@ -31,5 +32,6 @@ def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
o_ids.ACU_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x4]),
o_ids.TMP1075_1_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x5]),
o_ids.TMP1075_2_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x6]),
o_ids.HEATER: bytearray([0x54, 0x00, 0x00, 0x1]),
}
)

View File

@@ -6,10 +6,8 @@
import sys
from config.tmtcc_definitions import ModeList
from core.tmtc_backend import TmTcHandler
from test.obsw_pus_service_test import run_selected_pus_tests
from tmtc_core.core.tmtcc_backend import TmTcHandler
from tmtc_core.utility.tmtcc_logger import get_logger
from utility.tmtcc_binary_uploader import BinaryFileUploader
LOGGER = get_logger()

0
gomspace/__init__.py Normal file
View File

View File

@@ -14,6 +14,7 @@ class GomspaceDeviceActions:
PARAM_GET = bytearray([0x0, 0x0, 0x0, 0x00])
PARAM_SET = bytearray([0x0, 0x0, 0x0, 0xFF])
WDT_RESET = bytearray([0x0, 0x0, 0x0, 0x9])
REQUEST_HK_TABLE = bytearray([0x0, 0x0, 0x0, 0x10])
class TableIds:
@@ -96,7 +97,6 @@ def pack_ping_command(object_id: bytearray, data: bytearray) -> bytearray:
data are simply copied by the device and then sent back.
"""
action_id = GomspaceDeviceActions.PING
command = bytearray()
command = object_id + action_id + data
return command
@@ -107,7 +107,7 @@ def pack_gnd_wdt_reset_command(object_id: bytearray) -> bytearray:
"""
action_id = GomspaceDeviceActions.WDT_RESET
command = bytearray()
command = object_id + action_id
command += object_id + action_id
return command
@@ -117,5 +117,16 @@ def pack_reboot_command(object_id: bytearray) -> bytearray:
"""
action_id = GomspaceDeviceActions.REBOOT
command = bytearray()
command += object_id + action_id
return command
def pack_request_full_hk_table_command(object_id: bytearray) -> bytearray:
""" Function to generate the command to request the full housekeeping table from a gomspace
device.
@param object_id The object id of the gomspace device handler.
"""
action_id = GomspaceDeviceActions.REQUEST_HK_TABLE
command = bytearray()
command = object_id + action_id
return command

View File

@@ -13,4 +13,4 @@ class PDUConfigTable:
class PDUHkTable:
temperature = TableEntry(bytearray([0x00, 0x28]), TableEntry.uint16_size)
# Ground WDT value (remaining seconds until reboot)
wdt_gnd_left = TableEntry(bytearray([0x00, 0x80]), TableEntry.uint32_size)
wdt_gnd_left = TableEntry(bytearray([0x00, 0x80]), TableEntry.uint32_size)

View File

@@ -8,6 +8,7 @@
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from gomspace.gomspace_common import *
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
from config.tmtcc_object_ids import ObjectIds
@@ -53,9 +54,9 @@ class ACUHkTable:
def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(("print", "Testing ACU"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU"))
tc_queue.appendleft(("print", "P60 Dock: Enabling ACU connected to X1 slot (channel 0)"))
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling ACU connected to X1 slot (channel 0)"))
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size, Channel.on)
@@ -63,59 +64,59 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.reboot:
tc_queue.appendleft(("print", "ACU: Reboot"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU"))
command = pack_set_param_command(p60dock_object_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)

59
pus_tc/tmtcc_tc_heater.py Normal file
View File

@@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
"""
@file tmtcc_tc_heater.py
@brief Command sequence to test the HeaterHandler
@author J. Meier
@date 30.01.2021
"""
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
class TestProcedure:
"""
@brief The variables in this class can be used to configure the heater test procedure.
"""
on = True # All heaters will be turned on
off = False # All heaters will be turned off
class SwitchNumbers:
PAYLOAD_CAMERA_HEATER = 0
class SwitchActions:
OFF = 0
ON = 1
class ActionIds:
SWITCH_HEATER = bytearray([0x0, 0x0, 0x0, 0x0])
def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(("print", "Testing Heater Switching"))
if TestProcedure.on:
tc_queue.appendleft(("print", "Switching on heater of payload camera"))
command = pack_switch_heater_command(object_id, SwitchNumbers.PAYLOAD_CAMERA_HEATER, SwitchActions.ON)
command = PusTelecommand(service=8, subservice=128, ssc=300, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if TestProcedure.off:
tc_queue.appendleft(("print", "Switching off heater of payload camera"))
command = pack_switch_heater_command(object_id, SwitchNumbers.PAYLOAD_CAMERA_HEATER, SwitchActions.OFF)
command = PusTelecommand(service=8, subservice=128, ssc=301, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_switch_heater_command(object_id: bytearray, switch_nr: int, switch_action: int) -> bytearray:
""" Function to generate the command switch a heater
@param object_id The object id of the HeaterHandler object.
@param switch_nr The switch number identifying the heater to switch
@param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.
"""
action_id = ActionIds.SWITCH_HEATER
command = object_id + action_id
command.append(switch_nr)
command.append(switch_action)
return command

View File

@@ -5,7 +5,7 @@
@author J. Meier
@date 13.12.2020
"""
from tmtc_core.core.tmtc_core_definitions import QueueCommands
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 *
@@ -50,74 +50,86 @@ class P60DockHkTable:
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"))
tc_queue.appendleft((QueueCommands.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)
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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)
tc_queue.appendleft((QueueCommands.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)"))
tc_queue.appendleft((QueueCommands.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)
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.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 = 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"))
tc_queue.appendleft((QueueCommands.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"))
tc_queue.appendleft((QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in set param command"))
invalid_address = bytearray([0x01, 0xF4])
parameter_size = 2
parameter = 1
@@ -125,16 +137,24 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT
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"))
tc_queue.appendleft(
(QueueCommands.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 = 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"))
tc_queue.appendleft(
(QueueCommands.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 = 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())

View File

@@ -6,13 +6,12 @@
import os
from collections import deque
from typing import Union
from config.tmtcc_definitions import ServiceList
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 tmtc_core.pus_tc.tmtcc_tc_service_5_event import pack_generic_service5_test_into
from tmtc_core.pus_tc.tmtcc_tc_service_17_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
@@ -20,24 +19,27 @@ 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
from pus_tc.tmtcc_tc_tmp1075 import pack_tmp1075_test_into
from pus_tc.tmtcc_tc_heater import pack_heater_test_into
LOGGER = get_logger()
def pack_service_queue_user(service: Union[int, str], op_code: int, service_queue: TcQueueT):
def pack_service_queue_user(service: ServiceList, op_code: str, service_queue: TcQueueT):
if service == ServiceList.SERVICE_5:
return pack_service5_test_into(service_queue)
return pack_generic_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)
pdu1_object_id = get_object_id(ObjectIds.PDU1_HANDLER_ID)
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
return pack_pdu1_test_into(pdu1_object_id, p60dock_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)
pdu2_object_id = get_object_id(ObjectIds.PDU2_HANDLER_ID)
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
return pack_pdu2_test_into(pdu2_object_id, p60dock_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)
@@ -47,6 +49,9 @@ def pack_service_queue_user(service: Union[int, str], op_code: int, service_queu
if service == ServiceList.TMP1075_2:
object_id = get_object_id(ObjectIds.TMP1075_2_HANDLER_ID)
return pack_tmp1075_test_into(object_id, service_queue)
if service == ServiceList.HEATER:
object_id = get_object_id(ObjectIds.HEATER)
return pack_heater_test_into(object_id, service_queue)
LOGGER.warning("Invalid Service !")
@@ -54,6 +59,6 @@ def create_total_tc_queue_user() -> TcQueueT:
if not os.path.exists("log"):
os.mkdir("log")
tc_queue = deque()
pack_service5_test_into(tc_queue)
pack_generic_service5_test_into(tc_queue)
tc_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
return tc_queue

View File

@@ -25,11 +25,11 @@ class PDU1TestProcedure:
read_temperature = False
def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
def pack_pdu1_test_into(pdu1_object_id: bytearray, p60dock_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,
command = pack_set_param_command(p60dock_object_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())
@@ -37,12 +37,12 @@ def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
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 = pack_ping_command(pdu1_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,
command = pack_get_param_command(pdu1_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())

View File

@@ -19,7 +19,7 @@ class PDU2TestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = True
all = False
reboot = False
read_gnd_wdt = False
gnd_wdt_reset = False
@@ -31,68 +31,74 @@ class PDU2TestProcedure:
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
invalid_parameter_size_test = False
request_hk_table = True
def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
def pack_pdu2_test_into(pdu2_object_id: bytearray, p60dock_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,
command = pack_set_param_command(p60dock_object_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 = pack_reboot_command(pdu2_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,
command = pack_get_param_command(pdu2_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 = pack_gnd_wdt_reset_command(pdu2_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 = pack_ping_command(pdu2_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,
command = pack_set_param_command(pdu2_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:
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft(("print", "PDU2: Testing temperature reading"))
command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
command = pack_get_param_command(pdu2_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,
command = pack_get_param_command(pdu2_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,
command = pack_get_param_command(pdu2_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,
command = pack_set_param_command(pdu2_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())
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
tc_queue.appendleft(("print", "PDU2: Requesting housekeeping table"))
command = pack_request_full_hk_table_command(pdu2_object_id)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@@ -5,6 +5,7 @@
@author R. Mueller
@date 02.05.2020
"""
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
@@ -15,30 +16,30 @@ TEST_DEVICE_ID = get_object_id(ObjectIds.TEST_DEVICE)
def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(("print", "Testing Service 200"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200"))
# Object ID: Dummy Device
object_id = TEST_DEVICE_ID
# Set On Mode
tc_queue.appendleft(("print", "Testing Service 200: Set Mode On"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode On"))
mode_data = pack_mode_data(object_id, 1, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Normal mode
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Normal"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Normal"))
mode_data = pack_mode_data(object_id, 2, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Raw Mode
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Raw"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Raw"))
mode_data = pack_mode_data(object_id, 3, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Off Mode
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Off"))
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Off"))
mode_data = pack_mode_data(object_id, 0, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft(("export", "log/tmtc_log_service200.txt"))
tc_queue.appendleft((QueueCommands.EXPORT_LOG, "log/tmtc_log_service200.txt"))
return tc_queue

View File

@@ -6,7 +6,7 @@
"""
from typing import Tuple
from tmtc_core.pus_tm.obsw_tm_service_3 import Service3Base
from tmtc_core.pus_tm.tmtcc_pus_service_3 import Service3Base
from tmtc_core.utility.tmtcc_logger import get_logger
LOGGER = get_logger()