Probing Signal Values (Model Interface Toolkit)

LabVIEW 2017 Model Interface Toolkit Help

Edition Date: May 2017

Part Number: 374160C-01

»View Product Info
Download Help (Windows Only)

Signals in a model serve as probes, or test points, of a model as it executes. Whereas an outport typically connects to other parts of the application and must return data during every time step, applications typically do not need to read signal values at such a high priority. The Model Interface API provides VIs for accessing signal values in the background portion of your code.

The following block diagram shows the use of a Timed Loop that steps the model at a constant rate and a While Loop that reads signal values and displays them on the front panel. Both loops run until an error occurs or the stop front panel control is TRUE.

Loads the model from disk and reads the compiled rate of the model in seconds, which is used to calculate the Timed Loop period.

Performs the following tasks to prepare the VI to read signal values:
  1. Returns an array of paths for all the signals in the model.
  2. Creates a Signal Interface reference that you pass to other VIs to define which signals to probe and to get values from the probed signals.

Defines the list of signals to probe as the signals in the Signal Paths array. The Maximum Probed Data History input also configures the Model Interface API to store signal values from up to 100 model time steps in a buffer. More information.
Tip  To improve performance in your application, only probe signals whose values you need and avoid frequently changing the signals to probe. Probing many signals and frequently changing the signal list can both decrease performance.

Steps the model during each iteration of the Timed Loop and reads/writes inports and outports. The Timed Loop iterates until an error occurs or the stop control is TRUE.

Returns the values of signals from a specific model time step. The format of this output is a flattened 1D array that contains the values of each signal.
Tip  This VI contains a Simulation Time output, which returns the elapsed time in the model, in seconds, when the model produced the current signal values. This value is useful for allowing you to correlate events within the model with the time they occurred.

When LabVIEW returns probed signal values before the timeout, the False case of the Case structure converts the array of signal values to a cluster and plots them in a waveform chart on the front panel.

Closes the reference to the signal-probe session, unloads the model from memory, and handles any errors.

Refer to the MIT Signal Probes VI in the labview\examples\Control and Simulation\Model Interface directory for example code that demonstrates these concepts.

Returning Probed Data in Different Formats

The Get Probed Signal Values VI returns signal values in two formats, depending on which instance of the polymorphic VI you use:

  • Raw—Returns signal values in a flattened 1D array in column-major order. This polymorphic instance allows your code to run with higher performance.
    Tip  If you read probed signal values in raw format, you can format them offline using the Format Raw Signal Values VI.
  • Formatted—Returns signal values in a formatted array in which the value for each signal is a separate element, shown as follows:

Changing Signals to Probe

To change the signals that the Model Interface API is probing while the control loop steps the model, call the Set Signals to Probe VI again with the new list of signals. Note that if any signal values from the previous signal list are still in the signal buffer, meaning the Get Probed Signal Values VI has not returned those values, the Model Interface API discards those values and immediately starts buffering values for the new signal list.

Storing Signal Values from Multiple Time Steps

Each time the Get Probed Signal Values VIs executes, it returns signal values from the earliest time step for which LabVIEW stores signal data. Storing signal values from multiple time steps is useful because code that probes signals typically runs at a lower priority than the control loop that steps your model. Therefore, the model might execute multiple times, producing multiple values for each signal, between subsequent calls to the Get Probed Signal Values VI.

Tip  If you find the Get Probed Signal Values VI loses signal values because it does not execute before the buffer overflows, you can increase the value of the Maximum Probed Data History input of the Set Signals to Probe VI.

Related Links

Get Probed Signal Values VI

Set Signals to Probe VI

Basic Architecture for Executing Models


Not Helpful