Added TCs to command Thermal Controller (to be continued)

This commit is contained in:
Ulrich Mohr 2022-05-17 10:41:45 +02:00
parent a681850248
commit aadbfb2594
8 changed files with 77 additions and 17 deletions

View File

@ -47,3 +47,4 @@ class CustomServiceList(enum.Enum):
SUS_ASS = "sus-ass" SUS_ASS = "sus-ass"
TCS_ASS = "tcs-ass" TCS_ASS = "tcs-ass"
TIME = "time" TIME = "time"
CONTROLLERS = "controllers"

View File

@ -27,6 +27,7 @@ ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03])
BPX_HANDLER_ID = bytes([0x44, 0x26, 0x00, 0x00]) BPX_HANDLER_ID = bytes([0x44, 0x26, 0x00, 0x00])
# Thermal Object IDs # Thermal Object IDs
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])
HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4]) HEATER_ID = bytes([0x44, 0x41, 0x00, 0xA4])
TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04]) TMP_1075_1_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x04])
TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05]) TMP_1075_2_HANDLER_ID = bytes([0x44, 0x42, 0x00, 0x05])

View File

@ -944,6 +944,7 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
def add_system_cmds(cmd_dict: ServiceOpCodeDictT): def add_system_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.system.acs import AcsOpCodes, SusOpCodes from pus_tc.system.acs import AcsOpCodes, SusOpCodes
import pus_tc.system.tcs as tcs import pus_tc.system.tcs as tcs
import pus_tc.system.controllers as controllers
default_opts = generate_op_code_options( default_opts = generate_op_code_options(
enter_listener_mode=False, custom_timeout=8.0 enter_listener_mode=False, custom_timeout=8.0
@ -1049,3 +1050,23 @@ def add_system_cmds(cmd_dict: ServiceOpCodeDictT):
info="TCS Board Assembly", info="TCS Board Assembly",
op_code_entry=op_code_dict, op_code_entry=op_code_dict,
) )
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=controllers.OpCodes.THERMAL_CONTROLLER_NORMAL,
info=controllers.Info.THERMAL_CONTROLLER_NORMAL,
options=default_opts,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=controllers.OpCodes.THERMAL_CONTROLLER_OFF,
info=controllers.Info.THERMAL_CONTROLLER_OFF,
options=default_opts,
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CONTROLLERS.value,
info="Controllers",
op_code_entry=op_code_dict,
)

View File

@ -3,8 +3,7 @@ from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_200_fsfw_modes import Modes
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
from .common import command_assembly from .common import command_mode
class AcsOpCodes: class AcsOpCodes:
ACS_ASS_A_SIDE = ["0", "acs-a"] ACS_ASS_A_SIDE = ["0", "acs-a"]
@ -31,7 +30,7 @@ class DualSideSubmodes(enum.IntEnum):
def pack_acs_command(tc_queue: TcQueueT, op_code: str): def pack_acs_command(tc_queue: TcQueueT, op_code: str):
if op_code in AcsOpCodes.ACS_ASS_A_SIDE: if op_code in AcsOpCodes.ACS_ASS_A_SIDE:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
@ -39,7 +38,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly A side", info="Switching to ACS board assembly A side",
) )
if op_code in AcsOpCodes.ACS_ASS_B_SIDE: if op_code in AcsOpCodes.ACS_ASS_B_SIDE:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
@ -47,7 +46,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly B side", info="Switching to ACS board assembly B side",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE: if op_code in AcsOpCodes.ACS_ASS_DUAL_MODE:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE, submode=DualSideSubmodes.DUAL_SIDE,
@ -55,7 +54,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching to ACS board assembly dual mode", info="Switching to ACS board assembly dual mode",
) )
if op_code in AcsOpCodes.ACS_ASS_A_ON: if op_code in AcsOpCodes.ACS_ASS_A_ON:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
@ -63,7 +62,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly A side on", info="Switching ACS board assembly A side on",
) )
if op_code in AcsOpCodes.ACS_ASS_B_ON: if op_code in AcsOpCodes.ACS_ASS_B_ON:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
@ -71,7 +70,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly B side on", info="Switching ACS board assembly B side on",
) )
if op_code in AcsOpCodes.ACS_ASS_DUAL_ON: if op_code in AcsOpCodes.ACS_ASS_DUAL_ON:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.ON, mode=Modes.ON,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
@ -79,7 +78,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
info="Switching ACS board assembly dual side on", info="Switching ACS board assembly dual side on",
) )
if op_code in AcsOpCodes.ACS_ASS_OFF: if op_code in AcsOpCodes.ACS_ASS_OFF:
command_assembly( command_mode(
object_id=ACS_BOARD_ASS_ID, object_id=ACS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
@ -90,7 +89,7 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
def pack_sus_cmds(tc_queue: TcQueueT, op_code: str): def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in SusOpCodes.SUS_ASS_NOM_SIDE: if op_code in SusOpCodes.SUS_ASS_NOM_SIDE:
command_assembly( command_mode(
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.A_SIDE, submode=DualSideSubmodes.A_SIDE,
@ -98,7 +97,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching to SUS board to nominal side", info="Switching to SUS board to nominal side",
) )
if op_code in SusOpCodes.SUS_ASS_RED_SIDE: if op_code in SusOpCodes.SUS_ASS_RED_SIDE:
command_assembly( command_mode(
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.B_SIDE, submode=DualSideSubmodes.B_SIDE,
@ -106,7 +105,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching to SUS board to redundant side", info="Switching to SUS board to redundant side",
) )
if op_code in SusOpCodes.SUS_ASS_OFF: if op_code in SusOpCodes.SUS_ASS_OFF:
command_assembly( command_mode(
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,
@ -114,7 +113,7 @@ def pack_sus_cmds(tc_queue: TcQueueT, op_code: str):
info="Switching SUS board off", info="Switching SUS board off",
) )
if op_code in SusOpCodes.SUS_ASS_DUAL_MODE: if op_code in SusOpCodes.SUS_ASS_DUAL_MODE:
command_assembly( command_mode(
object_id=SUS_BOARD_ASS_ID, object_id=SUS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=DualSideSubmodes.DUAL_SIDE, submode=DualSideSubmodes.DUAL_SIDE,

View File

@ -3,7 +3,7 @@ from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
def command_assembly( def command_mode(
object_id: bytes, mode: Modes, submode: int, tc_queue: TcQueueT, info: str object_id: bytes, mode: Modes, submode: int, tc_queue: TcQueueT, info: str
): ):
tc_queue.appendleft((QueueCommands.PRINT, info)) tc_queue.appendleft((QueueCommands.PRINT, info))

View File

@ -0,0 +1,35 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from tmtccmd.tc.pus_200_fsfw_modes import Modes
from .common import command_mode
import config.object_ids as obj_ids
class OpCodes:
THERMAL_CONTROLLER_NORMAL = ["0", "thermal-normal"]
THERMAL_CONTROLLER_OFF = ["1", "thermal-off"]
class Info:
THERMAL_CONTROLLER_NORMAL = "Switching Thermal Controller into normal"
THERMAL_CONTROLLER_OFF = "Switching Thermal Controller off"
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.THERMAL_CONTROLLER_NORMAL:
command_mode(
object_id=obj_ids.THERMAL_CONTROLLER_ID,
mode=Modes.NORMAL,
submode=0,
tc_queue=tc_queue,
info=Info.THERMAL_CONTROLLER_NORMAL,
)
if op_code in OpCodes.THERMAL_CONTROLLER_OFF:
command_mode(
object_id=obj_ids.THERMAL_CONTROLLER_ID,
mode=Modes.OFF,
submode=0,
tc_queue=tc_queue,
info=Info.THERMAL_CONTROLLER_OFF,
)

View File

@ -1,7 +1,7 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_200_fsfw_modes import Modes
from .common import command_assembly from .common import command_mode
from config.object_ids import TCS_BOARD_ASS_ID from config.object_ids import TCS_BOARD_ASS_ID
@ -17,7 +17,7 @@ class Info:
def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str): def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.TCS_BOARD_ASS_NORMAL: if op_code in OpCodes.TCS_BOARD_ASS_NORMAL:
command_assembly( command_mode(
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Modes.NORMAL, mode=Modes.NORMAL,
submode=0, submode=0,
@ -25,7 +25,7 @@ def pack_tcs_sys_commands(tc_queue: TcQueueT, op_code: str):
info=Info.TCS_BOARD_ASS_NORMAL, info=Info.TCS_BOARD_ASS_NORMAL,
) )
if op_code in OpCodes.TCS_BOARD_ASS_OFF: if op_code in OpCodes.TCS_BOARD_ASS_OFF:
command_assembly( command_mode(
object_id=TCS_BOARD_ASS_ID, object_id=TCS_BOARD_ASS_ID,
mode=Modes.OFF, mode=Modes.OFF,
submode=0, submode=0,

View File

@ -41,6 +41,7 @@ from pus_tc.system.acs import pack_acs_command, pack_sus_cmds
from pus_tc.devs.plpcdu import pack_pl_pcdu_commands from pus_tc.devs.plpcdu import pack_pl_pcdu_commands
from pus_tc.devs.str_img_helper import pack_str_img_helper_command from pus_tc.devs.str_img_helper import pack_str_img_helper_command
from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.tcs import pack_tcs_sys_commands
from pus_tc.system.controllers import pack_controller_commands
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import ( from config.object_ids import (
P60_DOCK_HANDLER, P60_DOCK_HANDLER,
@ -239,6 +240,8 @@ def pack_service_queue_user(
return pack_rw_ass_cmds( return pack_rw_ass_cmds(
tc_queue=service_queue, object_id=RW_ASSEMBLY, op_code=op_code tc_queue=service_queue, object_id=RW_ASSEMBLY, op_code=op_code
) )
if service == CustomServiceList.CONTROLLERS.value:
return pack_controller_commands(tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")