This Transform is no longer supported by Danlaw or dSPACE. Use dSPACE (using XIL API).
The dSPACE Connector Transform enables you to perform real-time HIL testing. This topic applies to the configuration where HIL API .NET is used for communication between MxTransIt and dSPACE.
•dSPACE HIL API .NET version 1.2 or later
1.In Matlab, set the path so that Matlab can find the S-Function:
Select: File-> Set Path... Then click Add Folder, browse to the currently installed Harness folder, and add the path to it. For example:
C:\Program Files\MicroMax\MxSuite 22.214.171.124556\Harness\dSpace
If more than one version of MxSuite is installed, scroll up and down the path list to make sure only one path to MxSuite is present.
When updating to a new version of MxSuite, make sure to remove the old path and add the path to the newly installed version.
Note: Some projects don’t utilize paths from default location or overwrite them when opening model using configuration script. In that case, consult your model specialist on how to edit your script to add the new path.
2.Insert the S-Function into the top level of your model.
a.Open your model for editing.
b.Open the Simulink Library Browser.
c.Find the S-Function or browse Simulink ->User-Defined Functions ->S-Function
d.Place the S-Function in your model (the exact location does not matter, you can place it anywhere, however placing it at the top level will make it visible to all users who might need to review the model later).
e.Right click on S-Function block and click on “S-Function Parameters”. Change the S-function name to MxNetSFunctionHILAPI, and set parameters to 0 0.
f.At this point you can check if the path is correctly set. Click on Edit button. If the path to harness was correctly set, the source code of the S-Function opens in a text editor. No further action is needed; simply close the window. If Matlab cannot find the file or gives any errors, then review your Path setting.
3.The S-Function is expected to be executed every 1ms. If this is the rate at which your model executes, you can move on to the next step.
a.Find Subsystem in Library Browser, place subsystem in your model and copy the S-Function inside the new subsystem.
b.To change the execution rate of the subsystem in Matlab, right click on Subsystem and select "Subsystem properties", select "Treat as atomic unit", and change the rate from (-1) to 0.001 s (1 ms):
If more advanced timing modifications are needed, consult your model specialist. If you have a multiprocessor application with different parts of the model running on a separate processor, you can harness all processors separately by placing S-Function in each subsystem.
4.In the directory where the model is saved, delete the auto-generated Matlab folders and files (for example: sfprj, slprf, *_rti1006, *_rti1005).
5.Rebuild your model by pressing Ctrl+B
6.Download your newly built application to dSPACE HIL, AND verify that it is running.
1.Select File ->New..->Project from the MxVDev main menu to create new MxSuite project:
2.Select the Custom and RTClock options.
3.Click Finish to launch MxTransIt.
4.In MxTransIt, use the Toolbox to put the dSPACE (using HILAPI) Transform into your Harness.
5.Before continuing, check the version of HILAPI Installed:
If the app config file was updated, close MxSuite and launch again so that the DLL is reloaded. This only needs to be done once per MxVDev installation. If you install a new version of MxSuite, repeat this step.
Use Alias – Set to true to add the group/submodel name to the Signal. (This results in a more descriptive name, for example: ‘SignalA_Out1’ instead of ‘Out1’)
The tree browser shown is similar to the Signal selector in ControlDesk. The Signals are grouped by subsystems. To display Signals from subordinate branches of the Dictionary tree, check the Recursive box.
1.Select the Signals required for your testing and add them to the transform by clicking the >> button.
2.Click OK after you have selected all required Signals. The selected Signals now appear as ports on the dSPACE transform.
3.Export the ports so they can be used in MxVDev.
•Trace file Signals are organized in the Tree View by models and sub-models. If you know which model contains the Signals you are interested in, you can click on the node and select Signals that are needed.
•To select more that one Signal at once, press Ctrl+click to select additional Signals, or Ctrl+A to select all Signals.
•When working with a large number of Signals, you can use the search filter to reduce the number of displayed Signals.
oBy default, the filter works on the currently selected Tree Node.
oWhen the ‘Recursive’ check box is selected, the filter works on all sub-models as well.
oFor better performance, type in the search string first, then select the Recursive check-box since each keystroke starts a new search.
oTo search all available Signals, select the top most tree node. This can take some time depending on search string and number of Signals in the trace file.