The Properties view displays the properties of the selected model element. In figure "The YAKINDU Model Viewer workbench", you can find it at the bottom, marked with a red rectangle.
If you select a block, the blocktype, name, and navigation path are displayed at the top of the
Properties view. You can copy the navigation path to the clipboard by pressing
[Ctrl+C] on the keyboard.
The Properties view
Below the navigation path, the block’s properties are listed as a table. On the left-hand side of the properties view, you can toggle between the General and the Other tab. The General tab shows only the most important data of a block, whereas the Other tab displays additional properties, like its graphical information or the block’s ID.
If you select another model element, the properties view changes to reflect the selected element’s properties. However, you can „pin” the current properties by clicking on the properties view’s pin button . As long as the properties view is pinned, it doesn’t change its contents, no matter which elements you select. In this mode, the properties view has an additional line below the view’s title, telling which element’s properties are shown.
Click on the pin button again to unpin the properties view.
The Properties view in pinned mode
When browsing Simulink models in the YAKINDU 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, YAKINDU Model Viewer cannot access them directly when opening the model file.
However, YAKINDU 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 YAKINDU Model Viewer. You will find it as a zip-compressed archive file YAKINDU_Export.zip in the scripts subfolder of the YAKINDU 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
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.
Now open the Simulink model in YAKINDU 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 YAKINDU Model Viewer
If a system contains blocks of the TargetLink toolbox provided by dSPACE, these blocks are displayed similar to those in MATLAB Simulink.
Example system with TargetLink specific blocks
Matlab Simulink allows you to create masked blocks. These highly customizable block types are supported by the YAKINDU Model Viewer. A mask defines a user interface for entering block properties combined with a custom graphical visualization of the masked Simulink block. The visualization is defined by special drawing commands. The mask hides the block’s contents, making it appear to the user as an atomic block with its own parameter dialog box and icon.
To create and edit masked blocks, Matlab Simulink provides a Mask Editor. In the Mask Editor the user defines a new visual block representation with some kind of drawing commands. The API provides different functions to display strings, render images or plot some coordinates. Additionally, it allows access to predefined parameters and gives you the option to define local variables.
Furthermore, the user can define a script to initialize parameters defined in masked blocks. The user can enter any valid MATLAB expression, consisting of MATLAB functions and scripts, operators, and variables defined in the mask and Matlab workspace. The initialization script is executed and interpreted by Simulink before the drawing commands are executed in order to render the custom visualization. This behavior enables the user to do some complex calculations and store the results in mask parameters which can be accessed later by the drawing commands to render the visual.
Due to Simulinks scripting functions, masked blocks can become very complex. The YAKINDU Model Viewer supports the visualization of masked blocks with custom drawing scripts.
In most cases masked blocks are displayed simply as you would expect. If the block displays three question marks, it is an indicator that information for the correct display of the block is missing. Reasons for this can be unsupported drawing commands in the display script or missing mask parameters which are necessary for the complete interpretation of the script.
If your script contains unsupported commands, it may be possible to replace them with supported commands. You can find a list of supported drawing commands here.
Complex calculations within the drawing script that use unsupported commands could, for example, be moved to the initialization script part in order to assign the return values of the calculations to a mask parameter. The drawing script can then access this parameter. The parameter can also be exported so that the visualization can also be displayed in the Model Viewer. Further reasons for the export of mask parameters can be found in this chapter.
As described earlier the user can use an initialization script within the mask editor to define mask parameters which can be used within expressions in the drawing command script.
To be able to process the commands completely – especially values of mask parameters, it is necessary to export these parameters from the masked blocks. For this purpose the Model Viewer provides an export script which must be executed by the user within Matlab. The script collects the mask parameters for each masked block and workspace parameters and stores them in a file which is located in the same folder as the root model file. The model file name with the extension „.ymvd” is used as the export file name. The serialization format is JSON. Chapter 4.2.1 describes how the export script is installed and used.
As described in the previous chapter, the initialized mask parameters of a block can be exported from Matlab. If a masked block defines such parameters and they have been exported, these are listed in the Properties View.
The picture above shows the Properties View of a masked block. For this block, a mask parameter ‚param1’ with the value 0 was exported.
The parser parses the drawing command script so that the interpreter can process it, using a delegate for rendering the graphics. Most of the icon drawing commands are already supported. These include:
As you can see, most of the icon drawing commands and corresponding parameters supported by MATLAB Simulink can be interpreted. Unsupported arguments are ignored, and the block_icon() command is not yet implemented.