Documentation Home Page eHS Toolbox Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

How to use the eHS Export to Protected Block

General

There are 2 ways to use the eHS export Protected Block feature. The first is simply to use the UI, and the second is more automation oriented, using scripts.

eHS export Protected Block feature in the User Interface

Right click in the eHS block, and select 'eHS' > 'export Protected Block'

It will create the protected block in the current model.

eHS export Protected Block feature as a script

Description

To facilitate the automation of the eHS export Protected Block feature, the Matlab Function that generates the protected block can be called manually inside a script to create a locked library file containing multiple different eHS Protected Blocks. Within the eFPGASIM product, this function is called: generateProtectedBlock.

The generateProtectedBlock function takes in input the Original eHS Block to export and the location where to output the resulting eHS Protected Block. The generateProtectedBlock function can be called multiple times, pointing to the same output file path, in order to create a library of many eHS Protected Blocks.

Input arguments

generateProtectedBlock(originalModelPath, originalBlockPath, protectedModelPath, protectedBlockName)

Matlab Function takes 4 inputs:

  1. The file path of the Simulink Model in which the Original Block to be exported is located
  2. The Block Path of the eHS Block to be exported
  3. The output file path in which the eHS Protected Block is to be created
  4. The name of the eHS Protected Block to be created

Behavior

  • If the output library does not exist, the script will automatically create it.
  • If the output library exists,
    • If the block already exists, it will be overwritten.
    • If the block does not exist, it will be added and properly positioned into the library after the last one.

Example

Take this model for example, an eHS Block situated on the desktop:

We want to create a library block called machineLibrary in which this eHS Block will be exported as a eHS Protected Block. The generateProtectedBlock function should be called with the following parameters:

>> generateProtectedBlock('C:\Users\admin\Desktop\originalModel', ...
                                             'untitled/eHS SE SFunction Drivers', ...
                                             'C:\Users\admin\Desktop\machinesLibrary', ...
                                             'My PMSM Protected Block');

IMPORTANT: Use backslashes ( '\' ) for the file path and forward slashes ( '/' ) for the block path.

The resulting eHS Protected Block will be saved in a new Simulink Locked Library file. The function can be called again to add eHS Protected Blocks to the new library like so (using the same source block here for example purposes)

>> generateProtectedBlock('C:\Users\admin\Desktop\originalModel', ...
                                             'untitled/eHS SE SFunction Drivers', ...
                                             'C:\Users\admin\Desktop\machinesLibrary', ...
                                             'My Other PMSM Protected Block');

Now machinesLibrary.slx will contain two eHS Protected Blocks: "My PMSM Protected Block" and "My Other PMSM Protected Block" for the user to use.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323