Main Content

Processor-in-the-Loop Execution with theMATLABCoder应用程序

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. InProcessor-in-the-Loop Execution From Command Line, steps 1 and 2 of the examplePIL Execution of Code Generated for a Kalman Estimatorshow how you can set up and register a connectivity configuration for PIL execution on your development computer.

  1. To open theMATLAB Coder™app, on the MATLAB Toolstrip应用程序stab, underCode Generation, click the app icon.

  2. To open your project, click, and then clickOpen existing project。Select the project. For example,kalman_filter.prj

  3. On theGenerate Codepage, click theGeneratearrow

  4. In theGeneratedialog box:

    1. SetBuild typetoStatic LibraryorDynamic Library

    2. In theOutput file namefield, use the default value. For example,kalman01

    3. Clear theGenerate code onlycheck box.

    4. From theHardware Boarddrop-down list, selectNone - Select device below

    5. In theDevice字段,指定供应商和类型。这些设置必须匹配目标硬件的设置rtwTargetInfo.mfile of your target connectivity configuration. For host-based PIL, select settings that match your host computer. For example:

      • For a Windows®64-bit system, setDevice vendortoIntelandDevice typetox86-64(Windows64)。另外,设置Enable long longtoYes

      • For a Linux®64-bit system, setDevice vendortoIntelandDevice typetox86-64 (Linux 64)

      • For aMac OS Xsystem, setDevice vendortoIntelandDevice typetox86-64 (Mac OS X)

    You do not have to specify theToolchainsetting. By default, theMATLAB Coder应用程序定位安装的工具链。

  5. To generate the C or C++ code, clickGenerate

  6. ClickVerify Code

  7. 在命令字段,specify the test file that calls the original MATLAB functions, for example,test01_ui.m

  8. To start the PIL execution, clickRun Generated Code

    TheMATLAB Coderapp:

    • Generates a standalone library, for example,codegen\lib\kalman01

    • Generates PIL 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 theTest Outputtab.

  9. 验证PIL执行的结果是否与原始MATLAB函数的结果相匹配。

  10. To terminate the PIL execution process, clickStop PIL Verification。Alternatively, on theTest Outputtab, click the link that followsTo terminate execution

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, inWindows 7, clickAllow access

Related Examples

More About