-
Notifications
You must be signed in to change notification settings - Fork 14
EclipseCon2015
This page documents the steps needed to reproduce the demo shown at the EclipseCon 2015.
To get started, set up your environment as described in the Installation section of the User guide. To build up a connection with you running Matlab instance, see Accessing Simulink models github wiki page.
Additionally, the demo uses the following built in Matlab Simulink example models:
- sldemo_applyVarStruct
- sldemo_hydcyl
- sldemo_mdlref_basic
It is highly recommended to copy these systems' model files (.slx) and rename the copies (e.g. sldemo_applyVarStruct.slx to sldemo_applyVarStruct_demo.slx) to avoid any name clashes, shadowings and confusions.
The first part of this demonstration shows a basic import-export scenario. The model used for this purpose is sldemo_applyVarStruct.
- Create a new general, empty project in Eclipse with Massif installed, and copy the original model file with a new name to the root (e.g. sldemo_applyVarStruct_demo.slx).
- Import the model using Massif with the default options. This will create a model named sldemo_applyVarStruct_demo.simulink, that is already an EMF model.
- To see the result model of the import, use the default generated EMF model editor (called Simulink editor) within Eclipse.
- Before export, delete the model file sldemo_applyVarStruct_demo.slx from the root of the project and make sure that the model name is not known by Matlab:
which -all sldemo_applyVarStruct_demo
This command should yield 'sldemo_applyVarStruct_demo' not found.
. If it still exists, open it, then close it, and also make sure that the file is deleted.
- Now export the .simulink model. Open it in Matlab (type
sldemo_applyVarStruct_demo
), and the model is ready for simulation.
The second part demonstrates some elementary model manipulation techniques for Simulink models via their EMF representation.
- Open the .simulink model with the editor in Eclipse. In the next step a new 'gain' block will be added to the root of the model.
- On the root model element labeled Simulink Model sldemo_applyVarStruct_demo right click > new child > Block.
- It must be added an identifier reference and a library link reference. Copy those type of elements from the block labeled 'Block Gain' (this is also in the root of the model).
- For the copied identifier reference set the value of the Name property to 'newGain', then save the modified EMF model.
- Export the model again. Note that export takes much less time and the new gain block is added to the model.
- Delete some of the direct children of the root model object in the EMF model. Save it again.
- Export the model. Note that the deletion of blocks is also propagated to the already existing model in Simulink.
This demo shows that how are the shallow, deep and flattening import modes differ. They are handling model references differently, as described in Model import. The model used is called sldemo_mdlref_basic.
- Create a new general, empty project within Eclipse with Massif installed.
- Copy the model sldemo_mdlref_basic.slx to the root of the project and rename it (e.g. sldemo_mdlref_basic_demo.slx)
- Go to Window > Preferences > Simulink Preferences > Model Import preferences, then select the desired import mode.
This model import process can be repeated to see the differences between the three discussed import modes. In EMF the difference is seen for the model elements named 'CounterA', 'CounterB' and 'CounterC'. When using shallow import, no internal blocks are present in EMF. For deep import, the referenced models are also imported as individual models and will be placed in a separate directory within the created Eclipse project. For flattening, the model references are imported as though they were ordinary subsystems.
The third demonstration introduces the capabilities of the fourth, referencing import mode via the sldemo_hydcyl example model.
- Create a new general, empty project in Eclipse with Massif installed
- Copy the model sldemo_hydcyl.slx to the root of the project and rename it (e.g. sldemo_hydcyl_demo.slx)
- Set the import mode in Preferences to Referencing (for brief instructions see previous demo steps)
- Import the model.
Please note, that all subsystems with active links are referencing a library. So that when the importer encounters a linked block, it imports the referenced library and skips the traversal of the block itself. This import mode is typically used when complex models are imported that rely on a few libraries on multiple occasions.