Spacecraft Systems MATLAB Tutorial 2
MACE21111
04 November 2019, 16:00 – 17:00
1
Thermal Design Overview
This question may be assessed.
This question will focus on analysing the thermal cycle undergone by a satellite in orbit. This is a fundamental part of the type of thermal design that you are covering in chapter 6 of your notes.
Here, we will look at a satellite in Low Earth Orbit, and observe the changes in tem- perature that it will undergo over the course of one orbit. This exercise will test both your understanding of a satellite’s thermal cycle, and your proficiency with concepts such as while loops and if-statements.
Question
A 1kg nanosatellite is deployed into orbit from the ISS, at an altitude (r) of 408km. Assuming that this satellite began its orbit immediately after the end of an eclipse period, find the change in temperature (dT) across a 100 cm2 face of this satellite over the course of one orbit. This face can treated as always directly facing the sun, and is made of a material that has an absorptance (α) of 0.75 and an emittance (ε) of 0.8. When it is deployed it has an initial temperature (Ti) of 15◦C, and is made of aluminium, which has a specific heat capacity (cp) of 0.902 J kg−1 K−1.
This satellite has a component that can only function at temperatures above 0◦C. You need to plot out the change of temperature that occurs over time, and determine if this mission will be successful. For this you will need the previously described satellite specifications, as well as the physical constants given in table 1, located in the appendix. It is important that you take into account the amount of time that the satellite spends in eclipse, and the effect that this will have on the temperature.
2
Tasks
This task will require you to calculate the temperature values across a range of time values, sort them in an array, and plot and display them as a graph. No example code will be supplied, but you should be able to complete every aspect of this activity on your own.
Any code which works and shows appropriate MATLAB skills is fine, but we will provide a detailed walk though of how to complete each task. If in doubt, make sure to use the various resources available to you, such as the help function, the teaching assistants and, of course, this handout. One of the more comprehensive resources that is available for use is the MATLAB documentation section on the MathWorks website.1
This exercises will focus primarily on testing your knowledge of arrays and if statements, but it also involves a lot of coding algebraic expressions. As such, it is recommended that you keep your Spacecraft Systems course notes on hand. All necessary equations will either be provided, or can be found in Chapter 6.
With that in mind, here is a step-by-step guide to completing this exercise:
1. This first step is to define the various inputs and physical constants that you will need in your code.
To make things easier, a list of the parameters that you will need to create is provided in table 2 in the appendix to this guide.
Be sure to give your variables suitable names. This will both help you keep track of the various properties, and it will help us mark your work.
2. Before you can calculate the change in temperature, there are several other pa- rameters that you will need to calculate first. You will need to use the previously listed variables to calculate the thermal time constant (τt), the equilibrium tem- peratures (Teq), and the time spent in eclipse (te). Once you have these, you will use them to calculate the change in temperature (dT).
The simplest of these is the thermal time constant (τt).
[HINT: You will need to find the equation for this in chapter 6 of your notes, and then translate this into MATLAB. This is a fairly simple algebraic expression, so you should be familiar with the arithmetic operators necessary to code this equation.]
1It can be found here: https://uk.mathworks.com/help/matlab/ You can search for general phrases, or a specific function which you know the name of like plot. It will provide you with a description, usage syntax, usage examples, and more.
3
3. Next, you will need to calculate the Thermal Power Input (Qin), and use it to calculate the Equilibrium Temperature (Teq). You will need to do this twice, once for the equilibrium temperature during sun exposure, and once for the equilibrium temperature during eclipse. Note that there are some differences between the two sets of equations, so you’ll need to create four different variables, with four different equations (two Qin variables, and two Teq variables).
The equations for sun exposure can be found in your notes, and for simplicity the equations for eclipse can be seen in equations 1 and 2.
Qin = qe.A.ε (1) 4 Qin
Teq = ε.σ.A (2) As you can see these mostly rely on multiplication, division and exponents, so
you should have no trouble translating them to MATLAB.
4. Before you can calculate the change in temperature, you first need to determine the eclipse duration for the satellite.
θ = arcsin(RE ) (3) r
Equation 3 gives the angles at which a satellite will be in eclipse, assuming that the sun line is normal to the surface. Note that is a quite a big assumption, but it should be suitable for this piece of code.
Figure 1 gives an indication of what the parameters described in this equation mean. Assuming a circular orbit, and thus a constant velocity, you can find the fraction of the total distance of each orbit spent in eclipse. Then, find the time in eclipse by multiplying the orbital period (P) by this fraction.
When it comes to inputting this into MATLAB, the only thing you might have trouble with is the inverse sine function. Try using the arcsin function to get the inverse sine in radians, and asind to get it in degrees.
5. Once all of these parameters have been obtained, it is possible to calculate the change in temperature over time. This can be done using equation 4.
dT (T4 −T4)
= eq (4)
dt τt
In order to do this, you will need to use numerical iteration. There are a variety
of ways to do this, but here is a simple explanation.
You will need to take take the orbital period (P), and divide it into set time steps (dt). You will need to calculate the change in temperature that occurs in each
4
Figure 1: Angles of eclipse cast by Earth
time step, add it to the previous temperature, and save that value in an array. You will also need to save the total time elapsed (t) to a corresponding position in another array. You need to to write your code so that this can be repeated for each subsequent time step. You can use a while loop for this. This is a simple matter of setting it so that while the current time elapsed is less than the orbital period, the time will continue to progress by one time step.
Naturally, the conditions will change based on whether or not the satellite is in an eclipse. To determine this, use an if statement within the while loop. If the satellite is in the sunlight the temperature will increase to the equilibrium temperature for solar exposure, and if it is in eclipse the temperature will decrease to the equilibrium temperature for eclipse. In terms of equation 4, if the satellite in eclipse than the equilibrium temperature for eclipse will be used, and if the satellite is not in eclipse than the equilibrium temperature for sun exposure will be used.
A simple flow diagram depicting this process can be seen in figure 2. You will need to take this flow of logic and translate it to MATLAB script using while loops and if statements.
[HINT: To aid you with saving the temperature and time values to an array, it is recommended that you create a “counter” variable, and increase it by one with each iteration of the loop. When it comes time to save these values to an array, you can simply save them to the ”counter” position in the array.]
6. Once the values are saved to an array, you will need to plot these on a graph. You can use the plot function for this.
Additionally, for readability you will need to display at which points the satellite is in eclipse. The exact way that you do this is up to your own discretion. It could be by drawing a line to indicate the point at which eclipse starts, by shading the
5
eclipse area, or any other methods you can think of.
Finally, you will need to label your graph, and make it readable.
Figure 2: Flow diagram depicting code to calculate temperature change
Discussion
1. Would deploying this satellite at a higher altitude be a valid method for avoiding component failure? Comment on the practicality of using this as a solution.
2. If you were to change the surface coating to a material with had a solar ab- sorptance of 0.25 and an emittance of 0.25, would that be more suitable for this mission? Support your answer by presenting a time graph for this on the same axis as the previously described scenario. Be sure to label your graph carefully. You may need to experiment with the hold on and hold off functions for this.
3. What simplifications are present in this analysis? How would you overcome these if you had the time?
4. Pick three MATLAB functions, expressions or statements that you used to solve this problem. Briefly explain what they do, and how you used them in your code.
5. Find one place where your code could be improved, state the line(s), and how you could improve it. Think about how easy it is to use, how easy it is for others to understand the code, how fast it is, etc.
6
If you are assigned this tutorial, you must hand in a MATLAB Live Script. This must include:
• Working code which produces the graph described in the Tasks section. Make sure it has:
– Appropriately labelled axes
– An appropriate title
– A curve for both the original surface, and the painted surface – An appropriate and clear legend.
• Comments and text paragraphs explaining what is happening at each point of the code, and your justification for any decisions you made. Look online for good commenting practices2.
• Answers to the questions in the Discussion section above.
2Try reading https://blog.codinghorror.com/code-tells-you-how-comments-tell-you-why/ and https://www.cs.utah.edu/~germain/PPS/Topics/commenting.html if you’re not sure where to start.
7
Appendix
Property
Value
Solar radiation flux, qs
1400 W m−2
Earth radiation flux, qE
240 W m−2
Earth albedo, ar
0.3
Stephan-Boltzmann constant, σ
5.67 × 10−8 W m−2 K−4
Radius of Earth, RE
6371 km
Standard gravitational parameter of Earth, μ
3.99 × 105 km3 s−2
Table 1: Thermo-physical Data
Symbol
Property
qs
Solar radiation flux
qe
Earth radiation flux
ar
Earth albedo
σ
Stepahn-Boltzmann constant
RE
Radius of Earth
μ
Standard gravitational parameter of Earth
h
Altitude
α
Absorptance
ε
Emittance
m
Mass
A
Area
cp
Specific heat capacity
Ti
Initial temperature
Table 2: List of necessary parameters
8