Because many dynamic system models consist of differential equations, you must solve these differential equations to observe the behavior of the simulated system. Most simulations you create in the LabVIEW Control Design and Simulation Module use ordinary differential equation (ODE) solvers. However, you also can choose to implement differential algebraic equations (DAE) solvers that enable you solve equations that contain an unknown function.
Before you simulate a dynamic system model, you must specify and configure the solver for that simulation. ODE and DAE solvers use methods to approximate the solution to a differential equation. The solvers implement these methods in a variety of ways, each with various strengths and weaknesses. Defining characteristics of a solver include the following qualities:
Use the recommendations in the following sections to choose an appropriate solver for a simulation.
Choose a fixed step-size ODE solver for use with a simulation that must run deterministically in real time. Fixed step-size solvers run deterministically on RT targets, whereas variable step-size ODE solvers might not because the computational overhead of taking a time step varies over the course of an application.
The Control & Simulation Loop provides the following fixed step-size ODE solvers:
If a model encounters many discontinuities—in the form of logic that causes a discontinuity in the ODE states or their derivatives—choose a lower order solver, such as a solver of first, second, or third order. The following features introduce this type of discontinuity and might make a lower order solver appropriate.
|Note This recommendation does not apply to discontinuities introduced by sample data systems in the model.|
If the model does not encounter any discontinuities, choose a higher order solver, such as a solver of fourth order or greater.
A single-step ODE solver might be most efficient for applications that reset the solver often. Initializing a solver requires a certain amount of computation. This computation takes place each time the calculation resets a VI or encounters a discontinuity. Thus, a multi-step ODE solver that requires initialization at each step might be less efficient than a single-step solver.
The Control & Simulation Loop provides the following single-step ODE solvers:
If a model varies in stiffness over time, choose an implicit solver. Consider a system that has a broad spectrum of time constants and whose solution contains a component that is high in frequency but quickly dies out relative to the amplitude of the lower frequency waveform. An appropriate solver integrates the system when the high frequency solution is present, and then changes its strategy for the lower frequency solution.
The following implicit solvers start the solution at a low order and gradually move to a higher order when the solution is not stiff or does not experience discontinuities:
When a model varies in stiffness, the solver might need to make certain steps with a very small step size. When you configure the solver, if you set the Minimum Step Size (s) parameter too large, the step might become unstable or, for implicit solvers, the step might lose convergence. If you experience these conditions, try reducing the Minimum Step Size (s). This same logic applies to the Initial Step Size (s) parameter.
Variable step-size solvers make as large a step as seems stable for the ODE. If the collected output does not contain the details you want, you can limit the step size with the Maximum Step Size (s) parameter.