Using the Test Sequence block, you can define a set of input functions to test your component, and conditionally switch the function based on component signals. See Test Sequence for more information.
This example demonstrates building and simulating a test sequence using ramp and square wave signals. The test initializes at constant temperature, ramps down to a limit, and executes a square-wave temperature cycle.
Access the model. Enter
Copy this model file and supporting files to a writable location on the MATLAB® path:
sltestSignalFunctionExample.slx sltestHeatpumpBusPostLoadFcn.mat PumpDirection.m
Open the model, and open the harness.
open_system('sltestSignalFunctionExample'); sltest.harness.open('sltestSignalFunctionExample/Controller',... 'RampSquareHarness')
Double-click the Test Sequence block to open the test sequence editor.
Rename the first and second steps. Delete the default names and replace
Add a third step to the table. Right-click the
ramp_down line, and select Add step
after. Name the third step
Add output conditions and transition fields to the steps. Copy and paste the listings from the table.
const_90 Tset = 75; Troom_in = 90;
ramp_down Tset = 75; Troom_in = 90-ramp(et)/8;
Troom_in <= 60
temp_step Tset = 75; Troom_in = 75+15*square(et/90);
Set the simulation time to
Simulate the Test Harness. Observe the
in the scope.