Importing External Data Files Into STK
STK Pro, STK Premium (Air), STK Premium (Space), or STK Enterprise
You can obtain the necessary licenses for this tutorial by contacting AGI Support at support@agi.com or 1-800-924-7244.
The results of the tutorial may vary depending on the user settings and data enabled (online operations, terrain server, dynamic Earth data, etc.). It is acceptable to have different results.
The external data files used in this tutorial represent telemetry data that would come from an external source. It is not actual data associated with the Satellite () object used in this scenario. They're used to show you how to format and insert your data when working with STK. Throughout this tutorial, Notepad ++ was used as the text editor.
Capabilities Covered
This lesson covers the following STK Capabilities:
- STK Pro
- Analysis Workbench
Overview
STK users can create external files of data to import into STK. These files can provide reference data for an object. These objects must conform to the appropriate file format. Furthermore, you can use STK to display time-ordered mission data on the 3D Graphics window during scenario playback. This feature is useful if you receive post-flight or post-operation telemetry data that is critical to visualize during scenario playback. This information can be used to help understand behaviors of your vehicle and its subsystems in a comprehensive 3D environment.
Video Guidance
Watch the following video. Then follow the steps below, which incorporate the systems and missions you work on (sample inputs provided).
Create a New Scenario
Create a new scenario with a run time of twenty four (24) hours.
- Launch STK ().
- Click the Create a Scenario () button.
- Enter the following in the STK: New Scenario Wizard:
- When you finish, click .
- When the scenario loads, click Save (). A folder with the same name as your scenario is created for you.
- In the Save As window, verify the scenario name and location and click .
Option | Value |
---|---|
Name: | External_Data_Test |
Description: | Format and use external data files in STK using Connect and the Analysis Workbench. |
Start: | 1 Jan 2019 16:00:00.000 UTCG |
Stop: | 2 Jan 2019 16:00:00.000 UTCG |
Save Often!
Add A Satellite
Add a Satellite () object to the scenario.
- Using the Insert STK Objects Tool () insert a Satellite () object using the Orbit Wizard () method.
- When the Orbit Wizard opens, change Satellite to TestSat.
- Accept the remaining default settings and click .
External Data Files
An External Data file is an ASCII text file formatted for compatibility with STK that ends in a *.txt extension. External Data files contain time ordered object data computed outside of STK.
External Data files, like other external file formats, must contain a version stamp. A version stamp indicates the version of STK software for which the file is formatted to be used. Files can be created in, and imported to, STK software versions consistent with the file version stamp or higher. The version stamp must be the first line in the External Data file. For example, a file created in and stamped with STK 4.0 could be imported into STK software version 4.0 through the most recent version.
External Data files also contain data groups and data elements to ensure that the data contained in the file can be read by STK. A DataGroup identifies a group of related quantities that will be specified on the same time grid. Individual values are specified using DataElements.
External Data File Format Example
A properly formatted External Data file might look like the following example file. There are two data fields "bippy" and "zippy."
External Data File Example
- Open Notepad, Notepad ++, WordPad, or another text editor that does not add hidden characters to your text.
- Click here to open the STK Help page where the external data file example is located.
- Copy the external data file example and paste it into the text editor.
Edit the File
It is important to note that the times in the data file are given as 'seconds past the reference epoch.' Be sure to set that reference epoch and/or generate your times accordingly.
- In STK, open TestSat's () properties ().
- On the Basic - Orbit page, locate the Orbit Epoch: field.
- Copy the Orbit Epoch: time.
- Click .
- In the external data file example, replace the ReferenceEpoch time with the Orbit Epoch time from TestSat ().
- Remove the UTCG unit.
- Change "bippy" to "Distance."
- Change "zippy" to "Rate."
Example:
ReferenceEpoch 1 Jan 2019 16:00:00.000
Save the File
Save the file as a Normal text file (*.txt) file.
- Open the File menu and select Save As.
- Browse to the scenario folder (e.g. C:\Users\username\Documents\STK 12\External_Data_Test).
- Name the File Name: "My External Data."
- Click .
ExternalData Connect Command
After the file is created, a simple Connect command can associate the external file with the Satellite object. The command executed is the ExternalData command. The command allows for the association and management of time ordered data computed outside of STK with STK objects.
The syntax for the command is:
ExternalData <ObjectPath> {DataOption} [<Parameters>]
- In STK, close the Timeline View.
- Click the New Integrated HTML Browser () icon in the STK default toolbar.
- Click the Browse () icon in the New Integrated HTML Browser's HTML View Controls toolbar.
- Click the Example HTML Utilities icon when the Open window appears.
- Open folders in the following order:
- STK Automation
- API Demo
- Open the API Demo Utility.htm.
Type the Connect Command
- When the API Demo Utility opens, remove any text within the Code Sandbox.
- Enter the following Connect command into the Code Sandbox:
- Inside the quotation marks, copy and paste the path of the External Data.txt file (e.g. ExternalData */Satellite/TestSat ReadFile "C:\Users\username\Documents\STK 12\External_Data_Test\External Data.txt" Save).
- Click .
- When finished, close the API Demo Utility tool.
ExternalData */Satellite/TestSat ReadFile "" Save
Create a Custom Report
Now that the data is read into STK and associates with the Satellite () object (TestSat), you can create a custom report of the data in order to generate a report and display it dynamically on the 3D Graphics window. To create the report, open the Report & Graph Manager.
- In the Object Browser, right-click on TestSat ().
- Select the Report & Graph Manager option.
- In the Styles list, select the folder named "External_Data_Test Styles."
- Click the Create new report style () icon.
- Rename the new report "External Data Text File."
- Press ENTER to open the report's properties ().
Report Content Properties
In the Report Content Properties Content page, all of the Data Providers available for a particular object are located in the Data Providers section.
- Expand () the group named "User Supplied Data."
- Expand () the data provider named "My Data."
- Move () the following to the Report Contents:
- Time
- Distance
- Rate
- Click .
- Generate the External Data Text File report.
- When finished, close the report and the Report & Graph Manager.
3D Graphics Properties for STK Objects - Data Display
In an object's properties, the 3D Graphics - Data Display page is used to display dynamic data for the specified object in the 3D Graphics window. This feature is useful when presenting information that requires both visual and textual data.
- Open TestSat's () properties ().
- Select the 3D Graphics - Data Display page.
- Click the button.
- Select External Data Text File in the Styles field.
- Click .
- Make any desired Position and Appearance changes and click .
View in 3D
- Bring the 3D Graphics window to the front.
- Zoom To TestSat ().
- In the Animation Toolbar, select X Real-time Animation Mode ().
- Reset () the scenario.
- Click Start ().
- When finished, reset () the scenario.
As the scenario plays, you can see a dynamic display of the external data in the 3D Graphics window.
3D Graphics External Data Display
Calculation Scalar Format
Another way to get external data into STK is by using a Calculation Scalar file (*.csc). A Calculation Scalar file is an ASCII text file formatted for compatibility with STK that ends in a *.csc extension. The first step is to convert the user supplied data into STK's "*.csc" format. When completed, you can convert the file into a STK report and dynamically display the report in the 3D Graphics window. There are two example files located in STK Help: TimeValues and TimeValueRates.
- TimeValues: Indicates that subsequent time-ordered tabulated data will contain two columns: time and scalar values.
- TimeValueRates: Indicates that subsequent time-ordered tabulated data will contain three columns: time, scalar values, and their rates.
TimeValueRates Format
For this scenario, use the TimeValueRates example.
- Return Notepad, Notepad ++, WordPad, or another text editor that does not add hidden characters to your text.
- Open the File menu and select New.
- Click here to open the STK Help page where the TimeValueRates example is located.
- Copy the TimeValueRates Format (*.csc) Example and paste it into the text editor.
Edit the File
It is important to note that the times in the data file are given as 'seconds past the reference epoch.' Be sure to set that reference epoch and/or generate your times accordingly.
- In STK, open TestSat's () properties ().
- On the Basic - Orbit page, locate the Orbit Epoch: field.
- Copy the Orbit Epoch: time.
- Click .
- Remove the pound sign (#) from ReferenceEpoch.
- In the Calculation Scalar File example, replace the ReferenceEpoch time with the Orbit Epoch time from TestSat ().
Change the Units
- Remove the UTCG unit.
- Change ValueUnit to km.
- Change ValueRateUnit to km/sec.
Example:
ReferenceEpoch 1 Jan 2019 16:00:00.000
Change the Date Format
- Drop down to the telemetry data field (e.g. BEGIN TimeValueRates).
- On your keyboard, press CTRL + F.
- Select Replace.
- In the Find what: field, enter the date of the data (e.g. 18/09/2013).
- In the Replace with: field, enter the data of the ReferenceEpoch using the DD/MM/YYYY format (e.g. 01/01/2019).
- Click Replace All.
- Close the Replace window.
Depending on your text editor, the following steps may be slightly different. In this example, we're using Notepad ++.
Fix the Times
- Manually fix all the times so they match the starting hour of your scenario.
- Take a look finished file below:
Example of finished file:
Edited CSC File
Save the File
- Extend the File menu.
- Select Save As.
- Browse to the scenario folder (e.g. C:\Users\username\Documents\STK 12\External_Data_Test).
- Open the Save as type: pull-down menu.
- Select All types: (*.*).
- Name the File Name: MyTimeValueRate.csc.
- Click .
- Close the text editor.
Analysis Workbench Calculation Tool
The Calculation Tool includes components of the following basic types: Scalar, Condition, and Parameter Set.
- Right-click on TestSat ().
- Select Analysis Workbench ().
- When the Analysis Workbench opens, select the Calculation tab.
Scalar Calculation
Scalars define components that produce scalar time-varying calculations.
- Click the Create new Scalar Calculation () button.
- In the Add Calculation Component window, set the following:
- Click .
- Close the Analysis Workbench.
Option | Value |
---|---|
Type: | File |
Name: | MyTelemetryData |
Filename: | MyTimeValueRate.csc (browse to the location of the file) |
Create a Custom Report
Create a custom report of the data in order to generate a report and display it on the 3D Graphics window. To create the report, open the Report & Graph Manager.
- Right-click on TestSat ().
- Select the Report & Graph Manager tool.
- In the Styles list, select the folder named "External_Data_Test Styles".
- Click the Create new report style () button.
- Rename the new report "External CSC Telemetry Data."
- Press ENTER to open the report's properties ().
Report Content Properties
In the Report Content Properties Content page, all of the Data Providers available for a particular object are located in the Data Providers section.
- Expand () the group named "Scalar Calculations."
- Expand () the data provider named "MyTelemetryData."
- Move () the following to the Report Contents field:
- Time
- Scalar
- Scalar Rate
Rename the Report Contents
- In the Report Contents field, select Scalar Calculations-MyTelemetryData-Scalar.
- Click the button.
- Rename Title: "Kilometers."
- Click .
- In the Report Contents field, select Scalar Calculations-MyTelemetryData-Scalar Rate.
- Click the button.
- Rename Title: Kilometers per Second.
- Click .
- Click to close the report's properties.
Generate the Report
- Generate the My CSC Telemetry Data report.
- When finished, close the report and the Report & Graph Manager.
3D Graphics Properties for STK Objects - Data Display
Place the telemetry data onto the 3D Graphics window.
- Open TestSat's () properties ().
- Select the 3D Graphics - Data Display page.
- Clear the External Data Text File check box.
- Click the button.
- When the Add a Data Display window appears, in the Styles field, select External CSC Telemetry Data.
- Click .
- Make any desired Position and Appearance changes.
- Click .
View in 3D
- Bring the 3D Graphics window to the front.
- Zoom To TestSat.
- In the Animation Toolbar, select Normal Animation Mode ().
- Set Time Step: to 10:00 sec
- Reset () the scenario.
- Click Start ().
As the scenario plays, you can see a dynamic display of the external data in the 3D Graphics window.
3D Graphics CSC Data Display
Save Your Work
- When finished, Reset () the scenario and close any reports or tools that are still open.
- Save () your work.