Drive STK with Connect Commands and Excel

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 Connect commands used in this lesson are compatible with version 11.0 of the STK software and newer.

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.

Capabilities covered

This lesson covers the following capability of the Ansys Systems Tool Kit® (STK®) digital mission engineering software:

  • STK Pro

Problem statement

Engineers and mission planners need an efficient way to keep track of all the objects in an STK scenario. They also need to quickly replicate, insert, and modify scenario objects in batches. You are modeling a small unmanned aircraft system (sUAS), or drone, which routinely flies training missions in the vicinity of Mount St. Helens using the same flight route. The drone sends a live video feed back to operators on the ground. The locations of the assigned targets are changed with each flight. You need a quick and simple way to model the new target locations to determine if, and when, the drone's on-board camera can see the new targets.

Solution

Model and plan the sUAS mission using the STK software, then simplify the mission-planning process further by creating new targets in bulk for your next sUAS mission using sets of Connect commands populated from entries in a Microsoft Excel workbook.

What you will learn

Upon completion of this tutorial, you will be able to:

  • Build Connect commands using formulas and functions in an Excel workbook
  • Use the API Demo Utility to transfer Connect commands into the STK application

Using a starter scenario

A partially created scenario has been created for you allow you to focus on building your Connect commands in Excel and transferring them to the STK application.

Opening the starter scenario

Open the starter scenario in the STK application.

  1. Launch the STK application ().
  2. Click Open a Scenario in the Welcome to STK dialog box.
  3. Browse to <Install Dir>\Data\Resources\stktraining\VDFs (for example, C:\Program Files\AGI\STK_ODTK 13\Data\Resources\stktraining\VDFs).
  4. Select Connect_Starter.vdf.
  5. Click Open.

Saving the VDF as a scenario file

When you open the scenario, the STK application creates a directory with the same name as the scenario in the default user directory (for example, C:\Users\<username>\Documents\STK_ODTK 13). The scenario will not save automatically. When you save a scenario in the STK application, the file will not change its file type automatically. In other words, if you open a Visual Data File (VDF), the default save format will still be a VDF. The same is true for a scenario file (*.sc). If you want to save a VDF as an SC file (or vice-versa), you must change the file format when you are performing the Save As procedure.

  1. Open the File menu.
  2. Select Save As... in the File menu.
  3. Select the STK User folder in the left navigation pane when the Save As dialog box opens.
  4. Select the Connect_Starter scenario folder.
  5. A scenario folder with the same name as the VDF was created for you when you opened the VDF in the STK application. This folder contains the temporarily unpacked files from the VDF.

  6. Click Open.
  7. Select Scenario Files (*.sc) as the Save as type.
  8. Select the Connect_Starter Scenario file in the file browser.
  9. Click Save.
  10. Click Yes when the Confirm Save As dialog box opens to overwrite the existing scenario file in the folder and to save your scenario.

Save () often during this lesson!

Understanding the starter scenario

Prior to modifying the scenario, you should become familiar with the objects already created in the starter scenario.

  1. Review the objects loaded in the Object Browser.
  2. Review the 2D and 3D Graphics windows for situational awareness.

2D View: Search Pattern

The sUAS drone. modeled with an Aircraft object, is flying a search pattern over the test area, which is in the vicinity of Mount St. Helens. The search area is defined using an Area Target object. The drone is using a Sensor object with a Simple Conic sensor definition with a 45-degree cone half angle to simulate the field of view of its on-board video camera, which is pointing straight down. A local terrain file (StHelens_Training.pdtt) is used both analytically and visually, which you confirm by viewing the Scenario's Basic - Terrain properties and the Globe Manager hierarchy.

Configuring a new Excel workbook

Create a new Excel workbook, which you'll use to batch create the STK scenario. You can reuse this Excel workbook over and over again whenever new target locations are set.

Creating a new Excel workbook

Open the Excel application, create a new, blank workbook, and save it in your scenario folder.

  1. Open Microsoft Excel.
  2. Select Blank workbook in the New ribbon.
  3. Select the File menu.
  4. Select Save As when the Save As pane opens.
  5. Click Browse.
  6. Browse to your scenario folder (for example, C:\Users\<username>\Documents\STK_ODTK 13\Connect_Starter).
  7. Enter TargetGenerator in the File name field.
  8. Click Save.

Naming your columns

Begin by naming the columns in your workbook with headers appropriate for the Connect commands and options you'll be entering in them.

  1. Find the cells in Row 1.
  2. Copy and paste or enter the following into your workbook in the first row:
Cell Header
A1 Target ID
B1 CoordinateType
C1 Latitude
D1 Longitude
E1 New
F1 SetPosition
G1 VO Model
H1 SetHeightAboveGround
I1 SetAzElMask
J1 SetConstraint

Whenever you place text in a cell that overflows into adjoining cells, you can use your mouse to resize the columns. To use your mouse, rest the cursor on right side of the column boundary you want to move until it becomes a resize cursor (a double-sided arrow pointing left and right). Then, you can simply double-click on the column boundary to automatically fit the column width to the cell contents. You can click and drag the boundary until the column is the width you want.

Naming your five Target objects

Your object names cannot contain any spaces, such as "Target 1". You have to name it without a space, such as "Target1" or "Target_1".

  1. Click on cell A2.
  2. Enter Target1 in the cell.
  3. Hover your cursor over the lower-right corner of cell A2.
  4. Your cursor will turn into a small plus sign (+). This is called the fill handle.

  5. Click and drag the fill handle down to cell B6.
  6. Release your left mouse button.

This is a quick way to add the remaining targets.

Target ID

Entering geodetic coordinates

The STK software provides five ways of positioning a facility, place, or target. You will use the Geodetic Position type. The geodetic latitude of a point is the angle between the normal to the reference ellipsoid and the equatorial plane. The longitude of a point is the angle between the projection of the position vector in the equatorial plane and the prime meridian. It is measured as increasing in a counterclockwise sense when viewed from the north pole.

  1. Click on cell B2.
  2. Enter Geodetic.
  3. Hover your cursor over the lower-right corner of cell B2 to expose the fill handle.
  4. Click and drag the fill handle down to cell B6.
  5. Release your mouse button.

The Geodetic term will automatically be filled to the other cells in column B.

Inserting waypoint coordinates

Mission planners have provided you with the new target coordinates. With every mission, you simply have to update these coordinates, and then you can update your STK scenario accordingly. In this scenario, use the coordinates provided.

  1. Find Columns C and D.
  2. Copy and paste or enter the following latitude coordinates into the workbook:
  3. Cell Latitude
    C2 46.539
    C3 46.468
    C4 46.961
    C5 46.568
    C6 46.2
  4. Copy and paste or enter the following longitude coordinates into the workbook:
  5. Cell Longitude
    D2 -122.97
    D3 -122.613
    D4 -122.313
    D5 -122.027
    D6 -122.186

With a Geodetic Position, latitude is measured in degrees from -90.0 degrees to +90.0 degrees and longitude is measured in degrees from -360.0 degrees to +360.0 degrees. In this case, all of the targets are set to be within the bounds of terrain's extent between 46 and 47 degrees latitude and -123 and -122 degrees longitude. These are also the boundary points of the Area Target object that defines the test area.

Creating Connect commands in Excel

Connect provides you with an easy way to connect with the STK application and work in a client-server environment. You can use the library shipped with Connect to easily build applications that communicate with the STK software. This library contains functions, constants, and other messaging capabilities that you can use to connect third-party applications to the STK application. Take some time to view the Help files associated with Connect in the Integrating with STK Help section of the help. These help pages provide the basics for anyone starting with Connect and will help you to understand the Connect commands you are building and sending to this scenario:

You can easily build bulk Connect commands using formulas in Excel. Excel formulas are equations that perform calculations, analyze data, and manipulate text. Formulas begin with an equal sign (=) followed by one or more operators. Operators are symbols that specify the type of calculation or action for the formula to perform. There are four different types of calculation operators in Excel: arithmetic, comparison, text concatenation, and reference. The text concatenation operator type only has one operator: the ampersand (&) operator. It is used to join, or concatenate, one or more text strings to produce a single piece of text. You can use this operator to quickly produce text strings to write Connect commands in batches.

Creating New Connect commands with an Excel formula

You can use the New command to create a new STK scenario or add a new STK object to the current scenario. In Excel, you have to create a line of text (or a string) that contains the New command. When you run data from your Excel workbook into the STK application, the STK software will execute the Connect commands as they are written in your Excel workbook.

In the STK software, the New Connect command has this syntax:

New <ApplicationPath> <ClassPath> <NewObjectName> {NewOptions}

You must parse the command out into individual pieces that can be concatenated together to build the New Connect command with the proper syntax. You can include text strings, including leading and trailing spaces, in Excel formulas by surrounding the text string with double quotes (""). In this case, you want to create five New commands in Excel so the STK application will add five Target objects to your scenario.

  1. Bring your Excel workbook to the front.
  2. Copy and paste or enter the following formula into cell E2:
  3. ="New / Target "&A2

    Be sure to include the trailing space after "Target". Using leading and trailing spaces where needed in text strings is key to successfully building Connect commands in Excel.

    If you've entered it correctly, the formula bar should look like this:

    Excel Formula Bar

  4. Select the Enter key.
  5. Check your equals sign, spacing, and ampersand if you receive an error.
  6. To improve the readability of your formula, you can include including spaces around the text concatenation (&) operator (for example, ="New / Target " & A2), which Excel will ignore. Since spaces can also function as intersection operators when combining ranges of cells for calculations in Excel formulas, it is generally good practice to avoid using them except where necessary outside of text strings.

  7. Expand the width of column E to read the Connect command.
  8. Ensure that "New / Target Target1" has appeared in cell E2.

Essentially, you told Excel that cell E2 should contain (or "equal") the line of text "New / Target " and whatever is in cell A2. Now, whenever you update the Target ID in cell A2, your New command in cell E2 will update automatically. However, whem you copy cell E2 into the STK application, its value will be copied as "New / Target Target1" rather than the formula. You will repeat this thought process for all the Connect commands in the Excel workbook. The following picture breaks down the text string even further:

Ampersand operator

Duplicating the New command down column E

You have created a command for one new Target object named Target1. Now, use the same formula for Target2 through Target5. You can save time by copying the formula into the rest of column E by dragging the fill handle down. When you fill formulas down, relative references will be put in place to ensure the formulas adjust for each row.

  1. Click on cell E2.
  2. Hover your cursor over the lower-right corner of cell E2 to expose the fill handle.
  3. Click and drag the fill handle down to cell E6.
  4. Release your left mouse button.

Four New commands should appear in cells E3 through E6.

Creating SetPosition commands in Excel

In the STK software, you use the SetPosition command to set the position of a facility, place, target or area target. To create a SetPosition command, you can use the same process you used with the New command. The SetPosition command will move the Target objects to the specified Geodetic coordinates in the STK application and place the targets on top of the terrain at that coordinate.

In the STK software, the SetPosition Connect command has this syntax:

SetPosition <ObjectPath> [{Type}] {CoordType} <Parameters>

You need to replicate that syntax in a way that the STK software can understand before you can pass this command to the STK application from Excel.

  1. Copy and paste or enter the following formula into cell F2:
  2. ="SetPosition */Target/"&A2&" "&B2&" "&C2&" "&D2&" Terrain"
  3. Select the Enter key.
  4. Check your equals sign, spacing, and ampersands if you receive an error.
  5. Expand the width of column F to read the Connect command.
  6. Ensure that "SetPosition */Target/Target1 Geodetic 46.539 -122.97 Terrain" has appeared in cell F2.
  7. When you specify Terrain for the Geodetic coordinate type, the STK application will use the altitude from the terrain data being used in the scenario. If no terrain data is available at the specified latitude and longitude, the altitude is set to 0.0.

  8. Click on cell F2.
  9. Hover your cursor over the lower-right corner of cell F2 to expose the fill handle.
  10. Click and drag the fill handle down to cell F6.
  11. Release your left mouse button.

You should now have SetPosition commands for all five of the Target objects.

Creating VO Model commands in Excel

The Target objects currently have their models turned off in the 3D Graphics window. Use the VO Model command to assign a model to a facility, place, target or any type of vehicle. This will turn the targets' models on visually in your scenario.

In the STK software, the VO Model Connect command has this syntax:

VO <ObjectPath> Model {Option1} <Value1> [{Option2} <Value2>]...

You need to replicate the command in Excel for the STK software to understand your Excel workbook.

  1. Copy and paste or enter the following formula into cell G2:
  2. ="VO */Target/"&A2&" Model Show On"
  3. Select the Enter key.
  4. Check your equals sign, spacing, and ampersands if you receive an error.
  5. Expand the width of column G to read the Connect command.
  6. Ensure that "VO */Target/Target1 Model Show On" has appeared in cell G2.
  7. Click on cell G2.
  8. Hover your cursor over the lower-right corner of cell G2 to expose the fill handle.
  9. Click and drag the fill handle down to cell G6.
  10. Release your left mouse button.

You should now have VO Model commands for all five of the Target objects.

Creating SetHeightAboveGround commands in Excel

Use the SetHeightAboveGround command to set the height above ground of a facility, place or target. The Target objects' center points are located on the surface of the terrain. Use the SetHeightAboveGround command to add additional height to your Target objects to simulate the actual height of an attached transmitter, receiver, sensor, radar, etc.

In the STK software, the SetHeightAboveGround Connect command has this syntax:

SetHeightAboveGround <ObjectPath> <Height>

The default distance unit for Connect commands and the STK application is meters.

You must replicate the command as a string in Excel in order for the STK software to execute the command.

  1. Copy and paste or enter the following formula into cell H2:
  2. ="SetHeightAboveGround */Target/"&A2&" 3"
  3. Select the Enter key.
  4. Check your equals sign, spacing, and ampersands if you receive an error.
  5. Expand the width of column H to read the Connect command.
  6. Ensure that "SetHeightAboveGround */Target/Target1 3" has appeared in cell H2.
  7. Click on cell H2.
  8. Hover your cursor over the lower-right corner of cell H2 to expose the fill handle.
  9. Click and drag the fill handle down to cell H6.
  10. Release your left mouse button.

You should now have SetHeightAboveGround commands for all five of the Target objects.

Creating SetAzElMask commands in Excel

Use the SetAzElMask command to set the azimuth-elevation mask for a facility, place or target. You need to take terrain into consideration when considering access to the drone's camera. Use the SetAzElMask command to create a 360-degree AzEl mask for each target, which will allow them to use the analytical terrain.

In the STK software, the SetAzElMask command has this syntax:

SetAzElMask <ObjectPath> {UseOption} ["<FilePath>"]

As before, you need to enter a formula in Excel to concatenate the data in such a way that STK can interpret.

  1. Copy and paste or enter the following formula into cell I2:
  2. ="SetAzElMask */Target/"&A2&" Terrain"
  3. Select the Enter key.
  4. Check your equals sign, spacing, and ampersands if you receive an error.
  5. Expand the width of column I to read the Connect command.
  6. Ensure that "SetAzElMask */Target/Target1 Terrain" has appeared in cell I2.
  7. Click on cell I2.
  8. Hover your cursor over the lower-right corner of cell I2 to expose the fill handle.
  9. Click and drag the fill handle down to cell I6.
  10. Release your left mouse button.

You should now have SetAzElMask commands for all five of the Target objects.

Creating SetConstraint commands in Excel

Use the SetConstraint command to set a constraint for a facility, place, or target object.

and has this syntax:

SetConstraint <ObjectPath> {ConstraintName} <Parameters>

Copy and past an Excel formula that concatenates a SetConstraint command to enable an AzEl Mask constraint, which will be used to calculate access.

  1. Copy and paste or enter the following formula into cell J2:
  2. ="SetConstraint */Target/"&A2&" AzElMask On"
  3. Select the Enter key.
  4. Check your equals sign, spacing, and ampersands if you receive an error.
  5. Expand the width of column J to read the Connect command.
  6. Ensure that "SetConstraint */Target/Target1 AzElMask On" has appeared in cell J2.
  7. Click on cell J2.
  8. Hover your cursor over the lower-right corner of cell J2 to expose the fill handle.
  9. Click and drag the fill handle down to cell J6.
  10. Release your left mouse button.

You should now have SetAzElMask commands for all five of the Target objects.

Transferring the Connect commands to the STK application

Connect commands are normally passed from outside the STK application over a TCP/IP connection or through a COM interface. In this scenario, you'll use the API Demo Utility through an integrated Web Browser window in the STK Workspace. The API Demo Utility functions inside of the STK application; therefore, no outside connections are required.

Using the API Demo Utility

The Web Browser works like most traditional web browsers except that it is an integrated part of the STK workspace. You can use the Web Browser to open the API Demo Utility. The API Demo Utility will allow you to send Connect commands into the current scenario.

  1. Return to the STK application.
  2. Select the Window menu in the Menu Bar at the top of the STK application.
  3. Select Tile Vertically.
  4. Click New Web Browser Window () on the Default toolbar.
  5. Click Browse () on the Web Browser Controls toolbar when the Web Browser window opens.
  6. Select the Example HTML Utilities folder in the left navigation pane when the Open dialog box appears.
  7. Select the STK Automation folder.
  8. Click Open.
  9. Select the API Demo folder.
  10. Click Open.
  11. Select API Demo Utility.htm.
  12. Click Open to confirm your selection and to close the Open dialog box.

Customizing your workspace

Since you will be using the API Demo Utility frequently, and potentially repeatedly, dock it to the bottom of the STK Workspace and arrange your windows.

  1. Right-click on the Web Browser - API Demo Utility window's title bar.
  2. Select Docked to in the shortcut menu.
  3. Select Bottom in the Docked to submenu.
  4. Resize the Web Browser window as necessary to view the full extent of the API Demo Utility.

Copying the New and SetPosition Connect commands

Copy your Connect commands from the Excel workbook and paste them into the API Demo Utility's Code Sandbox, starting with the New and SetPosition commands. Then, use the utility to send them to your scenario.

  1. Return to your Excel workbook.
  2. Select cells E2 through E6.
  3. Copy the cells by selecting the Ctrl + C keyboard shortcut.
  4. Return to the STK application.
  5. Clear all the text from the API Demo Utility's Code Sandbox.
  6. Paste the New Connect commands into the Code Sandbox.
  7. Return to your Excel workbook.
  8. Copy cells F2 through F6.
  9. Return to the STK application.
  10. Paste the SetPosition commands into the Code Sandbox beneath the New commands.

You have to generate the targets prior to setting their locations.

Code Sandbox

Running the code and viewing your scenario changes

Run the code, then review one of the Target objects' Basic - Position properties to see if your Connect commands worked properly.

  1. Click Run Code.
  2. Look at the Object Browser.
  3. You should see that five (5) Target () objects have been insterted into your scenario.

  4. Right-click on Target1 ().
  5. Select Properties () in the shortcut menu.
  6. Select the Basic - Position page when the Properties Browser opens.
  7. Note the data in the Position panel.
  8. Targets Added

    Note that the Position Type has been set to Geodetic, and if you compare the latitude and longitude values you copied from your Excel workbook, you can see they are correct. Also, the Use terrain data check box has been selected, which sets the altitude of the target automatically.

  9. Keep the Properties Browser open.

Copying the VO Model and SetHeightAboveGround Connect commands

Before you copy the VO Model and SetHeightAboveGround commands from the Excel workbook, look at the 3D Graphics - Model properties that the Connect commands will change.

  1. Note that Height Above Ground is set at 0 km.
  2. Select the 3D Graphics - Model page.
  3. Notice Show is turned off in the Model panel.
  4. Click Cancel to close the Properties Browser without making any changes.
  5. Clear all the Connect commands from the Code Sandbox.
  6. Return to your Excel workbook.
  7. Copy all of the VO Model Connect commands.

Running the VO Model and SetHeightAboveGround Connect commands

Paste the VO Model and SetHeightAboveGround commands from the Excel workbook into to the API Demo Utility, then run the commands.

  1. Return to the STK application.
  2. Paste all five VO Model Connect commands into the Code Sandbox.
  3. Return to your Excel workbook.
  4. Copy all five SetHeightAboveGround commands.
  5. Return to the STK application.
  6. Paste the SetHeightAboveGround commands into the Code Sandbox below the VO commands.
  7. Click Run Code.

Viewing your scenario changes

View the changes to one of the Target objects' properties.

  1. Open Target1's () Properties ().
  2. Select the Basic - Position page.
  3. Note that the Height Above Groun is now set at 0.003 km (equivalent to 3 meters).

  4. Select the 3D Graphics - Model page.
  5. Note that the Show check box is now selected in the Model File panel.

  6. Click Cancel to close the Properties Browser without making any changes.
  7. Clear all the Connect commands from the Code Sandbox.
  8. Return to your Excel workbook.

Running the SetAzElMask and SetConstraint Connect commands

Copy and paste the SetAzElMask and SetConstraint commands to the API Demo Utility.

  1. Copy all five SetAzElMask commands.
  2. Return to the STK application.
  3. Paste all five SetAzElMask commands into the Code Sandbox.
  4. Return to your Excel workbook.
  5. Copy all five SetConstraint commands.
  6. Return to the STK application.
  7. Paste all five SetConstraint commands to the Code Sandbox below the SetAzElMask commands.
  8. You have to define the AzElMasks prior to turning them on for access calculations.

  9. Click Run Code.

Viewing the scenario changes

View the changes to Target1's Basic - AzElMask properties.

  1. Open Target1's () Properties ().
  2. Select the Basic - AzElMask page.
  3. You can see that the Use: Terrain Data method is selected and the Use Mask for Access Constraint check box is selected, which has enabled the Az-El Mask constraint in the Target object's Constraints - Active properties.

  4. Click Cancel to close the Properties Browser without making any changes.
  5. Clear the Connect commands from the Code Sandbox.

Building Access Connect commands

After practicing with six different Connect commands, you have the tools to add any Connect command to the lesson using your Excel workbook and the STK Help. Try building a Connect command that will create an access between the TV_FOV Sensor object and all five Target objects.

Building the Access commands in Excel

Use the STK Help to find the proper syntax for Access commands and build them in Excel.

  1. Select STK Help in the Help menu on the Menu Bar.
  2. Select Integrating with STK on the left when the STK Help opens.
  3. Select Connect Command Library.
  4. Select Alphabetical Listing.
  5. Locate the Access Connect command on the list.
  6. Note the syntax and examples the help provides.
  7. Return to your Excel workbook.
  8. Enter Access in cell K1 to create a new Access heading The direction that the aircraft is pointing..
  9. Use your experience with previous Connect commands in this lesson and the STK Help as a guide to write a formula that concatenates the Access command correctly.
  10. Create Accesses for all five (5) targets.
  11. A hint if you are stuck:Closed

    Try entering this formula in cell K2 of your Excel workbook : ="Access */Aircraft/sUAS_Drone/Sensor/TV_FOV */Target/"&A2

Running the Access commands

Copy and paste the Access commands to the API Demo Utility.

  1. Copy all five Access commands from the Excel workbook to the API Demo Utility.'s Code Sandbox.
  2. Click Run Code.

If done correctly, you will see the individual accesses listed in the API Demo Utility's Output field.

Output Accesses

Note that drone's camera does not have access to two of the Target objects, Target1 being located outside of the sensor's field of view and Target5's location being deep inside n Mount St. Helens' crater.

Creating an Access graph command

You can further use Excel and Connect to generate an Access graph using the GraphCreate command. T he GraphCreate command generates a graph, based on the style specified, and allows you to save it as a file or display it on the screen. It has the following syntax:

GraphCreate <ObjectPath> ({Option} <Value>)...

The Style and Type options are required for this command. The Type option selects the type of graph to create. The Style option is the name of the graph style to create and uses the syntax:

Style "<GraphStyleName>"

The style must match an existing graph style within the STK application, look for the style in the ScenarioDir, then in the UserDir, and then in the InstallDir. Available styles display in the Report & Graph Manager window. For details on how to specify "<GraphStyleName>", see Report Style Names on the Connect Command Syntax Elements help page.

Creating an AccessObject option

When graph accesses, you must specify the object to which access will be calculated using the AccessObject option and the following syntax:

AccessObject <AccessObjectPath>

Access will be calculated from the object for which the command is being issued, specified using the <ObjectPath> parameter.

  1. Return to your Excel workbook.
  2. Enter Access Object in cell L1.
  3. Copy and paste or enter the following formula into cell L2:
  4. ="AccessObject */Target/"&A2

  5. Select the Enter key.
  6. Check your equals sign, spacing, and ampersand if you receive an error.
  7. Expand the width of column L to read the Connect command.
  8. Ensure that "AccessObject */Target/Target1" has appeared in cell L2.

Filling in the remaining AccessObject options

Now, fill the formula down to create the remaining AccessObject options.

  1. Click on cell L2.
  2. Hover your cursor over the lower-right corner of cell L2 to expose the fill handle.
  3. Click and drag the fill handle down to cell L6.
  4. Release your left mouse button.

You should now have AccessObject options for all five of the Target objects.

Building the GraphCreate command in Excel

The AccessObject option can be entered multiple times with a single GraphCreate command to specify multiple access objects. You can create a GraphCreate command encompassing all five targets using the TEXTJOIN function. The TEXTJOIN function is a very useful function when working with Connect commands in Excel. It combines text from multiple ranges and/or strings with a specified delimiter between each value. It uses the following syntax:

TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)

You can use the TEXTJOIN function with the text concatenation operator to build out your full GraphCreate command.

  1. Copy and paste or enter the following formula in cell L7:
  2. ="GraphCreate */Aircraft/sUAS_Drone/Sensor/TV_FOV Type Display Style ""Access"" "&TEXTJOIN(" ",TRUE,L2:L6)

    The "TRUE" value for the TEXTJOIN's function's ignore_empty argument will ignore empty cells. Note also that the Access GraphstyleName is surrounded by double quotes in the formula. This escapes the inner quotes and allows you to include them in the formula's output.

  3. Select the Enter key.
  4. Check your equals sign, spacing, ampersands, and syntax if you receive an error.
  5. Expand the width of column L again to read the full extent of the command.
  6. Ensure that the following has appeared in cell L7:
  7. GraphCreate */Aircraft/sUAS_Drone/Sensor/TV_FOV Type Display Style "Access" AccessObject */Target/Target1 AccessObject */Target/Target2 AccessObject */Target/Target3 AccessObject */Target/Target4 AccessObject */Target/Target5

You are telling the STK application to display an Access graph on the screen for all the accesses between the sensor and five target objects.

Running the GraphCreate command in the STK application

With your full command created, run the command in the API Demo Utility and view the results.

  1. Copy the full GraphCreate command in cell L7.
  2. Return to the STK application.
  3. Clear the Connect commands from the Code Sandbox.
  4. Paste the copied GraphCreate command into the Code Sandbox.
  5. Click Run Code.

If done correctly, you will see an Access graph displayed on screen. Note that only the three targets for which access could be found are shown on the graph.

Access Graph

Saving your work

Clean up your workspace and save your scenario.

  1. Close any open graphs, properties, tools, and utilities.
  2. Save () your work.
  3. Close the STK and Excel applications when you are finished.

Summary

You opened a prebuilt STK scenario and created an Excel workbook which can be saved and used each time you mission plan an sUAS mission. You began by loading new targets into the scenario by transferring the Connect commands from the Excel workbook to the STK scenario via the API Demo Utility. You placed the targets at their updated coordinates, placing them on top of analytical terrain and raising them an additional three (3) meters above the ground. You also manipulated the 3D model of each target. You then created azimuth / elevation masks and used the masks as access constraints, then used additional commands to calculate access between the sensor and the targets and to create an Access graph.

Although you had only five targets in this scenario, you could have more or fewer, depending on the mission plan and priorities. For complex missions with many moving parts, an Excel workbook helps you keep track of all the objects and replicate objects quickly.

On your own

You can use any number of Excel functions together with concatenate operators in your Excel formulas to help build out your Connect commands. For example, suppose you wanted to assign random targets each day. You could use a RAND function in a formula, whose=RAND()*(b-a)+a, in conjunction with the limits of your Area Target object, to produce random coordinates for each Target object within the test area's bounds instead of preset coordinates:

Coordinate Formula
Latitude =RAND()*(47-46)+46
Longitude =RAND()*(-123+122)-122

As long as your Excel formulas will generate Connect commands with the proper syntax, you can use them to drive your analysis in the STK application.