Plugin Samples

Sample applications that demonstrate some of those Plugin technologies follow.

On windows the code samples included in the STK install are read only. If you wish to work with one of the samples, you should copy the appropriate directory to an area on the local machine where you have write permissions, and then mark the files writable before trying to compile them.

Registering Windows Script and Binary COM Component Plugins on Vista with UAC Enabled

If User Account Control (UAC) is enabled on Vista, and you attempt to register a Windows Script or binary COM Component plugin, you will receive the following error:

The module C:\Windows\<system32>\scrobj.dll was loaded but the call to DllRegisterServer failed with error code 0x80070005.

Use the following workaround to register the plugin:

  1. Run the command in elevated mode. Right click on "Command Prompt" and select "Run as Administrator".
  2. Navigate to the directory containing the plugin(s) that you want to register.
  3. Run the following command: c:\windows\system32\regsvr32 /i:<plugin name> c:\windows\system32\scrobj.dll

Using Code Samples

The code samples included in the STK install are read only. To work with any of the installed code samples:

  1. From the Windows Start menu, select STK 12->STK Codesamples 12 to access <STK install folder>/CodeSamples/CodeSamples.zip.
  2. Copy CodeSamples.zip to a folder where you have write permissions and unzip the file.
  3. Change the properties of the files to writable before compiling them.

All code samples for extending constraints, listed below, are organized by programming language and project name in the <user-selected folder>CodeSamples/Extend/<Plugin Type><Language>/<Project> folder.

where,

<Plugin Type> can be Constraints, Gator.AttitudeControllers, Gator.EngineModels, Gator.Search, Gator.EOMFunctions, SRP.LightReflection, HPOP.ForceModels, DragModels, Radar, Ui.Plugins, Graphics, VGT.Plugins, or EphemerisFileReader.

Astrogator Attitude Controllers

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Gator.AttitudeControllers/<Language>/<Project>.

Language Project Description
C++ Gen Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.
Language Project Description
C# Gen Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.
Language Project Description
WSC JScript.Example1.AttitudeController Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.
MATLAB.Example1.AttitudeController Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.
VBScript.Example1.AttitudeController Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.
Language Project Description
Python Python_Att_Ctrl_Plugin_Example.py Computes the attitude of the body with respect to VNC axes using a Euler 321 sequence of rotations for yaw, pitch, and roll. Both yaw and pitch are modeled to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser.

Astrogator Engine Models

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Gator.EngineModels/<Language>/<Project>.

Language Project Description
C++ Gen Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.
Language Project Description
C# Gen Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.
Language Project Description
WSC JScript.Example1.EngineModel Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.
MATLAB.Example1.EngineModel Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.
VBScript.Example1.EngineModel Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.
Language Project Description
Python Python_Engine_Model_Plugin_Example.pl Computes thrust and Isp. Isp is specified by the user. Thrust is computed to grow with time since segment start, using user specified coefficients, and oscillate with user specified amplitude using the argument of latitude as the oscillation angle. The argument of latitude is obtained as a Calc Object from the Astrogator Component Browser. This sample serves as a demonstration of the capability and is not representative of any particular desired engine performance.

Astrogator Equation of Motion Function

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Gator.EOMFunctions/<Language>/<Project>.

Language Project Description
C++ Gen A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.
Language Project Description
C# Gen A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.
Language Project Description
Visual Basic Gen A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.
Language Project Description
WSC JScript.Example1.EOMFunc A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.
VBScript.Example1.EOMFunc A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.
Language Project Description
Python Python_EOMFunc_PluginExample.py A plugin that uses the Equations of Motion (EOM) function to give the derivative of four user variables: effective impulse, and the x-, y-, and z-components of integrated delta-V. This plugin uses the Astrogator plugin interface, IAgAsEOMFuncPlugin.

Astrogator Searches

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Gator.Search/<Language>/<Project>.

Language Project Description
C++ Gen A plugin search profile that uses a bisection method to target a value. These plugins use the Astrogator search plugin interface, IAgPluginSearch.
Language Project Description
C# Gen A plugin search profile that uses a bisection method to target a value. These plugins use the Astrogator search plugin interface, IAgPluginSearch.
Language Project Description
MATLAB Gen A plugin search profile that uses a bisection method to target a value. These plugins use the Astrogator search plugin interface, IAgPluginSearch.
Language Project Description
WSC JScript.SearchControlRealExample A plugin that configures a control for use with the SearchExample plugin. This plugin implements the Astrogator IAgSearchControlReal plugin interface.
JScript.SearchExample A plugin search profile that uses a bisection method to target a value. These plugins use the Astrogator search plugin interface, IAgPluginSearch.
JScript.SearchResultExample A plugin that configures a result for use with the SearchExample plugin. This plugin implements the Astrogator IAgSearchResults plugin interface.
VBScript.SearchControlRealExample A plugin that configures a control for use with the SearchExample plugin. This plugin implements the Astrogator IAgSearchControlReal plugin interface.
VBScript.SearchExample A plugin search profile that uses a bisection method to target a value. These plugins use the Astrogator search plugin interface, IAgPluginSearch.
VBScript.SearchResultExample A plugin that configures a result for use with the SearchExample plugin. This plugin implements the Astrogator IAgSearchResults plugin interface.

Constraints

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Constraints/<Language>/<Project>.

Language Project Description
C++ Range Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
Language Project Description
C# NIIRS Calculates a modified form of the NIIRS image quality metric, useful when evaluating optical instruments. This version of the GSD equation is parameterized in terms of Q (the optical ratio), lamba (wavelength), and D (optical diameter). These parameter values are made available for the user to edit. The constraint has been registered only for Facilities and Targets performing access to Sensors. This example is best suited for use as a Figure of Merit metric for Coverage computations.
Range Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
Language Project Description
Visual Basic Range Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
Language Project Description
WSC AccessConstraint.JScript.RangeExample Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
AccessConstraint.MATLAB.RangeExample Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
Language Project Description
Java

For instructions on configuring the Java samples with the Eclipse IDE, click here.

Extend_STK_Plugin_AccessConstraint_Common Sample code shared for Access Constraint Java plugins.
Extend_STK_Plugin_AccessConstraint_Config Demonstrates how to use the IAgUtPluginConfig and IAgAttrBuilder interfaces to provide configurable variables via the STK GUI for use in the runtime access computations.
Extend_STK_Plugin_AccessConstraint_NIIRS Calculates a modified form of the NIIRS image quality metric, useful when evaluating optical instruments. This version of the GSD equation is parameterized in terms of Q (the optical ratio), lamba (wavelength), and D (optical diameter). These parameter values are made available for the user to edit. The constraint has been registered only for Facilities and Targets performing access to Sensors. This example is best suited for use as a Figure of Merit metric for Coverage computations.
Extend_STK_Plugin_AccessConstraint_Range Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.
Language Project Description
Python

For more information on developing python plugins, click here.

Range Simply uses the range between objects as its metric. Of course, such a metric is already available in STK, but this code is meant to demonstrate registration issues, not computational complexity. It is registered on only a handful of possible STK Object pairings.

Density Models

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/DensityModels/<Language>/<Project>.

Language Project Description
C# Exponential Drag with Exponential Atmospheric Density Model.
ExtendedExponential Exponential Atmospheric Density Model, but triggered at additional times.
WSC ExtendedExponential Exponential Atmospheric Density Model, but triggered at additional times.
Python DensityModel Exponential Atmospheric Density Model, but triggered at additional times.

Drag Models

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/DragModels/<Language>/<Project>.

Language Project Description
C# Lift The atmospheric reflectance being modeled has components of lift and drag.
WSC Lift The atmospheric reflectance being modeled has components of lift and drag.
N-Plate N plate drag model. This model uses a 6-sided cube, 20 m^2 per side
Spherical The drag being modeled is that of a sphere.
Python Drag The atmospheric reflectance being modeled has components of lift and drag.

Ephemeris File Reader

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/EphemerisFileReader/<Language>/<Project>.

Language Project Description
C# EphemerisFileReader Demonstrates reading ephemeris into STK by parsing an example data report style.
Language Project Description
WSC JScript.Example.EphemerisFileReader Demonstrates reading ephemeris into STK by parsing an example data report style.
VBScript.Example.EphemerisFileReader Demonstrates reading ephemeris into STK by parsing an example data report style.

Graphics Plugins

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Graphics/<Language>/<Project>.

Language Project Description
C# OpenStreetMapPlugin Streams imagery from OpenStreetMap onto the globe.
ProjectionRasterStreamPlugin Projects a raster stream (video) onto a surface, such as terrain or a model, or the far end of a frustum.
Language Project Description
Visual Basic OpenStreetMapPlugin Streams imagery from OpenStreetMap onto the globe.
ProjectionRasterStreamPlugin Projects a raster stream (video) onto a surface, such as terrian or a model, or the far end of a frustum.
Language Project Description
Java

For instructions on configuring the Java samples with the Eclipse IDE, click here.

Extend_STK_Plugin_Graphics_Common Sample code shared for Graphics Java plugins.
Extend_STK_Plugin_Graphics_ProjectionStream_Basic Demonstrates how to create a Graphics Projection Stream plugin that can display a custom configurable (via file path) raster and project it into the 3D graphics visualization space.
Extend_STK_Plugin_Graphics_RasterStream_Basic Demonstrates how to create a Graphics Raster Stream plugin that can display a custom configurable (via file path) raster as a layer within the 3D graphics visualization.
Extend_STK_Plugin_Graphics_CustomImageGlobeOverlay_OpenStreetMap Demonstrates how to create a Graphics Custom Image Globe Overlay using Open Street Map online tile urls within the 3D graphics visualization.

HPOP Force Models

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/HPOP.ForceModels/<Language>/<Project>.

Language Project Description
C++ Gen Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
MyPlugin Template for building a C++ HPOP Force Model plugin.
Language Project Description
C# Gen Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
MyPlugin Template for building a C++ HPOP Force Model plugin.
Srp Computes a model of solar radiation pressure for a TDRS spacecraft, using both specular and diffuse reflectivity effects.
Language Project Description
Visual Basic Gen Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
Srp Computes a model of solar radiation pressure for a TDRS spacecraft, using both specular and diffuse reflectivity effects.
Language Project Description
WSC JScript.Example1.Hpop Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
MATLAB.Example1.Hpop Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
MyPlugin.Hpop Template for building a C++ HPOP Force Model plugin.
VBScript.Example1.Hpop Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.
Language Project Description
Python Python_Hpop_Force_Model_Plugin Adds additional constant acceleration in a user chosen reference frame (i.e., a maneuver without mass loss effects), and models a oscillating solar radiation pressure area. The oscillation angle is determined as the angle between the current position vector and a specified Vector from the Vector Geometry Tool.

Radar Plugins

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Radar/<Language>/<Project>.

Language Project Description
C++ Clutter Geometry A plugin that enables you to configure the clutter geometry algorithm. The clutter geometry algorithm determines the location of each clutter point relative to the radar.
Clutter Map A plugin that enables you to apply your own clutter database to clutter computations for a Radar.
RCS A plugin that is used for modeling the time dynamic, aspect dependent RCS and the reflected polarization of the Radar signal.
Language Project Description
C# Clutter Geometry This plugin enables you to configure the clutter geometry algorithm. The clutter geometry algorithm determines the location of each clutter point relative to the radar.
Clutter Map A plugin that enables you to apply your own clutter database to clutter computations for a Radar.
RCS A plugin that is used for modeling the time dynamic, aspect dependent RCS and the reflected polarization of the Radar signal.
Language Project Description
wsc Clutter Geometry This plugin enables you to configure the clutter geometry algorithm. The clutter geometry algorithm determines the location of each clutter point relative to the radar.
Clutter Map A plugin that enables you to apply your own clutter database to clutter computations for a Radar.
Language Project Description
Python Clutter Geometry A plugin that enables you to configure the clutter geometry algorithm. The clutter geometry algorithm determines the location of each clutter point relative to the radar.
Clutter Map A plugin that enables you to apply your own clutter database to clutter computations for a Radar.
RCS A plugin that is used for modeling the time dynamic, aspect dependent RCS and the reflected polarization of the Radar signal.

Solar Pressure Light Reflection

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/SRP.LightReflection/<Language>/<Project>.

Language Project Description
C# Spherical Model The light reflectance being modeled is that of a sphere.
Language Project Description
WSC 2 Plate Reflectance Model Computes Reflectance and Partials in Body Coordinates. This model solves for 2 scale parameters, one for each plate.
Spherical Model The light reflectance being modeled is that of a sphere.
Language Project Description
Python 2 Plate Reflectance Model Computes Reflectance and Partials in Body Coordinates. This model solves for 2 scale parameters, one for each plate.

UI Plugins

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/Ui.Plugins/<Language>/<Project>.

Language Project Description
C# Basic Adds a toolbar button, context menu, custom user interface, progress bar, and custom configuration page.
GfxAnalysis Contains a custom user interface that opens a scenario, adds a satellite, adds a sensor, and allows you to select an analysis to run on the objects. It shows the user how you can use the Object Model from a plugin.
RectangularSensorPlugin Adds a ProjectionStream to a rectangular sensors.
VgtGridPlugin Adds a spatial grid around an object.
Language Project Description
Visual Basic Basic Adds a toolbar button, context menu, custom user interface, progress bar, and custom configuration page.
Color Changer Allows the user to select multiple items in the Object Browser and change the items color with a color ramp or an explicit color. It shows the user how to use the Object Model from a plugin.

VGT Plugins

All code samples for extending constraints are organized by programming language and project name in <user-selected folder>CodeSamples/Extend/VGT.Plugins/<Language>/<Project>.

Language Project Description
C++ Axes Rotates the ICRF VGT axes on the object by 30 degrees.
CalcScalar Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
Point Compute object's altitude and divide it by 2.
Vector Compute the average position of the Sun and Moon displacement vectors.
Language Project Description
C# Axes Rotates the ICRF VGT axes on the object by 30 degrees.
CalcScalar Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
Point Compute object's altitude and divide it by 2.
Vector Compute the average position of the Sun and Moon displacement vectors.
Language Project Description
Visual Basic Axes Rotates the ICRF VGT axes on the object by 30 degrees.
CalcScalar Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
Point Compute object's altitude and divide it by 2.
Vector Compute the average position of the Sun and Moon displacement vectors.
Language Project Description
WSC VGT.Axes.JScript.Example1 Rotates the ICRF VGT axes on the object by 30 degrees.
VGT.Axes.VBScript.Example1 Rotates the ICRF VGT axes on the object by 30 degrees.
VGT.CalcScalar.JScript.Example1 Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
VGT.CalcScalar.VBScript.Example1 Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
VGT.Point.JScript.Example1 Compute object's altitude and divide it by 2.
VGT.Point.VBScript.Example1 Compute object's altitude and divide it by 2.
VGT.Vector.JScript.Example1 Compute the average position of the Sun and Moon displacement vectors.
VGT.Vector.VBScript.Example1 Compute the average position of the Sun and Moon displacement vectors.
Language Project Description
Python

For more information on developing python plugins, click here.

Axes Rotates the ICRF VGT axes on the object by 30 degrees.
CalcScalar Add "Trajectory(CBF).Cartesian.X” and “Trajectory(CBF).Cartesian.Z”
Point Compute object's altitude and divide it by 2.
Vector Compute the average position of the Sun and Moon displacement vectors.