LabVIEW Control Design and Simulation Module

Configure Simulation Parameters Dialog Box

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

Requires: Control Design and Simulation Module

Double-click the Input Node of the Control & 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 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 (s)—Specifies the time at which to start the ODE solver. The default is 0 seconds.
      • Final Time (s)—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 or DAE solver the simulation uses.
        Note  If the term (variable) appears next to a solver, that solver has a variable step size. The other solvers have a fixed step size.
        The type of solver you select determines the simulation parameters you can configure. If you select a fixed step-size ODE solver, you can configure the Step Size (s). If you select a variable step-size ODE solver, you can configure 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 Control Design and 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 Control Design and Simulation Module stops the simulation. Remove the checkmark from this checkbox to slightly improve simulation performance.
    • Continuous 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 (s)—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 (s)—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 (s)—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 Control Design and 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 Control & Simulation Loop, the Control Design and 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 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 Control Design and 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 Control & Simulation Loop,the Control Design and 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 Step—Use this section to control discrete time step parameters.
      • Discrete Step Size (s)—Specifies the base time step size for the simulation, in seconds. The ODE solver might not evaluate a discrete function every Discrete Step Size (s). 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 (s) parameter of that discrete function. Discrete Step Size (s) must be a divisor of the overall discrete time, which is based on the sample period (s) and sample skew (s) of each discrete function on the simulation diagram.
        Note  If you select a fixed step-size ODE solver, the Discrete Step Size (s) must be an integer multiple of the Step Size (s). If you attempt to specify a Discrete Step Size (s) that is not an integer multiple of the Step Size (s), LabVIEW launches a Configuration Error dialog box when you click the OK button. To fix the Discrete Step Size (s), click the Modify Configuration button. To ignore the error, click the Continue Anyway button.
      • Auto Discrete Time—Automatically calculates the Discrete Step Size (s) based on sample period (s) and sample skew (s) parameters of each discrete function on the simulation diagram.

        The Control Design and Simulation Module 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 (s) parameter and the sample skew (s) 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 Control Design and 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, x2xn, where xn > 0.
        Note  If there are no discrete functions on the simulation diagram, or if the sample period (s) of each discrete function is –1, the Discrete Step Size (s) depends on the type of ODE solver you specify. If you specify a fixed step-size ODE solver, the Discrete Step Size (s) equals the Step Size (s) of the ODE solver. If you specify a variable step-size ODE solver, the Discrete Step Size (s) equals the Initial Step Size (s).
    • Signal Collection—Contains the following option for configuring how the Control & Simulation Loop Output Node collects and stores signal histories and how the Access Model Hierarchy function collects signal values at run time:
      • Decimation—Specifies when to collect a signal value. If you set the value of Decimation to 1, LabVIEW records a value at every time step. If you set the value of Decimation to n, where n > 1, LabVIEW a value once every n time steps. By default, Decimation is 0, which means LabVIEW does not collect any values.

        Collecting signals is computationally expensive. Increasing the signal decimation can resolve performance issues.
  • Timing Parameters—Use this page to access simulation timing parameters.
    • Enable Synchronized Timing—Use this section to specify whether you want to synchronize the Control & Simulation Loop with a timing source.
      • Synchronize Loop to Timing Source—Specifies that you want to synchronize the timing of the Control & Simulation Loop to a timing source. To enable synchronization, place a checkmark in this checkbox and then choose a timing source from the Source type list box.

        If you do not place a checkmark in this checkbox, the Control & Simulation Loop executes as fast as possible. National Instruments recommends you use this option if you select a variable step-size ODE Solver.

        If you synchronize the Control & Simulation Loop to an internal, or software, timing source, major time steps of the simulation execute as fast as possible. If you synchronize this loop to an external, or hardware, timing source, these major time steps execute at a periodic rate the timing source specifies.
    • Timing Source—Use this section to specify the type and name of the Control & Simulation Loop timing source.
      • Source type—Specifies the timing source that the Control & 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 Control & 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 <reset at structure start>—1 kHz timing source that resets on the first call of every invocation of the structure.
        • 1 MHz <reset at structure start>—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 Control & Simulation Loops, both Control & Simulation Loops share the same instance of the timer. Therefore, the offset is relative to the same starting point for both Control & Simulation Loops.
    • Loop Timing Attributes—Use this section to control the timing of the Control & Simulation Loop.
      • Auto Period—Automatically calculates the period of the simulation diagram as the Step Size of the fixed step-size ODE Solver divided by the period of the Source type you select.

        This option is available only for fixed step-size ODE solvers and for the 1 kHz and 1 MHz timing source types. This option is not available for external timing sources.

        If the Step Size does not divide the period of the Source type evenly, this indicator displays a 0. If you click the OK button in this situation, LabVIEW returns an error.
      • Calculated Period—Specifies the calculated amount of time that elapses between two subsequent iterations of the Control & Simulation Loop. Calculated Period is equal to the Step Size of the fixed step-size ODE Solver divided by the period of the Source type you select. This option appears only if you place a checkmark in the Auto Period checkbox.
      • Period—Specifies the amount of time that elapses between two subsequent iterations of the Control & Simulation Loop. The unit of the period changes depending on the clock source you select in Source type. The default value is 1000 milliseconds.
      • Offset / Phase—Sets the amount of time the Control & Simulation Loop waits before it executes its first iteration. The default value is 0. You can use this option to synchronize Control & Simulation Loops or align their phase shifts. For example, consider two Control & 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 Control & Simulation Loop and a value of 100 in the Offset / Phase of the second Control & Simulation Loop, the Control & Simulation Loops execute at their respective periods. However, the second Control & Simulation Loop executes 100 timing units after the first Control & Simulation Loop.
      • Priority—Sets the priority of the execution of the Control & Simulation Loop relative to other Control & Simulation Loops and Timed Loops. The larger the number you enter in this option, the higher the priority the Control & Simulation Loop has over other loops. Priority must be a positive integer between 1 and 65,535. The default value is 100.
        Note  These priorities are different from VI priorities. The LabVIEW Timed Loop Scheduler runs Control & 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.
      • Deadline—Specifies the time when the Control & Simulation Loop must complete the iteration. Deadline equals Period if you do not specify a value. The deadline value is relative to the start of the Control & Simulation Loop and is specified in units of the timing source.
      • Timeout (ms)—Specifies the amount of time in milliseconds the Control & Simulation Loop waits for a timing source before the Control & Simulation Loop aborts execution. The default value is –1, which specifies no timeout.
    • Processor Assignment—Specifies the processor assigned to handle execution. The Processor Assignment settings include the following components.
      • Mode—Specifies how to assign available processors to handle execution. You can select from the following options:
        • Automatic—LabVIEW assigns a processor to handle execution automatically. LabVIEW disables the Processor control and sets it to -2 when you select this option.
        • Manual—The value you enter in the Processor control specifies the processor you want to use to handle execution. You must specify a value between 0 and 255 in the Processor control.
      • Processor—Specifies the processor you want to handle execution. The default is -2, which means LabVIEW automatically assigns a processor. To manually assign a processor, enter a number between 0 and 255, where 0 represents the first processor. If you enter a number that exceeds the number of available processors, you generate a run-time error and the timed structure does not execute.

Log in to get a better experience