Astrogator Engine Plugin MATLAB Script

« Go Back

Information

 
QuestionHow do I define an Astrogator custom engine model using a MATLAB script?
Answer
*** The following instructions are valid for STK 12.0 and later ***

As of STK 12.0, the custom engine model is deprecated and so you must define all custom engines through a COM plugin. To see examples of engine model COM plugins, go to <STK Install>\CodeSamples\Extend\Gator.EngineModels.

For all non-WSC-type plugins, duplicate Plugin Engine under Engine Models in the Component Browser, and then change the PluginIdentifier and PluginConfig fields in the new engine model to refer to your custom engine script.

For instructions on how to register and use WSC-type plugins, refer to this FAQ: How Do I Register a WSC-type Plugin with STK or ODTK? After you register the plugin, the custom engine model should appear under Engine Models in the Component Browser.

*** The following instructions are valid for STK 11.7 and earlier ***

You can see a working example on the AGI Code Snippets page. Refer to this example on AGI's Github to see a valid custom engine plugin script built in MATLAB. To define and implement your own custom model, follow these steps.

1. It is first necessary to build a valid MATLAB plugin script that registers the necessary inputs and outputs for a custom engine model. A valid MATLAB plugin always takes the same form, which is described in the Programmers Interface Help.

To see the possible inputs and outputs for a custom engine plugin, see the Astrogator Plugin Points help.

A simple custom engine model might look like this (make sure the file name matches the function name!):

User-added image

2. In STK, open the Component Browser under the Utilities shortcut menu.

3. In the Custom Functions folder, select MatlabCustomFunction and click Duplicate. Double-click the copy of the MatlabCustomFunction to select the MATLAB script created in step 3. It is a good idea to keep this script in the same folder as the scenario.

User-added image

4. In the Engine Models folder, select Custom Engine and click Duplicate. Double-click the copy of the Custom Engine and click the EvalFunction entry in the table. In the resulting window, move the component created in step 3 to the right. Accept all changes and close the component browser.

User-added image
User-added image

5. Create a new satellite and set the propagator to Astrogator.

6. In the Astrogator MCS, add a maneuver segment, change the type to Finite, and under the Engine tab – Engine Model, select the custom engine model created in step 4.

User-added image

7. Run the MCS to see the results. A MATLAB Command Window will appear as the MATLAB engine runs the script in the background. Check the message viewer for any errors or information. A correctly initialized and executed script will provide the following messages:

User-added image
TitleAstrogator Engine Plugin MATLAB Script
URL NameAstrogator-engine-plugin-MATLAB-script

Related Files