.


Software Tools

mdl2mw Utility (mdl2mw.exe)

The command line application, md2mw.exe is used to download a Simulink model to a ZMP controller. The command syntax is:

mdl2mw <mdl filename>

Executing mdl2mw will load all of the MechaWare blocks into controller memory for execution by the controller firmware. The blocks will be initialized (zeroing the static data) and then the models will be enabled in the firmware.

The mdl2mw utility creates a map of the blocks loaded and stores that map in a file with the same name as the Simulink .mdl file but with a .map extension. This file is useful when accessing the blocks using the C++ API. The following is an example of a .map file:

  Block Name
NOISE1
FF 1            
GAIN 1
PID 1
SUM 2
DIFFERENTIATOR 1
SP_BIQUAD 2
SUM 3
Model
 0
 0
 0
 0
 0
 0
 0
 0
 Block
 0
 1
 2
 3
 4
 5
 6
 7

The Block Names on the left duplicate the “Name” field of the blocks in the Simulink model. The Model and Block numbers indicate the indices used by the API to access the blocks.

MATLAB Workspace Import (mdl2mw Model Loader for MechaWare 4.0)

MechaWare block parameters can reference variables from a Matlab workspace. Use the variable name as the parameter value as shown in step 1.

    1. Use symbol name as parameter value in MechaWare block

    1. Save the Matlab workspace containing the desired variables to a file (.mat).

    1. Use –workspace flag when running mdl2mw model loader and provide the filepath:
      [-workspace ].

Notes

      • All symbols will be resolved at download time by the Model Downloader.

      • When resolving symbols, matches to mask parameter names take priority over workspace variable names.

      • Indexing into structures or matrices is not currently supported. When referencing standard, non-sparse matrices, the first entry’s value is used [1,1].

      • The –workspace option must come before listing the MDL model files: mdl2mw.exe –workspace.

Note:  MAT file formats Version 5 and Version 7 are explicitly supported. (MAT file format Version 4 is not supported)

This feature complements symbolic reference of subsystem mask parameters. It allows block parameters to refer to their containing subsystem block’s parameters which in turn refer to Matlab workspace variables. See Subsystem Blocks - Mask Parameters. Workspace variables referring to other workspace variables by name is not currently supported.

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2009 Motion Engineering