LabVIEW Control Design and Simulation Module

Configuring the Timing of the Control & Simulation Loop (Control Design and Simulation Module)

  • Updated2023-03-14
  • 3 minute(s) read

The Control & Simulation Loop contains parameters that affect how often the simulation executes. You configure these parameters when you are running a simulation that has real-world timing needs. For example, if you are simulating a controller that must return a value every millisecond, you can configure the simulation to execute only once every millisecond. This example places a strict upper-bound on the execution of the Control & Simulation Loop; therefore, the simulation is deterministic. NI provides special real-time (RT) hardware targets you can use to ensure determinism in a simulation. In addition to an RT target, you also must install the LabVIEW Real-Time Module to execute a simulation deterministically. Refer to the NI website for information about these RT hardware targets and the Real-Time Module.

Note  Deterministic simulations require fixed step-size ordinary differential equation (ODE) solvers.

You use the Timing Parameters page of the Configure Simulation Parameters dialog box to configure the timing of the Control & Simulation Loop. You can use this dialog box to configure the following timing scenarios:

No Timing

To run a simulation without any timing restrictions, ensure the Synchronize Loop to Timing Source checkbox does not contain a checkmark. In this situation, the simulation runs as fast as possible. This option is appropriate for running offline simulations.

1 kHz Timing on a Computer Running Windows

If you do not have an RT target available, you can simulate 1 kHz timing using a computer running Windows. To make this change, place a checkmark in the Synchronize Loop to Timing Source checkbox and select 1 kHz Clock from the Source type list.

If you have a supported NI RT target, you also can select the 1 MHz Clock option. If you select this option for a simulation that is running on an unsupported target, the LabVIEW Control Design and Simulation Module switches to 1 kHz timing when you run the simulation.

Note  You are not restricted to the 1 kHz or 1 MHz loop rates. You can use the Period control to adjust the period of the simulation as necessary.

Hardware-Controlled Timing Defined by External Timing Source

To specify a rate other than 1 kHz, you can use an external timing source, such as an NI DAQ device, to control the Control & Simulation Loop. To make this change, place a checkmark in the Synchronize Loop to Timing Source checkbox and select Other <defined by source name or terminal> from the Source type list. Then, wire the timing source out output of the DAQmx Create Task VI to the Source name input of the Control & Simulation Loop.

Note  You must install NI-DAQmx™, available on the National Instruments Device Driver DVD, to use the DAQmx VIs.

Hardware-Controlled Timing Defined by VIs

Instead of using an external timing source, you can use the RT hardware I/O VIs to control the timing of the Control & Simulation Loop. In this situation, you ensure the Synchronize Loop to Timing Source checkbox does not contain a checkmark. Then, you use a VI, such as the DAQmx Read VI, to control the timing of the Control & Simulation Loop.

Log in to get a better experience