Tutorial 5: Upgrading the workbench

This is the final tutorial in the OSSO workbench series. This tutorial will focus on the process to upgrade the ping commands to account for the orbit of our satellite. To do this, we will use the satellite's latest version of TLE that Scepter holds to predict the next overpass. This will then be translated into a delay command which will be added before the ping commands.

Background

To give a bit of background into why we need to upgrade the signal, a brief explanation of the concepts will be given to clarify the reasoning.
When a satellite is in orbit, it does not remain in the same location with reference to a point on the Earth. That only happens in the special case of a geostationary orbit. For the most part, this means that companies with satellites need to operate from multiple ground stations in order to have a consistent coverage. This also means that for a single ground station to satellite contact, there is only a small period of the day during which the two can communicate. Therefore, we need to know when our satellite is going to be in range of our ground station in order to have the most efficient command process in place.
One of the best ways to predict the orbit of a satellite is to use its TLE. Although this isn't a perfect method, by updating the TLE over time and verifying with actual radio data, the orbit of a satellite can be predicted to great accuracy. Obviously, for the scope of this workbench, Javelin's TLE tracker will suffice in predicting our overpass time and duration.

Workbench section 4: ping upgrade

TLE track and overpass calculation

Our first step is to get the TLE and calculate the time of the next overpass. Fortunately for us, Javelin comes with a TLE tracker. This file has been adjusted and copied into the Javelin-Scepter directory for us to use in our workbench.
The first step in this process is to extract the TLE data from Scepter and to reprint it into a text file to be accessed by the tracker. The code used to do this is given below.
1
satellite_info = get_single_satellite(sat_id)
2
satellite_tle = satellite_info['tle']
3
filename = 'scepter_tle.txt'
4
f = open(filename, 'w')
5
f.write(satellite_tle['tle_line_1'] + '\n')
6
f.write(satellite_tle['tle_line_2'] + '\n')
7
f.close()
This can now be placed into our function to extract and print the overpass data. This function is given below.
1
def get_overpass_from_tle(filename):
2
"""
3
This function grabs the tle from a file and calculates the next overpass using current UTC time.
4
"""
5
tle_list, overpass_data = pull_data(filename)
6
header_strings = 'Overpass Time (AEST)' + (26 - len('Overpass Time (AEST)')) * ' ' + ' | '
7
header_strings += ' Duration' + (14 - len(' Duration')) * ' ' + ' | '
8
header_strings += ' Time Until Overpass'
9
print(header_strings)
10
print(len(header_strings) * '-')
11
delta_t = []
12
13
for n in range(len(overpass_data)):
14
next_overpass = datetime.datetime.strptime(overpass_data[n]["start_time"], "%Y-%m-%dT%H:%M:%S.%f")
15
duration = datetime.datetime.strptime(overpass_data[n]["end_time"],
16
"%Y-%m-%dT%H:%M:%S.%f") - datetime.datetime.strptime(
17
overpass_data[n]["start_time"], "%Y-%m-%dT%H:%M:%S.%f")
18
utc_now = datetime.datetime.utcnow()
19
delta_t.append(next_overpass - utc_now)
20
print(str(next_overpass + datetime.timedelta(hours=10)) + ' | ' + str(duration) + ' | ' + str(delta_t[n]))
21
22
return delta_t[0].total_seconds(), \
23
datetime.datetime.strptime(overpass_data[0]["start_time"], "%Y-%m-%dT%H:%M:%S.%f"), \
24
datetime.datetime.strptime(overpass_data[0]["end_time"],
25
"%Y-%m-%dT%H:%M:%S.%f") - datetime.datetime.strptime(
26
overpass_data[0]["start_time"], "%Y-%m-%dT%H:%M:%S.%f")
The above function will take the filename of your newly created TLE text file, and use the Javelin function pull_data() to get the TLE list and overpass data of that satellite. For us, we are only interested in the overpass data, but feel free to add the TLE list to the returns for uses you find elsewhere. Following this calculation, we then use the datetime package to convert the overpass time into a datetime variable. Then, by finding the difference between the overpass and current time, we can find the time until overpass (delta_t). We have converted this into seconds as that is the measurement used in the delay commands. An error of 10 seconds was also added to account for any minor errors in the prediction and to ensure that the ground station is able to connect to the satellite successfully. The overpass information is then printed out into the terminal before returning our time difference.

Command translation and execution

The final step in this is to convert this new information into the commands and execute them. This sounds a lot harder than it is, as all we need to do is to add a delay delta_t to the command list before conducting the same process as before. This can be done with the code below.
1
delta_t, next_overpass, duration = get_overpass_from_tle(filename)
2
3
new_cmd_lines = ['delay ' + str(round(delta_t))] + old_cmd_lines
Since the delay command only allows for integers, the round function was used to convert the number to this. This new delay command was then added to the list of commands previously extracted from Scepter and used in tutorials 3 and 4.
The commands are then executed in the exact same manner as done previously using the following code:
1
execute_operator_cmds(new_cmd_lines)

Using the workbench

Once you have completed the above step, you have officially completed the construction of your workbench. To use this, simply run the workbench file and update the JSON inputs as you see fit. In our example, we have looped over the overpass command section to allow the commands to be sent on each overpass until we want it to stop. You are more than welcome to implement this and more into your workbench in order to help further automate and refine your processes. Enjoy!

Conclusion

Well done! You have completed the workbench tutorials. If you haven't already, check out the workbench documentation.
Table of contents