Simulation Module User Manual
Simulation Module User Manual
TM
Worldwide Offices
Australia 1800 300 800, Austria 43 0 662 45 79 90 0, Belgium 32 0 2 757 00 20, Brazil 55 11 3262 3599,
Canada (Calgary) 403 274 9391, Canada (Ottawa) 613 233 5949, Canada (Québec) 450 510 3055,
Canada (Toronto) 905 785 0085, Canada (Vancouver) 514 685 7530, China 86 21 6555 7838,
Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 385 0 9 725 725 11,
France 33 0 1 48 14 24 24, Germany 49 0 89 741 31 30, Greece 30 2 10 42 96 427, India 91 80 51190000,
Israel 972 0 3 6393737, Italy 39 02 413091, Japan 81 3 5472 2970, Korea 82 02 3451 3400,
Malaysia 603 9131 0918, Mexico 001 800 010 0793, Netherlands 31 0 348 433 466,
New Zealand 0800 553 322, Norway 47 0 66 90 76 60, Poland 48 22 3390150, Portugal 351 210 311 210,
Russia 7 095 783 68 51, Singapore 65 6226 5886, Slovenia 386 3 425 4200, South Africa 27 0 11 805 8197,
Spain 34 91 640 0085, Sweden 46 0 8 587 895 00, Switzerland 41 56 200 51 51, Taiwan 886 2 2528 7227,
Thailand 662 992 7519, United Kingdom 44 0 1635 523545
For further support information, refer to the Technical Support and Professional Services appendix. To comment
on the documentation, send email to [email protected].
Warranty
The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects
in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National
Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives
notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be
uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before
any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are
covered by warranty.
National Instruments believes that the information in this document is accurate. The document has been carefully reviewed for technical
accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent
editions of this document without prior notice to holders of this edition. The reader should consult National Instruments if errors are suspected.
In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. CUSTOMER’S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF
NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER. NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR
DAMAGES RESULTING FROM LOSS OF DATA, PROFITS, USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY
THEREOF. This limitation of the liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including
negligence. Any action against National Instruments must be brought within one year after the cause of action accrues. National Instruments
shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover
damages, defects, malfunctions, or service failures caused by owner’s failure to follow the National Instruments installation, operation, or
maintenance instructions; owner’s modification of the product; owner’s abuse, misuse, or negligent acts; and power failure or surges, fire,
flood, accident, actions of third parties, or other events outside reasonable control.
Copyright
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying,
recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National
Instruments Corporation.
Trademarks
LabVIEW™, National Instruments™, NI™, ni.com™, NI-CAN™, and NI-DAQ™ are trademarks of National Instruments Corporation.
MATLAB®, Simulink®, and Stateflow® are registered trademarks of The MathWorks, Inc.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Patents
For patents covering National Instruments products, refer to the appropriate location: Help»Patents in your software, the patents.txt file
on your CD, or ni.com/patents.
Chapter 1
Introduction to Modeling
Modeling Dynamic Systems ..........................................................................................1-1
Determining Model Complexity......................................................................1-2
Developing the Model .....................................................................................1-2
Physical Modeling ............................................................................1-2
Lumped versus Distributed Parameter Models ..................1-2
Linear versus Nonlinear Models.........................................1-2
Time-Variant versus Time-Invariant Models .....................1-3
Continuous versus Discrete Models ...................................1-3
Empirical Modeling ..........................................................................1-3
Introduction to Ordinary Differential Equation Solvers ................................................1-3
Introduction to Rapid Control Prototyping and Hardware-in-the-Loop
Configurations.............................................................................................................1-4
Chapter 2
Simulation Environment
Simulation Diagram .......................................................................................................2-1
Simulation Loop ..............................................................................................2-1
LabVIEW VIs, Functions, and Structures.......................................................2-2
Feedback Cycles..............................................................................................2-3
Setting Simulation Parameters ........................................................................2-5
Simulation Time Parameters.............................................................2-7
Continuous Solver Parameters ..........................................................2-7
Discrete Solver Parameters ...............................................................2-8
Setting Timing Parameters ..............................................................................2-9
LabVIEW Real-Time Module for ETS Targets................................2-9
LabVIEW Real-Time Module for RTX Targets...............................2-9
Off-Line Simulations ........................................................................2-10
Simulation Functions .....................................................................................................2-10
Discrete Systems Functions.............................................................................2-12
Displaying Dynamic Content on Expandable Nodes ......................................2-12
Flipping Function Direction ............................................................................2-13
Programmatically Stopping a Simulation........................................................2-14
Chapter 3
Real-Time Applications
Determinism .................................................................................................................. 3-1
Case Study: Rapid Control Prototype and Hardware-in-the-Loop Simulation ............. 3-2
Off-Line Simulation........................................................................................ 3-2
Rapid Control Prototype Implementation ....................................................... 3-3
Hardware-in-the-Loop Implementation .......................................................... 3-4
Discrete Behavior............................................................................................ 3-4
Chapter 4
Ordinary Differential Equation Solvers
Simulation Discontinuities ............................................................................................ 4-2
ODE Solver Accuracy and Order .................................................................................. 4-2
Variable Step-Size versus Fixed Step-Size ODE Solvers ............................................. 4-3
Single-Step versus Multi-Step ODE Solvers................................................................. 4-3
Stiff ODE Solvers.......................................................................................................... 4-4
LabVIEW Simulation ODE Solvers.............................................................................. 4-4
Chapter 5
Simulink Translator
Converting Simulink Models into LabVIEW Code ...................................................... 5-1
Common Warnings........................................................................................................ 5-2
Appendix A
Technical Support and Professional Services
Glossary
The LabVIEW Simulation Module User Manual describes how to use the
simulation environment, Simulation functions, and simulation subsystems.
Refer to the LabVIEW Help for more information about specific Simulation
Module palettes, functions, and dialog box options.
Use this manual to learn how to use the LabVIEW Simulation Module in
real-time applications and how to use the Simulink Translator to convert
Simulink® model (.mdl) files into LabVIEW VIs. This manual also
describes factors to consider when you develop a model and factors to
consider when you select an ordinary differential equation (ODE) solver to
use for a simulation.
Conventions
The following conventions appear in this manual:
» The » symbol leads you through nested menu items and dialog box options
to a final action. The sequence File»Page Setup»Options directs you to
pull down the File menu, select the Page Setup item, and select Options
from the last dialog box.
bold Bold text denotes items that you must select or click in the software, such
as menu items and dialog box options. Bold text also denotes parameter
names; dialog box names; and pages, sections, and components of dialog
boxes.
italic Italic text denotes variables, emphasis, or a cross reference. This font also
denotes text that is a placeholder for a word or value that you must supply.
monospace Text in this font denotes text or characters that you should enter from the
keyboard. This font is also used for the proper names of disk drives, paths,
directories, programs, subprograms, subroutines, device names, functions,
operations, variables, filenames, and extensions.
Related Documentation
The following documents contain information that you might find helpful
as you read this manual:
• LabVIEW Control Design Toolkit User Manual
• LabVIEW Execution Trace Toolkit User Guide
• LabVIEW Help
• LabVIEW Real-Time Module User Manual
• LabVIEW User Manual
• NI-CAN Hardware and Software Manual
• NI-DAQmx Help
With the Simulation Module, you can create simulations to lower product
development costs by accelerating product development, providing higher
quality, and reducing associated risk. You also can create simulations to
provide insight into the behavior of systems that you cannot replicate
conveniently in the laboratory.
Consider the following issues when you develop a dynamic system model.
1 Dorf, Richard C., and Robert H. Bishop. Modern Control Systems, 9th ed. Upper Saddle River, NJ: Prentice-Hall, Inc., 2001.
2 Franklin, Gene F., J. David Powell, and Abbas Emami-Naeini. Feedback Control of Dynamic Systems, 4th ed. Upper Saddle
River, NJ: Prentice Hall, 2002.
3 Franklin, Gene F., J. David Powell, and Michael L. Workman. Digital Control of Dynamic Systems, 3rd ed. Menlo Park, CA:
Addison Wesley Longman, Inc., 1998.
4 Nise, Norman S. Control Systems Engineering, 3rd ed. New York: John Wiley & Sons, Inc., 2000.
5 Ogata, Katsuhiko. Modern Control Engineering, 4th ed. Upper Saddle River, NJ: Prentice-Hall, Inc. 2001.
Physical Modeling
The laws of physics define the physical model of a system. The following
sections describe various classifications and features of physical models.
y1 = f(x1)
y2 = f(x2)
Y = f(x1 + x2) = y1 + y2
relays; switches; and rate limiters. All real-world systems are nonlinear,
though you can linearize the model to simplify a design or analysis task.
Empirical Modeling
Empirical models use data gathered from experiments to define the
mathematical model of a system. To some degree, even physical models
are empirical because you determine experimentally certain constants used
to develop the model. A variety of empirical modeling methods exist. One
method of empirical modeling uses tables of experimental data that
represent the system you want to model. Another method for developing
models uses system identification methods. System identification methods
use measured data to create differential or difference equation
representations that model the data. You can use LabVIEW System
Identification Toolkit VIs to create models using system identification
methods. If you have the System Identification Toolkit installed, refer to
the LabVIEW Help for more information about these VIs.
Simulation Diagram
The simulation diagram graphically displays the simulation model that an
application must evaluate at each time step of the simulation. You place a
dynamic element and other logical or arithmetic code on the simulation
diagram to define the model the ODE solver evaluates at each time step.
Note Dynamic elements include the following Simulation functions: Integrator, State
Space, Transfer Function, Zero-Pole-Gain, Discrete Integrator, Discrete State Space,
Discrete Transfer Function, and Discrete Zero-Pole-Gain.
Simulation Loop
Because simulations naturally run as loops that iterate over multiple time
steps, the Simulation Module includes the Simulation Loop. The
Simulation Loop, shown in Figure 2-1, executes the simulation diagram
until it reaches the simulation final time or until the Halt Simulation
function programmatically stops the execution.
You must place all Simulation functions, except the Set Diagram
Parameters function, and all simulation subsystems within a Simulation
Loop or within another simulation subsystem. Refer to the Simulation
Functions section for information about these functions.
You can wire the Set Diagram Parameters function to the optional
parameters terminal of the Simulation Loop, shown at left, to
programmatically configure simulation parameters for the enclosed
simulation diagram. If the parameters terminal is unwired, you can
right-click the border of the Simulation Loop and select Configure
Simulation Parameters from the shortcut menu to configure the
simulation parameters using the Simulation Parameters dialog box. Refer
to the Setting Simulation Parameters section for more information about
setting these parameters.
The Simulation Loop has error in and error out terminals, which send
error information through the simulation diagram. If the error in terminal
detects an error, the simulation diagram returns the error information in the
error out terminal and does not evaluate the simulation. If an error occurs
while the Simulation Loop is executing, the simulation stops running, and
the error information is output in the error out terminal. Refer to the
Simulation Debugging section for more information about how to resolve
simulation errors.
Note You can load models you create using the LabVIEW Control Design VIs into the
simulation diagram. Refer to the LabVIEW Control Design Toolkit User Manual for more
information about control design models.
Note The Run as Discrete Node option is enabled by default with a Sample Rate Divisor
of 1.
Feedback Cycles
The relationship between the inputs and outputs of a function defines the
feedthrough behavior of that function. An input has direct feedthrough to
an output if the function uses the input at the current step to compute the
output at the current step. An input has indirect feedthrough to an output if
the function does not use the input at the current step to compute the output
at the current step. The indirect feedthrough function uses the input from
the previous step or steps to compute the output at the current step.
You can use one or more Simulation functions as well as other LabVIEW
functions in a feedback cycle as long as at least one Simulation function
in the feedback cycle has indirect feedthrough behavior. The indirect
feedthrough function can start the data flow by executing its output at the
current step before receiving an input from the cycle at the current step.
Therefore, the input at the current step and the output at the current step
must not depend on each other directly in at least one function in the cycle.
Note The wires on the simulation diagram use arrows to indicate the direction of data
flow. These arrows help you identify feedback cycles on the simulation diagram by
showing data flow direction.
For other Simulation functions, the parameter values you specify determine
the feedthrough behavior. The following Simulation functions have
parameter-dependent feedthrough behavior:
• State Space
• Transfer Function
• Zero-Pole-Gain
• Discrete Filter
• Discrete Integrator
• Discrete State Space
• Discrete Transfer Function
• Discrete Zero-Pole-Gain
To set the simulation parameters for the simulation diagram at edit time,
you can use the Simulation Parameters dialog box. To set the simulation
parameters programmatically, use the Set Diagram Parameters function.
Use the Set Diagram Parameters function to set the values of the simulation
parameters programmatically.
Place the Set Diagram Parameters function outside the Simulation Loop to
the left of the parameters terminal and wire the simulation parameters out
output of this function to the parameters terminal. Then, right-click the
Set Diagram Parameters function and select Create»Control or Create»
Constant from the shortcut menu to create a set of simulation parameters
controls on the front panel. Figure 2-4 shows how to wire the Set Diagram
Note If you wire the Set Diagram Parameters function to the parameters terminal, the
configuration data the function specifies—including the default values—override the static
configuration you set using the Simulation Parameters dialog box.
If you select a variable step-size ODE solver method, you can specify the
Initial Time Step, which is the time step size for the first time step of
the simulation diagram evaluation. A variable step-size ODE solver
dynamically adjusts subsequent time steps based upon what you specify in
the Relative Tolerance and Absolute Tolerance parameters. You can use
the Minimum Time Step and Maximum Time Step parameters to specify
the smallest and largest time step sizes the variable step-size ODE solver
can use to evaluate the simulation diagram.
Note Methods whose names are followed by the word (variable) in the Continuous
Solver Method list are variable step-size ODE solver methods. All other methods in the
list are fixed step-size ODE solver methods.
The time step size affects how accurate a simulation is and how fast the
simulation runs. A simulation with a large time step runs faster than a
simulation with a smaller time step. However, a simulation with a large
time step is less accurate than a simulation with a smaller time step. Refer
to Chapter 4, Ordinary Differential Equation Solvers, for more information
about ODE solvers and time steps.
The type of ODE solver you select determines how you can specify the
Discrete Time Step. If you select a fixed step-size ODE solver method,
you can use the Use multiple of Time Step option, which is enabled by
default, to set the Discrete Time Step. When this option is enabled,
LabVIEW multiplies the Time Step by the Discrete Time Step Multiple
to calculate the Discrete Time Step. The Use multiple of Time Step
option is useful because, for fixed step-size ODE solvers, the Discrete
Time Step must be an integer multiple of the Time Step.
If you remove the checkmark from the Use multiple of Time Step
checkbox and specify the Discrete Time Step directly, LabVIEW verifies
that the Discrete Time Step is an integer multiple of the Time Step for
fixed step-size ODE solvers. If you attempt to specify a Discrete Time
Step that is not an integer multiple of the Time Step, LabVIEW launches
a Configuration Error dialog box when you click OK to close the
Simulation Parameters dialog box. You can select Modify
Configuration or Continue Anyway from the Configuration Error
dialog box.
If you select a variable step-size ODE solver, the Discrete Time Step is not
required to be an integer multiple of the Time Step. Therefore, the Use
multiple of Time Step option is not available. You must specify the
Discrete Time Step directly. The Use multiple of Time Step option is also
unavailable if you configure the simulation parameters programmatically,
regardless of the ODE solver method you select.
Note The simulation timing parameters are most accurate in a LabVIEW Real-Time
application. If you do not run an application on a real-time system, other processes on the
operating system can interrupt the execution of the Simulation Loop.
Complete the following steps to avoid these errors when you run a
simulation diagram or subsystem that is downloaded to the RTX target:
1. Open the Loop Configuration dialog box and set the Period to 0.
2. Place a subVI that contains a Wait Until Next ms Multiple function on
the simulation diagram or subsystem and set the millisecond multiple
accordingly.
Off-Line Simulations
If you are executing an off-line simulation on a Windows operating system,
National Instruments recommends you set the Period to 0 for optimal
performance. Refer to the Loop Configuration Dialog Box (Simulation
Module) topic in the LabVIEW Help for more information about setting the
timing parameters for the Simulation Loop.
Simulation Functions
Use the Simulation functions and other LabVIEW functions to build a
simulation model. You must place all Simulation functions, except the
Set Diagram Parameters function, on the simulation diagram, either inside
a Simulation Loop or in a simulation subsystem. Refer to Simulation
Subsystems for information about placing functions in a simulation
subsystem.
Many Simulation functions have a configuration dialog box that you can
use to view and set the function parameters. Double-click a Simulation
function to display its configuration dialog box. For example, Figure 2-5
displays the configuration dialog box for the Sine Wave function.
The left side of the configuration dialog box lists all the parameters that you
can configure for the Sine Wave function. When you select a parameter
from the Parameters table, the Parameter Information section displays
a control you can use to set the value of that parameter. You can use the
Parameter source control to specify the source of the parameter value.
If you select Configuration page as the Parameter source, LabVIEW
uses the parameter value you specify in the configuration dialog box. If you
select Terminal, LabVIEW uses the parameter value you wire to the input
terminal on the simulation diagram.
Note If you specify Configuration page as the Parameter source for a parameter, an
input terminal does not exist on the function icon for that parameter.
The parameters you specify for a Simulation function are unique to that
function. If you create multiple instances of the same function, you can set
different parameter values for each instance of the Simulation function. If
you copy and paste a Simulation function, the copy of the function retains
the parameter values of the original function.
Note Different discrete functions can run at different sample rates in the Simulation Loop.
Note A function displays dynamic content only if it uses the dynamic icon style.
Right-click an icon and select Icon Style»Dynamic from the shortcut menu to specify this
icon style. Dynamic is the default icon style for Simulation functions.
If an expandable node uses the dynamic icon style, you can change the size
of that expandable node on the simulation diagram. For example, you can
resize the Signal Generator node on the simulation diagram to view more
of the graph. Figure 2-7 displays the original icon and the resized icon.
Simulation Subsystems
Creating simulation models using the Simulation Module can require a
large amount of space on the block diagram. To reduce the amount of space
required to create a simulation diagram, you can convert a section of that
simulation diagram into a simulation subsystem.
Note If you select Edit»Create SubVI after highlighting nodes on a simulation diagram,
LabVIEW creates a subVI from only the non-Simulation function nodes in the selection.
You also can create a simulation subsystem using the New dialog box,
which you can access by selecting File»New from the pull-down menu.
Select Other Document Types»Simulation Subsystem from the Create
new list.
Stand-Alone Subsystems
When you execute the simulation subsystem as a stand-alone VI, the
simulation diagram executes as if it were contained within a Simulation
Loop. This behavior enables you to edit the simulation model without
having to place a Simulation Loop on the block diagram.
Note The settings you specify in the Execution Properties page for the simulation
subsystem do not affect the execution of the parent simulation diagram when you place the
subsystem on a simulation diagram. Select File»VI Properties and select Execution from
the pull-down menu to display the Execution Properties page.
Note You can configure the connector pane for a simulation subsystem the same way you
configure the connector pane for a subVI.
Linearizing a Subsystem
You can use the Linearize Subsystem dialog box to generate a linear
time-invariant state-space model from the subsystem model. You can use
this linear state-space model for control design. Select Tools»Simulation
Tools»Linearize Subsystem from the pull-down menu to display this
dialog box. Refer to the LabVIEW Help for more information about the
Linearize Subsystem dialog box.
Simulation Debugging
LabVIEW performs syntax checking on the simulation diagram. While you
edit the simulation diagram, LabVIEW notifies you if there is a data type
problem or an invalid feedback cycle.
Note If you run the subsystem in stand-alone mode, you can debug it the same way you
can debug a simulation diagram.
Refer to the documentation for the type of I/O you are using for more
information about I/O programming in the Real-Time Module. For
example, refer to the NI-DAQmx Help for information about analog,
digital, and timing I/O. Refer to the NI-CAN Hardware and Software
Manual for information about CAN I/O.
Determinism
Running a simulation or controller in real time means that the simulation
time must equal the wall-clock time at each point at which the simulation
or controller interacts with the real world. Generally, these physical
interaction points correspond to the sampling points of the input and output
hardware. Thus, at each sampling time, the simulation time must equal the
wall-clock time.
inputs and outputs. Some ODE solvers, including the variable step-size
ODE solvers, are inherently non-deterministic. You cannot use these
non-deterministic ODE solvers in a real-time application.
All of the discrete ODE solvers have an inherently fixed time step size and
are inherently deterministic. Therefore, the discrete ODE solvers are
appropriate for real-time implementation. The Discrete Systems functions
use the discrete ODE solvers in their implementation. ODE solver
determinism is important only when you use continuous dynamic
functions, such as the Integrator, State Space, Transfer Function, and
Zero-Pole-Gain functions.
Off-Line Simulation
The starting point is the off-line simulation of the full system. The
simulation diagram in Figure 3-1 represents a simple control system.
The system contains a controller, a model of the plant, and a front panel
control that represents the set point or reference signal.
To convert the full simulation to a rapid control prototype, remove the plant
model from the simulation. Replace the plant input with a hardware output
and replace the plant output with a hardware input.
Note The inputs and outputs can be analog or digital signals, timing signals such as
encoders, CAN signals, and so on.
In Figure 3-2, notice that the block diagram code to the left of the
Simulation Loop is the NI-DAQmx setup code. Inside the Simulation
Loop, the DAQmx Read (Analog DBL 1Chan 1Samp) VI receives an
analog value from the data acquisition device, and the DAQmx Write
(Analog DBL 1Chan 1Samp) VI returns an analog value to the device.
Refer to the NI-DAQmx Help for more information about single-point
hardware-timed I/O.
Hardware-in-the-Loop Implementation
You might want to test a controller implementation versus a plant
simulation. In these HIL simulations, the plant model and its associated
inputs and outputs must occur in real time to provide the most accurate and
reliable controller testing.
You can convert the full simulation of the system to an HIL simulation in a
manner similar to the RCP implementation. You must remove the controller
from the full off-line simulation and then replace the plant model input with
a hardware input and the plant model output with a hardware output. The
result, shown in Figure 3-3, is a system similar to the RCP implementation,
except with the controller model, not the plant model, replaced with
physical hardware inputs and outputs.
Discrete Behavior
Notice the discrete nature of the I/O calls in the simulation diagram. The
I/O executes only once per fixed time step of the continuous Integrator
function. Refer to the LabVIEW VIs, Functions, and Structures section
of Chapter 2, Simulation Environment, for more information about
configuring the discrete behavior of LabVIEW VIs you place on a
simulation diagram.
dy
------ = f ( t, y )
dt
y ( t0 ) = y 0
1 Ascher, Uri M., and Linda R. Petzold. Computer Methods for Ordinary Differential Equations and Differential-Algebraic
Equations. Philadelphia: Society for Industrial and Applied Mathematics, 1998.
2 Shampine, Lawrence F. Numerical Solution of Ordinary Differential Equations. New York: Chapman & Hall, Inc., 1994.
Simulation Discontinuities
In general, the Simulation Module ODE solvers assume that all simulation
diagram signals and their derivatives are continuous throughout any time
step. To get the most accurate solution possible, the ODE solver must stop
and restart whenever it encounters a discontinuity. Therefore, the presence
of many discontinuities in a simulation limits the maximum step size that
an ODE solver can take. This influences which ODE solver you should
choose.
In general, with a higher order ODE solver, you can use fewer time steps
and larger step sizes to get the accuracy you need, thus decreasing the
effects of round-off in the solution and potentially reducing the amount of
time needed to compute the solution. However, this accuracy might come
with a higher computational cost per step. If the step size is limited by
factors other than error, such as discontinuities, you might get the accuracy
you need more efficiently by using a lower order ODE solver.
These variable step-size ODE solvers can take small time steps when the
simulation variables vary rapidly and can take larger time steps when the
simulation variables vary more slowly, which increases computational
efficiency.
Note The Simulink Translator cannot convert Stateflow® diagrams or other Simulink
blocksets.
The Simulink Translator converts the .mdl file into a top-level VI that
consists of a simulation diagram containing LabVIEW functions, wires,
and subsystems corresponding to the contents of the .mdl file.
The Simulink Translator reads and parses the .mdl file for model
information such as timing and ODE solver settings.
Note If MathWorks MATLAB® and Simulink are installed on the computer, the Simulink
Translator automatically executes any .m files included in the .mdl file before it parses the
.mdl file.
Common Warnings
If the Simulink Translator cannot find a value for a parameter in the .mdl
file it is converting, you receive a warning. In these cases, the Simulink
Translator uses the default value of the parameter in the corresponding
LabVIEW function.
Note In some cases, the Simulink Translator cannot find a value for a parameter because
the parameter contains an expression instead of a constant value. If MATLAB is installed
on the computer, the Simulink Translator attempts to evaluate these MATLAB expressions
in the .mdl file prior to translating the file. If the Simulink Translator successfully
evaluates the expression, the Simulink Translator uses the result of that evaluation as
the parameter value and does not produce a warning.
If you searched ni.com and could not find the answers you need, contact
your local office or NI corporate headquarters. Phone numbers for our
worldwide offices are listed at the front of this manual. You also can visit
the Worldwide Offices section of ni.com/niglobal to access the branch
office Web sites, which provide up-to-date contact information, support
phone numbers, email addresses, and current events.
B
BDF Backwards difference formula. Also known as Gear’s Method.
C
CGD Common Graph Description. The format the Simulink Translator uses to
store each system, subsystem, block, and line from the Simulink model.
continuous model Dynamic system model used to represent real-world signals that vary
continuously with time. A continuous model is characterized by differential
equations.
D
direct feedthrough Relationship between a function input and a function output in which the
function uses the input at the current step to calculate the output at the
current step.
discrete model Dynamic system model used to represent signals that are sampled in time
at discrete intervals. A discrete model is characterized by difference
equations.
distributed parameter Physical model that can be described by partial differential equations.
model
E
empirical modeling Modeling technique in which you use experimental data to define a system
model.
F
feedback cycle Cycle in which data flow originates from an output of a function or
subsystem and terminates as an input of the same function or subsystem.
G
global error Maximum difference between the solution the function computes and the
exact solution.
H
HIL Hardware-in-the-loop. A simulation configuration in which you test
a controller implementation with a software model of the plant.
I
indirect feedthrough Relationship between a function input and a function output in which the
function does not use the input at the current step to compute the output at
the current step.
L
linear model Model that obeys the principle of superposition.
local error Error introduced into the solution per time step.
M
multi-step ODE ODE solver that approximates the behavior of a model at time t + dt by
solver taking into account the behavior of the model at a number of previous time
steps.
N
nonlinear model Model that does not obey the principle of superposition.
O
ODE Ordinary differential equation.
order ODE solver characteristic that determines how much the error amount
changes when you vary the step size.
P
parameters terminal Optional Simulation Loop terminal used to configure a cluster of
simulation parameters for the enclosed diagram.
PECE Predict-evaluate-correct-evaluate.
physical modeling Modeling technique in which you use the laws of physics to define a system
model.
R
RCP Rapid control prototype. A simulation configuration in which you test plant
hardware with a software model of the controller.
S
simulation diagram LabVIEW diagram that allows you to use Simulation functions within a
Simulation Loop or simulation subsystem. A simulation diagram, like other
LabVIEW diagrams, has the following semantic properties:
• The order of operations is not completely specified by the user.
• The order of operations is implied by data interdependencies.
• A function may only execute after all necessary inputs have become
available.
• Outputs are generated after a function completes execution.
Simulation Loop Loop that executes the simulation diagram over multiple time steps.
single-step ODE ODE solver that approximates the behavior of a model at time t + dt by
solver taking into account only the behavior of the model at time t.
stiff system System whose dynamics are described by widely varying time constants.
T
time step Interval from t to t + dt.
V
variable step-size ODE solver that adjusts the step size throughout the simulation to ensure
ODE solver that the per-step error remains at a given relative and absolute tolerance.