From b4604951b39a4023fe124c8386a8ad9649a9a250 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Wed, 25 May 2022 10:03:47 +0200 Subject: [PATCH] added preliminary rw proc --- pus_tc/system/proc.py | 200 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 197 insertions(+), 3 deletions(-) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index d072874..fc378b2 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -37,12 +37,14 @@ from pus_tc.devs.sus import Sus9SetIds from pus_tc.devs.sus import Sus10SetIds from pus_tc.devs.sus import Sus11SetIds from pus_tc.devs.star_tracker import SetIds as StrSetIds +from pus_tc.devs.reaction_wheels import RwSetIds from pus_tc.system.tcs import pack_tcs_sys_commands from pus_tc.system.controllers import pack_controller_commands from pus_tc.system.acs import pack_acs_command, pack_sus_cmds from pus_tc.devs.imtq import pack_imtq_test_into, pack_dipole_command from pus_tc.devs.star_tracker import pack_star_tracker_commands +from pus_tc.devs.reaction_wheels import pack_rw_ass_cmds, pack_set_speed_command @@ -59,6 +61,8 @@ class OpCodes: MGT_FT_DP = ["mgt-ft-dp"] SUS_FT = ["sus-ft"] STR_FT = ["str-ft"] + RW_FT_ONE_RW = ["rw-ft-one-rw"] + RW_FT_TWO_RWS = ["rw-ft-two-rws"] class KeyAndInfo: @@ -74,6 +78,8 @@ class KeyAndInfo: MGT_FT_DP = ["MGT dipole", "MGT functional test with dipole"] SUS_FT = ["SUS", "SUS functional test"] STR_FT = ["STR", "STR functional test"] + RW_FT_ONE_RW = ["RW ONE RW", "RW functional test with one RW"] + RW_FT_TWO_RWS = ["RW TWO RWS", "RW functional test with two RWs"] KAI = KeyAndInfo @@ -87,10 +93,14 @@ PROC_INFO_DICT = { KAI.TCS_FT_OFF[0]: [OpCodes.TCS_FT_OFF, KAI.TCS_FT_OFF[1], 120.0, 10.0], KAI.ACS_FT[0]: [OpCodes.ACS_FT, KAI.ACS_FT[1], 120.0, 10.0], KAI.MGT_FT[0]: [OpCodes.MGT_FT, KAI.MGT_FT[1], 120.0, 10.0], - KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 120.0, 10.0], - # collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120seconds is not needed after MGTs are tested +# collection_time for KAI.MGT_FT_DP maybe be reduced as a full 120seconds is not needed after MGTs are tested + KAI.MGT_FT_DP[0]: [OpCodes.MGT_FT_DP, KAI.MGT_FT_DP[1], 10.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], +# 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], +# 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], } @@ -125,6 +135,16 @@ def pack_generic_hk_listening_cmds( tc_queue=tc_queue, ) + elif one_rw is True: + activate_one_rw_in_sequence( + tc_queue=tc_queue, + ) + + elif two_rws is True: + activate_two_rws_in_sequence( + tc_queue=tc_queue, + ) + else: pass @@ -147,7 +167,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): key = KAI.BAT_FT[0] sid_list.append(make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)) 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, ) if op_code in OpCodes.CORE_FT: @@ -347,6 +367,41 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str): pack_star_tracker_commands(object_id=oids.STAR_TRACKER_ID, tc_queue=tc_queue, op_code="3") + if op_code in OpCodes.RW_FT_ONE_RW: + key = KAI.RW_FT_ONE_RW[0] +# RW NORMAL + pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") + + # RW + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.STATUS_SET_ID)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TEMPERATURE_SET_ID)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.LAST_RESET)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TM_SET)) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=True, + ) +# RW off + pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") + +# ass command with 2 rws to speed + if op_code in OpCodes.: + key = KAI.[0] +# RW NORMAL + pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="nml") + + # RW + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.STATUS_SET_ID)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TEMPERATURE_SET_ID)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.LAST_RESET)) + sid_list.append(make_sid(oids.RW_ASSEMBLY, RwSetIds.TM_SET)) + pack_generic_hk_listening_cmds( + tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False, mgt=False, one_rw=True, + ) +# RW off + pack_rw_ass_cmds(object_id=oids.RW_ASSEMBLY, tc_queue=tc_queue, op_code="off") + + + """ def listen_to_hk_for_x_seconds( @@ -466,3 +521,142 @@ def activate_mgts_alternately( ) tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft((QueueCommands.WAIT, 10.0)) + + +def activate_one_rw_in_sequence( + tc_queue: TcQueueT, +): +# RW1 speed cmd + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + command = pack_set_speed_command( + object_id=oids.RW1_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.RW1_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + +# RW2 speed cmd + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + command = pack_set_speed_command( + object_id=oids.RW2_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.RW2_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + +# RW3 speed cmd + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + command = pack_set_speed_command( + object_id=oids.RW3_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.RW3_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + 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( + tc_queue: TcQueueT +): + # RW1+3 speed cmd + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + command = pack_set_speed_command( + object_id=oids.RW1_ID, + speed=20000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + command = pack_set_speed_command( + object_id=oids.RW3_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.RW1_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + command = pack_set_speed_command( + object_id=oids.RW3_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + # RW2+4 speed cmd + tc_queue.appendleft((QueueCommands.WAIT, 5.0)) + command = pack_set_speed_command( + object_id=oids.RW2_ID, + speed=20000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + 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.RW2_ID, + speed=1000, + ramp_time=10000, + ) + tc_queue.appendleft(command.pack_command_tuple()) + 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)) +