Like all MATLAB functions it’s possible to also embed the
ADD Matlab Services into your “MATLAB Simulink” or “dSpace TargetLink” work flow.
In order to parallel the creation of a simulation model and appropriate “ADD” – container (allegorised as DDX-file) it’s necessary to adduct a few
services.
Schematic diagram:
The following example shows up the implementation for a Simulink “Lookup2D” - block! The aim is to ally the creation of the “Lookup2D” – block and its corresponding ADD object (“Map”) by using the services “vitADDOffline” and “vitDDX2WS”.
To link a figure on a block element it is necessary to call the decated MATLAB function within the appropriated Callback function. The Callback function “OpenFcn” ha been used in this particular example.
After double clicking on the appropriate block, “OpenFcn” executes the dialog
function “vitLookup2D_ParamterDLG.m”.
The parameter value is defined as handle of the current block (MATLAB function: “get_param(gcb, ‘Handle’))”).>
The “vitLookup2D_ParameterDLG” block property
window can handle the row, column and output data of a “Lookup2D” -
block. Also it is possible to start “ADD Offline” by pressing the
“Open ADD” button, set the block attributes (“RowIndex”, “ColumnIndex”,
“OutputValues”) by pressing “OK” and close the property window by
pressing “Cancel”.
 |
 |
By pressing the “Open ADD” button the underlying “btADD_Callback”
function will be executed.
First service call “vitADDOffline” opens “ADD Offline” user interface
and automatically creates a new object with classification “Output”,
type “Online” and set the “Vector of output values” – string as name .
At this junction object name will be “Visu-IT! Lookup2D”. After
redacting the newly created ADD object to a proper “Map”-object, the
“ADD Offline” editor must save the DDX-file and could be closed
afterward.
The subsequent service call “vitDDX2WS” transmits the DDX-file into
MATLAB Workspace (WS).
Now it’s possible to exactly snatch the content of a WS variable by
composing its prefix (see “addsPrefix”), type (according to the block
type: Lookup2D » Map) and name (“ADDobjName”). WS data could be
transferred to Simulink block (identifier: “blockHandle”) by pressing
the “OK”-bottom.
Hint: Block parameters could only be set if the underlying model is unlocked!
For further details, please see the document "ADD Matlab Services" (see
Quicklinks)