customizing computations with stk plug-ins using compiled code

59
Pg 1 of 59 AGI www.agiuc.com Customizing computations with STK Plug-ins using compiled code Dr. Vince Coppola – Analytical Graphics, Inc. October 2005

Upload: glenda

Post on 02-Feb-2016

60 views

Category:

Documents


0 download

DESCRIPTION

Customizing computations with STK Plug-ins using compiled code. Dr. Vince Coppola – Analytical Graphics, Inc. October 2005. Outline. What is an STK plug-in? Motivation: TDRS SRP Model COM based plug-ins Access constraint example Questions and answers. What is an STK plug-in?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Customizing computations with STK Plug-ins using compiled code

Pg 1 of 59AGI www.agiuc.com

Customizing computations with STK Plug-ins using compiled code

Dr. Vince Coppola – Analytical Graphics, Inc.

October 2005

Page 2: Customizing computations with STK Plug-ins using compiled code

Pg 2 of 59AGI www.agiuc.com

Outline

• What is an STK plug-in?

• Motivation: TDRS SRP Model

• COM based plug-ins

• Access constraint example

• Questions and answers

Page 3: Customizing computations with STK Plug-ins using compiled code

Pg 3 of 59AGI www.agiuc.com

What is an STK plug-in?

• Custom software that STK uses during computations

• Purpose– Customize models used in STK computations to specific

needs

Page 4: Customizing computations with STK Plug-ins using compiled code

Pg 4 of 59AGI www.agiuc.com

What is an STK plug-in? (cont.)

• Differs from STK/Connect– Not used to control task flow

• Differs from STK/X and 4DX– Not used for custom GUIs– Not used for creating a custom application

Page 5: Customizing computations with STK Plug-ins using compiled code

Pg 5 of 59AGI www.agiuc.com

Example: TDRS SRP model

• TDRS– GEO Communication satellite– Solar panels track Sun– Solar sail, AW C-band antenna, and SGL antenna are nominally

Earth-pointing

• Need– Generate ephemeris using a high-fidelity force model

• Force Model Contributors– Gravity field (solid tides?) (ocean tides?)– Third body gravity (Sun, Moon, others?)– General relativity effect– Solar radiation pressure (SRP)

Page 6: Customizing computations with STK Plug-ins using compiled code

Pg 6 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• Solar radiation pressure force– Depends on particle absorption and reflection– Depends on surface orientation– Surface orientation varies along the trajectory

• Generic model: spherical shape– Accel = Cr * (Area/mass) * Illumination * Irradiance / c– Directed along apparent sun line– Supported by STK

Page 7: Customizing computations with STK Plug-ins using compiled code

Pg 7 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• Better model for TDRS– Based on Pechenick, K. and Hujsak, R. (1987)– Account for surface orientation of main parts– Account for diffuse and specular reflection– Accel = Cr *(1.0/mass)* Illumination * Irradiance / c *

{A1 k + A2 k x ( k x N ) + A3 k x ( k x M ) }– k – along sun line, N normal to solar panels, M radial– A1, A2, A3 depends on area, reflection values

Page 8: Customizing computations with STK Plug-ins using compiled code

Pg 8 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• Use a HPOP Plug-in – Code the model in a computer language of choice

• C++, C#, VB.NET, Perl, VBScript, Jscript, etc.

– Adhere to the published plug-in interface• Sample code provided

– Choose to use the plug-in from the HPOP GUI• Just like the other force model settings

– Set any plug-in specific parameters from the GUI• Similar to the other force model settings

– Configure the remaining force model parameters– HPOP generates the ephemeris using the force model

Page 9: Customizing computations with STK Plug-ins using compiled code

Pg 9 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• What you don’t code (nor test, doc, maintain)– All the other force model contributions– The numerical integration algorithm– The VOP formulation– The time regularization algorithm– The covariance propagation algorithm

• Save time and avoid risk– Code only the custom part

Page 10: Customizing computations with STK Plug-ins using compiled code

Pg 10 of 59AGI www.agiuc.com

Purpose

Plug-ins provide the means for custom modeling while leveraging STK’s tested

generic computational framework

Only code the custom part of the model

Page 11: Customizing computations with STK Plug-ins using compiled code

Pg 11 of 59AGI www.agiuc.com

HPOP plug-in uses

• Attitude dependent SRP

• Attitude dependent Drag

• Density model

• Satellite thermal emission

• Micrometeorite particle collisions

• Re-entry drag and lift

• Outgasssing (thrust without mass loss)– Models non-physical accelerations

Page 12: Customizing computations with STK Plug-ins using compiled code

Pg 12 of 59AGI www.agiuc.com

Outgassing

Page 13: Customizing computations with STK Plug-ins using compiled code

Pg 13 of 59AGI www.agiuc.com

Performance

143168

329

0

50

100

150

200

250

300

350

C++ C# Jscript

90 days propagation

seco

nds

Page 14: Customizing computations with STK Plug-ins using compiled code

Pg 14 of 59AGI www.agiuc.com

Plug-in evolution

• STK 4.3 introduced plug-in scripts (2002)– Perl, VBScript, Matlab scripts– AGI-developed interface

• Installation• Calling conventions• Debugging ideas• Troubleshooting

Page 15: Customizing computations with STK Plug-ins using compiled code

Pg 15 of 59AGI www.agiuc.com

Available plug-in points

• 15 plug-in points– Astrogator– Vector Tool– Access constraint– Attitude simulator– Communications modeling

Page 16: Customizing computations with STK Plug-ins using compiled code

Pg 16 of 59AGI www.agiuc.com

Plug-in scripts

• Use– Only needed when generic models are insufficient– Several customers rely on this capability

• Limitations– 3 languages – Perl, VBScript, Matlab– Not as fast as compiled code– Non-standard function calling conventions– Requested input data must be known a priori – Unable to get/set plug-in parameter data

Page 17: Customizing computations with STK Plug-ins using compiled code

Pg 17 of 59AGI www.agiuc.com

COM-based plug-ins

• Computer programmer-friendly plug-ins– Based on Microsoft’s COM technology

• STK 6.1 introduced COM Plug-ins (2004)– HPOP

• STK 6.2 (2005)– Astrogator engine model, Astrogator attitude controller

• STK 7.0 (2005)– Alpha prototype for Access constraints, dynamic phase

array antenna

Page 18: Customizing computations with STK Plug-ins using compiled code

Pg 18 of 59AGI www.agiuc.com

COM

• Component Object Model – Standard Microsoft protocol– Many languages (Windows operating system)

• C++, C#, VB.NET, Perl, VBScript, Jscript

– Sun Java• No samples yet customer interest?

– Microsoft J++ / J#• No samples yet

Page 19: Customizing computations with STK Plug-ins using compiled code

Pg 19 of 59AGI www.agiuc.com

Plug-in concepts

• Focused on a computational task– HPOP: evaluating the force model– Attitude controller: steering an engine– Engine model: modeling thrust and flow rate– Access constraint: providing a visibility measure

• Plug-in point– Own triggering events– Provides interface for setting/getting input/output data

Page 20: Customizing computations with STK Plug-ins using compiled code

Pg 20 of 59AGI www.agiuc.com

Plug-In Points

• Must modify STK to make a plug-in point– Identify a computation– Identify a need for user customization– Identify the triggering events– Identify inputs and outputs

• Made available as need arises

Page 21: Customizing computations with STK Plug-ins using compiled code

Pg 21 of 59AGI www.agiuc.com

Matlab plug-ins

• Previous capability supported Matlab– Compatible with Matlab version 6.x and 7.x

• Matlab is COM-aware– Can use COM objects– Can be used as a COM object

• Recommendation– Use a scripting language plug-in to STK– Call Matlab from scripting language

Page 22: Customizing computations with STK Plug-ins using compiled code

Pg 22 of 59AGI www.agiuc.com

HPOP plug-in

• Custom force model

• Supported by STK and ODTK

• Plug-in scripts– Astrogator propagator plug-in– Custom force model– Migration to COM plug-ins soon!

Page 23: Customizing computations with STK Plug-ins using compiled code

Pg 23 of 59AGI www.agiuc.com

HPOP plug-in events

• Init()

• PrePropagate()

• PreNextStep()

• Evaluate()

• PostEvaluate()

• PostPropagate()

• Free()

Page 24: Customizing computations with STK Plug-ins using compiled code

Pg 24 of 59AGI www.agiuc.com

Hpop plug-in events (cont.)

PostPropagate()

PrePropagate()

while needing to take another step

{ PreNextStep()

Attempt the step

while haven’t taken a good step

{

Assess whether step is good

}}

Page 25: Customizing computations with STK Plug-ins using compiled code

Pg 25 of 59AGI www.agiuc.com

Hpop plug-in events (cont.)

Attempt the step:

Evaluate force model :

Evaluate()

Perform preliminary computations

Compute all force model contributions

PostEvaluate()

Add all force model contributions

Page 26: Customizing computations with STK Plug-ins using compiled code

Pg 26 of 59AGI www.agiuc.com

Calling convention

• Plug-in scripts passed input / output data

• COM based plug-ins pass interfaces– Each event has an interface appropriate for that event– The interface has properties and methods for getting

inputs and outputs

bool

Evaluate( IAgAsHpopPluginResultEval interface)

Page 27: Customizing computations with STK Plug-ins using compiled code

Pg 27 of 59AGI www.agiuc.com

Calling Convention (cont.)

bool

Evaluate( IAgAsHpopPluginResultEval interface)

illum = interface.SolarIntensity

if(illum > 0)

{

interface.SunPosition(eSRP, eInertial,

sunX, sunY, sunZ)

… <compute SRP acceleration> …

interface.AddAccleration(eInertial, aX, aY, aZ)

}

Page 28: Customizing computations with STK Plug-ins using compiled code

Pg 28 of 59AGI www.agiuc.com

Calling Convention (cont.)

Init( IAgUtPluginSite siteInterface)

PrePropagate( IAgAsHpopPluginResult interface)

PreNextStep( IAgAsHpopPluginResult interface)

Evaluate( IAgAsHpopPluginResultEval interface)

PostEvaluate( IAgAsHpopPluginResultPostEval

interface)

PostPropagate( IAgAsHpopPluginResult interface)

Free()

Page 29: Customizing computations with STK Plug-ins using compiled code

Pg 29 of 59AGI www.agiuc.com

Exception handling

• Event calls return a Boolean value– True: everything is okay– False: an unrecoverable error occurred

• Turns this event off – no longer called

• STK code captures exceptions raised by a plug-in– Exception text sent to message viewer

• Certain interface function may fail– Sets a defined error code

Page 30: Customizing computations with STK Plug-ins using compiled code

Pg 30 of 59AGI www.agiuc.com

Inputs and outputs

• Specific to each interface

• Ephemeris

• Variables pertaining to the plug-in point– HPOP: Cd, Drag Area, Cr, SRP Area, Mass, etc.– Engine Model: thrust, mass flow rate, Isp– Attitude Controller: Euler angles, quaternion

• Methods and properties

Page 31: Customizing computations with STK Plug-ins using compiled code

Pg 31 of 59AGI www.agiuc.com

Documentation

• Compiled help file (stkPlugins.chm)– Plug-in points– Triggering events– Interface methods and properties– 7 language syntaxes shown

• VB.NET, VB6, C#• Managed C++, Unmanaged C++• VBScript, Perl

Page 32: Customizing computations with STK Plug-ins using compiled code

Pg 32 of 59AGI www.agiuc.com

Evaluate method

Page 33: Customizing computations with STK Plug-ins using compiled code

Pg 33 of 59AGI www.agiuc.com

Evaluate method (cont.)

Page 34: Customizing computations with STK Plug-ins using compiled code

Pg 34 of 59AGI www.agiuc.com

Eval interface

Page 35: Customizing computations with STK Plug-ins using compiled code

Pg 35 of 59AGI www.agiuc.com

SunPosition method

Page 36: Customizing computations with STK Plug-ins using compiled code

Pg 36 of 59AGI www.agiuc.com

SunPosition_Array method

Page 37: Customizing computations with STK Plug-ins using compiled code

Pg 37 of 59AGI www.agiuc.com

IAgUtPluginSite interface

• bool Init( IAgUtPluginSite site)

• Message Viewer– Write messages to message viewer

• Vector Tool– Vectors, axes, points, angles, etc– Ephemeris and attitude of any object expressed in any

components

• Astrogator Calc Objects

Page 38: Customizing computations with STK Plug-ins using compiled code

Pg 38 of 59AGI www.agiuc.com

Building plug-in components

• Scripting languages– Windows script host– Text editor

• Compiled languages– Microsoft Visual Studio (C++, C#, VB.NET)

Page 39: Customizing computations with STK Plug-ins using compiled code

Pg 39 of 59AGI www.agiuc.com

Installation

• Standard COM registration

• Registration in the Windows registry– GUID– Regsvr32

• C++ components• Perl, VBScript, Jscript components

– Regasm • .NET components (C#, VB.NET)

• Must register on every machine you want to run on

Page 40: Customizing computations with STK Plug-ins using compiled code

Pg 40 of 59AGI www.agiuc.com

Debugging

• Available for compiled plug-ins– Able to debug plug-in code when running STK– Must exit STK before re-building the plug-in

• Not available for scripting languages– Create a log file instead– Use message viewer (but not too much)– Advantage: Can edit text file with STK running

• Helps to reduce cycle time

Page 41: Customizing computations with STK Plug-ins using compiled code

Pg 41 of 59AGI www.agiuc.com

TDRS SRP model

• Init()– Return true to turn plug-in On

• PrePropagate()– Check whether SRP is On– Pre-compute some variables

• PreNextStep, PostPropagate(), Free()– If debug mode, output msgs else do nothing

Page 42: Customizing computations with STK Plug-ins using compiled code

Pg 42 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• Evaluate()– Compute SRP based on formula– Use interface->AddAcceleration()

• PostEvaluate()– If debug mode, output diagnostic messages to viewer

Page 43: Customizing computations with STK Plug-ins using compiled code

Pg 43 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

• Plug-in parameter data– Diffuse reflectivity, specular reflectivity– ‘Debug’ settings (messages sent to MessageViewer)

• IAgUtPluginConfig– Implement this interface to set / get parameter data– GetPluginConfig()

• Register parameter data with STK

– VerifyPluginConfig()• Determine whether user settings are acceptable

Page 44: Customizing computations with STK Plug-ins using compiled code

Pg 44 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

AddBoolDispatchProperty (

scope,

"DebugMode",

"Turn debug messages on or off",

"DebugMode",

eFlagNone )

Page 45: Customizing computations with STK Plug-ins using compiled code

Pg 45 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

AddDoubleDispatchProperty (

scope,

"Reflectivity_Specular",

"Specular reflectivity coefficient",

"SpecularReflectivity",

eFlagNone )

Page 46: Customizing computations with STK Plug-ins using compiled code

Pg 46 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

Page 47: Customizing computations with STK Plug-ins using compiled code

Pg 47 of 59AGI www.agiuc.com

TDRS SRP model (cont.)

Page 48: Customizing computations with STK Plug-ins using compiled code

Pg 48 of 59AGI www.agiuc.com

Choosing a plug-in language

Language SpeedCode

complexityMemory Debug

Scripting Slower Simple Automatic No

C#, VB.NET

Fast Medium Automatic Yes

C++ Fastest DifficultManage

yourselfYes

Page 49: Customizing computations with STK Plug-ins using compiled code

Pg 49 of 59AGI www.agiuc.com

Using COM in plug-in scripts

• Post STK 7.0– Migration to use COM based plug-ins

• Able to use COM plug-ins from VBScript– Restricted to inputs / outputs available– Must use AGI-defined interface– Get handle to the COM component on initialization– Route inputs to the COM component– Have COM component compute values– Return using plug-in script mechanism

Page 50: Customizing computations with STK Plug-ins using compiled code

Pg 50 of 59AGI www.agiuc.com

Access constraints

• Constraints are often measures– Elevation angle– Range– Ground elevation angle– Sunlight

• Used for visibility and for Figures Of Merit (FOM)– Coverage: visibility to a grid of points– FOM: quality of coverage during visibility times

Page 51: Customizing computations with STK Plug-ins using compiled code

Pg 51 of 59AGI www.agiuc.com

Figure of merit

Page 52: Customizing computations with STK Plug-ins using compiled code

Pg 52 of 59AGI www.agiuc.com

Example: image quality

• Sensor taking a picture of ground – Oblique geometry of sensor with respect to ground– Sensor properties (focal length, pixel resolution)– Ground properties (sun elevation)– Time effects

• Create an access constraint plug-in– Use as an image quality metric

Page 53: Customizing computations with STK Plug-ins using compiled code

Pg 53 of 59AGI www.agiuc.com

Ground sampled distance

• Built in GSD constraint

• pp is the pixel pitch

• range is the slant range

• θ is the ground elevation angle

• f is the focal length

sinf

rangeppGSD

Page 54: Customizing computations with STK Plug-ins using compiled code

Pg 54 of 59AGI www.agiuc.com

Ground spot size and optical ratio

• Ground spot size due to the optics

• D is the optical diameter

• λ is the wavelength

• The optical ratio

sinD

rangeGSS

Dpp

f

GSD

GSSQ

Page 55: Customizing computations with STK Plug-ins using compiled code

Pg 55 of 59AGI www.agiuc.com

Alternate GSD

• Can perform trade studies on GSD as we vary Q

• Create a plug-in constraint– Implement GSD as function of Q

sin

DQ

rangeGSD

Page 56: Customizing computations with STK Plug-ins using compiled code

Pg 56 of 59AGI www.agiuc.com

Q Variation Study

Q = 0.583Q = 0.750Q = 1.000Q = 1.250Q = 1.500Q = 1.750Q = 2.000

Page 57: Customizing computations with STK Plug-ins using compiled code

Pg 57 of 59AGI www.agiuc.com

NIIRS

• National Image Interpretability Rating Scale– “Image quality for remote sensing systems,” Robert

Fiete, Eastman Kodak, Opt. Eng. 38(7), July 1999.– For electro-optical systems

• Create a plug-in access constraint

SNR

GHRERb

GSDaNIIRS

344.0656.0log

)(log251.10

10

10

inches in

Page 58: Customizing computations with STK Plug-ins using compiled code

Pg 58 of 59AGI www.agiuc.com

NIIRS Results

Q = 2.000

Page 59: Customizing computations with STK Plug-ins using compiled code

Pg 59 of 59AGI www.agiuc.com

Questions & answers