This example shows how to programatically create a SystemTEst test harness for a model of a fuel rate controller that uses bus inports. The result is a preconfigured TEST-File based on your model.
This example requires the following products to run:
|On this page…|
The Simulink model used in this example is a modified version of the fuel rate controller with one root-level Inport block using a bus object, where each signal in the bus represents:
Exhaust gas (EGO)
Manifold absolute pressure (MAP)
A test harness can be created using the function SYSTEST.CREATEHARNESS. This will generate a TEST-file with:
A test case whose signals have the same names as the inport blocks
A Simulink element configured with the model and Inport blocks mapped to the signals of the test case
% Define the test file and model name testFileName = 'demosystest_fuelctrl_harness.test'; modelName = 'demosystest_fuelctrl_bus_model.mdl'; % Create a test harness systest.createHarness(testFileName, modelName);
Now that the test harness is created, we can add test cases to the harness. Test cases can be added graphically using the Test Case Editor in the SystemTest desktop. You can also add test cases programmatically by importing them from various sources such as Excel® files, a Signal Builder block and Simulink Design Verifier data files.
For more information on adding pre-existing test cases, see the examples: