meier/plocSupervisor #7

Merged
muellerr merged 7 commits from meier/plocSupervisor into develop 2021-07-24 14:40:57 +02:00
8 changed files with 98 additions and 9 deletions
Showing only changes of commit d55a12a100 - Show all commits

View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="PLOC SUPV Test" type="PythonConfigurationType" factoryName="Python" folderName="UDP">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="C:\Users\jakob\AppData\Local\Programs\Python\Python39\python.exe" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_cli.py" />
<option name="PARAMETERS" value="-c udp -s ploc_supv -l -t 6 --hk" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -28,3 +28,4 @@ class CustomServiceList(enum.Enum):
REACTION_WHEEL_3 = "reaction_wheel_3" REACTION_WHEEL_3 = "reaction_wheel_3"
REACTION_WHEEL_4 = "reaction_wheel_4" REACTION_WHEEL_4 = "reaction_wheel_4"
RAD_SENSOR = "rad_sensor" RAD_SENSOR = "rad_sensor"
PLOC_SUPV = "ploc_supv"

View File

@ -81,6 +81,14 @@ class EiveHookObject(TmTcHookBase):
} }
service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor) service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor)
op_code_dict_srv_ploc_supv = {
"0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PLOC Supervisor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)
service_op_code_dict[CustomServiceList.ACU.value] = service_acu_tuple service_op_code_dict[CustomServiceList.ACU.value] = service_acu_tuple
service_op_code_dict[CustomServiceList.TMP1075_1.value] = service_tmp1075_1_tuple service_op_code_dict[CustomServiceList.TMP1075_1.value] = service_tmp1075_1_tuple
service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tmp1075_2_tuple service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tmp1075_2_tuple
@ -94,6 +102,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple service_op_code_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple
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
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

@ -25,6 +25,7 @@ RW3_ID = bytes([0x44, 0x12, 0x00, 0x3])
RW4_ID = bytes([0x44, 0x12, 0x00, 0x4]) RW4_ID = bytes([0x44, 0x12, 0x00, 0x4])
START_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1]) START_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])
def get_object_ids() -> Dict[bytes, list]: def get_object_ids() -> Dict[bytes, list]:
@ -45,5 +46,6 @@ def get_object_ids() -> Dict[bytes, list]:
RW3_ID: "Reaction Wheel 3", RW3_ID: "Reaction Wheel 3",
RW4_ID: "Reaction Wheel 4", RW4_ID: "Reaction Wheel 4",
RAD_SENSOR_ID: "Radiation Sensor", RAD_SENSOR_ID: "Radiation Sensor",
PLOC_SUPV_ID: "PLOC Supervisor",
}) })
return object_id_dict return object_id_dict

View File

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
@file ploc.py @file ploc_mpsoc.py
@brief TMP1075 tests @brief Tests for commanding the MPSoC of the PLOC.
The MPSoC is programmed by the ILH.
@author J. Meier @author J. Meier
@date 06.01.2021 @date 06.03.2021
""" """
import struct import struct
@ -33,10 +34,10 @@ class PlocReplyIds:
tm_mem_read_report = 6 tm_mem_read_report = 6
def pack_ploc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (QueueCommands.PRINT,
"Testing PLOC Handler with object id: 0x" + object_id.hex()) "Testing PLOC MPSoC with object id: 0x" + object_id.hex())
) )
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write: if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:

48
pus_tc/ploc_supervisor.py Normal file
View File

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
"""
@file ploc_supervisor.py
@brief Tests for commanding the supervisor of the PLOC.
The supervisor is programmed by Thales.
@author J. Meier
@date 10.07.2021
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.ecss.tc import PusTelecommand
class PlocTestProcedure:
"""
@brief Use this class to define the tests to perform for the PLOC.
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
test_tc_mem_write = False
test_tc_mem_read = True
class SupvActionIds:
HK_REPORT = 1
class SupvHkIds:
HK_REPORT = 52
def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing PLOC Supervisor with object id: 0x" + object_id.hex())
)
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report"))
command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -20,14 +20,15 @@ from pus_tc.pdu1 import pack_pdu1_test_into
from pus_tc.acu import pack_acu_test_into from pus_tc.acu import pack_acu_test_into
from pus_tc.imtq import pack_imtq_test_into from pus_tc.imtq import pack_imtq_test_into
from pus_tc.tmp1075 import pack_tmp1075_test_into from pus_tc.tmp1075 import pack_tmp1075_test_into
from pus_tc.ploc import pack_ploc_test_into from pus_tc.ploc_mpsoc import pack_ploc_mpsoc_test_into
from pus_tc.ploc_supervisor import pack_ploc_supv_test_into
from pus_tc.heater import pack_heater_test_into from pus_tc.heater import pack_heater_test_into
from pus_tc.reaction_wheels import pack_single_rw_test_into 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 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_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 RAD_SENSOR_ID, PLOC_SUPV_ID
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -86,6 +87,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.RAD_SENSOR.value: if service == CustomServiceList.RAD_SENSOR.value:
object_id = RAD_SENSOR_ID object_id = RAD_SENSOR_ID
return pack_rad_sensor_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_rad_sensor_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PLOC_SUPV.value:
object_id = PLOC_SUPV_ID
return pack_ploc_supv_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

View File

@ -2,7 +2,7 @@ import struct
from typing import Tuple from typing import Tuple
from config.object_ids import * from config.object_ids import *
from pus_tc.imtq import ImtqActionIds from pus_tc.imtq import ImtqActionIds
from pus_tc.ploc import PlocReplyIds from pus_tc.ploc_mpsoc import PlocReplyIds
def user_analyze_service_8_data( def user_analyze_service_8_data(