author, manage, and execute simulation-凯发k8网页登录

main content

author, manage, and execute simulation-based tests of generated code

author, manage, and execute simulation-based tests of the generated code, by using simulink® test™ with simulink plc coder™.

  1. if you do not have the plcdemo_simple_subsystem model open, open it.

  2. create a signal build test harness for the subsystem. to create a test harness for a subsystem, select the subsystem, right-click, and from the context menu, select test harness > create for . set test harness properties through the create test harness dialog box.

  3. open the plc coder app. click the plc code tab.

  4. click settings.

  5. in the configuration parameters dialog box, on the plc code generation pane, select a target and click the generate testbench for subsystem check box.

  6. click ok.

  7. select the test harness window subsystem, click the plc code tab and click generate plc code. the generated code contains multiple test benches from the signal builder. you can run this code in the plc emulator to make sure it matches your model simulation.

limitations

  • if you use anything other than a signal builder block in the test harness, you must create a top-level atomic subsystem in the test harness that contains the subsystem under test and the testing blocks (for example, test sequence block) and generate code for this subsystem.

  • simulink plc coder does not support the verify keyword in the test sequence block

  • simulink plc coder supports the duration keyword in the test sequence block but it requires that you run the generated code with the same sample rate as in the simulink model.

网站地图