Update tmtccmd #21

Merged
meierj merged 32 commits from mueller/master into develop 2021-09-15 14:59:39 +02:00
12 changed files with 183 additions and 55 deletions
Showing only changes of commit a7f1ed904c - Show all commits

View File

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

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="PDU1 Test UDP" type="PythonConfigurationType" factoryName="Python" folderName="Devices"> <configuration default="false" name="PDU1 Commanding" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<module name="tmtc" /> <module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" /> <option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" /> <option name="PARENT_ENVS" value="true" />
@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_cli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_cli.py" />
<option name="PARAMETERS" value="-s pdu1 -l" /> <option name="PARAMETERS" value="-s pdu1 -l -t 4" />
<option name="SHOW_COMMAND_LINE" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" /> <option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" /> <option name="MODULE_MODE" value="false" />

View File

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

View File

@ -31,3 +31,4 @@ class CustomServiceList(enum.Enum):
PLOC_SUPV = "ploc_supv" PLOC_SUPV = "ploc_supv"
PLOC_UPDATER = "ploc_updater" PLOC_UPDATER = "ploc_updater"
CORE = 'core' CORE = 'core'
STAR_TRACKER = 'star_tracker'

View File

@ -47,16 +47,27 @@ class EiveHookObject(TmTcHookBase):
op_code_dict_srv_p60 = { op_code_dict_srv_p60 = {
"0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "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}),
} }
service_p60_tuple = ("P60 Device", op_code_dict_srv_p60) service_p60_tuple = ("P60 Device", op_code_dict_srv_p60)
op_code_dict_srv_pdu1 = { op_code_dict_srv_pdu1 = {
"0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("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}),
"4": ("PDU1: Turn star tracker off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PDU1: Turn SUS nominal off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("PDU1: Turn ACS Side A on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("PDU1: Turn ACS Side A off", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1) service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1)
op_code_dict_srv_pdu2 = { op_code_dict_srv_pdu2 = {
"0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("PDU1: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PDU1: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2) service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2)
@ -149,9 +160,14 @@ class EiveHookObject(TmTcHookBase):
} }
service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater)
op_code_dict_srv_star_tracker = {
"0": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu2_tuple service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple
@ -161,6 +177,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple
service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
return service_op_code_dict return service_op_code_dict
def get_json_config_file_path(self) -> str: def get_json_config_file_path(self) -> str:

View File

@ -21,11 +21,11 @@ IMTQ_HANDLER_ID = bytes([0x44, 0x14, 0x00, 0x14])
PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15]) PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
GPS_HANDLER_0_ID = bytes([0x44, 0x13, 0x00, 0x45]) GPS_HANDLER_0_ID = bytes([0x44, 0x13, 0x00, 0x45])
GPS_HANDLER_1_ID = bytes([0x44, 0x13, 0x01, 0x46]) GPS_HANDLER_1_ID = bytes([0x44, 0x13, 0x01, 0x46])
RW1_ID = bytes([0x44, 0x12, 0x00, 0x1]) RW1_ID = bytes([0x44, 0x12, 0x00, 0x47])
RW2_ID = bytes([0x44, 0x12, 0x00, 0x2]) RW2_ID = bytes([0x44, 0x12, 0x01, 0x48])
RW3_ID = bytes([0x44, 0x12, 0x00, 0x3]) RW3_ID = bytes([0x44, 0x12, 0x02, 0x49])
RW4_ID = bytes([0x44, 0x12, 0x00, 0x4]) RW4_ID = bytes([0x44, 0x12, 0x03, 0x50])
START_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1]) STAR_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1])
RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5]) RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16]) PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16])
PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00]) PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00])

View File

@ -33,10 +33,19 @@ class P60DockTestProcedure:
class P60DockConfigTable: class P60DockConfigTable:
out_en_0 = TableEntry(bytearray([0x00, 0x68]), TableEntry.uint8_size) # ACU out_en_0 = TableEntry(bytearray([0x00, 0x68]), TableEntry.uint8_size) # ACU VCC
out_en_1 = TableEntry(bytearray([0x00, 0x69]), TableEntry.uint8_size) # PDU1 out_en_1 = TableEntry(bytearray([0x00, 0x69]), TableEntry.uint8_size) # PDU1 VCC
out_en_2 = TableEntry(bytearray([0x00, 0x6A]), TableEntry.uint8_size) out_en_2 = TableEntry(bytearray([0x00, 0x6A]), TableEntry.uint8_size) # unused
out_en_3 = TableEntry(bytearray([0x00, 0x6B]), TableEntry.uint8_size) # PDU2 out_en_3 = TableEntry(bytearray([0x00, 0x6B]), TableEntry.uint8_size) # PDU2 VCC
out_en_4 = TableEntry(bytearray([0x00, 0x6C]), TableEntry.uint8_size) # ACU VBAT
out_en_5 = TableEntry(bytearray([0x00, 0x6D]), TableEntry.uint8_size) # unused
out_en_6 = TableEntry(bytearray([0x00, 0x6E]), TableEntry.uint8_size) # PDU1 VBAT
out_en_7 = TableEntry(bytearray([0x00, 0x6F]), TableEntry.uint8_size) # PDU2 VBAT
out_en_8 = TableEntry(bytearray([0x00, 0x70]), TableEntry.uint8_size) # Stack VBAT
out_en_9 = TableEntry(bytearray([0x00, 0x71]), TableEntry.uint8_size) # Stack 3V3
out_en_10 = TableEntry(bytearray([0x00, 0x72]), TableEntry.uint8_size) # Stack 5V
out_en_11 = TableEntry(bytearray([0x00, 0x73]), TableEntry.uint8_size) # GS 3V3 (unused)
out_en_12 = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint8_size) # GS 5V (unused)
# When channel consumes more than cur_lu_lim, channel is turned of immediately # When channel consumes more than cur_lu_lim, channel is turned of immediately
cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size) cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size)
@ -48,7 +57,25 @@ class P60DockHkTable:
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size) wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on"))
parameter = 0 # set channel off
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":
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off"))
parameter = 0 # set channel 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
if P60DockTestProcedure.all or P60DockTestProcedure.reboot: if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot")) tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot"))
command = pack_reboot_command(object_id) command = pack_reboot_command(object_id)

View File

@ -2,6 +2,7 @@
""" """
@file tmtcc_tc_pdu1.py @file tmtcc_tc_pdu1.py
@brief PDU2 tests @brief PDU2 tests
@details PDU2 is mounted on the X4 slot of the P60 dock
@author J. Meier @author J. Meier
@date 17.12.2020 @date 17.12.2020
""" """
@ -27,49 +28,84 @@ class PDU1TestProcedure:
turn_channel_2_on = False # Star Tracker connected to this channel (5V) turn_channel_2_on = False # Star Tracker connected to this channel (5V)
turn_channel_2_off = False turn_channel_2_off = False
turn_channel_3_on = False # MTQ connected to this channel (5V) turn_channel_3_on = False # MTQ connected to this channel (5V)
turn_channel_3_off = True turn_channel_3_off = False
def pack_pdu1_test_into( def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
pdu1_object_id: bytearray, p60dock_object_id: bytearray, tc_queue: TcQueueT tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1"))
):
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU1")) if op_code == "1":
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())
if op_code == "3":
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)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker 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=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
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 = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping: if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(pdu1_object_id, ping_data) command = pack_ping_command(object_id, ping_data)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature: if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
command = pack_get_param_command( command = pack_get_param_command(
pdu1_object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size PDUHkTable.temperature.parameter_size
) )
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)"))
command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on) PDUConfigTable.out_en_2.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)"))
command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off) PDUConfigTable.out_en_2.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_3.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.on) PDUConfigTable.out_en_3.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_3.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.off) PDUConfigTable.out_en_3.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -2,6 +2,7 @@
""" """
@file tmtcc_tc_pdu2.py @file tmtcc_tc_pdu2.py
@brief PDU2 tests @brief PDU2 tests
@details PDU2 is mounted on the X2 slot of the P60 dock
@author J. Meier @author J. Meier
@date 17.12.2020 @date 17.12.2020
""" """
@ -35,70 +36,79 @@ class PDU2TestProcedure:
request_hk_table = False request_hk_table = False
def pack_pdu2_test_into(pdu2_object_id: bytearray, p60dock_object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: def pack_pdu2_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2")) tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2"))
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling PDU2")) if op_code == "1":
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_3.parameter_address, tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on"))
P60DockConfigTable.out_en_3.parameter_size, Channel.on) command = pack_set_param_command(object_id, PDUConfigTable.out_en_7.parameter_address,
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) PDUConfigTable.out_en_7.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if PDU2TestProcedure.all or PDU2TestProcedure.reboot: if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reboot")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reboot"))
command = pack_reboot_command(pdu2_object_id) command = pack_reboot_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt: if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value"))
command = pack_get_param_command(pdu2_object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address, command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size) PDUHkTable.wdt_gnd_left.parameter_size)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset: if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing ground watchdog reset")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing ground watchdog reset"))
command = pack_gnd_wdt_reset_command(pdu2_object_id) command = pack_gnd_wdt_reset_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.ping: if PDU2TestProcedure.all or PDU2TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Ping Test")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(pdu2_object_id, ping_data) command = pack_ping_command(object_id, ping_data)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on: if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 on (TCS Heater)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 on (TCS Heater)"))
command = pack_set_param_command(pdu2_object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on) PDUConfigTable.out_en_2.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature: if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading"))
command = pack_get_param_command(pdu2_object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size) PDUHkTable.temperature.parameter_size)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state: if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)"))
command = pack_get_param_command(pdu2_object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address, command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size) PDUConfigTable.out_en_2.parameter_size)
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0: if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading current limit value of output channel 0 (OBC)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading current limit value of output channel 0 (OBC)"))
command = pack_get_param_command(pdu2_object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address, command = pack_get_param_command(object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size) PDUConfigTable.cur_lu_lim_0.parameter_size)
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off: if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off"))
command = pack_set_param_command(pdu2_object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off) PDUConfigTable.out_en_2.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table: if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting housekeeping table")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting housekeeping table"))
command = pack_request_full_hk_table_command(pdu2_object_id) command = pack_request_full_hk_table_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

39
pus_tc/star_tracker.py Normal file
View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""
@file star_tracker.py
@brief Star tracker commanding
@author J. Meier
@date 14.08.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
class StarTrackerActionIds:
PING = 0
REQ_TEMPERATURE = 25
def pack_star_tracker_commands_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Generate command for star tracker with object id: 0x" + object_id.hex())
)
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping"))
command = pack_ping_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_ping_command(object_id: bytearray) -> bytearray:
data = int(input("Specify ping data: "))
command = bytearray()
command = object_id + struct.pack('!I', StarTrackerActionIds.PING)
command = command + struct.pack('!I', data)
return command

View File

@ -28,10 +28,11 @@ from pus_tc.reaction_wheels import pack_single_rw_test_into
from pus_tc.rad_sensor import pack_rad_sensor_test_into from pus_tc.rad_sensor import pack_rad_sensor_test_into
from pus_tc.ploc_upater import pack_ploc_updater_test_into from pus_tc.ploc_upater import pack_ploc_updater_test_into
from pus_tc.core import pack_core_commands from pus_tc.core import pack_core_commands
from pus_tc.star_tracker import pack_star_tracker_commands_into
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \ from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \ TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \
RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, STAR_TRACKER_ID
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -46,19 +47,13 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
return pack_service200_test_into(tc_queue=service_queue) return pack_service200_test_into(tc_queue=service_queue)
if service == CustomServiceList.P60DOCK.value: if service == CustomServiceList.P60DOCK.value:
object_id = P60_DOCK_HANDLER object_id = P60_DOCK_HANDLER
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue) return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
pdu1_object_id = PDU_1_HANDLER_ID object_id = PDU_1_HANDLER_ID
p60dock_object_id = P60_DOCK_HANDLER return pack_pdu1_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
return pack_pdu1_test_into(
pdu1_object_id=pdu1_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
)
if service == CustomServiceList.PDU2.value: if service == CustomServiceList.PDU2.value:
pdu2_object_id = PDU_2_HANDLER_ID object_id = PDU_2_HANDLER_ID
p60dock_object_id = P60_DOCK_HANDLER return pack_pdu2_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
return pack_pdu2_test_into(
pdu2_object_id=pdu2_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
)
if service == CustomServiceList.ACU.value: if service == CustomServiceList.ACU.value:
object_id = ACU_HANDLER_ID object_id = ACU_HANDLER_ID
return pack_acu_test_into(object_id=object_id, tc_queue=service_queue) return pack_acu_test_into(object_id=object_id, tc_queue=service_queue)
@ -98,6 +93,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.PLOC_UPDATER.value: if service == CustomServiceList.PLOC_UPDATER.value:
object_id = PLOC_UPDATER_ID object_id = PLOC_UPDATER_ID
return pack_ploc_updater_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_ploc_updater_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.STAR_TRACKER.value:
object_id = STAR_TRACKER_ID
return pack_star_tracker_commands_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.CORE.value: if service == CustomServiceList.CORE.value:
return pack_core_commands(tc_queue=service_queue, op_code=op_code) return pack_core_commands(tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

@ -1 +1 @@
Subproject commit 8b8bf6847a950914db5f4f1d268f8638993d207c Subproject commit e7df305143120985da11236b8d75f8a5387d95e5