Department of Electrical and Computer Engineering

ECE411S – Real-time Computer Control

LAB 3

IMPLEMENTATION ISSUES IN DIGITAL CONTROL

1 Purpose

The purpose of this experiment is to investigate issues that arise in the implementation of

digital controllers. The effects of quantization and finite word-length on signal representation as

well as system parameters are studied. Different forms for the realization of digital controllers and

their numerical accuracy are investigated. The possibility of quantization-induced limit cycles is

demonstrated. Finally, a sampled-data control system is implemented with 16-bit accuracy and

its performance evaluated.

2 Introduction

In our study of digital control design, we have implicitly assumed that computations can

be done with infinite precision. In an actual implementation, the digital control law is realized

through a microcontroller or a digital signal processing chip. These would have finite precision,

usually 8-bit or 16-bit. The analog-to-digital converter (ADC) as well as the digital-to-analog

converter (DAC) also have finite precision, usually 8-bit, 10-bit, or 12-bit. The digital control

law calculation is often done in fixed-point arithmetic, although we do not go into the details of

the implementation.

The finite word-length issue has a significant impact on how to implement a digital controller.

To evaluate the performance of a sampled-data control system, we need to quantize all controller

coefficients as well as signals coming out from the ADC and DAC. In this experiment, we examine

typical situations to illustrate the finite word-length effects. You will also implement the sampleddata control system described in Section 4.6 of the course notes.

3 Preparation

Familiaze yourself with the operation of the quantizer in simulink, which can be found in the

Discontinuities library. In a directory which is in the path for Matlab, add the m-file quant.m,

consisting of the lines:

function [xq]=quant(x,q)

xq=q*round(x/q);

Here q is the quantization value. You will use quant.m to quantize the coefficients of the

control law. Next, complete the following preparation exercises and hand in your answers, on

1

a separate sheet, to your T.A. at the beginning of the lab. Every student must hand in

his/her own work. There is space provided below to record your preparation work for the

experiment.

3.1 Control Design Calculations

1. In preparation for the design calculations for the sampled-data control problem described

in Section 4.6, enter the A, B, and D matrices as described on p.123 into Matlab. Take the

sampling interval T = 0.1 sec. Compute [Ad, Bd] = c2d(A, B, T) and partition the matrices

of the resulting discrete time system into the form

x

′ = Adx + Bdu e = Dx

with

x =

x1

x2

, Ad =

A1 A3

0 A2

, Bd =

B1

0

, D =

D1 D2

2. Choose F1 to place the poles of A1 +B1F1 at 0, 0. Repeat the calculation to place the poles

of A1 + B1F1 at 0.8 ± j0.2.

3. Determine the matrices needed to solve the linear algebraic equation (4.8) in the course

notes for the 2 choices of F1. Determine the corresponding solutions for X and F2. Note

that the command to vectorize a matrix A in Matlab is A(:), and the Kronecker product

of A and B is kron(A, B).

4. Determine the gain for the full order observer to place the poles at A + LD at 0, 0, 0, 0, 0.

Repeat to place the poles at 0.1, 0.1 ± j0.3, 0.2 ± j0.2. For future reference, call the output

feedback controller with all poles placed at 0, Controller 1. The second one is Controller

2. Determine their respective transfer functions. Save your data also to a usb stick for use

in the lab.

5. Sketch the simulink diagram that you would use to simulate the sampled-data control

system, incorporating explicitly the quantizer after the zero-order holds. Put also the

sketch in the box below for reference during the experiment.

2