MATLAB Examples

Isolate Referenced Model for Functional Testing

To functionally test a referenced model, you can create a slice of a referenced model treating it as an open-loop model. You can isolate the simplified open-loop referenced model with the inputs generated by simulating the close-loop system.

This example shows how to slice the referenced model controller of a fault-tolerant fuel control system for functional testing. To create a simplified open-loop referenced model for debugging and refinement, you generate a slice of the referenced controller.


Step 1: Open the Model

The fault-tolerant fuel control system model contains a referenced model controller fuel_rate_control.


Step 2: Slice the Referenced Model

To analyze the fuel_rate_control referenced model, you slice it to create a standalone open-loop model. To open the Model Slice Manager, select Analysis > Design Verifier > Model Slicer or right-click the fuel_rate_control model and select Model Slicer > Slice component. When you open the Model Slice Manager, the Model Slicer compiles the model. You then configure the model slice properties.

Note: The simulation mode of the sldvSlicerdemo_fuelsys model is accelerator mode. When you slice the referenced model, the software configures the simulation mode to normal mode and sets it back to its original simulation mode while exiting the Model Slicer.

Step 3: Select Starting Point

Open the fuel_rate_control model, right-click the fuel-rate port, and select Model Slicer > Add as a starting point. The Model Slicer highlights the upstream constructs that affect the fuel_rate.

Step 4: Generate Slice

a. In the Model Slice Manager dialog box, select the Simulation time window.

b. For the Start simulation time, enter 0.

c. For the Stop Simulation time, enter 20.

d. Click Generate Slice. The software simulates the sliced referenced model by using the inputs of the close-loop sldvSlicerdemo_fuelsys model.

For the sliced model, in the Signal Builder window, one test case is displayed that represents the signals input to the referenced model for simulation time 0–20 seconds.