EHB-CB INI Configuration (Simulink and MATLAB)
This page documents MATLAB and Simulink-related eHandbookCB.ini options.
MATLAB Connection
In order to render the graphics of Simulink blocks appropriately, a connection to MATLAB is required.
By default a connection from Container-Build to MATLAB is enabled and established when converting Simulink models. In order to prevent a connection to MATLAB, the command line option -nomatlab can be used.
With an active MATLAB connection, images of Simulink block masks or block decorations are exported and are available as an overlay on the respective block when loaded in EHANDBOOK-NAVIGATOR.
Timeout for MATLAB Connection
The command line parameter -matlabpath uses MATLAB during the build process for Simulink mask generation. This happens via a MATLAB API connection. To ensure, that EHB-CB is not blocked, there is a configurable timeout, if the connection hangs for any reason. For this, the parameter -DmatlabTimeoutThreshold=value can be specified in the eHandbookCB.ini file. The value should be an integer and unit corresponds to minute.
In the following example, the timeout is set to 10 minutes:
-DmatlabTimeoutThreshold=10
Without any given timeout specification in the ini-file, the default is set to 5 minutes.
|
If the timeout occurs, the established MATLAB connection will be terminated immediately. The EHANDBOOK Container-Build process continues without any connection retry, therefore no more mask images are generated. An error is logged in the log file. |
Caching Mechanism for Simulink Referenced Models
Performance of Simulink model conversion has been improved by introducing caching mechanism for referenced Simulink models. This is achieved by caching the libraries that are already converted. For this, the parameter -DsimulinkLibraryCacheSize=value can be specified in the eHandbookCB.ini file. The value should be an integer and unit corresponds to number of libraries.
In this example, the cached number of library modules is set to 50:
-DsimulinkLibraryCacheSize=50
Without any given specification in the eHandbookCB.ini file, the default is set to cache 100 library models.
|
This caching has a major impact of the overall memory consumption of EHANDBOOK Container-Build. When many and/or huge libraries are cached and only a small amount of RAM is specified for EHANDBOOK Container-Build, the tool may crash with an out of memory error! In this case you have to decrease the amount of cached libraries or increase the RAM, as described in chapter RAM Usage. |
Parallelization for Simulink Mask Image Generation
Re-start MATLAB Connection for Model Count
We have realized that MATLAB becomes slower and slower the longer the API connection is established. So, the performance of Simulink mask generation has been improved by introducing restart of MATLAB connections. This is achieved by configuring -DrestartMatlabConnectionForModelCount=value which can be specified in the eHandbookCB.ini file. Value should be in integer and unit corresponds to number of models after the MATLAB connection is restated.
In this example, the MATLAB connection is restarted every 30 models:
-DrestartMatlabConnectionForModelCount=30
If no restart should happen, the value has to be set to =0
Without any given specification in the ini-file, the default is set to restart MATLAB connection for every 25 models.
Thread Count for Simulink Mask Generation
Performance of Simulink mask generation has been improved by using multiple CPU threads of the used PC system. Parallelization for mask generation is based on configured number of threads running on each instance of MATLAB. This is achieved by configuring -DthreadCountForMaskGeneration=value which can be specified in the eHandbookCB.ini file or as a command line argument -vmargs -DthreadCountForMaskGeneration. Value should be in integer and unit corresponds to number of CPU threads used for parallelization during mask generation.
In this example, 4 CPU threads are used:
-DthreadCountForMaskGeneration=4
|
Types for Simulink Mask Image Generation Caching
Performance of Simulink mask generation has been improved by introducing a caching mechanism for Simulink mask types. Types with same mask data should be considered for caching. For this, the types of masks can be configured with -DtypesForMaskGenerationCaching=type1,type2,… in the eHandbookCB.ini file.
Example: If a block mask data has parameter "Type" with value TL_out or TL_in which are used in many blocks, such types can be cached as
-DtypesForMaskGenerationCaching=TL_out,TL_in
|
If the data of the mask type is different in Simulink blocks, such types should not be cached as this results in incorrect mask generation. Example: If two blocks has mask data has parameter |
Simulink Mask Decorations as Image
Not all the mask data is currently interpreted by EHANDBOOK Container-Build. To overcome this, there is a new option which exports the Simulink Mask as an image and shows them in EHANDBOOK-NAVIGATOR. The option is enabled by default, to switch to mask interpretation add the following entry in the eHandbookCB.ini file:
-DenableSimulinkMaskInterpretation=true
By default, the option is disabled and set to false. The Simulink mask decorations as image is currently supported only for blocks which are rectangular in shape. This option requires a MATLAB connection for the build process.
The earlier option -DenableSimulinkMaskDecorationsAsImage is deprecated.
With simulink mask decoration as image approach, it is possible to generate mask images for selected rectangular blocks with mask applied on them. A list of rectangular blocks with mask are identified and listed in eHandbookCB.ini file:
-DrectangularBlocksWithMask
By default, this option specifies a set of rectangular blocks with mask applied on them. This list can be further extended with additional rectangular blocks with masks on them.
|
Mask Icons in Simulink are not generated for Plot Commands.
Display property of a masked block does not have plot information from MATLAB 2017a onwards. Hence mask icons are not generated for such blocks.
Alternatively, use the option |
Simulink Rich Text Annotations as Text
Currently EHANDBOOK has some limitations on Simulink Annotations which contain rich text formatting. To overcome this, there is a new option which extracts the textual content from rich text annotations and shows them as text in EHANDBOOK-NAVIGATOR. The option can be enabled with the following option:
-DsimulinkAnnotationsAsText=true
|
Some rich text formattings like tables and images are currently not supported. |
Name Matching for zipped Simulink Main Files
Typically, you will have only one Simulink file per sub directory (Directory Based EHB-CB) or per functional component (ASAM based EHB-CB). EHB-CB also supports multiple Simulink files, where one main model file is referencing other model files. To make this happen, all files must be zipped, where the zipped file name must match to the main model name (default behavior). There should not be any hierarchy within the zip folder.
If this is not the case, you can specify one or more suffixes, which will be ignored from the zip name to still allow name matching with the main model name:
-DsimulinkZipSuffix=suffix1,suffix2
This option accepts multiple suffixes with comma separated values.
Name matching for SIMULINK model files with suffix
When there are multiple SIMULINK model files within a zip file input, this option allows name matching with the desired model file within the zip by ignoring the provided suffix from the model file names and matching the name against the zip file name.
-DsimulinkModelFileSuffix=suffix1,suffix2
Note: Both simulinkZipSuffix & simulinkModelFileSuffix arguments can be used together to enforce name matching according to user’s preference.
Handling of Simulink Mask Documentation for library models and referenced models
Mask documentation (referred as Base documentation) can be associated with a library model or a referenced model. Further uses are allowed to add an additional documentation (Referred as Custom Documentation) to the instance of library model or referenced model used in their model. In EHANDBOOK, mask documentation are indicated with tooltip as follows:
-
If a library block has a custom mask, then the documentation contents for the custom mask shall be shown in the tooltip.
-
If a library block has a base mask, but no custom mask, then the documentation contents for the base mask shall be shown in the tooltip.