Main Content

Isolate Model Components for Functional Testing

You can create a standalone model for the model designed usingDesign Model Architecture. The model slice isolates the model components and relevant signals for debugging and refinement.

Isolate Subsystems for Functional Testing

To debug and refine a subsystem of your model, create a standalone model. The standalone model isolates the subsystem and relevant signals. You can observe the subsystem behavior without simulating the entire source model.

Note

You cannot slice virtual subsystems. To isolate a virtual subsystem, first convert it to an atomic subsystem.

Isolate a Subsystem with Simulation-Based Inputs

To observe the simulation behavior of a subsystem, include logged signal inputs in the standalone model. When you configure the model slice, specify a simulation time window. For large models, observing subsystem behavior in a separate model can save time compared to compiling and running the entire source model.

This example shows how to include simulation effects for the Controller subsystem of a cruise control system.

  1. To open the Model Slice Manager, on theAppstab, underModel Verification, Validation, and Testgallery, clickModel Slicer.

  2. To select the starting point for dependency analysis, right-click a block, signal, or a port, and selectModel Slicer>Add as Starting point.

  3. To isolate the subsystem in the sliced model, right-click the subsystem, and selectModel Slicer>Slice component.

    In the example model, selectingSlice componentfor the Controller subsystem limits the dependency analysis to the path between the starting point (the throttle outport) and the Controller subsystem.

  4. To specify the simulation time window:

    1. In the Model Slice Manager, selectSimulation time window.

    2. Click the run simulation button.

    3. Enter the simulation stop time, and clickOK.

      The Model slicer analyzes the model dependencies for the simulation interval.

  5. To extract the subsystem and logged signals, clickGenerate slice. Enter a file name for the sliced model.

    Based on the dependency analysis, a Signal Builder block supplies the signal inputs to the subsystem.

    In the sliced model shown, the sliced model Signal Builder block contains one test case representing the signal inputs to the Controller subsystem for simulation time 0–45 seconds.

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 controllerfuel_rate_control.

open_system('sldvSlicerdemo_fuelsys');

Step 2: Slice the Referenced Model

To analyze thefuel_rate_controlreferenced model, you slice it to create a standalone open-loop model. To open the Model Slice Manager, selectApps>Model Verification, Validation, and Test>Model Slicer, or right-click thefuel_rate_controlmodel and selectModel 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 thesldvSlicerdemo_fuelsysmodel isAcceleratormode. When you slice the referenced model, the software configures the simulation mode toNormalmode and sets it back to its original simulation mode while exiting the Model Slicer.

Step 3: Select Starting Point

Open thefuel_rate_controlmodel, right-click thefuel-rateport, and selectModel Slicer>Add as starting point. The Model Slicer highlights the upstream constructs that affect thefuel_rate.

Step 4: Generate Slice

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

b. ClickRun simulation.

c. For theStop time, enter20. ClickOK.

d. ClickGenerate Slice. The software simulates the sliced referenced model by using the inputs of the close-loopsldvSlicerdemo_fuelsysmodel.

切片模型的信号生成器窗口, one test case is displayed that represents the signals input to the referenced model for simulation time 0–20 seconds.

See Also

|