Dynamic system simulation

This is the final article of a five-part series reviewing various programming approaches to complex systems. Previous articles have focused on ladder diagrams, function block diagrams, textual programming, and statecharts. This article explores a programming model for describing and simulating the behavior of dynamic systems as they change over time—an often essential step in the design o...


This is the final article of a five-part series reviewing various programming approaches to complex systems. Previous articles have focused on ladder diagrams, function block diagrams, textual programming, and statecharts. This article explores a programming model for describing and simulating the behavior of dynamic systems as they change over time—an often essential step in the design of a controller system.

Many control engineers prefer to visualize their systems in a control block diagram rather than as a set of differential equations.

The term “dynamic system” usually refers to a system whose state variables change in time. In a mechanical system, these variables might be the positions, velocities, and accelerations. In electrical systems, currents and capacitor charges usually provide state variables. In a chemical system, the variables might be concentrations of various reactants.

You may often want to control dynamic systems, and the control algorithm itself is a dynamic system (controller) with internal state variables. To help design a complicated control algorithm, you can simulate the interaction of the controller and the plant offline.

Simulation of a dynamic system

To compute the state of a dynamic system at any given time, it suffices to specify the initial values of the system’s state variables as well as a function that determines how quickly the variables should be changing at any time:

You can approximate time evolution of the system as a series of states that it reaches in “time steps.” Simplest, although usually least accurate, is the Euler method, which computes the state at the next time step by the Euler formula:

There are other more accurate but more complicated methods for approximating the system’s state, but they all work similarly to the Euler equation, and all compute approximate states of the system at a series of time steps.

Control block diagrams

Control engineers rarely think of their systems in terms of the differential equations. Rather, they prefer to think in terms of separate, interacting components connected together as part of a “control block diagram.” In a control block diagram, the output of a component block may depend on the physical state of the component block and/or its inputs. In addition, it is often necessary to have output signals from the plant that feed back to the controller input.

Although they appear different, control block diagrams are equivalent to the differential equation representation. In general, a dynamic system block in the control block diagram is represented by a single box with internal state variables and time-varying input and output variables.

The input and output variables are signals injected into and extracted from the dynamic system to account for interaction among the different components in the block diagram. The state variables define the dynamic characteristics of the system, which are driven not only by their initial conditions but also by the input variables.

Note that the outputs are described as a function of the state variables and input variables, with no dynamics added but the ones provided by the states.

You can place system blocks in a series, which indicates that for consecutive blocks, the outputs of a former block become the inputs of the later one. For example, consider the case of a torsional pendulum. The actuator is an electric motor that provides torque based on the electric current supplied to the motor. The electric current is determined by drive electronics that communicate to the PID controller. The PID controller input is the difference between the reference (instantaneous value of the set point as it moves on its trajectory) and the plant-block output measured by a camera that determines the position of the top disc.

A typical control loop feature is feedback interaction, which is the connection of outputs from later system blocks to the inputs of former system blocks. In our example, the plant-block output is an input for the PID controller. The computed simulation model accounts for feedback connections in a natural fashion.


Each system block has inputs and outputs, as well as internal state variables.

Simulation of a control block diagram system

Several software tools—including NI MATRIXx suite, MathWorks’ Simulink environment, and NI LabVIEW Control Design and Simulation Module—are available to describe a system using control block diagrams and simulate the system’s behavior.

Software that simulates a control block diagram generally runs the system as part of a large loop, with iterations of the loop representing one time step of the system. In addition, such software provides several methods for solving the system described by the diagram—including highly accurate variable-step-size solvers suitable for quick offline simulation, as well as fixed-step-size and discrete solvers suitable for deployment to a real-time target.

Some dynamic system simulation products also make it easy to interact directly with hardware in the diagram. For example, the LabVIEW Control Design and Simulation Module includes functions for interfacing with data acquisition devices.

In addition, many products provide functions for porting a simulation to a real-time implementation. For example, you can use the NI LabVIEW Control Design and Simulation Module to port your simulation solution to real-time targets such as NI CompactRIO and PXI hardware.

In a control block diagram, all blocks placed inside the simulation framework execute according to the integration solver defined for the simulation loop. The blocks represent control blocks that could execute at different sample rates. This multirate execution is essential to determine the interaction of the different mechanical-electrical devices because devices placed inside a control loop rarely all execute at the same sampling rate.

Another benefit to using the simulation model is that you can adjust parameters on the fly as the simulation progresses in time. You can modify the PID controller gains and motor configuration parameters to determine optimal parameters for the closed-loop response. Note also the feedback interconnection, in which the pendulum position connects to the controller input, is naturally implemented inside the simulation loop.

Finally, the implementation of a simulation in a software package can also make it easy to create complex user interfaces.

Strengths and weaknesses

As with all computation models, dynamic system simulation is more appropriate in some programming situations and less in others. It is important to understand and incorporate the strengths and weaknesses of the computational model into your software design decisions.


  • Intuitive, self-documenting representations of dynamic systems. Create descriptions of complex systems that are easily read and understood by other engineers.

  • Multiple options for advanced simulation solver methods. Take advantage of ready-made and tested implementations of complex solver methods such as Runge-Kutta, Adams, and BDF solvers.

  • Multirate execution capability. Easily and intuitively schedule control blocks running at different rates.

  • Dynamic adjustment of parameters. Easily vary the parameters of the control blocks during the course of the simulation.


  • Incomplete programming system. To represent functions that are not provided directly with the simulation suite, you must combine the simulation system with a general-purpose programming language such as C or LabVIEW.

  • More time spent on analysis. To break a system down into component dynamic systems, you must conduct some analysis.

With the simulation model of computation, controls experts can develop complicated control algorithms quickly to test their interactions with simulated plants and to deploy their control algorithms to a variety of targets.

Author Information

Kevin Hogan is a senior engineer for the LabVIEW Control Design and Simulation Module in LabVIEW R&D at National Instruments in Austin, Texas. Hogan joined NI in August 1999 and holds a master’s in computational applied mathematics from The University of Texas at Austin.

Ricardo Dunia is a senior engineer for the LabVIEW Control Design and Simulation Module in LabVIEW R&D at National Instruments in Austin, Texas. He is also a lecturer for the Process Control senior class in the Cockrell School of Engineering at The University of Texas at Austin. Dunia joined NI in March 2003 and holds a doctorate in chemical engineering from the UT-Austin.

No comments
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Controller programming; Safety networks; Enclosure design; Power quality; Safety integrity levels; Increasing process efficiency
Additive manufacturing benefits; HMI and sensor tips; System integrator advice; Innovations from the industry
Robotic safety, collaboration, standards; DCS migration tips; IT/OT convergence; 2017 Control Engineering Salary and Career Survey
Featured articles highlight technologies that enable the Industrial Internet of Things, IIoT-related products and strategies to get data more easily to the user.
This article collection contains several articles on how automation and controls are helping human-machine interface (HMI) hardware and software advance.
This digital report will explore several aspects of how IIoT will transform manufacturing in the coming years.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Mobility as the means to offshore innovation; Preventing another Deepwater Horizon; ROVs as subsea robots; SCADA and the radio spectrum
Future of oil and gas projects; Reservoir models; The importance of SCADA to oil and gas
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me