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

Configure Simulation Parameters Dialog Box (Simulation Module)

LabVIEW 8.2 Simulation Module Help
September 2006

NI Part Number:
371894A-01

»View Product Info

Double-click the Input Node of the Simulation Loop to display this dialog box. If you are running a simulation as a stand-alone subsystem, you can select Operate»Configure Simulation Parameters from the pull-down menu to display this dialog box.

Use this dialog box to set general simulation parameters and simulation timing parameters for a simulation diagram or stand-alone simulation subsystem.

Note  Values that you programmatically configure using the Input Node override any equivalent settings you make in this dialog box.

This dialog box includes the following components:

  • Simulation Parameters—Use this page to access general simulation parameters.
    • Simulation Time—Use this section to specify the time interval over which the ordinary differential equation (ODE) solver evaluates the model.
      • Initial Time—Specifies the time at which to start the ODE solver. The default is 0 seconds.
      • Final Time—Specifies the time at which to stop the ODE solver. The default is 10 seconds. Enter a value of Inf to run the simulation continuously until the Halt Simulation function stops the execution programmatically.
    • Solver Method—Use this section to specify which ODE solver to use to evaluate the model.
      • ODE Solver—Specifies the type of ODE solver the simulation uses. The type of ODE solver you select determines the simulation parameters you can set. If you select a fixed step-size ODE solver, you can set the Step Size (s). If you select a variable step-size ODE solver, you can set the following parameters: Initial Step Size (s), Minimum Step Size (s), Maximum Step Size (s), Relative Tolerance, and Absolute Tolerance.
      • Nan/Inf Check—Specifies that you want the Simulation Module to check the simulation values for not a number (NaN) and infinite (Inf) values. If you place a checkmark in this checkbox and the simulation detects either of these values, the Simulation Module stops the simulation. Remove the checkmark from this checkbox to slightly improve simulation performance.
    • Time Step and Tolerance—Use this section to define the time step and tolerance of variable step-size ODE solver methods.
      • Step Size (s)—Specifies the interval between the times at which the ODE solver evaluates the model and updates the model output, in seconds. This option is available only if you select a fixed step-size ODE solver.
      • Initial Step Size—Specifies the time step size for the first time step of the simulation diagram evaluation. This option is available only if you select a variable step-size ODE solver.
      • Minimum Step Size—Specifies the smallest time step size the ODE solver can use to evaluate the simulation diagram. This option is available only if you select a variable step-size ODE solver.
      • Maximum Step Size—Specifies the largest time step size the ODE solver can use to evaluate the simulation diagram. This option is available only if you select a variable step-size ODE solver.
      • Relative Tolerance—Specifies the relative tolerance that defines the acceptable error of the ODE solver a(y). The LabVIEW Simulation Module compares a(y) with the estimated error of the ODE solver e(y) and adjusts the step size of the ODE solver accordingly. This option is available only if you select a variable step-size ODE solver.

        Relative Tolerance defines the acceptable error a(y) as follows:

        For y' = f(y), a(y) ≈ |y| * Relative Tolerance + Absolute Tolerance.

        During each iteration of the Simulation Loop, the Simulation Module estimates the error of the ODE solver as e(y). If e(y) > a(y), the variable step-size solver reduces the step size such that the step size >= Minimum Step Size. If e(y) < a(y), the variable step-size solver increases the step size such that the step size <= Maximum Step Size.

        In general, a larger Relative Tolerance increases the step size. This increase reduces the time the simulation needs to complete. Relative Tolerance has a larger effect on a(y) when y is large.

      • Absolute Tolerance—Specifies the absolute tolerance that defines the acceptable error of the ODE solver a(y). The Simulation Module compares a(y) with the estimated error of the ODE solver e(y) and adjusts the step size of the ODE solver accordingly. This option is available only if you select a variable step-size solver. Absolute Tolerance defines the acceptable error a(y) as follows:

        For y' = f(y), a(y) ≈ |y| * Relative Tolerance + Absolute Tolerance.

        During each iteration of the Simulation Loop, the Simulation Module estimates the error of the ODE solver as e(y). If e(y) > a(y), the variable step-size solver reduces the step size such that the step size >= Minimum Step Size (s). If e(y) < a(y), the variable step-size solver increases the step size such that the step size <= Maximum Step Size (s).

        In general, a larger Absolute Tolerance increases the step size. This increase reduces the time the simulation needs to complete. Absolute Tolerance has a larger effect on a(y) when y is small.

    • Discrete Time—Use this section to control discrete time step parameters.
      • Discrete Step Size—Specifies the base time step size for the simulation, in seconds. The ODE solver might not evaluate a discrete function every Discrete Step Size. The ODE solver evaluates a single discrete function and updates the output of that function every n discrete time steps. n is based on the sample period (sec) parameter of that discrete function. Discrete Step Size must be a divisor of the overall discrete time, which is based on the sample period (sec) and sample skew (sec) of each discrete function on the simulation diagram.

        Note  If you select a fixed step-size ODE solver, the Discrete Step Size must be an integer multiple of the Step Size. If you attempt to specify a Discrete Step Size that is not an integer multiple of the Step Size, LabVIEW launches a Configuration Error dialog box when you click the OK button to close the Simulation Parameters dialog box. To fix the Discrete Step Size, click the Modify Configuration button. To ignore the error, click the Continue Anyway button.
      • Auto Discrete Time—Automatically calculates the Discrete Step Size based on sample period (sec) and sample skew (sec) parameters of each discrete function on the simulation diagram. The Simulation Module calculates the floating-point greatest common divisor (GCD) of two numbers, x1 and x2, by finding the largest value of z such that the following equation is true:

        where i = 1, 2. In this equation, x1 represents the sample period (sec) parameter and the sample skew (sec) parameter of a single discrete function on the simulation diagram. x2 represents these parameters for a second discrete function on the simulation diagram. z is the discrete time step of the simulation, and ε is a small number. The Simulation Module uses an extension of this equation to calculate the floating-point GCD of a set of discrete functions on the simulation diagram that have sample periods x1, x2 ... xn, where xn > 0.

        Note  If there are no discrete functions on the simulation diagram, or if the sample period (sec) of each discrete function is –1, the Discrete Step Size depends on the type of ODE solver you specify. If you specify a fixed step-size ODE solver, the Discrete Step Size equals the Step Size of the ODE solver. If you specify a variable step-size ODE solver, the Discrete Step Size equals the Initial Step Size.
  • Timing Parameters—Use this page to access simulation timing parameters.
    • Timing—Use this section to specify whether the Simulation Loop uses a software or hardware timing source. If you specify a software timing source, major time steps of the simulation execute as fast as possible. If you specify a hardware timing source, these major time steps execute at a periodic rate the timing source specifies.
      • Software Timing—Executes the simulation diagram as fast as possible with no time restrictions. National Instruments recommends you use software timing if you select a variable step-size ODE Solver.
    • Loop Timing Source—Use this section to specify the type and name of the Simulation Loop timing source.
      • Source type—Sets the timing source that the Simulation Loop uses. You either can select one of the four timing sources in the following list, or select a timing source that you configure on the system.
        • 1 kHz Clock—The 1 kHz clock of the operating system. Using the 1 kHz clock, the Simulation Loop can execute an iteration once every 1 millisecond. All LabVIEW platforms that can run a timed structure support the 1 kHz timing source.
        • 1 MHz Clock—The 1 microsecond clock supported on real-time (RT) targets with Intel Pentium III or later-class processors, such as the National Instruments PXI-817x and PXI-818x devices.

          Note  You must install the LabVIEW Real-Time Module and create a VI under the RT target in the Project Explorer window to use this option.
        • 1 kHz Clock <reset at structure>—1 kHz timing source that resets on the first call of every invocation of the structure.
        • 1 MHz Clock <reset at structure>—1 MHz timing source that resets on the first call of every invocation of the structure.
        • Other <defined by source name or terminal>—A previously defined timing source referred to by Source name or wired to the Input Node.
      • Source name—Specifies the name of the instance of the timer. For example, if you enter the same name in Source name in two different Simulation Loops, both Simulation Loops share the same instance of the timer. Therefore, the offset is relative to the same starting point for both Simulation Loops.
    • Loop Timing—Use this section to control the timing of the Simulation Loop.
      • Period—Specifies the amount of time that elapses between two subsequent iterations of the Simulation Loop. The unit of the period changes depending on the clock source you select in Source type. The default value is 1000 milliseconds.
      • Auto Period—Automatically calculates the period of the simulation diagram as the Step Size of the fixed step-size ODE Solver divided by the step size of the Source type. This option is available only for fixed step-size ODE solvers.
      • Offset (phase)—Sets the amount of time the Simulation Loop waits before it executes its first iteration. The default value is 0. You can use this option to synchronize Simulation Loops or align their phase shifts. For example, consider two Simulation Loops that use the same timing source information you specified in the Source name text box. If you enter a value of 0 in the Offset (phase) of the first Simulation Loop and a value of 100 in the Offset (phase) of the second Simulation Loop, the Simulation Loops execute at their respective periods. However, the second Simulation Loop executes 100 timing units after the first Simulation Loop.
      • Timeout (ms)—Specifies the amount of time in milliseconds the Simulation Loop waits for a timing source before the Simulation Loop aborts execution. The default value is –1, which specifies no timeout.
      • Priority—Sets the priority of the execution of the Simulation Loop relative to other Simulation Loops. The larger the number you enter in this option, the higher the priority the Simulation Loop has over other Simulation Loops. The default value is 100.

        Note  These priorities are different from VI priorities. The LabVIEW Timed Loop Scheduler runs Simulation Loops at a priority level below the time-critical priority and above the high priority in LabVIEW. The RT scheduler is preemptive, so the higher-priority loop ready to execute preempts all lower priority loops and other LabVIEW code not running at time-critical priority.

Resources


 

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