Presentation by MSc Finn Haugen at NI Days 2004 in Drammen, Norway, April 27 2004:

Functions for Control, System Identification and Simulation in LabVIEW

Introduction

LabVIEW has toolkits with powerful functions for control design, system identification and simulation. This presentation will demonstrate how to use these toolkits in a practical application.

A few words about my background (http://techteach.no):

  • Teaching and writing and consulting in control engineering since about 1990
  • Developing KYBSIM (http://techteach.no/kybsim) - a library of freely available simulators developed in LabVIEW for dynamic systems, control and signal processing

PID Control Toolkit

Functions Palette

and

and

In addition there are many powerful functions in the Signal Processing Toolkit.

Example: Simulation of an Undamped Second Order System

There are many useful functions here in the Control Toolkit. But there may be a need for more accurate solutions in special situations.... One example is simulation of a second order system with zero damping. The step response of this system should be sustained oscillations. Below is a snapshot of the front panel of a simulator implemented by using the basic Integrator-block in Control Toolkit. The time-step is h=0.1 sec.

The block diagram is shown below.

As seen from the front panel (above), the simulation produces an unstable response, which is due to a numerical inaccuracy in implementing the simulator. This inaccuracy is because the Euler Forward method is used to realize the integrators numerically (can be seen by opening the Integrator.vi).

Although the Euler Forward method gives acceptable numerical results in most cases, there is a need for a more accurate simulation tool, as described below.

Toolkit for Simulation

Functions palette

Example: Simulation of an Undamped Second Order System (continued)

Below is shown the front panel and the block diagram of a simulator for the same second order system simulated in the example above. The block diagram contains a Simulation Loop, which can be configured by right-clicking on its border. In this example, the Runge-Kutta method is used with a step of 0.1 sec (same time-step as above). (The configuration will be demonstrated in the presentation.) The simulation now produces the correct response - sustained oscillations. With the Simulation Loop the whole model defined within the loop is treated as one comprehensive model, being solved using a user-defined numerical solver, e.g. a Runge-Kutta method.

Block diagram (note the special Simulation Loop):

Toolkit for System Identification

Functions palette

Example: Modeling and Control of a DC-motor

An application follows soon (see below).

Toolkit for Control Design Toolkit

Functions palette

Example: Modeling and Control of a DC-motor

See the application below.

An application: Modeling and Control of a DC-motor

Equipment

System:

  • DC motor (voltage input and tachometer voltage output):

     

  • FieldPoint I/O (for analog voltage I/O):

     

  • PC with LabVIEW and FieldPoint Explorer 3.02

About the Application

  • Excite process and store u and y in arrays
  • Estimate model from arrays of u and y. Analyse estimated model.
  • Verify Model: Simulate estimated model's y, compare with real (measured) y
  • Controller design using estimated model: Tune PID. Simulate. Draw Bode plot.

These items are addressed below.

The figure below shows a part of the VI front panel.

The comprehensive) block diagram is not shown here in this document, but the various tasks are implemented in separate while-loops, exchanging data using local variables.

Excite process and store u and y in arrays

The process is excited manually by adjusting the control signal with the PID-controller set in manual mode.

Estimate model from arrays of u and y. Analyse estimated model

A mathematical model of the motor is estimated using the SI Estimate State Space Model.vi (which implements a Subspace-method). Then the model is analysed in various ways using functions in the Control Design Toolkit.. See the front panel and the block diagram portions below.

Estimated discrete-time model, H_est(z):

Estimated H_est(z) transformed to continuous-time H_est(s) to better see the dynamic properties of the estimated model:

Block diagram portion:

Verify Model: Simulate estimated model's y, compare with real (measured) y

The model is verified by simulating with the estimated model and comparing the simulated speed signal with the measured speed (the model and the motor are excited by the same input signal). See the figure below (showing results from a simulated experiment).

Controller design/analysis using estimated model: Tuning PID. Simulation. Frequency response (Bode plot)

The PID controller is designed using a model, and the control system is analysed, using the model and functions in the Control Design Toolkit. The control system is simulated, and the stability margins are calculated. See front panel portions below.

Block diagram portion:


April 25 2004. By Finn Haugen (MSc), Telemark University College and TechTeach. E-mail: finn@techteach.no.