Matlab Integration solution is presented for Dynamics AX (Axapta) as a way to improve Dynamics AX (Axapta) computation performance significantly. It can be used for any performance critical calculation tasks.
An interface between Dynamics AX (Axapta) code and Matlab mathematical functions is implemented. Standard Dynamics AX (Axapta) doesn’t have built-in modules (classes) for this purpose, so own wrappers for Matlab-generated DLLs are necessary.
Matlab Integration solution provides a convenient and easy feature to call Matlab functions from Dynamics AX (Axapta) code. All required conversions for parameters and types are performed automatically.
Matlab® is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to-use environment where problems and solutions are expressed in familiar mathematical notation. Using Matlab, it is possible to solve technical computing problems faster than with traditional programming languages, such as C, C++, and FORTRAN.
Matlab provides a number of features for documenting and sharing a work. User can integrate his Matlab code with other languages and applications, and distribute own Matlab algorithms and applications.
For more information, please visit MathWorks site at www.mathworks.com.
General idea is to implement a universal module that provides interface to Matlab features from Dynamics AX (Axapta). This module is a COM-object that can be used from any code such as C++, Visual Basic etc.
Matlab provides its own COM-objects that can be produced via Matlab COM-Builder tool. However, these objects are unusable for Dynamics AX (Axapta) because of some technical restrictions.
Dataflow diagram is shown in Figure 1.
Dynamics AX (Axapta) code uses Matlab Proxy Object that operates with Matlab function wrapper DLL. Matlab compiler produces that wrapper DLL automatically for user function. CTF file contains compiled function code that is executed by Matlab runtime engine.
Matlab Proxy module maintains universal object model that allows using of any Matlab function independently on its parameters, return values and types.
Performance test results shown in Table 1 illustrate a significant advantage of Matlab vs Dynamics AX (Axapta) code for arithmetic operations.
Test Platform | Integer | Double | Total |
Axapta 2.5 | 1260 | 6800 | 8060 |
Axapta 3.0 with debug mode | 6890 | 10920 | 17810 |
Axapta 3.0 w/o debug mode | 6180 | 10060 | 16240 |
Axapta 3.0 with “C” DLL | 30 | 10 | 40 |
Axapta 3.0 with “C#” COM | 30 | 20 | 50 |
Axapta 3.0 with COM connector | 2070 | 6710 | 8780 |
XAL 2.8 | 1000 | 6000 | 7000 |
VBA macro (MS-Word 2003) | 440 | 130 | 570 |
VC++ 6.0 (exe) | 30 | 10 | 40 |
C# NET (exe) | 40 | 10 | 40 |
MATLAB 7.01 | N/A | 20 | 20 |
Usage of Matlab Integration gains much better performance for mathematic operations in Dynamics AX (Axapta). It efficiently utilized the power Matlab suite and extends standard Dynamics AX (Axapta) functionality. Described approach has broad applicable area for implementation of our Business Optimization Solutions.