2020-12-29 11:29:03 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
@file tmtcc_tc_pdu1.py
|
|
|
|
@brief PDU2 tests
|
|
|
|
@author J. Meier
|
|
|
|
@date 17.12.2020
|
|
|
|
"""
|
2021-05-17 17:42:04 +02:00
|
|
|
from tmtccmd.config.definitions import QueueCommands
|
2020-12-29 11:29:03 +01:00
|
|
|
|
2021-07-24 14:58:47 +02:00
|
|
|
from tmtccmd.tc.packer import TcQueueT
|
2021-04-10 22:59:51 +02:00
|
|
|
from tmtccmd.ecss.tc import PusTelecommand
|
2020-12-29 11:29:03 +01:00
|
|
|
from gomspace.gomspace_common import *
|
2021-03-19 17:39:52 +01:00
|
|
|
from pus_tc.p60dock import P60DockConfigTable
|
2020-12-29 11:29:03 +01:00
|
|
|
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.
|
|
|
|
"""
|
2021-02-09 12:35:10 +01:00
|
|
|
all = False
|
2020-12-29 11:29:03 +01:00
|
|
|
reboot = False
|
|
|
|
ping = False
|
|
|
|
read_temperature = False
|
2021-04-18 18:52:47 +02:00
|
|
|
turn_channel_2_on = False # Star Tracker connected to this channel (5V)
|
|
|
|
turn_channel_2_off = False
|
|
|
|
turn_channel_3_on = False # MTQ connected to this channel (5V)
|
2021-08-11 17:14:30 +02:00
|
|
|
turn_channel_3_off = False
|
2020-12-29 11:29:03 +01:00
|
|
|
|
|
|
|
|
2021-08-11 17:14:30 +02:00
|
|
|
def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
2021-08-11 16:49:32 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1"))
|
|
|
|
|
2021-08-11 17:14:30 +02:00
|
|
|
if op_code == "1":
|
2021-08-11 16:49:32 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on"))
|
|
|
|
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=30, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2020-12-29 11:29:03 +01:00
|
|
|
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
|
2021-03-19 17:50:09 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
|
2020-12-29 11:29:03 +01:00
|
|
|
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
2021-08-11 16:49:32 +02:00
|
|
|
command = pack_ping_command(object_id, ping_data)
|
2020-12-29 11:29:03 +01:00
|
|
|
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:
|
2021-03-19 17:50:09 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
|
|
|
|
command = pack_get_param_command(
|
2021-08-11 16:49:32 +02:00
|
|
|
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
2021-03-19 17:50:09 +01:00
|
|
|
PDUHkTable.temperature.parameter_size
|
|
|
|
)
|
2020-12-29 11:29:03 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
2021-04-18 16:35:18 +02:00
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
|
2021-04-18 18:52:47 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)"))
|
2021-08-11 16:49:32 +02:00
|
|
|
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
2021-04-18 16:35:18 +02:00
|
|
|
PDUConfigTable.out_en_2.parameter_size, Channel.on)
|
2021-04-18 18:52:47 +02:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
2021-04-18 16:35:18 +02:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
|
2021-04-18 18:52:47 +02:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)"))
|
2021-08-11 16:49:32 +02:00
|
|
|
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
2021-04-18 16:35:18 +02:00
|
|
|
PDUConfigTable.out_en_2.parameter_size, Channel.off)
|
2021-04-18 18:52:47 +02:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
|
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
|
2021-08-11 16:49:32 +02:00
|
|
|
command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
|
2021-04-18 18:52:47 +02:00
|
|
|
PDUConfigTable.out_en_3.parameter_size, Channel.on)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
|
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
|
2021-08-11 16:49:32 +02:00
|
|
|
command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
|
2021-04-18 18:52:47 +02:00
|
|
|
PDUConfigTable.out_en_3.parameter_size, Channel.off)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
2021-04-18 16:35:18 +02:00
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|