Skip to content
Snippets Groups Projects
Commit c9ec464e authored by Sebastian's avatar Sebastian
Browse files

Added function to get time of last telecommand

parent 7d349737
No related branches found
No related tags found
No related merge requests found
...@@ -1728,6 +1728,29 @@ def get_acquisition(pool_name, tm_21_3): ...@@ -1728,6 +1728,29 @@ def get_acquisition(pool_name, tm_21_3):
logger.info(meta_data[i]) logger.info(meta_data[i])
return result return result
def get_time_of_last_tc(pool_name="LIVE"):
"""
Finds the newest Telecommand in database with the Telemetry just before.
param pool_name: str
Name of the pool for TM/TC packets in the database
"""
tm_pool = cfl.get_pool_rows(pool_name)
# last_telecommand = None
tm_before_tc = None
for i in range(-1, -100, -1):
if tm_pool[i].timestamp == "":
# last_telecommand = tm_pool[i]
tm_before_tc = tm_pool[i-1]
break
timestamp = tm_before_tc.timestamp
timestamp_length = len(timestamp)
timestamp = float(timestamp[:timestamp_length -1])
return timestamp
def get_dpu_mode(pool_name="LIVE"): def get_dpu_mode(pool_name="LIVE"):
""" """
Get the data from the last entry in the database and check its DPU Mode. Get the data from the last entry in the database and check its DPU Mode.
......
...@@ -38,6 +38,7 @@ Verification_4 = "tm." + tm.get_frequency_of_hk.__name__ + str(inspect.signature ...@@ -38,6 +38,7 @@ Verification_4 = "tm." + tm.get_frequency_of_hk.__name__ + str(inspect.signature
Verification_5 = "tm." + tm.get_dpu_mode.__name__ + str(inspect.signature((tm.get_dpu_mode))) Verification_5 = "tm." + tm.get_dpu_mode.__name__ + str(inspect.signature((tm.get_dpu_mode)))
Verification_6 = "tm." + tm.get_packet_length.__name__ + str(inspect.signature((tm.get_packet_length))) Verification_6 = "tm." + tm.get_packet_length.__name__ + str(inspect.signature((tm.get_packet_length)))
Verification_7 = "tm." + tm.get_version_number.__name__ + str(inspect.signature((tm.get_version_number))) Verification_7 = "tm." + tm.get_version_number.__name__ + str(inspect.signature((tm.get_version_number)))
Verification_8 = "tm." + tm.get_time_of_last_tc.__name__ + str(inspect.signature((tm.get_time_of_last_tc)))
...@@ -49,7 +50,8 @@ verification_list = [ ...@@ -49,7 +50,8 @@ verification_list = [
("Get HK frequency", None, None, "descr", Verification_4), ("Get HK frequency", None, None, "descr", Verification_4),
("Get DPU Mode", None, None, "descr", Verification_5), ("Get DPU Mode", None, None, "descr", Verification_5),
("Get Packet Length", None, None, "descr", Verification_6), ("Get Packet Length", None, None, "descr", Verification_6),
("Get Version Number", None, None, "descr", Verification_7) ("Get Version Number", None, None, "descr", Verification_7),
("Get Time before last TC", None, None, "descr", Verification_8)
] ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment