Configure Signals as Test Points
What Is a Test Point?
A test point is a signal that Simulink® guarantees to be observable when using a Floating Scope block in a model. Simulink allows you to designate any signal in a model as a test point.
Designating a signal as a test point exempts the signal from model optimizations, such as signal storage reuse (see Signal storage reuse (Simulink Coder)) and block reduction (see Implement logic signals as Boolean data (vs. double)). These optimizations render signals inaccessible and hence unobservable during simulation.
Signals designated as test points will not have algebraic loops minimized, even if Minimize algebraic loop occurrences is selected (for more information about algebraic loops, see Algebraic Loop Concepts).
Test points are primarily intended for use when generating code from a model with Simulink Coder™. For more information about test points in the context of code generation, see Appearance of Test Points in the Generated Code (Simulink Coder).
Marking a signal as a test point has no impact on signal logging that uses
the Dataset
logging format. For information about logging
signals, see Save Signal Data Using Signal Logging.
Use one of the following ways to designate a signal as a test point:
Open the Signal Properties dialog for the signal and check Test Point in the Logging and accessibility section.
Use the Model Data Editor for batch configuration and for signals that are difficult to locate in a large model or hierarchy of subsystems. On the Signals tab, set the Change view drop-down list to
Instrumentation
and use the Test Point column. For more information, see Model Data Editor.To configure Stateflow® data in a chart as test points, see Monitor Test Points in Stateflow Charts (Stateflow).
To configure a signal as a test point programmatically:
Get handles to the ports of the block.
portHandles = get_param('myModel/myBlock','portHandles');
portHandles
is a structure. Each field stores a handle to a block port.Extract a handle to the output port that creates the target signal line.
outportHandle = portHandles.Outport;
Set the port parameter
TestPoint
to'on'
.set_param(outportHandle,'TestPoint','on')
Displaying Test Point Indicators
By default, Simulink displays an indicator on each signal whose Signal
Properties > Test point option is enabled. For example,
in the following model signals s2
and
s3
are test points:
Note
Simulink does not display an indicator on a signal that is
specified as a test point by a Simulink.Signal
object, because such a specification is external to the graphical
model.
A signal that is a test point can also be logged. See Save Signal Data Using Signal Logging for information about signal logging. The appearance of the indicator changes to indicate signals for which logging is also enabled.
To turn display of test point indicators on or off, in the Simulink Editor, on the Debug tab, select Information Overlays > Log & Testpoint to enable or disable the option.