Paul Urban, MathWorks
Debugging and testing signals nested in a hierarchy of a system requires additional signal lines to monitor the signals just for verification purposes. With Observer Blocks in Simulink Test™, you can monitor signals of a system for debugging or testing without perturbing interfaces or the dynamic response. You can probe internal signals and other elements without adding additional signal lines. In this video, learn how you can use an Observer model to map signals from your system model. You do not need to add ports, blocks, connections, or interfaces to your model. Observer blocks preserve your model simulation semantics, which can help increase confidence that your verification results apply to the implemented system.
To verify a design, you may need to access some signals buried deep inside a model hierarchy, but we don’t want to modify the design or its interface just for testing purposes.
Observers allow you to you monitor signals of your model while preserving the design’s dynamic response and interfaces.
This test harness is testing a controller.
It has a Test Sequence block to drive the input scenarios and a Test Assessment block that is verifying the behavior of the controller.
The Test Assessment block needs access to five signals—two are accessible at the level, but the other three are inside the controller.
Instead of modifying the controller to bring the signals to the Assessment, I will create an Observer model by simply selecting the input signals.
The Observer model is created with two Observer Ports.
Another way to add signals is using the Observer Dialog.
I will the select the signals inside the controller for observing and additional Observer Ports are added.
Now that we have all the signals we need, let’s move the Test Assessment block inside of the Observer and connect it.
Back in the Test Harness, you can see that the Observer Reference block was added to it.
We will cut the Test Assessment block from the harness and paste it into the Observer model.
Finally, we will connect the Observer Ports to the inputs of the Test Assessment.
Now, we can simulate our test harness and Observer models. We don’t need to add any signals to connect the Observer Ports.
After Simulation ends, we can take a look at the pass/fail results of the assessments in the Simulink Data Inspector.
With Observers, you can separate verification logic from the design and access any signal, at any hierarchy, without modifying the interfaces and without impacting the systems dynamic response. It helps avoid cluttering the model with additional signals required only for testing.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .Select web site
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.