Documentation

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) 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 Loops).

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 Signals with Test Points.

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 Export Signal Data Using Signal Logging.

Configure Signals as Test Points

Use one of the following ways to designate a signal as a test point:

  • Open the signal's Signal Properties dialog 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 information about the Model Data Editor, see Configure Data Properties by Using a Table.

  • To configure Stateflow® data in a chart as test points, see Monitor Test Points in Stateflow Charts.

To configure a signal as a test point programmatically:

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

  2. Extract a handle to the output port that creates the target signal line.

    outportHandle = portHandles.Outport;

  3. 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 Export 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, select or clear Display > Signals & Ports > Testpoint & Logging Indicators.

Related Examples

Was this topic helpful?