Main Content

Configure Signals as Test Points

What Is a Test Point?

Atest pointis a signal that Simulink®guarantees to be observable when using aFloating Scopeblock 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 (seeSignal storage reuse(Simulink Coder)) and block reduction (seeImplement logic signals as Boolean data (vs. double))。这些优化渲染信号无法访问and hence unobservable during simulation.

Signals designated as test points will not have algebraic loops minimized, even ifMinimize algebraic loop occurrencesis selected (for more information about algebraic loops, seeAlgebraic Loop Concepts)。

Test points are primarily intended for use when generating code from a model withSimulink Coder™. For more information about test points in the context of code generation, see测试点在生成的代码中(Simulink Coder).

Marking a signal as a test point has no impact on signal logging that uses theDatasetlogging format. For information about logging signals, seeExport Signal Data Using Signal Logging.

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

  • Open theSignal Propertiesdialog for the signal and checkTest Pointin theLogging and accessibilitysection.

  • 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 theSignalstab, set theChange viewdrop-down list toInstrumentationand use theTest Pointcolumn. For information about the Model Data Editor, seeConfigure Data Properties by Using the Model Data Editor.

  • To configure Stateflow®data in a chart as test points, seeMonitor Test Points in Stateflow Charts(Stateflow).

To configure a signal as a test point programmatically:

  1. Get handles to the ports of the block.

    portHandles = get_param('myModel/myBlock','portHandles');

    portHandlesis 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 parameterTestPointto'on'.

    set_param(outportHandle,'TestPoint','on')

Displaying Test Point Indicators

By default, Simulink displays an indicator on each signal whoseSignal Properties > Test pointoption is enabled. For example, in the following model signalss2ands3are test points:

Note

Simulink does not display an indicator on a signal that is specified as a test point by aSimulink.Signalobject, because such a specification is external to the graphical model.

A signal that is a test point can also be logged. SeeExport Signal Data Using Signal Loggingfor 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 theDebugtab, selectInformation Overlays>Log & Testpointto enable or disable the option.

Related Examples

More About