STK Integration

The STK object model provides an automation layer on top of STK Desktop or STK Engine. It contains types, interfaces, events, and classes representing various aspects of the STK application structure. It is designed to make it easy for you to control and automate STK objects, perform analysis, and interact directly with STK's physics-based analysis engine. Moxie provides additional libraries to adapt the STK Object Model for use in an executable architecture by implementing support for discrete event-driven behaviors.

The JAR file for the Moxie STK utilities library is moxie-stk-utilities.jar, located in the \delegates\com.agi.moxie.stk directory in your Moxie installation.

StkToolbox

The StkToolbox is the primary means of interacting with STK from Moxie. It is available to all delegates as an injection parameter.

Units

When working with STK, you must ensure STK is configured to accept and return the correct units for your analysis. The following lambda expression demonstrates how to ensure the provided STK Object Model code is using meters and radians units: stkToolbox.withMetersAndRadians(()-> { /* your provided code here */ }). After the expression executes, the toolbox resets the unit settings to their previous values.

Analysis Workbench

StkToolbox has a method getAwb(IAgStkObject) that returns an instance of AnalysisWorkbench. The analysis workbench is a feature in STK that provides arbitrary geometry and time analysis. In Moxie, AnalysisWorkbench is a wrapper around the STK object model code to help manage these objects when generating ad-hoc analysis objects to execute opaque expression behaviors.

DataProviderExecutor

DataProviderExecutor provides a number of helper methods to facilitate the execution and retrieval of data from STK data providers via the STK object model. To execute a data provider on a single STK object, call the appropriate execute method and specify the STK object, the full data provider path, and if needed, the start time, stop time, step size, and elements of interest. To execute an access data provider between two STK objects, call the getAccessAsTable method and specify both objects, as well as the same parameters as for an execute method. Either way, Moxie will evaluate elements of the data provider over the specified period of time and return a data table. Each column of the data table represents an element of the data provider, making it easy to iterate through the resulting data. The dataProviderPath is a string that contains the data provider group name as well as the data provider item name separated by a / if applicable. For more information, see the com.agi.moxie.stk.utilities.DataProviderExecutor API documentation.

StkObjectSpatialEntity

StkObjectSpatialEntity is a special delegate class that enables you to hold references to STK objects in your custom delegate instances. StkObjectSpatialEntity is designed to work with or without the Moxie-STK::Configuration::MoxieStkExistingObject stereotype applied. This section covers the usage of StkObjectSpatialEntity without the stereotype.

StkObjectSpatialEntity provides you with a way to connect to an existing STK object from your custom delegate instance, or even to create a new one on the fly. Take a look at the following snippets:

public class StkObjectEntityExample extends StkObjectSpatialEntity {
    protected StkObjectEntityExample(StkToolbox stkToolbox, StkEarth stkEarth, TimeProvider timeProvider) {
        super(stkToolbox, stkEarth, timeProvider);
    }
    private void updateFromObjectPath(IAgStkObject stkObject) {
        updateFromStkObject(stkObject);
    }
    private IAgStkObject updateFromNewObjectPath(String newStkObjectPath) {
        return updateFromNewStkObject(newStkObjectPath);
    }
}

Figure 1: Extending StkObjectSpatialEntity

StkObjectEntityExample stkObjectEntityExample = new StkObjectEntityExample(mToolbox, mStkEarth, mTimeProvider);
String stkObjectPath = "*/Target/testObject";
IAgStkObject stkObject = mToolbox.getRoot().getObjectFromPath(stkObjectPath);
stkObjectEntityExample.updateFromObjectPath(stkObject);

Figure 2: Updating an StkObjectSpatialEntity with an STK object instance from your STK scenario

Figure 1 shows you how to create an StkObjectEntityExample class that extends StkObjectSpatialEntity. Once you create an instance of StkObjectEntityExample, you can obtain a reference to an IAgStkObject from your STK scenario using the STK toolbox, as shown in Figure 2. You can then call updateFromObjectPath and pass the object into an instance of StkObjectSpatialEntity.

Alternatively, you can call updateFromNewObjectPath and pass in the object path to create a new STK object on the fly, as shown in Figure 3.

StkObjectEntityExample stkObjectEntityExample = new StkObjectEntityExample(mToolbox, mStkEarth, mTimeProvider);
String newStkObjectPath = "*/Target/newStkObject";
IAgStkObject stkObject = stkObjectEntityExample.updateFromNewObjectPath(newStkObjectPath);

Figure 3: Creating a new STK object in your STK scenario on the fly