Geostationary Satellite Visualizer Helper



This script shows how to improve the visualization of a GEO satellite from the STK defaults. This method requires 50+ setting changes, report generations, and modifying many properties, so it was easier to script it. It utilizes Connect Commands and the STK Object Model to perform the visualization changes. There are instructions to incorporate these visualization changes through the GUI here: How do I improve the visualization of GEO Satellite Orbits?

How to use:

  1. Create a Scenario with a satellite in Geosynchronous orbit called GEO.
  2. Run this code in MATLAB.

This script requires licensed installs of MATLAB, STK Integration and STK Analysis Workbench.

%Initialize STK with these 4 lines of code
%1 Establish the connection & Grab an existing instance of STK
%2 get the root from the personality
%3 set visible to true (show STK GUI)
%4 get the scenario root, its of type IAgScenario 
uiapp = actxGetRunningServer('STK11.application');
root = uiapp.Personality2;
uiapp.visible = 1;
scen = root.CurrentScenario;

    GEO = root.GetObjectFromPath('/Satellite/GEO');
    msgbox('Change the name of your satetllite to GEO or Find+Replace "Satellite/GEO" to "Satellite/MySatName"');

%this section makes a GEO object look like a nice GEO object.
%AGIers use these things to make the vehicle's orbit look good 
root.ExecuteCommand('Graphics */Satellite/GEO Basic LineWidth 3');
root.ExecuteCommand('Graphics */Satellite/GEO Pass2D OrbitLead None OrbitTrail All');
root.ExecuteCommand('Graphics */Satellite/GEO Pass2D Resolution MaxOrbit 100');
root.ExecuteCommand('VO */Satellite/GEO Pass3D Inherit On');
root.ExecuteCommand('VO */Satellite/GEO OrbitSystem Modify System "InertialByWindow" Show Off');
root.ExecuteCommand('VO */Satellite/GEO OrbitSystem Modify System "FixedByWindow" Show On');
root.ExecuteCommand('VO */Satellite/GEO Covariance Basic Show On Translucency 50');
root.ExecuteCommand('VO * Celestial Stars ShowPts Off');
root.ExecuteCommand('VO * Attributes Clouds On');
root.ExecuteCommand('Animate * Reset');

%Getting the LLA for this satellite to create the GeoStationary Box
satPosDP = GEO.DataProviders.Item('LLA State').Group.Item('Fixed').ExecSingle(scen.StartTime);
lat = cell2mat(satPosDP.DataSets.GetDataSetByName('Lat').GetValues);
lon = cell2mat(satPosDP.DataSets.GetDataSetByName('Lon').GetValues);
alt = cell2mat(satPosDP.DataSets.GetDataSetByName('Alt').GetValues);

%Create a GOOD view (Fixed View)
    fac = root.CurrentScenario.Children.New('eFacility','GoodView');
    fac = root.GetObjectFromPath('/Facility/GoodView');
    fac = root.CurrentScenario.Children.New('eFacility','GoodView');
fac.UseTerrain = false;
fac.Graphics.InheritFromScenario = false;
fac.Graphics.LabelVisible = false;

%Create and Show a GeoBox with a new Plane
%better than the Geostationary box because of a nice grid.
root.ExecuteCommand('VO * ViewFromTo Normal From Facility/GoodView To Facility/GoodView');
root.ExecuteCommand('VectorTool * Facility/GoodView Create Plane GeoBox "Normal"');
root.ExecuteCommand('VO */Facility/GoodView Model File "C:\Program Files\AGI\STK 11\STKData\VO\Models\Space\cubesat.mdl"')
root.ExecuteCommand('VO */Facility/GoodView SetVectorGeometry Add "Facility/GoodView GeoBox Plane" Show On Translucent On Translucency 0.8 PlaneSize 10.0 ShowAxisLabel On ShowRectGrid On');
root.ExecuteCommand('VO */Facility/GoodView ScaleLog 1.8');
root.ExecuteCommand('VO */Facility/GoodView ModelDetail Set ModelLabel .001 ');
Download File