In 20-sim you can exchange data with Matlab / Simulink in various ways:
|•||Export models as m-files|
|•||Export models as dll-files|
|•||Export a variable to Matlab|
|•||Export a parameter to Matlab|
|•||Pass a variable value to Matlab every simulation step|
|•||Load a variable value from Matlab every simulation step|
|•||Pass a command line string to Matlab every simulation step|
|•||Export linear systems to Matlab|
|•||Import Linear Systems from Matlab|
If this fails check if the following three points have been fulfilled.
To make a connection with Matlab, make sure you have 20-sim 188.8.131.52 or higher installed and a recent version of Matlab (2007 or above).
64-bit versions of Matlab are supported starting with 20-sim 4.6.
To make the connection to Matlab, Matlab needs to be registered as a COM-component. Not all Matlab versions register the COM-component automatically.
|1.||In 20-sim, open the Simulator (Ctrl+R)|
|2.||Open the Tools menu|
|3.||Click the Matlab button|
If Matlab starts (be patient this could take some time), the Matlab COM automation server is registered properly and you are finished. In case the error message "Could not start Matlab. Make sure that Matlab is installed and that the Matlab COM automation server is enabled.", proceed with step 3 and 4.
To make the connection to Matlab, Matlab needs to be registered as a COM-component. This can be done in the following manner from the command line (run: cmd):
The COM-registration only, is not enough for 20-sim to find the DLL's of Matlab. The next step (setting the PATH variable) must be performed also
The standard registration of Matlab in the PATH is the following (assuming Matlab is installed in Program Files and the used version of Matlab is R2015b):
The following path should be added too in case of a 32-bit version of Matlab:
In this additional path some important DLL's are present that are necessary to make the connection. for example: libeng.dll. Please check if this DLL is present at this path. If not try to find this DLL in your Matlab installation and add the found path to the PATH environment.
Changing the PATH environment variable can be done in the following manner:
|1.||From "My Computer", right mouse button: Properties:|
|2.||On Windows 7: choose Advanced Properties and go further as Admin, On Windows XP: you go directly to the System Properties dialog|
|3.||Choose the tab: Advanced|
|4.||Choose: Environment Variables.|