Processor-in-the-Loop Execution with the MATLAB Coder App - MATLAB & Simulink (original) (raw)

Use processor-in-the-loop (PIL) execution to verify the numerical behavior of cross-compiled object code with reference to your original MATLAB® functions.

Before you run a PIL execution, you must define a target connectivity configuration. In Processor-in-the-Loop Execution from Command Line, steps 1 and 2 of the example PIL Execution of Code Generated for a Kalman Estimator show how you can set up and register a connectivity configuration for PIL execution on your development computer.

  1. To open the MATLAB Coder™ app, on the MATLAB Toolstrip Apps tab, under Code Generation, click the app icon. The app opens the Create MATLAB Coder Project dialog box.
  2. To open your project, click Open, navigate to the folder that contains your MATLAB Coder project file, and select the file. For example,kalman_filter01.coderprj.
  3. In the Prepare section of the MATLAB Coder tab of the toolstrip:
    1. Specify Language.
    2. Set Output Type to Static Library (.lib) or Dynamic Library (.dll).
    3. From the Settings > Hardware list, selectNone - Select device below.
    4. Open Settings > View All Settings. In theHardware pane, specifyDevice vendor andDevice type. These settings must match the target hardware settings in thertwTargetInfo.m file of your target connectivity configuration. For host-based PIL, select settings that match your host computer. For example:
      • For a Windows® 64-bit system, set Device vendor toIntel andDevice type tox86-64 (Windows64). In addition, set Enable long long to Yes.
      • For a Linux® 64-bit system, set Device vendor toIntel andDevice type tox86-64 (Linux 64).
      • For a Mac OS X system, set Device vendor toIntel andDevice type tox86-64 (Mac OS X).
  4. In the Generate section of the toolstrip, clickGenerate Code > Generate Code and Build.
  5. In the Verify section of the toolstrip, use theRun Using PIL > Run file option to specify the test file that calls the original MATLAB functions, for example, test01_ui.m.
  6. Make sure Verification mode is set to Use generated code.
  7. If required, select the Enable source-level debugging for SIL or PIL check box.
  8. The MATLAB Coder app:
    • Generates a standalone library, for example,codegen\lib\kalman01.
    • Generates SIL interface code, for example,codegen\lib\kalman01\pil.
    • Runs the test file, replacing calls to the MATLAB function with calls to the generated code in the library.
    • Displays messages from the PIL execution in the Command Window.
  9. Verify that the results from the PIL execution match the results from the original MATLAB functions.
  10. To terminate the PIL execution process, in the Command Window, click the link that follows To terminate execution, for example,clear kalman01_pil.

Note

On a Windows operating system, the Windows Firewall can potentially block a SIL or PIL execution. To allow the execution, use the Windows Security Alert dialog box. For example, in Windows 7, click Allow access.

See Also

Topics