Support
What are ways to take real-time data and use it in STK?
Background: What is Real-Time? "Real-time" typically refers to the ability to acquire, process, and transmit data with minimal delay, enabling near-instantaneous or time-critical decision-making for aerospace systems. While "real-time" may not be truly instantaneous, it implies a level of responsiveness that is sufficient for the intended applications and operations. STK and other technologies have the ability to ingest data in near real-time. Adding the actual data from systems to STK to visualization and analysis is an important step in operations. The data that STK can ingest is position and attitude data in many formats. There are a few ways to ingest this data into STK.
Different Real-Time Options: There are a few options to get Real-Time data into STK.
- The first way is using custom scripting or custom applications using STK’s full API with STK or STK Engine. STK and STK Engine can be used as they offer very similar coding capabilities. See the example for “How to send real-time data to STK via Matlab”.
- The second way is using STK Components. STK Components has a different coding techniques than STK Engine. STK Components has very low levels coding as compared to STK Engine and the STK API. See the example for real-time data in Components. Example KML Tracking Demo
- The third way is using STK/Real Time Tracking Tool (RT3) Extension. RT3 is an off-the-shelf solution for displaying and analyzing live and simulated data feeds in STK. DSim is another extension to RT3 that provides an IEEE-compliant Distributed Interactive Simulation (DIS) and High Level Architecture (HLA) interface for reading data feeds from distributed simulations. DSim uses MÄK Technology's VR-Link toolkit to interact with the HLA and DIS feeds.
https://analyticalgraphics.my.site.com/faqs/articles/Keyword/RT3-and-DSIM-Display-Manager-Setup
https://analyticalgraphics.my.site.com/faqs/articles/Knowledge/How-to-set-up-the-HLA-configuration-in-STK-DSim
Note: Due to the lack of support, the speed issues using RT3, and the lack of new features, STK/RT3 is not recommended for real-time data. Other options should be explored.
There are additional considerations that you need to consider when using STK in real-time. These include, number of objects with real-time data, propagation during data gaps, visualizations required, and analysis required. These considerations are important and can be discussed with LSAS Tec-Support. Please reach out to the team by creating a new ticket at https://lsas-tec.freshdesk.com/support/tickets/new.
How to send real-time data to STK via Matlab:
When it comes to incorporating real-time data into STK via Matlab, the process can be broken down into three main steps:
Matlab: Establishing Connection and Configuring Properties:
To begin, you need to establish a connection between STK and your data feed. Please note that connecting to specific data feeds may require custom readers due to their unique formats. However, integrating Matlab with STK itself is a straightforward process. You can establish a connection by using a few lines of code, as shown below. This code snippet also demonstrates how to check if STK is open and start a new instance if needed.
try
% Get reference to running STK instance
uiApplication = actxGetRunningServer('STK12.application');
catch
% Launch new instance of STK
uiApplication = actxserver('STK12.application');
end
Configuring Scenario and Satellite Properties:
In order to utilize real-time data, you need to configure the scenario and satellite properties to accommodate it. This ensures that LSAS can handle and process the incoming real-time data accurately. The following code snippet demonstrates how to attach to an existing satellite or create a new one and modify the necessary properties for position and attitude.
%Create a satellite with the Real-Time Propagator
satellite = stkRoot.CurrentScenario.Children.New('eSatellite','realtimeSat');
%Set a satellite to have Real-Time Propagator
satellite.SetPropagatorType('ePropagatorRealtime');
satellite.Propagator.Propagate;
%Some Basic Settings
satellite.Propagator.LookAheadPropagator = 'eLookAheadTwoBody';
satellite.Propagator.Duration.LookAhead = 1.0;
satellite.Propagator.Duration.LookBehind = 3600.0;
satellite.Propagator.TimeStep = 30.0;
satellite.Propagator.Propagate;
%Set a satellite with the Realtime Attitude
satellite.SetAttitudeType('eAttitudeRealTime');
satellite.Attitude.LookAheadMethod = 'eHold';
satellite.Attitude.Duration.LookAhead = 1.0;
satellite.Attitude.Duration.LookBehind = 60.0;
Ingesting Real-Time Data:
The final step involves ingesting the real-time data into STK. You will need to execute the commands shown below whenever a new data point becomes available from the feed. The look-ahead and look-behind times depicted in the code snippet above allow the object to continue propagating even if there is a temporary lapse in the data stream. The provided commands illustrate how to set a new position point and set a new attitude point.
%Data Feed Input into Matlab variable
utcTime = { Data Feed Time } ;
satelliteLatitude = { Data Feed Latitude };
satelliteLongitude = { Data Feed Longitude };
satelliteAltitude = { Data Feed Altitude };
satelliteQ1 = { Data Feed Q1 };
satelliteQ2 = { Data Feed Q2 };
satelliteQ3 = { Data Feed Q3 };
satelliteQ4 = { Data Feed Q4 };
%Simple format of the time
currentTime = datestr((utcTime),'dd mmm yyyy HH:MM:SS.FFF');
%Add Points
pointBuilder = satellite.Propagator.PointBuilder.LLA;
pointBuilder.Add(currentTime,satelliteLatitude,satelliteLongitude,satelliteAltitude,0,0,0)
%Add Attitude
satelliteAttitude = satellite.Attitude;
satelliteAttitude.AddQuaternion(currentTime,satelliteQ1, satelliteQ2, satelliteQ3, satelliteQ4);
Types of Position and Attitude Data:
Please note that the code provided above showcases an example of utilizing an LLA point and a quaternion. This code should be executed for each new point in the data feed. It's important to mention that attitude data is not mandatory, but it can be included if it's available. Additionally, position points can be defined in various frames such as ECF, ECI, and B1950, not limited to LLA. This is also true for attitude values.
https://help.agi.com/stkdevkit/Content/DocX/STKObjects~IAgVeRealtimePointBuilder.html
The AGL_LLA considers terrain at the specified location when measuring <Alt>. | |
The input values are in the B1950 coordinate frame. | |
Origin is at the center of the Earth and axes which are fixed to the Earth. | |
Origin is at the center of the Earth and axes which are fixed in inertial space. The inertial coordinate system is J2000. | |
The LLA measures <Alt> from the surface of the Earth, or 0. | |
Lat & Lon & Altitude + Heading & Pitch & Speed. | |
The MSL_LLA considers mean sea level at the specified location when measuring <Alt>. | |
Valid values for ZoneStr are A, B, Y, Z or ddc, where 00<dd<61 and c is C-X. |
https://help.agi.com/stkdevkit/index.htm#DocX/STKObjects~IAgVeAttitudeRealTime.html
Adds attitude data based on a time-ordered set of quaternions interpreted relative to CBF. | |
Adds attitude data based on a time-ordered set of yaw, pitch, roll angles in the J2000 ECI coordinate system. | |
Adds attitude data based on a time-ordered set of Euler angles. | |
Adds attitude data based on a time-ordered set of quaternions. | |
Adds attitude data based on a time-ordered set of yaw, pitch and roll angles. |
Here is a sample script used to simulate a data feed with random input values. This can be used to evaluate STK’s real-time capabilities without connecting the real data feed.
%LSAS-TEC Reference Code:
%Real-Time Satellite using Random Inputs
try
% Get reference to running STK instance
uiApplication = actxGetRunningServer('STK12.application');
catch
% Launch new instance of STK
uiApplication = actxserver('STK12.application');
end
% Get our IAgStkObjectRoot interface
stkRoot = uiApplication.Personality2;
% Get the Scenario in RealTime mode
stkScenario = stkRoot.CurrentScenario;
stkScenario.Animation.AnimStepType = 'eScRealTime';
%Auto-Delete the satellite if it exists.
try
temporarySatellite = stkRoot.GetObjectFromPath('Satellite/realtimeSat');
temporarySatellite.Unload;
catch
end
%Create a satellite with the RealTime Popagator
satellite = stkRoot.CurrentScenario.Children.New('eSatellite','realtimeSat');
satellite.SetPropagatorType('ePropagatorRealtime');
satellite.Propagator.Propagate;
%Some Basic Settings
satellite.Propagator.LookAheadPropagator = 'eLookAheadTwoBody';
satellite.Propagator.Duration.LookAhead = 1.0;
satellite.Propagator.Duration.LookBehind = 3600.0;
satellite.Propagator.TimeStep = 30.0;
satellite.Propagator.Propagate;
%Set a satellite with the Realtime Attitude
satellite.SetAttitudeType('eAttitudeRealTime');
satellite.Attitude.LookAheadMethod = 'eHold';
satellite.Attitude.Duration.LookAhead = 1.0;
satellite.Attitude.Duration.LookBehind = 60.0;
for timeSeconds = 1:3600
%Data Feed Input (Random Simulated Data)
utcTime = datetime( 'now' , 'timezone' , 'utc' );
currentTime = datestr((utcTime),'dd mmm yyyy HH:MM:SS.FFF');
satelliteLatitude = 0 + rand/1000;
satelliteLongitude = 125 + rand/1000;
satelliteAltitude = 35788 + rand/10;
satelliteQ1 = rand;
satelliteQ2 = rand;
satelliteQ3 = rand;
satelliteQ4 = rand;
%Add the realtime data from data feed.
pointBuilder = satellite.Propagator.PointBuilder.LLA;
pointBuilder.Add(currentTime,satelliteLatitude,satelliteLongitude,satelliteAltitude,0,0,0)
%Add Attitude
satelliteAttitude = satellite.Attitude;
satelliteAttitude.AddQuaternion(currentTime,satelliteQ1,satelliteQ2,satelliteQ3,satelliteQ4);
pause(1);
disp(currentTime);
end
%END OF CODE %%%%%%%%%%%%%%%%%%%%%%%%%%
Here is an example from the AGI Code Samples page.
If you have any further questions or need assistance, we are here to help! Our dedicated Tec-Support team is ready to provide prompt and personalized assistance tailored to your needs. Please don't hesitate to reach out by submitting a ticket by going to https://lsas-tec.freshdesk.com/support/tickets/new. We look forward to assisting you and ensuring a positive experience.
Thanks,
LSAS Tec-Support Team
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article