Exporting Models

Navigation:  Editor > Using Models >

Exporting Models

Previous pageReturn to chapter overviewNext page

There are several methods to export 20-sim models.

Export to previous versions of 20-sim

You can save a model file using the Save command or the Save As command from the File menu. If you want to save part of you model, use the Save Submodel command of the File menu. A Save dialog will be opened in which you can enter the model name and location. At the bottom of the dialog, you can use the Save As Type box to select the file type:

 

 

Model files (*.emx)

Standard 20-sim 4.x format

 

Packed files (*.emz)

Zipped file including all linked files (e.g. datafiles, dll's, bitmaps etc.)

 

Sidops text files (*.txt)

Save model as text file.

Export to zip file

You can save a model and all externally linked files into one zip-file, using the Pack command of the File menu. With the Unpack command of the File menu, you can open these zip-files.

Export to Clipboard

From the File menu click Export and To File to export a selected model as a drawing to the clipboard (Windows Enhanced Metafile format).

Export to File

From the File menu click Export and To File to export a selected model as a drawing to a file (Windows Enhanced Metafile format).

Export to HTML

From the File menu click Export and To HTML to export the model, simulations etc. to an HTML file for the use in a word processor.

Export to Bitmap

From the File menu click Export and To Bitmap to export a selected model as a drawing to a file (png format).

Export to Matlab (m-file)

To export 20-sim models to Matlab, from the Editor you have to select the File menu and then click Export to Matlab/Simulink command. This will open a Matlab-Code Generation dialog. You can choose to export a complete model or a submodel. In both cases, three m-files are generated:

ModelName.m: A file containing the model equations and special 20-sim functions. The model equations are directly translated from the equations that are shown with the Show Equations command of the Model menu.
ModelName_run.m: An example file showing you how to run a simulation with the exported model in 20-sim.
ModelName_print.m: This file contains a function that is used in the run file.

Export to Simulink (m-file)

20-sim models are exported to Simulink S-functions. S-functions are block diagram elements of which the internal description can be an m-file or a dll-file. 20-sim can export both types. M-files can be opened from within Matlab and are therefore more accessible. Dll-files are compiled out of C-code, which makes them inaccessible, but a lot faster. Simulink does not support powerports. Therefore the powerports in a 20-sim model are translated to input and output ports.

 

To export 20-sim models to Simulink with an m-file description, from the Editor select the File menu and then click Export to Matlab/Simulink command. This will open a Matlab-Code Generation dialog. You can choose to export a complete model or a submodel. In both cases, two files are generated:

ModelName_.mdl: The exported 20-sim model based on a m-file that describes the model.
ModelName.m: An m-file that contains the model equations and special 20-sim functions. The model equations are directly translated from the equations that are shown with the Show Equations command of the Model menu.

Export to Simulink (dll-file)

To export 20-sim models to Simulink with an dll-file description, from the Simulator you have to select the Tools menu and then click the C-code generation command. This will open the C-code Generation dialog where you can choose to export to a Simulink S-function.

If you select the OK button, ANSI C-Code will be generated and compiled into a dll-function. Some files will be generated of which two are needed in Simulink:

ModelName_.mdl: The exported 20-sim model based on a dll-file that describes the model.
ModelName.dll: A dll-file that contains the model equations and special 20-sim functions. The model equations are directly translated from the equations that are shown with the Show Equations command of the Model menu.