Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Configuring the Timing of the Simulation Loop (Simulation Module)

LabVIEW 8.5 Simulation Module Help
August 2007

NI Part Number:
371894B-01

»View Product Info

The 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 Simulation Loop; therefore, the simulation is deterministic. National Instruments provides special real-time (RT) hardware targets you can use to ensure determinism in a simulation. In addition to an RT target, you must also install the LabVIEW Real-Time Module to execute a simulation deterministically. Refer to the National Instruments Web site for information about these RT hardware targets and the LabVIEW 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 Simulation Loop. You can use this dialog box to configure the following timing scenarios:

No Timing

To run a simulation without any timing restrictions, place a checkmark in the Software Timing checkbox on this page. In this situation, the simulation runs as fast as possible. This option is appropriate for running offline simulations.

Software-Controlled Timing on RTX Targets

The Ardence Real-Time Extension (RTX) does not support the Timed Loop or a hardware-timed Simulation Loop. To run a simulation on an RTX target, you can use the Wait Until Next ms Multiple function. Place this function on the simulation diagram and wire a value to the millisecond multiple input of this function.

If you are using either the Runge-Kutta 2, Runge-Kutta 3, or Runge-Kutta 4 ODE solver, National Instruments recommends you place this function in a subVI and configure that subVI to execute only on major time steps of the ODE solver. Complete the following steps to make this change.

  1. Click the Wait Until Next ms Multiple function and select Edit»Create SubVI.
  2. Right-click the subVI you created and select SubVI Node Setup from the shortcut menu to launch the SubVI Node Setup dialog box.
  3. Select the Continuous option.
  4. Ensure the Include minor time steps checkbox does not contain a checkmark.
  5. Click the OK button. The subVI that contains the Wait Until Next ms Multiple function now executes only on major time steps of the ODE solver.

1 kHz Timing on a Windows Computer

If you do not have an RT target available, you can simulate 1 kHz timing by using a Windows computer. To make this change, remove the checkmark from the Software Timing checkbox and select 1 kHz from the Source Type list.

If you have a supported National Instruments RT target, you also can select the 1 MHz option. If you select this option for a simulation that is running on an unsupported target, the LabVIEW 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 a National Instruments DAQ device, to control the Simulation Loop. To make this change, remove the checkmark from the Software Timing 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 Simulation Loop.

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

For an example of this procedure, refer to the analog discrete transfer function controller VI in the labview\examples\simulation\real-time\Analog discrete transfer function controller.llb.

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 Simulation Loop. In this situation, you place a checkmark in the Software Timing checkbox so the Simulation Loop runs as fast as possible. Then, you use a VI, such as the DAQmx Read VI, to control the timing of the Simulation Loop. This method is also suitable for RTX targets.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit