Skip to content
Login / Sign Up

Run WAVE-RT Models Using SimWB

Demos | SIMulation Workbench

WAVE-RT developed models may be incorporated into Simulink via the Export function of WaveBuild (wb). As part of the SimWB code generation and build process, a scan for WAVE-RT components is made. When found, various files required for compilation on the SimWB target machine will be copied into the model source directory and then tranferred along with the model-derived source code to SimWB. No user intervention is required. In the following discussion Linux file/directory references are followed by their Windows counterparts in square brackets, i.e. /tmp [C:\tmp]. The example is using the tut_wrt_ExportReady.wvm model, which can be found in the Products/WAVE/Tutorials/Advanced/WAVE-RT [Products\WAVE\Tutorials\Advanced\WAVE-RT] folder of your Ricardo installation.

Prerequisites

  • Make sure the Ricardo WAVE matlab directory is on the MATLAB path. For example, if you are using the WAVE 2014.2 release that is installed in /home/Ricardo [C:\Ricardo], then the MATLAB path should contain /home/Ricardo/2014.2/Common/Thirdparty/matlab [C:\Ricardo\2014.2\Common\Thirdparty\matlab].
  • From WaveBuild, select “File->Export WAVE-RT…” from the pulldown menus. Select the “Name the library ‘libWRT_model.so'” compile settings option. Export the model by pushing the Export button.wrt_wbExport.png
  • Open/create a Simulink model. Open the library browser, select the Ricardo Software entry and pull a WAVE-RT block into your model.
  • Double-click the block, and make sure the block parameters are configured in the following way:
    1. The Run-time Parameters tab settings should look like this, but with a WAVE-RT Timestep set to whatever you prefer.

      wrt_sfuncBlockParamsRuntime.png

    2. The Compile Parameters tab settings should look like this, but with the WAVE-RT model file name set to the name you specified during the Export from WaveBuild. This file must be in the same directory as the Simulink model file.

      wrt_sfuncBlockParamsCompile.png

  • After applying these changes, the WAVE-RT block will modify its inputs and outputs to match your WAVE model actuators and sensors. Once the block is connected you should be able to run your Simulink model as usual.
  • SimWB RTDB generation and model builds from the MLToolkit can now proceed as usual. No further user intervention is required.

Simulation Accuracy

The libraries used when running a WAVE-based simulation may have been compiled for the executing platform using different compilers (e.g. Windows vs. Linux) or even different version of the same compiler (e.g. gcc 4.8.2 vs. 4.3.4). This can lead to slightly different results for the same simulation when run in different ways (e.g. Simulink on your PC vs. within SimWB on Linux). Be aware of this when comparing results. The differences will be small, but noticable.

Back to top