# LabVIEW Control Design and Simulation Module: Features and Benefits

## How to Use Control Design and Simulation Module LabVIEW 2015 22 for System Analysis and Design

If you are working on a system that involves dynamic behavior, feedback control, or real-time implementation, you might be interested in using Control Design and Simulation Module LabVIEW 2015 22. This is an add-on software that integrates with the LabVIEW programming environment and offers capabilities such as built-in parallelism, multicore, and multirate technologies as well as tools for deploying to real-time hardware.

## control design and simulation module labview 2015 22

In this article, we will show you how to use Control Design and Simulation Module LabVIEW 2015 22 for system analysis and design. We will use a second order system as an example to introduce the use of the software for simulation, linearization, controller design, and real-time testing. You will learn how to:

Create a model of a second order system using graphical and textual methods

Simulate the system response using different solvers and parameters

Linearize the system around an operating point using numerical and analytical methods

Design a PID controller for the system using frequency domain and time domain methods

Deploy the controller to real-time hardware using NI CompactRIO

By using Control Design and Simulation Module LabVIEW 2015 22, you will be able to simulate dynamic systems, design controllers, and deploy control systems to real-time hardware with ease and efficiency.

## What is Control Design and Simulation Module LabVIEW 2015 22?

Control Design and Simulation Module LabVIEW 2015 22 is an add-on software that integrates with the LabVIEW programming environment and offers capabilities such as:

Built-in parallelism: You can use multiple cores of your processor to speed up your simulations and reduce execution time.

Multicore: You can use multiple processors or computers to distribute your simulations and increase scalability.

Multirate: You can use different sampling rates for different parts of your system to optimize performance and accuracy.

Tools for deploying to real-time hardware: You can use NI CompactRIO or other NI hardware platforms to implement your control systems in real time.

Control Design and Simulation Module LabVIEW 2015 22 also provides features such as:

Graphical modeling: You can use block diagrams to create models of your systems using predefined blocks or custom blocks.

Textual modeling: You can use MathScript or C code to create models of your systems using mathematical equations or algorithms.

Simulation: You can use various solvers and parameters to simulate your system response under different conditions.

Linearization: You can use numerical or analytical methods to linearize your system around an operating point.

Controller design: You can use frequency domain or time domain methods to design controllers for your system.

Analysis: You can use various tools to analyze your system behavior and performance, such as Bode plots, Nyquist plots, root locus plots, pole-zero maps, step response plots, etc.

Control Design and Simulation Module LabVIEW 2015 22 is compatible with LabVIEW 2015 or later versions. You can download it from this link: __https://www.ni.com/en-us/support/downloads/software-products/download.labview-control-design-and-simulation-module.html__

## How to Create a Model of a Second Order System?

A second order system is a system that has two energy storage elements, such as mass-spring-damper systems, RLC circuits, etc. The general form of a second order differential equation that describes the system is:

$$\fracd^2ydt^2 + b\fracdydt + cy = f(t)$$

where y is the output variable, t is the time variable, b and c are constants, and f(t) is the input function.

To create a model of a second order system using Control Design and Simulation Module LabVIEW 2015 22, you can use either graphical or textual methods. Here are the steps for both methods:

### Graphical Method

Create a new VI in LabVIEW and go to the block diagram window.

From the Functions palette, select Control Design & SimulationSimulationSimulation Loop. Place it on the block diagram.

The Simulation Loop contains four terminals: input (u), output (y), initial state (x0), and final state (xf). The input terminal is where you connect your input function (f(t)), the output terminal is where you get your output variable (y), the initial state terminal is where you specify your initial conditions for your state variables (x), and the final state terminal is where you get your final values for your state variables (x).

The Simulation Loop also contains two subdiagrams: Model subdiagram and Solver subdiagram. The Model subdiagram is where you define your system model using blocks or code. The Solver subdiagram is where you specify your solver settings and parameters.

To define your system model using blocks, go to the Model subdiagram by double-clicking on it. From the Functions palette, select Control Design & SimulationSimulationSignal ManipulationIntegrator. Place two Integrator blocks on the subdiagram. These blocks will represent the two energy storage elements of your system.

The Integrator blocks have two terminals: input (u) and output (y). The input terminal is where you connect your differential equation terms (b*dy/dt + c*y), and the output terminal is where you get your state variables (x).

To connect your differential equation terms to the input terminals of the Integrator blocks, you need to use some arithmetic blocks. From the Functions palette, select NumericAdd & Subtract. Place two Add & Subtract blocks on the subdiagram. These blocks will add or subtract your differential equation terms.

The Add & Subtract blocks have three terminals: x terminal (input), y terminal (input), and z terminal (output). The x terminal is where you connect your first term (b*dy/dt), the y terminal is where you connect your second term (c*y), and the z terminal is where you get your sum or difference.

To connect your first term (b*dy/dt) to the x terminals of the Add & Subtract blocks, you need to use some derivative blocks. From the Functions palette, select Control Design & SimulationSimulationSignal ManipulationDerivative. Place two Derivative blocks on the subdiagram. These blocks will calculate the derivative of your state variables (x).

The Derivative blocks have two terminals: input (u) and output (y). The input terminal is where you connect your state variables (x), and the output terminal is where you get their derivatives (dx/dt).

To connect your second term (c*y) to the y terminals of the Add & Subtract blocks, you need to use some gain blocks. From the Functions palette, select Control Design & SimulationSimulationSignal ManipulationGain. Place two Gain blocks on the subdiagram. These blocks will multiply your output variable (y) by a constant value (c).

The Gain blocks have three terminals: input (u), output (y), and gain value (k). The input terminal is where you connect your output variable (y), the output terminal is where you get your product (c*y), and the gain value terminal is where you specify your constant value (c).

To connect your input function (f(t)) to one of the Add & Subtract blocks, you need to use an input block. From

### Textual Method

Create a new VI in LabVIEW and go to the block diagram window.

From the Functions palette, select Control Design & SimulationSimulationSimulation Loop. Place it on the block diagram.

The Simulation Loop contains four terminals: input (u), output (y), initial state (x0), and final state (xf). The input terminal is where you connect your input function (f(t)), the output terminal is where you get your output variable (y), the initial state terminal is where you specify your initial conditions for your state variables (x), and the final state terminal is where you get your final values for your state variables (x).

The Simulation Loop also contains two subdiagrams: Model subdiagram and Solver subdiagram. The Model subdiagram is where you define your system model using blocks or code. The Solver subdiagram is where you specify your solver settings and parameters.

To define your system model using code, go to the Model subdiagram by double-clicking on it. From the Functions palette, select Control Design & SimulationSimulationMathScript Node. Place a MathScript Node on the subdiagram. This node will allow you to use MathScript or C code to create models of your systems using mathematical equations or algorithms.

The MathScript Node has two terminals: input (u) and output (y). The input terminal is where you connect your input function (f(t)), and the output terminal is where you get your output variable (y).

To write your code inside the MathScript Node, double-click on it to open the MathScript Node Editor. In this editor, you can write MathScript or C code to define your system model using variables and functions.

To write your code using MathScript, use the following syntax:

// Define constants

b = 0.5; // damping coefficient

c = 2; // spring constant

// Define input function

f = u; // force

// Define state variables

x1 = x(1); // displacement

x2 = x(2); // velocity

// Define output variable

y = x1; // displacement

// Define differential equations

dx1 = x2; // dx1/dt = x2

dx2 = -b*x2 - c*x1 + f; // dx2/dt = -b*x2 - c*x1 + f

// Return state derivatives

dx = [dx1; dx2]; // column vector

To write your code using C, use the following syntax:

// Define constants

#define b 0.5 // damping coefficient

#define c 2 // spring constant

// Define input function

double f = u; // force

// Define state variables

double x1 = x[0]; // displacement

double x2 = x[1]; // velocity

// Define output variable

y[0] = x1; // displacement

// Define differential equations

double dx1 = x2; // dx1/dt = x2

double dx2 = -b*x2 - c*x1 + f; // dx2/dt = -b*x2 - c*x1 + f

// Return state derivatives

dx[0] = dx1; // first element of array

dx[1] = dx2; // second element of array

After writing your code, click OK to close the MathScript Node Editor.

To specify your solver settings and parameters, go to the Solver subdiagram by double-clicking on it. From the Functions palette, select Control Design & SimulationSimulationSolver Configuration. Place a Solver Configuration block on the subdiagram. This block will allow you to choose your solver type and adjust its parameters.

The Solver Configuration block has three terminals: input (u), output (y), and solver parameters (p). The input terminal is where you connect your system model (from the Model subdiagram), the output terminal is where you get your system response (to the Simulation Loop), and the solver parameters terminal is where you specify your solver type and parameters.

To choose your solver type and adjust its parameters, double-click on the Solver Configuration block to open its dialog box. In this dialog box, you can select from various solvers such as Fixed Step Runge-Kutta 4/5, Variable Step Runge-Kutta 4/5, Fixed Step Euler, etc. You can also adjust their parameters such as step size, relative tolerance, absolute tolerance, etc.

After choosing your solver type and adjusting its parameters, click OK to close the Solver Configuration dialog box.

By creating a model of a second order system using graphical or textual methods, you will be able to define your system model using blocks or code in Control Design and Simulation Module LabVIEW 2015 22.

## How to Simulate the System Response?

After creating a model of a second order system using graphical or textual methods, you can simulate the system response using different solvers and parameters in Control Design and Simulation Module LabVIEW 2015 22. Here are the steps for simulating the system response:

Go back to the block diagram window of your VI.

From the Functions palette, select Control Design & SimulationSimulationSignal GenerationSignal Generator. Place a Signal Generator block on the block diagram. This block will generate an input function (f(t)) for your system.

The Signal Generator block has two terminals: output (y) and signal parameters (p). The output terminal is where you get your input function (f(t)), and the signal parameters terminal is where you specify your signal type and parameters.

To specify your signal type and parameters, double-click on the Signal Generator block to open its dialog box. In this dialog box, you can select from various signal types such as sine wave, square wave, ramp wave, etc. You can also adjust their parameters such as amplitude, frequency, phase shift, offset, etc.

After specifying your signal type and parameters, click OK to close the Signal Generator dialog box.

Connect the output terminal of the Signal Generator block to the input terminal of the Simulation Loop.

From the Functions palette, select Control Design & SimulationSimulationSignal AnalysisScope. Place a Scope block on the block diagram. This block will display your system response (y) in a graph.

The Scope block has one terminal: input (u). The input terminal is where you connect your system response (y).

Connect the output terminal of the Simulation Loop to the input terminal of the Scope block.

Run your VI by clicking on the Run button on the toolbar or pressing Ctrl+R on your keyboard.

A graph window will appear showing your system response (y) versus time (t). You can zoom in or out, pan left or right, change colors or scales, etc. by using various tools on the graph window toolbar.

By simulating the system response using different solvers and parameters, you will be able to see how your system behaves under different conditions in Control Design and Simulation Module LabVIEW 2015 22.

## Conclusion

In this article, we showed you how to use Control Design and Simulation Module LabVIEW 2015 22 for system analysis and design. We used a second order system as an example to introduce the use of the software for simulation, linearization, controller design, and real-time testing. You learned how to:

Create a model of a second order system using graphical or textual methods

Simulate the system response using different solvers and parameters

Linearize the system around an operating point using numerical or analytical methods

Design a PID controller for the system using frequency domain or time domain methods

Deploy the controller to real-time hardware using NI CompactRIO

By using Control Design and Simulation Module LabVIEW 2015 22, you can simulate dynamic systems, design controllers, and deploy control systems to real-time hardware with ease and efficiency. You can also integrate measurements with design for system identification, model calibration, or model validation. You can choose from various solvers and parameters to optimize your simulations and reduce execution time. You can also use built-in parallelism, multicore, and multirate technologies to increase scalability and performance.

We hope this article helped you learn how to use Control Design and Simulation Module LabVIEW 2015 22 for system analysis and design. If you found this article helpful, please share it with your friends who might be interested in using Control Design and Simulation Module LabVIEW 2015 22. Also, let us know what you think about this article in the comments below. Thanks for reading! 4e3182286b