Controlling and Monitoring the Execution of Models

NI VeriStand 2018 Help

Edition Date: May 2018

Part Number: 372846M-01

»View Product Info
Download Help (Windows Only)

NI VeriStand allows you to control and monitor models in your system through model execution channels. For example, you might want to manually start the execution of a model rather than allow it to execute upon deployment. Every model has three associated channels you can use to perform the following tasks:

Task Execution Channel
  • Run, pause, or stop the simulation.
  • Save the model state to file or restore the model state to file.
Model Command
View the model execution status, such as running or paused. Model Status
View the time in the model. Model Time
View how long the current time step of the model has been running. Time Step Duration

You can map model execution channels to model controls on the workspace, shown as follows, to control or monitor the state of the model after deployment.

You can find execution channels for a model in its Execution section in the System Explorer configuration tree.

Use Cases for Model Command/Model Status

Use the Model Command channel to change the model execution state at run time. If you configured your model to be initially paused, you can use this channel to start it. If your model gets into a desirable state for testing purposes, you can pause the model, save that state to a file, and then restore the state later. This allows you to avoid running lengthy start-up procedures or recreating specific failure scenarios.

Each status has a specific numeric value associated with it, as listed in the following table:

0 Start the model. If the model is paused, start the model from the current state.
1 Pause the model.
2 Reset the model.
3 Prompt to save the model state to file (after setting the model to idle). The model must be running or paused when you set this command; otherwise, NI VeriStand ignores the command.
4 Prompt to restore the model state from file (after setting the model to idle). The model must be running or paused when you set this command; otherwise, NI VeriStand ignores the command.

The Model Status channel returns whether the model is running, resetting, stopped, and so on. Each status has a specific numeric value associated with it, as listed in the following table:

0 Running
1 Paused
2 Resetting
3 Idle
4 Stopped
5 Restoring
6 Saving

Use Cases for Model Time

Use the Model Time channel to verify that the model is running at the correct rate. You can compare the model time to the value of the System Time system channel to determine if the model is executing slower or faster than real time. The following equation describes how the VeriStand Engine determines the rate at which to execute each model:

model rate = Primary Control Loop (PCL) rate / model decimation

If the rate for a model is incorrect, adjust its decimation, and then monitor the model time again.

Use Case for Time Step Duration

If a model takes a long time to execute, the PCL might run slower than the target rate or the model might not run on schedule during the next PCL iteration. If a system contains multiple models and you need to determine which one delayed the system, monitor the Time Step Duration execution channel for each model. During each PCL iteration, a model executes one time step, so this channel allows you to see if a model executes longer than the expected rate, given the following equation:

model rate = PCL rate / decimation

Note  (Windows) The Windows operating system supports only millisecond resolution. This channel does not provide exact timing for microsecond values and instead provides an approximation that averages to the requested time over the course of the timing interval. Windows does not support resolutions under one millisecond and rounds them up to one millisecond.

Related Links

Adding and Configuring Controls and Indicators

Recommendations for Configuring Models: Setting Model Timing

System Channels Table

WAS THIS ARTICLE HELPFUL?

Not Helpful