Custom Ephemeris and Attitude Tutorial May 2012 STK 9.2 Table of Contents Introduction ........................................................................................................................ 3 Create Scenario ................................................................................................................... 4 Insert the Objects................................................................................................................ 4 Create Planets ................................................................................................................. 4 Create the Deep Space Network..................................................................................... 4 Create FeatherSail ........................................................................................................... 6 Create a Model File from CAD ........................................................................................ 6 Attach the Model ............................................................................................................ 6 Import Ephemeris for FeatherSail................................................................................... 7 Ephemeris File ..................................................................................................................... 8 File Header Content ........................................................................................................ 8 Gather Your Data .......................................................................................................... 10 Cleaning up the View ........................................................................................................ 10 Fix Planet Graphics ........................................................................................................ 10 Fix FeatherSail Visuals ................................................................................................... 11 Ecliptic Plane ................................................................................................................. 12 Import Attitude Data ........................................................................................................ 13 FeatherSail Attitude Reference Axes ............................................................................ 13 Apply the Attitude Data ................................................................................................ 15 Attitude File................................................................................................................... 16 Conclusion ......................................................................................................................... 17 Introduction In this tutorial, we will examine how to import data from other analyses into STK for further analysis. We will examine a solar sail satellite called FeatherSail, slated for a mission in October 2015. While STK has modules capable of computing solar radiation pressure (the propulsion used for solar sail spacecraft), they’re expensive and not included in your Educational License. Therefore, we will be starting with ephemeris (trajectory) data and attitude data from a MATLAB simulation. These will be converted into an appropriate file format and read by STK. FeatherSail is a small solar sail satellite (~50 kg) designed to leave Earth orbit and approach the sun. Its mission is to map the complex magnetic field of the sun at various radii and inclinations to provide a 3-D map of the data. Since solar radiation pressure increases in intensity with the square of the distance of the satellite from the planet, FeatherSail gets a lot more thrust when it is closer to the sun. In its mission profile, it descends as quickly as possible to approximately 0.5 AU above the sun (below which it would be too warm to function). It also increases its inclination when it is convenient to do so, based on an optimization algorithm. After it reaches its target altitude, it begins to really crank its inclination out of the ecliptic plane. The hardware on board is estimated to have a 10 year lifetime, so that is the duration of the mission. During flight, FeatherSail will communicate with Earth via the Deep Space Network: three antenna stations positioned 120 degrees apart longitudinally on Earth so that collectively, they have complete access to all points in the sky at all times. Create Scenario Begin by creating a scenario within STK. 1. 2. 3. 4. 5. 6. 7. 8. Launch STK Click Create New Scenario. Name the scenario “FeatherSail”. Choose an appropriate save location. In the first Analysis Period box, enter “22 Oct 2015 00:00:00.0 UTCG” In the second box, enter “+10 years” to cover the entire mission duration. Choose the Central Body to be “Sun”, since this is primarily a solar mission. Click OK to finish creating the scenario. Insert the Objects Your next step is to insert all of the objects that you’ll need to begin this analysis. This will include the planets Earth and Venus, as well as the FeatherSail satellite. Create Planets 1. First, close the 2-D Graphics window. It won’t be needed. 2. Use the Insert STK Objects window that automatically opened for all new objects. 3. Click Planet under “Scenario Objects”, and then in the left pane under “Select a Method”, choose Define Properties. 4. Click Insert, and a new planet will appear in the Object Browser. The planet’s properties page should automatically open. 5. Select the “Basic -> Definition” menu from within the planet’s properties, and select the Central Body to be Earth. 6. Click on “2D-Graphics -> Attributes” to change the color and/or marker. 7. Click OK and notice that the planet’s name and orbit have automatically updated. 8. Repeat steps 3 through 7 to create the planet Venus. Create the Deep Space Network The Deep Space Network is a series of three antenna stations positioned around the world to provide uninterrupted access to deep space satellites. 1. Click on Earth in the Object Browser. 2. Click the small arrow next to the “New Object” button to activate the pull-down menu. 3. Select Facility from the list and change the Central Body to Earth. 4. Rename the facility to Goldstone_DSCC. 5. Open Goldstone_DSCC’s Properties. Change the Latitude to 35.4267 deg and the Longitude to -116.89 deg. The negative sign means South for latitude and West for longitude. 6. Repeat steps 1 through 5 for the other two observing stations using the following information: Station Name Goldstone_DSCC Madrid_DSCC Canberra_DSCC Latitude [deg] 35.4267 40.4314 -35.4014 Longitude [deg] -116.89 -4.2481 148.982 7. Confirm that the facilities have ended up on Earth in California, Spain, and Australia. 8. These viewing stations cannot see satellites less than 10 degrees above the horizon, so we must set a constraint on their visibility. 9. Select all three facilities at once in the Object Browser. 10. Click the Properties button at the top of the Object Browser to change all three properties simultaneously. 11. Go to the “Constraints -> Basic” page, and check the box called Min under “Elevation”. 12. Specify the value to be 10 degrees. Click OK to finish. 13. If you plan to use these stations in subsequent analyses, you can link them together with a Constellation item. Select Constellation from the “New Object” pull down menu. 14. Rename the Constellation to DeepSpaceNetwork. 15. Open its properties and select all three facilities from the “Available Objects” list. Click the Right Arrow to move them to the “Assigned Objects” list. Click OK. Create FeatherSail 1. Return to the “Insert STK Objects” window and select Satellite. For the method, select Define Properties. Click Insert to create the object. 2. Rename this satellite in the Object Browser to be “FeatherSail”. 3. Right click on FeatherSail and select Zoom To to zoom up close to the satellite. Create a Model File from CAD You’ll notice that the model being used for FeatherSail doesn’t much resemble a solar sail. As part of the design, you’ve already made a rough CAD model of the spacecraft using SolidWorks. You can turn this SolidWorks model into an STK Model file (.mdl). To do this, you’ll first need to convert your CAD model into a Lightwave file (.lwo). If your CAD package cannot do this directly by saving (such is the case with SolidWorks), you can use a number of online converters to do so. Two such converters are listed below and have a free demo that can be used for quick work. Start by saving your CAD model/assembly as a VRML file (.wrl). Then use the converter to convert to the Lightwave file (.lwo). Okino Polytrans - www.okino.com/conv/conv.htm Right Hemisphere Deep Exploration www.righthemisphere.com/products/dexp/de_std.html Once your model is in the Lightwave format, you can use AGI’s LWConverter program to create a model file (.mdl). Download the converter for free at the link posted below. Unzip and run the program, select your model and click Convert. http://www.agi.com/resources/download/files/LwConvert28b.zip Note that models from CAD files will typically contain an overwhelming number of polygons. It is important that you only use low fidelity models with minimum surfaces in order to prevent STK from getting bogged down with your model. The model files from each step in this description are provided for you with this tutorial, so you may repeat any step, or just move forward with the final model. Attach the Model Now you’ll want to attach the new model file you made to your satellite. 1. Open the properties of FeatherSail if they are not already up. 2. Select “3D Graphics -> Model” from the menu. 3. In the “Model” group, click the […] button next to the “Model File”. 4. Navigate to the model you created, or the FeatherSail.mdl file that came with this tutorial and select it. 5. Click Apply and return to the 3D Graphics window to see the model applied. Note that some of the polygons are transparent, a feature that results from using the demo version of the converter programs. 6. Close the “Insert STK Object” window, as we have finished adding items for now. Import Ephemeris for FeatherSail Currently, FeatherSail is in an arbitrary orbit. Let’s import our known trajectory data so we can see its solar mission trajectory. 1. Open FeatherSail’s properties. Select “Basic -> Orbit”, which is the default page. 2. Select the “Propagator” pull-down menu and select STK External. This indicates that you will be using an external ephemeris file for trajectories. 3. An ephemeris file (.e) has been provided for you. Click the […] button next to “Filename” and select the file FeatherSail.e. Click OK to exit the properties. 4. In order to see the orbit, you’ll need to return your view to the Sun. Click the Home View button in your 3D Graphics toolbar. If you cannot find this button, right click the toolbar and ensure that 3D Camera Control is checked. 5. Zoom out from the sun by right clicking and dragging your mouse forward. Orient your view where you can see the entire trajectory, including Venus and Earth. 6. Store this view by clicking the Store View button in the 3D graphics toolbar, three buttons to the right of Home View. 7. Click New, change the name from “view0” to “OrbitView”. 8. Uncheck “Set Current Time to View Time” so that you can return to this view at any point in the simulation without resetting the time. Click OK. 9. To return to this view at any time, click the little downward triangle next to the “Stored Views” button, and select OrbitView from the drop-down list. Ephemeris File The ephemeris file was given to for this simulation, but we will go into the details to show you how to make one of your own. File Header Content The ephemeris file is just a standard ASCII delimited file (or a text file) saved with the extension “.e”. You can edit or write these files with any standard text editor. I prefer WordPad simply because it puts new-line data on the next line, unlike NotePad. The first few lines of the file give STK all the information it needs to properly read the data you’re providing, which comes in later lines. Let’s review the header content. 1. Open “FeatherSail.e” with WordPad or another text editor. 2. Notice the first three lines: stk.v.9.0 BEGIN Ephemeris NumberOfEphemerisPoints 5000 3. These lines must be included in every ephemeris file and are the only required lines for this initial code. The first two lines specify the STK version and the filetype. The third line specifies the maximum number of points that will be read. It can be set to any value, but make sure it is greater than the number of data points you supply. 4. Note that at the very last line of the file, there is a complimenting “END ephemeris”. This is also required in every ephemeris file. 5. Commands and arguments are always separated by one or more spaces. 6. Look at the next four lines: ScenarioEpoch 22 Oct 2015 00:00:00.000000000 CentralBody Sun CoordinateSystem J2000_Ecliptic DistanceUnit Kilometers 7. The first line specifies the epoch for the data, or the date and time from which all the data points are measured from. If this line is not supplied, then the scenario’s start time will be used by default. 8. The second line specifies the Central Body for the trajectory. Earth is used by default, so since we want a solar trajectory, we must specify that it uses the Sun. 9. The third line is the coordinate system we will be measuring our trajectory information relative to. You may find available axes from the website listed below. Additionally, you can explore which axes you’d like to use by displaying them in the 3D Graphics Window a. Open the properties of the 3D Graphics Window. b. Select the Vector page. c. Click Add and choose a coordinate system from the Sun list that looks useful. Note that “Fixed” axes rotate with the Sun and “Inertial” axes do not. Also note that not all useable coordinate systems are available through this menu. J2000_Ecliptic, for example, cannot be displayed this way. d. Select the axes you want, click the Right Arrow to add them, and then click okay. e. Check the axes you want to show and view them in the 3D Graphics window. Run the simulation to watch axes move. http://www.agi.com/resources/help/online/ODTK/source/od/stk/astrocomps.ht m 10. We will use the J200_Ecliptic coordinate system. It uses the Vernal equinox as the x-axis, and the ecliptic normal as the z-axis. This is what was used in the MATLAB simulation as well, so the data should match. 11. The fourth line specifies the distance unit. Default is “Meters”. 12. Observe the next two lines: EphemerisTimePosVel 0.000000 117597728.483141 90587339.370622 194.804810 -14.999093 18.849019 -0.000228 13. The first line tells STK what type of data you are providing. In this case, we are providing data points that include the time after the specified epoch, the position in (x,y,z) coordinates, and the velocity in (vx, vy, vz) coordinates. The first data point is shown in the second line. 14. There are many formats you can choose from. The website linked below provides information on all possible commands used in ephemeris files. http://www.stk.com/resources/help/online/stk/source/stk/importfiles-02.htm Gather Your Data After the initial code is specified, you can provide your trajectory data to the file. To generate FeatherSail.e, we used MATLAB to generate position and time data from its integrator and are stored in the file “FeatherSail_Ephemeris.mat”. 1. Open MATLAB 2. Open the script called “GenerateEphemerisFiles.m” 3. Run the script. It loads the trajectory data from MATLAB into memory, then writes an ASCII file with all the data points. 4. Each data point is defined as the time since epoch, the x-y-z coordinates, and the velocities, all separated by a single space. Only one data point is allowed per line. 5. This script generates a text file called “FeatherSailData.txt” which includes the properly formatted data. 6. Copy and paste this data into your ephemeris file beneath your definition of the data type. 7. At the end of the data, add the final line, which is required: END Ephemeris 8. Save the file as a text file (.txt) in the type selector, but add the extension “.e” to its name. Cleaning up the View Lets return to STK. Pull up the 3D Graphics Window and select your OrbitView from the “Stored Views” menu. You might observe that the 3D Graphics window is not quite formatted in an informative way. There are four main problems. First, the planets orbits are not showing up. Second, there are planet labels on the Sun. Third, you cannot see where FeatherSail is on its orbit. Finally, you can immediately tell that we are not seeing FeatherSail’s entire orbit if it is indeed a 10 year mission. This section will show you how to adjust all of these visual settings. Fix Planet Graphics We’ll begin by fixing the first two problems related to the planet graphics. 1. Select both Earth and Venus from the Object Browser at the same time. 2. Click the Properties button at the top of the Object Browser to configure both planets at the same time. 3. Select “3D Graphics -> Attributes” and uncheck “Inherit from 2D Planet Graphics” 4. Now, check “Show Inertial Position”, “Show Position Label”, and “Show Orbit”. By not selecting the other two options, the labels on the Sun will be removed. 5. Click OK and confirm that the planets orbits are showing with appropriate labeling. Fix FeatherSail Visuals Now we will look at how to display FeatherSail so it is visible from this view. 1. Open FeatherSail’s properties. 2. Select “3D Graphics -> Model”. 3. In the “Details Threshold” panel, we can set the minimum distance at which you can see FeatherSail. 4. Select the slider bar corresponding to Marker, Label and drag it all the way to the right. The value should increase to 1e+012 km. Now the FeatherSail marker will appear no matter how far you are zoomed out in the 3D Graphics Window. 5. Look under the “Marker” button group. Change Pixel Size to 4. 6. Select the “3D Graphics -> Pass” menu. 7. Make sure “Inherit from 2D Graphics” is unchecked. 8. Under “Orbit Track”, change the “Lead Type” pull-down menu to All. 9. Click Apply and view the 3D Graphics Window. You should be able to see all of FeatherSail’s orbits now. The only problem is that FeatherSail’s label is large and gets in the way of the graphics. 10. Return to the Properties page and select “2D Graphics -> Attributes”. 11. Under the “Label” identifier, uncheck “Use Instance Name as Label”, and change the Label Name to “FS”. 12. Click OK and ensure everything looks correct in the 3D Graphics Window. Ecliptic Plane FeatherSail’s mission is to take the spacecraft out of the ecliptic plane. We’ll add the ecliptic plane to the simulation in order to better visualize its progress. 1. Open the Properties of the 3D Graphics Window. 2. Select Grids. 3. Check the box next to Show in the “Ecliptic Coordinates” group. Choose a dark color for the grid lines. 4. Click OK to view the ecliptic plane. 5. Now that the 3D Graphics Window is set up, watch the animation by pressing Play. Be sure to speed up the time step. 6. Reset the Animation when you are finished. Import Attitude Data Because solar sail satellites use reflected sunlight for propulsion, their attitude and orbital dynamics are heavily coupled, because the satellite must control in what direction it reflects light. This may limit instrument usage and communications because it cannot always point to Earth to communicate. We can specify FeatherSail’s attitude with a file similar to the ephemeris file called an attitude file (.a). Before we can do that, we must create the axes about which the attitude is defined. FeatherSail Attitude Reference Axes The attitude for a solar sail is convenient to be represented by a coordinate system that has the sail normal to the radial direction from the Sun. This is because, in this orientation, the solar sail produces no net thrust to change its orbital velocity and remains in a stationary orbit. In the MATLAB simulation that generated the trajectory and attitude data, the attitude was defined as a rotation about the orbit normal direction (a yaw rotation within the orbit plane) and then a rotation about the spacecraft body axis that was originally coincident with the orbit tangent direction (a pitch rotation out of orbit plane). These rotations originate from the orbit radial direction and can independently control the tangential and normal acceleration of FeatherSail, respecitvely. Let’s model these axes. 1. First, we’ll need to create the radial-direction vector from which our attitude is based. Open the Vector Geometry tool. 2. Select FeatherSail in the object tree on the left and expand its tree. 3. Select the Position vector. From the information that populates on the right, this vector points from the Sun center to FeatherSail. 4. 5. 6. 7. 8. Click Create New Axes…, which is the second button in the “create:” list. Ensure that the Parent is “Satellite/FeatherSail”. Name the axes Radial_CS. Change the field by “Type” to be Aligned and Constrained. In the “Aligned Vector” section, change the “Reference Vector” to Position using the “Select…” button. 9. Change the value in the box labeled “Z:” to be 0 and “X:” to 1. 10. In the “Constrained Vector” section, change the “Reference Vector” to Orbit_Normal using the “Select…” button. 11. Change the value in the box labeled “X:” to be 0 and “Z:” to 1. 12. Click OK. The new axes should appear with a green label in the Vector Geometry Tool. These axes will always have the x-axis pointing in the radial direction and the z-axis in the orbit normal direction. 13. Close the Vector Geometry tool. Now let’s display the new axes on our spacecraft. 14. Open FeatherSail’s properties and select “3D Graphics -> Vector”. 15. Click the Add… button. 16. Under FeatherSail’s axes, select Radial_CS. Click the Right Arrow to add it to the list of selected axes. Click OK. 17. Ensure that “Show” is checked for “Radial_CS”. Also check Body Axes. This will allow us to visualize the attitude relative to the coordinate system. Click OK. 18. Zoom to FeatherSail through the Object Browser and view the axes you’ve created. Play the animation and note that the reference axes change as the satellite moves such that the x-axis is always in the radial direction and z-axis is always in the orbit normal. Apply the Attitude Data Now we will add the given attitude file to the simulation. 1. Open FeatherSail Properties. Go to the “Basic -> Attitude” page. 2. On the far right, under the “Precomputed” group, check the box that says “Override Basic and Target Pointing Attitude for specified times” 3. Next to “File”, click the […] button and browse for the given attitude file “FeatherSail.a”. 4. Click OK. Look at the 3D Graphics Window and see how the attitude has changed. Run the animation and watch FeatherSail move relative to its reference coordinate system. Attitude File The attitude file is very similar to the ephemeris file. We will go over some key differences. 1. Open the attitude file “FeatherSail.a” in a text editor. 2. Review all the header commands and arguments: stk.v.9.0 BEGIN Attitude NumberOfAttitudePoints 5000 ScenarioEpoch 22 Oct 2015 00:00:00.000000000 CentralBody Sun CoordinateAxes Custom Radial_CS Satellite/FeatherSail Sequence 231 AttitudeTimeEulerAngles 3. As usual, we begin with the STK version and a command that signifies the beginning of an attitude file BEGIN Attitude. The NumberofAttitudePoints must be specified, just as with the ephemeris file. 4. ScenarioEpoch and CentralBody are not required, but generally a good idea to include. 5. Since we are using coordinate axes that we generated ourselves, we must point STK to those axes. First, the command is Coordinate Axes. Then a space followed by the word Custom. Next comes a space and the name of the axes we wish to use as reference, in this case: Radial_CS. Finally, we must point to the parent object of the reference axes in the format <Object Type>/<Object Name>. In this case, it is Satellite/FeatherSail. 6. Note that you cannot specify units like you could in ephemeris files. Rotations are always in degrees and cannot be changed to radians. 7. Sequence is a command that specifies the order of the axes about which the rotations will occur. By default, 313 is used. In this case, we want to yaw and then pitch, so we will use a 321 rotation sequence (where the third rotation is always zero). 8. Finally, we specify the data type we will be providing. In this case, we will specify time, and Euler angles (using the 321 sequence). You may choose many types of data to provide, including LLA, YPR, etc. The types of data and header commands are listed in full on the following website: http://www.stk.com/resources/help/online/stk/source/stk/importfiles01.htm#yprAngles 9. The data is added the same as the ephemeris file’s data was. There is MATLAB data provided with this tutorial in “FeatherSail_Attitude.mat”. This data can be called and written to a file using “GenerateAttitudeFiles.m”. A reminder that only one data point may be entered per line and values in that data point must be separated by at least one space. 10. Finally, the attitude file ends with the required command: END Attitude 11. Return to STK. Be sure to save your work. Conclusion At this point, the scenario is ready for any type of analysis you might want to run, including access calculations and link budgets between FeatherSail and the Deep Space Network or perhaps close-approaches with Venus. In this tutorial, we discussed how to generate your own model files for visual enhancement, ephemeris files (.e) for custom trajectories, and attitude files (.a) for custom attitude profiles. These files were added and manipulated to recreate results generated in other programs, now available for analysis with the powerful tools offered by STK.