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 training 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.

  1. Launch STK ().
  2. Click the Create a Scenario () button.
  3. Enter the following in the STK: New Scenario Wizard:
  4. 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
  5. When you finish, click OK .
  6. When the scenario loads, click Save (). A folder with the same name as your scenario is created for you.
  7. In the Save As window, verify the scenario name and location and click Save .

Save Often!

Add A Satellite

Add a Satellite () object to the scenario.

  1. Using the Insert STK Objects Tool () insert a Satellite () object using the Orbit Wizard () method.
  2. When the Orbit Wizard opens, change Satellite to TestSat.
  3. Accept the remaining default settings and click OK .

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

  1. Open Notepad, Notepad ++, WordPad, or another text editor that does not add hidden characters to your text.
  2. Click here to open the STK Help page where the external data file example is located.
  3. 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.

  1. In STK, open TestSat's () properties ().
  2. On the Basic - Orbit page, locate the Orbit Epoch: field.
  3. Copy the Orbit Epoch: time.
  4. Click Cancel .
  5. In the external data file example, replace the ReferenceEpoch time with the Orbit Epoch time from TestSat ().
  6. Remove the UTCG unit.
  7. Example:

    ReferenceEpoch 1 Jan 2019 16:00:00.000

  8. Change "bippy" to "Distance."
  9. Change "zippy" to "Rate."

Save the File

Save the file as a Normal text file (*.txt) file.

  1. Open the File menu and select Save As.
  2. Browse to the scenario folder (e.g. C:\Users\username\Documents\STK 12\External_Data_Test).
  3. Name the File Name: "My External Data."
  4. Click Save .

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>]

  1. In STK, close the Timeline View.
  2. Click the New Integrated HTML Browser () icon in the STK default toolbar.
  3. Click the Browse () icon in the New Integrated HTML Browser's HTML View Controls toolbar.
  4. Click the Example HTML Utilities icon when the Open window appears.
  5. Open folders in the following order:
    • STK Automation
    • API Demo
  6. Open the API Demo Utility.htm.

Type the Connect Command

  1. When the API Demo Utility opens, remove any text within the Code Sandbox.
  2. Enter the following Connect command into the Code Sandbox:
  3. ExternalData */Satellite/TestSat ReadFile "" Save

  4. 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).
  5. Click Run Code .
  6. When finished, close the API Demo Utility tool.

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.

  1. In the Object Browser, right-click on TestSat ().
  2. Select the Report & Graph Manager option.
  3. In the Styles list, select the folder named "External_Data_Test Styles."
  4. Click the Create new report style () icon.
  5. Rename the new report "External Data Text File."
  6. 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.

  1. Expand () the group named "User Supplied Data."
  2. Expand () the data provider named "My Data."
  3. Move () the following to the Report Contents:
    • Time
    • Distance
    • Rate
  4. Click OK .
  5. Generate the External Data Text File report.
  6. 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.

  1. Open TestSat's () properties ().
  2. Select the 3D Graphics - Data Display page.
  3. Click the Add... button.
  4. Select External Data Text File in the Styles field.
  5. Click OK.
  6. Make any desired Position and Appearance changes and click OK.

View in 3D

  1. Bring the 3D Graphics window to the front.
  2. Zoom To TestSat ().
  3. In the Animation Toolbar, select X Real-time Animation Mode ().
  4. Reset () the scenario.
  5. Click Start ().
  6. As the scenario plays, you can see a dynamic display of the external data in the 3D Graphics window.

    3D Graphics External Data Display

  7. When finished, reset () the scenario.

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.

  1. Return Notepad, Notepad ++, WordPad, or another text editor that does not add hidden characters to your text.
  2. Open the File menu and select New.
  3. Click here to open the STK Help page where the TimeValueRates example is located.
  4. 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.

  1. In STK, open TestSat's () properties ().
  2. On the Basic - Orbit page, locate the Orbit Epoch: field.
  3. Copy the Orbit Epoch: time.
  4. Click Cancel .
  5. Remove the pound sign (#) from ReferenceEpoch.
  6. In the Calculation Scalar File example, replace the ReferenceEpoch time with the Orbit Epoch time from TestSat ().

Change the Units

  1. Remove the UTCG unit.
  2. Example:

    ReferenceEpoch 1 Jan 2019 16:00:00.000

  3. Change ValueUnit to km.
  4. Change ValueRateUnit to km/sec.

Change the Date Format

  1. Drop down to the telemetry data field (e.g. BEGIN TimeValueRates).
  2. On your keyboard, press CTRL + F.
  3. Depending on your text editor, the following steps may be slightly different. In this example, we're using Notepad ++.

  4. Select Replace.
  5. In the Find what: field, enter the date of the data (e.g. 18/09/2013).
  6. In the Replace with: field, enter the data of the ReferenceEpoch using the DD/MM/YYYY format (e.g. 01/01/2019).
  7. Click Replace All.
  8. Close the Replace window.

Fix the Times

  1. Manually fix all the times so they match the starting hour of your scenario.
  2. Take a look finished file below:

Example of finished file:

Edited CSC File

Save the File

  1. Extend the File menu.
  2. Select Save As.
  3. Browse to the scenario folder (e.g. C:\Users\username\Documents\STK 12\External_Data_Test).
  4. Open the Save as type: pull-down menu.
  5. Select All types: (*.*).
  6. Name the File Name: MyTimeValueRate.csc.
  7. Click Save .
  8. Close the text editor.

Analysis Workbench Calculation Tool

The Calculation Tool includes components of the following basic types: Scalar, Condition, and Parameter Set.

  1. Right-click on TestSat ().
  2. Select Analysis Workbench ().
  3. When the Analysis Workbench opens, select the Calculation tab.

Scalar Calculation

Scalars define components that produce scalar time-varying calculations.

  1. Click the Create new Scalar Calculation () button.
  2. In the Add Calculation Component window, set the following:
  3. Option Value
    Type: File
    Name: MyTelemetryData
    Filename: MyTimeValueRate.csc (browse to the location of the file)
  4. Click OK .
  5. Close the Analysis Workbench.

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.

  1. Right-click on TestSat ().
  2. Select the Report & Graph Manager tool.
  3. In the Styles list, select the folder named "External_Data_Test Styles".
  4. Click the Create new report style () button.
  5. Rename the new report "External CSC Telemetry Data."
  6. 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.

  1. Expand () the group named "Scalar Calculations."
  2. Expand () the data provider named "MyTelemetryData."
  3. Move () the following to the Report Contents field:
    • Time
    • Scalar
    • Scalar Rate

Rename the Report Contents

  1. In the Report Contents field, select Scalar Calculations-MyTelemetryData-Scalar.
  2. Click the Options... button.
  3. Rename Title: "Kilometers."
  4. Click OK .
  5. In the Report Contents field, select Scalar Calculations-MyTelemetryData-Scalar Rate.
  6. Click the Options... button.
  7. Rename Title: Kilometers per Second.
  8. Click OK .
  9. Click OK to close the report's properties.

Generate the Report

  1. Generate the My CSC Telemetry Data report.
  2. 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.

  1. Open TestSat's () properties ().
  2. Select the 3D Graphics - Data Display page.
  3. Clear the External Data Text File check box.
  4. Click the Add... button.
  5. When the Add a Data Display window appears, in the Styles field, select External CSC Telemetry Data.
  6. Click OK .
  7. Make any desired Position and Appearance changes.
  8. Click OK .

View in 3D

  1. Bring the 3D Graphics window to the front.
  2. Zoom To TestSat.
  3. In the Animation Toolbar, select Normal Animation Mode ().
  4. Set Time Step: to 10:00 sec
  5. Reset () the scenario.
  6. Click Start ().
  7. 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

  1. When finished, Reset () the scenario and close any reports or tools that are still open.
  2. Save () your work.