fixes in procedures

This commit is contained in:
Jakob Meier 2022-06-02 18:51:40 +02:00
parent 7259fc008a
commit 3ff95280e5
6 changed files with 78 additions and 50 deletions

View File

@ -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$/tmtccli.py" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s 17" /> <option name="PARAMETERS" value="-s 17 -l" />
<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

@ -212,12 +212,16 @@ def pack_set_speed_command(
"Invalid RW speed specified. " "Invalid RW speed specified. "
"Allowed range is [1000, 65000] 0.1 * RPM" "Allowed range is [1000, 65000] 0.1 * RPM"
) )
else: elif speed < 0:
if speed < -65000 or speed > -1000: if speed < -65000 or speed > -1000:
raise ValueError( raise ValueError(
"Invalid RW speed specified. " "Invalid RW speed specified. "
"Allowed range is [-65000, -1000] 0.1 * RPM" "Allowed range is [-65000, -1000] 0.1 * RPM"
) )
else:
# Speed is 0
pass
if ramp_time_ms < 0 or ( if ramp_time_ms < 0 or (
ramp_time_ms > 0 and (ramp_time_ms > 10000 or ramp_time_ms < 10) ramp_time_ms > 0 and (ramp_time_ms > 10000 or ramp_time_ms < 10)
): ):

View File

@ -1,5 +1,6 @@
from __future__ import annotations from __future__ import annotations
import struct
import time import time
from typing import List from typing import List
@ -188,6 +189,11 @@ def pack_generic_hk_listening_cmds(
sid=sid_list[i], sid=sid_list[i],
) )
) )
activate_all_rws_in_sequence(
tc_queue=tc_queue, test_speed=0, test_ramp_time=5000, init_ssc=0
)
tc_queue.appendleft((QueueCommands.WAIT, 30))
current_time = time.time() current_time = time.time()
current_time += collection_time current_time += collection_time
if not cfg.use_tc_sched: if not cfg.use_tc_sched:
@ -197,11 +203,14 @@ def pack_generic_hk_listening_cmds(
for cmd in disable_cmd_list: for cmd in disable_cmd_list:
tc_queue.appendleft( tc_queue.appendleft(
generate_time_tagged_cmd( generate_time_tagged_cmd(
release_time=struct.pack("!I", current_time), release_time=struct.pack("!I", int(current_time)),
tc_to_insert=cmd, tc_to_insert=cmd,
ssc=0, ssc=0,
) )
) )
if not cfg.use_tc_sched:
tc_queue.appendleft((QueueCommands.WAIT, 120))
sid_list.clear() sid_list.clear()
diag_list.clear() diag_list.clear()
@ -323,7 +332,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
False, False,
False, False,
False, False,
False, False
] ]
pack_acs_command(tc_queue=tc_queue, op_code="acs-a") pack_acs_command(tc_queue=tc_queue, op_code="acs-a")
@ -343,6 +352,15 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-b") pack_acs_command(tc_queue=tc_queue, op_code="acs-b")
sid_list.clear()
diag_list = [
False,
False,
False,
False,
False
]
for b_side_dev in b_side_pairs: for b_side_dev in b_side_pairs:
oid = b_side_dev[0] oid = b_side_dev[0]
set_id = b_side_dev[1] set_id = b_side_dev[1]
@ -359,11 +377,24 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.WAIT, 5.0)) tc_queue.appendleft((QueueCommands.WAIT, 5.0))
pack_acs_command(tc_queue=tc_queue, op_code="acs-d") pack_acs_command(tc_queue=tc_queue, op_code="acs-d")
sid_list.clear()
for d_side_dev in d_side_pairs: for d_side_dev in d_side_pairs:
oid = d_side_dev[0] oid = d_side_dev[0]
set_id = d_side_dev[1] set_id = d_side_dev[1]
sid_list.append(make_sid(oid, set_id)) sid_list.append(make_sid(oid, set_id))
diag_list = diag_list + diag_list diag_list = [
False,
False,
False,
False,
False,
False,
False,
False,
False,
False,
]
pack_generic_hk_listening_cmds( pack_generic_hk_listening_cmds(
tc_queue=tc_queue, tc_queue=tc_queue,
proc_key=key, proc_key=key,
@ -563,37 +594,29 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
key = KAI.RW_FT_ONE_RW[0] key = KAI.RW_FT_ONE_RW[0]
rw_pairs = [ rw_pairs = [
(oids.RW1_ID, RwSetIds.STATUS_SET_ID), (oids.RW1_ID, RwSetIds.STATUS_SET_ID),
(oids.RW1_ID, RwSetIds.TEMPERATURE_SET_ID),
(oids.RW1_ID, RwSetIds.LAST_RESET), (oids.RW1_ID, RwSetIds.LAST_RESET),
(oids.RW1_ID, RwSetIds.TM_SET), (oids.RW1_ID, RwSetIds.TM_SET),
(oids.RW2_ID, RwSetIds.STATUS_SET_ID), (oids.RW2_ID, RwSetIds.STATUS_SET_ID),
(oids.RW2_ID, RwSetIds.TEMPERATURE_SET_ID),
(oids.RW2_ID, RwSetIds.LAST_RESET), (oids.RW2_ID, RwSetIds.LAST_RESET),
(oids.RW2_ID, RwSetIds.TM_SET), (oids.RW2_ID, RwSetIds.TM_SET),
(oids.RW3_ID, RwSetIds.STATUS_SET_ID), (oids.RW3_ID, RwSetIds.STATUS_SET_ID),
(oids.RW3_ID, RwSetIds.TEMPERATURE_SET_ID),
(oids.RW3_ID, RwSetIds.LAST_RESET), (oids.RW3_ID, RwSetIds.LAST_RESET),
(oids.RW3_ID, RwSetIds.TM_SET), (oids.RW3_ID, RwSetIds.TM_SET),
(oids.RW4_ID, RwSetIds.STATUS_SET_ID), (oids.RW4_ID, RwSetIds.STATUS_SET_ID),
(oids.RW4_ID, RwSetIds.TEMPERATURE_SET_ID),
(oids.RW4_ID, RwSetIds.LAST_RESET), (oids.RW4_ID, RwSetIds.LAST_RESET),
(oids.RW4_ID, RwSetIds.TM_SET), (oids.RW4_ID, RwSetIds.TM_SET),
] ]
diag_list = [ diag_list = [
True,
False, False,
False, False,
True,
False, False,
False, False,
True,
False, False,
False, False,
False, True,
False,
False,
False,
False,
False,
False,
False,
False, False,
False, False,
] ]

View File

@ -16,7 +16,7 @@ class SetIds(enum.IntEnum):
def handle_thermal_controller_hk_data( def handle_thermal_controller_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
): ):
if set_id is SetIds.SENSOR_TEMPERATURE_SET: if set_id == SetIds.SENSOR_TEMPERATURE_SET:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
pw.dlog("Received sensor temperature data") pw.dlog("Received sensor temperature data")
@ -32,12 +32,11 @@ def handle_thermal_controller_hk_data(
print(parsed_data) print(parsed_data)
tcp_server_sensor_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data) tcp_server_sensor_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
elif set_id is SetIds.DEVICE_TEMPERATURE_SET: elif set_id == SetIds.DEVICE_TEMPERATURE_SET:
pw = PrintWrapper(printer) pw = PrintWrapper(printer)
pw.dlog("Received device temperature data") pw.dlog("Received device temperature data")
fmt_str = "!fhhhhiiiifHHHHHhhhhhfffffff"
fmt_str = "!fffffiiiiffffhhhhhhhfffffff" tm_data = struct.unpack(fmt_str, hk_data[:80])
tm_data = struct.unpack(fmt_str, hk_data[:90])
parsed_data = { parsed_data = {
"Q7S_TEMPERATURE": tm_data[0], "Q7S_TEMPERATURE": tm_data[0],
"BATTERY_TEMPERATURE_1": tm_data[1], "BATTERY_TEMPERATURE_1": tm_data[1],
@ -52,13 +51,13 @@ def handle_thermal_controller_hk_data(
"SYRLINKS_POWER_AMPLIFIER_TEMPERATURE": tm_data[10], "SYRLINKS_POWER_AMPLIFIER_TEMPERATURE": tm_data[10],
"SYRLINKS_BASEBAND_BOARD_TEMPERATURE": tm_data[11], "SYRLINKS_BASEBAND_BOARD_TEMPERATURE": tm_data[11],
"MGT_TEMPERATURE": tm_data[12], "MGT_TEMPERATURE": tm_data[12],
"ACU_TEMPERATURE_1": tm_data[13], "ACU_TEMPERATURE_1": tm_data[13] / 10,
"ACU_TEMPERATURE_2": tm_data[14], "ACU_TEMPERATURE_2": tm_data[14] / 10,
"ACU_TEMPERATURE_3": tm_data[15], "ACU_TEMPERATURE_3": tm_data[15] / 10,
"PDU1_TEMPERATURE": tm_data[16], "PDU1_TEMPERATURE": tm_data[16] / 10,
"PDU2_TEMPERATURE": tm_data[17], "PDU2_TEMPERATURE": tm_data[17] / 10,
"P60DOCK_TEMPERATURE_1": tm_data[18], "P60DOCK_TEMPERATURE_1": tm_data[18] / 10,
"P60DOCK_TEMPERATURE_2": tm_data[19], "P60DOCK_TEMPERATURE_2": tm_data[19] / 10,
"GYRO_0_TEMPERATURE": tm_data[20], "GYRO_0_TEMPERATURE": tm_data[20],
"GYRO_1_TEMPERATURE": tm_data[21], "GYRO_1_TEMPERATURE": tm_data[21],
"GYRO_2_TEMPERATURE": tm_data[22], "GYRO_2_TEMPERATURE": tm_data[22],
@ -69,26 +68,27 @@ def handle_thermal_controller_hk_data(
} }
print(parsed_data) print(parsed_data)
tcp_server_device_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data) tcp_server_device_temperatures.report_parsed_hk_data(object_id, set_id, parsed_data)
elif set_id is SetIds.SUS_TEMPERATURE_SET: elif set_id == SetIds.SUS_TEMPERATURE_SET:
pw = PrintWrapper(printer) pass
pw.dlog("Received SUS temperature data") # pw = PrintWrapper(printer)
fmt_str = "!ffffffffffffffffff" # pw.dlog("Received SUS temperature data")
tm_data = struct.unpack(fmt_str, hk_data[:4 * 18]) # fmt_str = "!ffffffffffffffffff"
parsed_data = { # tm_data = struct.unpack(fmt_str, hk_data[:4 * 18])
"SUS_0": tm_data[0], # parsed_data = {
"SUS_1": tm_data[1], # "SUS_0": tm_data[0],
"SUS_2": tm_data[2], # "SUS_1": tm_data[1],
"SUS_3": tm_data[3], # "SUS_2": tm_data[2],
"SUS_4": tm_data[4], # "SUS_3": tm_data[3],
"SUS_5": tm_data[5], # "SUS_4": tm_data[4],
"SUS_6": tm_data[6], # "SUS_5": tm_data[5],
"SUS_7": tm_data[7], # "SUS_6": tm_data[6],
"SUS_8": tm_data[8], # "SUS_7": tm_data[7],
"SUS_9": tm_data[9], # "SUS_8": tm_data[8],
"SUS_10": tm_data[10], # "SUS_9": tm_data[9],
"SUS_11": tm_data[11], # "SUS_10": tm_data[10],
} # "SUS_11": tm_data[11],
print(parsed_data) # }
# print(parsed_data)
# TODO: Forward data to space simulator # TODO: Forward data to space simulator

View File

@ -45,6 +45,7 @@ class TmTcpServer:
try: try:
(self.client_connection, _) = self.server_socket.accept() (self.client_connection, _) = self.server_socket.accept()
self.client_connection.setblocking(False) self.client_connection.setblocking(False)
print("Client connected")
except: except:
# no client waiting # no client waiting
return return

@ -1 +1 @@
Subproject commit 03b70906a60e3f34c3a9f654970c611f7ea264fd Subproject commit 6914cfaaf6fbdb7b5623a1fc9e5a909b11fb2acb