AGI STK Engine (4DX) Blog

May 13, 2009

STK 9 Astrogator Object Model

Filed under: .Net, C#, Java — Tags: , , , , , — Matthew @ 5:15 pm

With STK 9 just about wrapped up, I have time to talk about some of the new features added to the STK Object Model. I'll be focusing today on one of the major pieces that was added, Astrogator. For those who aren't too familiar with Astrogator, it is a specialized analysis module for interactive orbit maneuver and spacecraft trajectory design. Astrogator acts as one of the propagators available for a satellite object. This module calculates the satellite's ephemeris by executing a Mission Control Sequence, or MCS, that you define according to the requirements of your mission. By exposing it through the STK Object Model you now have more options for automating repetitive tasks, integrating with other applications or even developing your own custom application.

Following are a few of the many highlights of the Astrogator Object Model.
Documentation
All the interfaces, methods and properties have been fully documented.

STK 9 Astrogator Object Model documentation

Included in the documentation are high level diagrams that show how the interfaces are interconnected. I'd recommend taking a look at these diagrams because they can be very important to get a visual picture of the overall architecture.

Diagram of the STK 9 Astrogator Object Model

 

Support for multiple languages
The Astrogator Object Model can be used in environments supporting COM automation. Available environments include .Net (Visual Basic©, Visual C#©, etc.), Java, Visual C++, PowerPoint, Excel, Access, and scripting languages supporting COM late binding.

With languages like C# and Java you have the added benefit of intellisense to make your productivity soar

Intellisense using Astrogator Object Model in STK 9

 
If you notice, all of the interfaces have been prefixed with IAgVA(Vehicle Astrogator) to help find Astrogator specific functionality and all enumerations have been prefixed with AgEVA.

Consistency with STK Object Model and the previous Astrogator automation.
In previous versions of STK, it was possible to automate Astrogator with latebound clients such as vbscript. This was good, but it didn't have the benefits of catching mistakes at compile time(think of how much time this will save!) or finding what functionality was available. While designing the Astrogator Object Model, we tried to be consistent with the previous Astrogator automation as much as possible. As an example, to get the Result Value of a segment in the previous versions you'd code something like this(in javascript).
var leader = stk.Scenario(0).Satellite(0).GetAstrogatorDefn();
var leaderProp = leader.GetSegmentByName("Propagate");
var inTrack = leaderProp.GetResultValue("InTrack");

The new way is pretty similar(in C#).
IAgSatellite leaderSat = Application.CurrentScenario.Children["leader"] as IAgSatellite;
IAgVADriverMCS leader = leaderSat.Propagator as IAgVADriverMCS;
AgVAMCSPropagate leaderProp = leaderDriver.MainSequence["Propagate"] as AgVAMCSPropagate;
double inTrack = (double)leaderProp.GetResultValue("InTrack");

The STK Object Model uses what we call UnitPreferences that allows the user to input or output data in a particular unit type. The Astrogator Object Model uses the same UnitPreferences to make functionality consistent across the board. If you're used to coding using the STK Object Model, you'll be able to jump right in and start coding without a learning curve. Even if you aren't too familiar, we have a lot of tutorials for both the STK Object Model and Astrogator Object Model to get you up to speed fast.

To finish out, I took an excellent article “Simultaneous” propagation with Astrogator and rewrote it using C# and the new Astrogator Object Model exposed in STK 9. To run the attached project, you'll need to start up STK and load the scenario attached to the blog. Two things to note. the script in their attached zip file used meters for distance quantities so the UnitPreferences in my application had to be changed from the default kilometers to meters. The second thing to note is that the code is pretty similar and the end result looks pretty sweet. 

Image of the Astrogator run using the Astrogator Object Model

With intellisense, great documentation and a small learning curve, you'll find youself mastering interactive orbit maneuvers in no time at all! Enjoy!

To view the project click here.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress