more missing flags and finalized rw proc

This commit is contained in:
Markus Kranz 2022-05-25 10:53:39 +02:00
parent aa01fe4401
commit ebf44e8b0e
2 changed files with 67 additions and 51 deletions

View File

@ -196,7 +196,7 @@ def pack_rw_ass_cmds(tc_queue: TcQueueT, object_id: bytes, op_code: str):
tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft(cmd.pack_command_tuple())
def pack_set_speed_command(object_id: bytes, speed: int, ramp_time: int) -> bytearray: def pack_set_speed_command(object_id: bytes, speed: int, ramp_time: int) -> PusTelecommand:
"""With this function a command is packed to set the speed of a reaction wheel """With this function a command is packed to set the speed of a reaction wheel
:param object_id: The object id of the reaction wheel handler. :param object_id: The object id of the reaction wheel handler.
:param speed: Valid speeds are [-65000, -1000] and [1000, 65000]. Values are :param speed: Valid speeds are [-65000, -1000] and [1000, 65000]. Values are
@ -209,4 +209,5 @@ def pack_set_speed_command(object_id: bytes, speed: int, ramp_time: int) -> byte
command += object_id + command_id command += object_id + command_id
command = command + struct.pack("!i", speed) command = command + struct.pack("!i", speed)
command = command + ramp_time.to_bytes(length=2, byteorder="big") command = command + ramp_time.to_bytes(length=2, byteorder="big")
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
return command return command

View File

@ -98,9 +98,9 @@ PROC_INFO_DICT = {
KAI.SUS_FT[0]: [OpCodes.SUS_FT, KAI.SUS_FT[1], 120.0, 10.0], KAI.SUS_FT[0]: [OpCodes.SUS_FT, KAI.SUS_FT[1], 120.0, 10.0],
KAI.STR_FT[0]: [OpCodes.STR_FT, KAI.STR_FT[1], 120.0, 10.0], KAI.STR_FT[0]: [OpCodes.STR_FT, KAI.STR_FT[1], 120.0, 10.0],
# collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120seconds is not needed after RWs are tested # collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120seconds is not needed after RWs are tested
KAI.RW_FT_ONE_RW[0]: [OpCodes.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 10.0], KAI.RW_FT_ONE_RW[0]: [OpCodes.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 1.0],
# collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120seconds is not needed after RWs are tested # collection_time for KAI.RW_FT_ONE_RW maybe be reduced as a full 120seconds is not needed after RWs are tested
KAI.RW_FT_ONE_RW[0]: [OpCodes.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 10.0], KAI.RW_FT_ONE_RW[0]: [OpCodes.RW_FT_ONE_RW, KAI.RW_FT_ONE_RW[1], 10.0, 1.0],
} }
@ -176,7 +176,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
key = KAI.CORE_FT[0] key = KAI.CORE_FT[0]
sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)) sid_list.append(make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=False, two_rws=False,
) )
if op_code in OpCodes.PCDU_FT: if op_code in OpCodes.PCDU_FT:
@ -374,15 +374,28 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
# RW NORMAL # RW NORMAL
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml")
# RW # RW HK für alle RWs nur einzeln
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.STATUS_SET_ID)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TEMPERATURE_SET_ID)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.LAST_RESET)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TM_SET)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.TM_SET))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=True, two_rws=False, tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=True, two_rws=False,
) )
# RW off # RW OFF
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off")
# ass command with 2 rws to speed # ass command with 2 rws to speed
@ -392,19 +405,30 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml")
# RW # RW
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.STATUS_SET_ID)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TEMPERATURE_SET_ID)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.LAST_RESET)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TM_SET)) sid_list.append(make_sid(oids.RW1_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW2_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW3_ID, RwSetIds.TM_SET))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.STATUS_SET_ID))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.TEMPERATURE_SET_ID))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.LAST_RESET))
sid_list.append(make_sid(oids.RW4_ID, RwSetIds.TM_SET))
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=False, two_rws=True, tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=False, two_rws=True,
) )
# RW off # RW OFF
pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off")
""" """
def listen_to_hk_for_x_seconds( def listen_to_hk_for_x_seconds(
tc_queue: TcQueueT, tc_queue: TcQueueT,
@ -536,69 +560,63 @@ def activate_one_rw_in_sequence(
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW1_ID, object_id=oids.RW1_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 10.0))
# RW2 speed cmd # RW2 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW2_ID, object_id=oids.RW2_ID,
speed=20000, speed=20000,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW2_ID, object_id=oids.RW2_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 10.0))
# RW3 speed cmd # RW3 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW3_ID, object_id=oids.RW3_ID,
speed=20000, speed=20000,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW3_ID, object_id=oids.RW3_ID,
speed=1000, speed=0,
ramp_time=10000,
)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 10.0))
# RW4 speed cmd
command = pack_set_speed_command(
object_id=oids.RW4_ID,
speed=20000,
ramp_time=10000,
)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command(
object_id=oids.RW4_ID,
speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 5.0))
# RW4 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
command = pack_set_speed_command(
object_id=oids.RW4_ID,
speed=20000,
ramp_time=10000,
)
tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command(
object_id=oids.RW4_ID,
speed=1000,
ramp_time=10000,
)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
def activate_two_rws_in_sequence( def activate_two_rws_in_sequence(
tc_queue: TcQueueT tc_queue: TcQueueT
@ -617,23 +635,21 @@ def activate_two_rws_in_sequence(
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW1_ID, object_id=oids.RW1_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW3_ID, object_id=oids.RW3_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 10.0))
# RW2+4 speed cmd # RW2+4 speed cmd
tc_queue.appendleft((QueueCommands.WAIT, 5.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW2_ID, object_id=oids.RW2_ID,
speed=20000, speed=20000,
@ -646,17 +662,16 @@ def activate_two_rws_in_sequence(
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
# WRONG: should be RW INIT command from datasheet
tc_queue.appendleft((QueueCommands.WAIT, 70.0)) tc_queue.appendleft((QueueCommands.WAIT, 70.0))
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW2_ID, object_id=oids.RW2_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
command = pack_set_speed_command( command = pack_set_speed_command(
object_id=oids.RW4_ID, object_id=oids.RW4_ID,
speed=1000, speed=0,
ramp_time=10000, ramp_time=10000,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())