COM-Based Engine Plugins

COM-based engine plugin components provide a capability for users to incorporate customer-specific non-generic modeling into computations. An engine plugin component is a software component built using Microsoft's COM technology that is called by the application at certain pre-defined event times within the computation cycle. The plugin is allowed to modify the computation by adding additional considerations or modifying parameters. There are two types of COM-based engine plugins: (i) compiled code (usually a dynamic link library) and (ii) script code (not to be confused with plugin scripts). COM-based plugins can be implemented in any COM compatible programming language or scripting language including the scripting languages supported by the Engine Plugin Scripts.

COM-based engine plugins were developed to address the limitation of plugn scripts, at the expense of slightly increased complexity. Some of the available plugin points overlap those available using scripting plugins. As plugin points that currently use plugin scripts are rewritten to use COM-based plugins, backward compatibility will be preserved. Although the current plugin script capabilities continue to be supported, we recommend that when a plugin point is available both for scripting and COM-based plugins, that you use the COM-based plugin point.

Compiled code may be implemented in a variety of languages (Visual Basic, Visual C#, C++, etc.) that support COM interfaces. Compiled code will be executed almost as fast as the application program itself. Another advantage is that you can debug your component using a standard debugger while it is in use. Of course, any modification of the code requires recompilation before it can be used. While a C++ COM component can be used, modified, rebuilt, and used again while the application is still running, COM components built using a .Net(Visual Basic and Visual C#, etc.) cannot---they can only be rebuilt once the application has exited.

You can use WSH (Windows Scripting Host) to implement a COM Engine plugin using any text editor. They can be implemented in a variety of languages (VBScript, JScript, PerlScript, Python, etc.). This presents the same advantages and inconveniences as plugin scripts. Although the script code is slower to execute than compiled code, scripts can be edited after each run. They cannot be debugged, however. Often, proof-of-concepts are developed using scripts before being written in a compiled language for speed.

Many users may wish to use MATLAB to perform their computations. MATLAB is COM-aware and can be called through a COM interface. To use MATLAB in a plugin, it is recommended that you create a Windows script component using a script language, and communicate with MATLAB through its COM object model. Samples are provided that use a VBScript component that opens up MATLAB and calls a MATLAB m-file to perform a computation. Because MATLAB is an application, not just a dynamic link library (DLL), function calls made between the plugin and MATLAB are likely to be very much slower than just using the scripting environment itself (which of course is slower than using a compiled language).Speed penalties of up to 50x over the use of the scripting environment itself have been observed.

Available COM-based Plugins

For a list of COM-based plugins that includes their plugin points and a description, see STK Engine plugins

Related Topics:

You may also want to learn more about:

STK 11.2.1 Programming Interface