When browsing Simulink models in the itemis Model Viewer, it can be helpful to see the values of parameters directly in the model. However, Matlab maintains parameter values in the Matlab workspace, not in the model. Thus, itemis Model Viewer cannot access them directly when opening the model file.
However, itemis Model Viewer implements a solution to circumvent this obstacle. Here’s an outline of what you can do:
The subsequent sections explain how to setup and run the export script and make use of parameter values in blocks.
Currently, this feature is supported for constant blocks only.
The export script that extracts parameters and their values from the Matlab workspace and exports them to a .ymvd file is bundled with itemis Model Viewer. You will find it as a zip-compressed archive file YAKINDU_Export.zip in the scripts subfolder of the itemis Model Viewer installation directory.
Open Matlab Simulink and initialize your Simulink workspace completely. That is, execute all required Matlab Simulink scripts, especially those that initialize any parameter values. The parameter values must be set before the export script can be run.
Please ensure that Simulink can find all needed libraries. If any libraries are missing, please include them in the Matlab search path.
Now that all parameter values are set, you can run the script to export them. Go to Matlab Simulink, enter the following into the command window, and hit
[Return]
.
YAKINDU_export('modelname')
Entering the export command on the Matlab command-line
The export command executes, logs what it does to the command window, and creates a file besides the model file. That file comes with the same basename as the model file, but with a .ymvd filename extension.
The export script creates an .ymvd file alongside the model file.
If you specify just the model name in the export command, Simulink expects the model to reside in the Matlab search path. However, your model file might reside somewhere else. In this case, please also specify the path to the model. That path is relative to the current folder.
YAKINDU_export('some/path/modelname')
Now open the Simulink model in itemis Model Viewer. The tool will notice the .ymvd file besides your model file, read it, and display the parameters.
Parameter names are shown inside the block, and – in parenthesis – their associated values. The label below the block displays the block’s name. Parameter names and values can also be seen in the properties view.
Constant blocks with parameter values displayed in itemis Model Viewer