Communications Notes

This document includes notes that were created while making and running the communications script and analysis

Author: Alex Jackson Date: 3/09/2024

Requirements: -Create a script in python that uses the spacecraft class, planet class and ground station model -Initialize from orbital elements (recommended starting with ISS orbit) -Set ground station as Rolla with a 10 degree elevation mask -Free to choose run frequency -Use AutoDoc feature for Analysis -Generate a table displaying the initial conditions used for the script and runtime -Generate a table with seconds of communication per day, number of passes per day, average duration of pass, longest pass and shortest pass -Generate a table with maximum range rate per pass -Generate plots with range, azimuth, and elevation as a function of time -Create 2D ground track plot of the spacecraft overlaid over a map of Earth with indications of when the spacecraft passes over the ground station (not complete)

Script:

The first section of our code establishes our simulation executive. This is a class that handles the scheduling, manages the frames, houses the search function, and functions for logging and integration. The search function is why each new object has a string as an input. The parseargs function interperets the command line inputs. Then we set the simulation speed and an end time for our simulation. Creating this executive also automatically establishes a root frame that is at the origin.

We then create our planet object by inputting our simulation executive and a name which, by convention, should be the same as the object name. In this case we want to establish Earth as our central body. We then want to 'place' this planet at the origin of the root frame which is done in the next line. By default the gravitational parameter is the gravitational parameter of Earth but for clarity we will specify this quantity in units of m3/s2.

The next section in our code creates an object of the spacecraft class. This class has a constructor, which is a function that is run when the class is created to establish basic properties of the object in our class. In our case the constructor takes in two arguments, the simulation executive and the name of the spacecraft. For this example, our spacecraft object is named sc. When this object is created it also establishes a body axis. We then want to establish that our spacecraft object, sc, is orbiting around our planet object, Earth. To do this we use a function called config from planet that takes in a planet.

We then need to create our ground station. We do this by creating a ground station object in this case called Rolla where our groundstation will be. The ground station constructor requires the simulation executive as an input. Next, we decide which spacecraft we want to track and assign its body frame. We then set the planet rotating frame as the Eath fixed frame. Next, we establish the location of the ground station by inputting the lattitude, longitude, and radius from the center of the Earth. Note that the lattitude is geocentric lattitude. For the purpose of this script the Earth was simplified to be a sphere and thus geodetic lattitude is equal to geocentric lattitude. The values that were input come from the lattitude and longitude of Rolla, Missouri. Finally, we establish the elevation mask in radians. This is the angle above the horizon that we will say is blocked due to obstructions or transmission regulations.

Next, we need to initialize our spacecrafts position and velocity. We do this using initializeFromOrbitElements with the elements of the international space station. We must convert the given orbit elements to degrees by multiplying by a constant called DEG2RAD that has the value of pi/180. This is done to speed up the code by avoiding unecessary division, provide clarity of the purpose of the calculation, and provide an easy way to change the value across all of its instances if needed. It is crucial that initializeFromOrbitElements is run after exc.startup.

We then use csvlogger to create a csv file the will contain our outputs including range, range-rate, azimuth, elevation, time, and if the satellite is in pass.

Finally, we call exc.startup and exc.run to run our script. The output will show up in the same directory as the script in a folder called results.

Analysis: First, we import our csv file created in script.py. This uses a utility called pandas which we imported as pd. Next, we create a document that will house all of our figures and tables. This uses a utility called AutoDocPy. We will use a feature of AutoDocPy to create a table of orbit elements and simulation run time that were used to run the simulation in script.py. To do this we first create a data frame to store that data and then write that data frame as a table.

We then want to gather some useful information about the passes such as pass frequency and pass length. To do this we need to look at the PassData.csv file that was created when we ran analysis.py. Notice that the last column has a value of one when the spacecraft is not in view of the ground station and a value of zero when it is. It then follows that to find the number of passes during the simulation we need to find how many times that column changes from a one to a zero. We will store the times at which this happens in a vector called PassStart. Similarly, the end of each pass can be found by finding when the last column changes from a zero to a one. The corresponding time will be stored in a vector called PassEnd. To make this happen in the code we need to first initialize our vectors with zeroes. The length 16 was chosen because that is the number of orbits that the ISS completes in one day and is therefore the maximum possible length of the vector. Note that this means there will be additional zeros at the end of the vector that need to be excluded from the data analysis. A vector of pass times was created by subtracting the start times from the end times using numpy’s subtract function. This will subtract the two vectors element-wise and return a vector of the same length as the inputs. We then convert this vector to minutes and round it to two decimal places so that it looks presentable in the table. We then create a data frame and add the passes per day which is just the legth of the PassTime vector neglecting the zero values. Additionally, we record the maximum, average, minimum, and total pass time using numpy’s data functions. Lastly, the maximum range rate was recorded in the data frame.

Next we graph azimuth, elevation, range, and range rate vs time using matplotlib.pyplot which we imported as plot. The data was filtered by finding the index of the first PassStart value and calling it StartIndex and finding the index of the last PassEnd value and calling it EndIndex. All of the graphs only graph the values between those two indices.

Running the code: Running python code is very simple. To run these codes you just need to type "python3 script.py" or "python3 analysis.py". As mentioned before, analysis.py creates a subdirectory called results in the script directory where our csv is output. Analysis.py creates a document called "Communications_Analysis" that houses our tables and graphs.