49
Paper ID #16436 Visual and Intuitive Approach to Explaining Digitized Controllers Dr. Daniel Raviv, Florida Atlantic University Dr. Raviv is a Professor of Computer & Electrical Engineering and Computer Science at Florida Atlantic University. In December 2009 he was named Assistant Provost for Innovation and Entrepreneurship. With more than 25 years of combined experience in the high-tech industry, government and academia Dr. Raviv developed fundamentally different approaches to ”out-of-the-box” thinking and a breakthrough methodology known as ”Eight Keys to Innovation.” He has been sharing his contributions with profession- als in businesses, academia and institutes nationally and internationally. Most recently he was a visiting professor at the University of Maryland (at Mtech, Maryland Technology Enterprise Institute) and at Johns Hopkins University (at the Center for Leadership Education) where he researched and delivered processes for creative & innovative problem solving. For his unique contributions he received the prestigious Distinguished Teacher of the Year Award, the Faculty Talon Award, the University Researcher of the Year AEA Abacus Award, and the President’s Leadership Award. Dr. Raviv has published in the areas of vision-based driverless cars, green innovation, and innovative thinking. He is a co-holder of a Guinness World Record. His new book is titled: ”Everyone Loves Speed Bumps, Don’t You? A Guide to Innovative Thinking.” Dr. Daniel Raviv received his Ph.D. degree from Case Western Reserve University in 1987 and M.Sc. and B.Sc. degrees from the Technion, Israel Institute of Technology in 1982 and 1980, respectively. Paul Benedict Caballo Reyes, Florida Atlantic University Paul Benedict Reyes is an Electrical Engineering major in Florida Atlantic University who expects to graduate Spring 2016. His current interests are in wireless communications, power systems, and electrical machines. He holds leadership positions in organizations such as Tau Beta Pi and Asian Student Union. Mr. George Roskovich, Florida Atlantic University c American Society for Engineering Education, 2016

Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Embed Size (px)

Citation preview

Page 1: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Paper ID #16436

Visual and Intuitive Approach to Explaining Digitized Controllers

Dr. Daniel Raviv, Florida Atlantic University

Dr. Raviv is a Professor of Computer & Electrical Engineering and Computer Science at Florida AtlanticUniversity. In December 2009 he was named Assistant Provost for Innovation and Entrepreneurship.

With more than 25 years of combined experience in the high-tech industry, government and academiaDr. Raviv developed fundamentally different approaches to ”out-of-the-box” thinking and a breakthroughmethodology known as ”Eight Keys to Innovation.” He has been sharing his contributions with profession-als in businesses, academia and institutes nationally and internationally. Most recently he was a visitingprofessor at the University of Maryland (at Mtech, Maryland Technology Enterprise Institute) and at JohnsHopkins University (at the Center for Leadership Education) where he researched and delivered processesfor creative & innovative problem solving.

For his unique contributions he received the prestigious Distinguished Teacher of the Year Award, theFaculty Talon Award, the University Researcher of the Year AEA Abacus Award, and the President’sLeadership Award. Dr. Raviv has published in the areas of vision-based driverless cars, green innovation,and innovative thinking. He is a co-holder of a Guinness World Record. His new book is titled: ”EveryoneLoves Speed Bumps, Don’t You? A Guide to Innovative Thinking.”

Dr. Daniel Raviv received his Ph.D. degree from Case Western Reserve University in 1987 and M.Sc. andB.Sc. degrees from the Technion, Israel Institute of Technology in 1982 and 1980, respectively.

Paul Benedict Caballo Reyes, Florida Atlantic University

Paul Benedict Reyes is an Electrical Engineering major in Florida Atlantic University who expects tograduate Spring 2016. His current interests are in wireless communications, power systems, and electricalmachines. He holds leadership positions in organizations such as Tau Beta Pi and Asian Student Union.

Mr. George Roskovich, Florida Atlantic University

c©American Society for Engineering Education, 2016

Page 2: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

A Visual and Intuitive Approach to

Explaining Digitized Controllers

Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Department of Computer & Electrical Engineering and Computer Science

Florida Atlantic University

Emails: [email protected], [email protected], [email protected]

Abstract

In recent years, while teaching Control Systems and Digital Control Systems courses, we have

noticed that some students do not fully understand the meaning of a “controller.” This may sound

strange, especially when such students can solve problems, design controllers, and successfully

pass the class. The observations made on this paper are based on our multiple years of

experience in teaching the topics as well as several informal discussions with professors in other

universities. It appears that some students miss the basic understanding that a controller (whether

analog or digital) represents a transfer function (in the S-Domain or the Z-Domain) or a

differential/difference equation so that, together with the dynamics of the plant and the rest of the

system, it allows for desired closed loop behavior.

This problem can be partially alleviated during laboratory experiments when students notice that

a controller’s transfer function in the S-Domain can be practically implemented using hardware,

which includes op-amps, capacitors, and resistors, and that this implementation is not unique.

They can also witness the effect of changing the controller’s parameters on closed loop

performance. The confusing issue for some is this: How can “software” (i.e., using difference

equations, which are implemented using a micro-controller, including A/D and D/A converters)

replace “hardware”? In other words, how can some lines of code yield similar input/output

relationships obtained from an analog controller?

This gap in understanding the similar time-response behavior of hardware and software

implementations is what this paper tries to bridge. It is done in a visual, intuitive, step-by-step

manner, elaborating on the pros and cons of transforming from the S-Domain to the Z-Domain,

from Z-Domain to difference equations, and finally, from difference equations to implementable

code. The paper uses examples of controllers and their possible representations, while clarifying

and expanding on hardware implementations and their “semi-equivalent” software codes. This

Page 3: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

includes the use of the exact S to Z transformation (relevant only at sampling instants) and

multiple S to Z approximations with appropriate justifications.

The paper is an extension of on-going research that explains the meaning of sampling, digital

computation, and reconstruction in digital control systems. It should be emphasized that the

approach presented here does not attempt to replace material in existing textbooks. It simply

presents supplementary visual and intuitive explanations that can help instructors and students to

better understand topics in digital control systems. For clarification purposes, some explanations

refer to existing textbook material.

In order to explore the validity and usefulness of the new approach, a 40-minute presentation

using visualization techniques was given to a Control Systems class followed by a questionnaire.

Answers are based on a scale of “1” to “5,” “5” being strongly agree, “3” neutral, and “1”

strongly disagree. The following is a brief summary of the results based on 20 responses: 50% of

the students agreed and 30% strongly agreed that they better understand how a controller in

hardware translates to software code. 55% strongly agree and 40% agree that visualization

helped them understand the implementation of digital controllers. We are currently working on a

more rigorous assessment to evaluate that students’ learning.

1. Introduction

With the advent of the internet and growing accessibility through mobile devices, a

tremendous amount of information is readily available to the new generation. “Rapid advances in

information technology are reshaping the learning styles of many students.”1 The new

generation’s perception of information is changing with this advancement in technology.6

Due to the increase in preference for visual media, instructors may notice it is harder for

students to understand difficult concepts. Such a case is noted by Tyler DeWitt, a chemistry high

school teacher and Ph.D. student at MIT.3Mr. DeWitt requests more effort should be made

teaching concepts to young students. Mr. DeWitt’s realization came when he noticed his students

missed key concepts although they were attending well planned lectures and completing assigned

book reading. To remedy this, he engaged students with a different style of teaching that made

the subject less intimidating and more fun.

American astrophysicist Neil deGrasse Tyson mentions a similar problem during a speech

given to the American Association of Physics Teachers.4He also highlighted the significance of

educators relating to their students during lecture. For example, teachers can engage the students

by making references about pop culture and relating it to the lecture.

Much like what DeWitt and Tyson have noted, it has been observed at Florida Atlantic

University that there are students who have already taken the Control Systems 1 class but are still

Page 4: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

having trouble understanding key concepts. Specifically, issues in understanding concepts arise

when transitioning from analog controllers to digital controllers.

Among the issues observed:

1. Understanding the deep meaning of the role of a controller in closed loop.

2. Conceptual understanding of transitioning from analog to digital controllers. For

example, the idea that implemented code in a microprocessor (including of course signal

sampling and reconstruction) can result in performance that is similar to analog hardware.

3. Understanding the justification behind the different transformations from the S-Domain

to the Z-Domain.

4. Appreciating the fact that a digital controller can have different representations. For

example, a controller’s Transfer Function can be represented in multiple ways.

5. Becoming aware of factors to be taken into consideration when dealing with digital

controllers; the effect of sampling, approximations, computation delay, and

reconstruction.

This paper addresses these observations by offering a visual, intuitive, engaging, and less

intimidating approach to explaining key concepts to students, with a focus on observations 2 and

3 (above). It should be noted that this approach is not meant to compete with textbooks but rather

provide a supplement to help instructors introduce the material so that students can learn better

and stay interested.

2. Observation 1: Understanding the Deep Meaning of the Role of Controller in Closed

Loop

We observed that some students do not have a deep understanding of a controller. Rather

than shock the student with transfers functions and equations, analogy is employed to ease the

process.

Controller Design as an Art

Designing a controller can be perceived as an art. Picture an artist who wants to make the

color green. They have three primary colors: red, blue and yellow. On their palate, they start with

yellow.

Page 5: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 1 – An Artist’s Palate

As we know from elementary school, the artist needs to add blue to yellow to make green.

Figure 2 – Palate with More Colors

Designing controllers in Control Systems is similar to art. The controller’s “dynamics” are

variably mixed to obtain a desired behavior. Like design, varying levels of blue are added to

further tune the resulting shade until it is closest to the desired output.

Purpose of Design

As an artist must mix paint to achieve a desired color, an engineer must tune elements of a

controller to achieve a desired output. This is no more evident in the case of the PID controller.

Imagine two drivers trying to change from one highway lane to another. The first driver,

apparently very tired, may overshoot their mark by correcting the steering wheel more than once

until finally settling close to the desired lane (Figure 3).

Page 6: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 3 – Bad Driver Behavior

The second driver, apparently a better one, changes lanes without any overshoot (Figure 4).

They will shift concisely and efficiently into the next desired position.

Figure 4 – Good Driver Behavior

If an engineer were to design autonomous cars that make the same decisions as the two

drivers, controllers would need to be designed to control the various responses of the cars and

remove or minimize the error.

In the case of imitating the first driver steering into another lane, it looks like the system has

a poorly designed controller, with a series of overshoots and undershoots.

In the case of the second driver, it looks like the controller is a better one. The difference in

the performance of the two autonomous cars is that the controller of the first car is a simple P

(Proportional) controller, while the second one is a well-designed and tuned PID (Proportional

Integral Derivative) controller. Amazingly, two identical cars with two different controllers

behave in a completely different manner.

When designing a controller for a DC motor in a closed loop system, the same result may

occur.

Time

Position

Page 7: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 5 – DC Motor Behavior without Controller

2

In Figures 5 and 6, the orange arrow represents the angular position of the motor shaft and

the black arrow represents a reference angle. The desired position is 90 degrees. In the case of

Figure 5, a P controller is used. Similar to a damped pendulum, the motor continues overshooting

and undershooting until coming closer to the desired angle. In this scenario, this performance is

undesired.

A better design can lead to a response as in Figure 6 where a well-designed and tuned PID

controller is used. Such a controller does not only dampen a response but also quickly achieves

the final desired response.

Figure 6 – DC Motor Behavior with Controller

2

The PID is achieved using a controller that modifies the error signal, thereby affecting the

input to the DC motor. The block diagram for the new system will now look similar to Figure 7:

Page 8: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 7 – Block Diagram with Some Controller

We emphasize to students that a good design of a controller results in dynamic signal

modification so that the closed loop system behaves as desired.

In addition to having many different controller functionalities, each controller can have

multiple implementations as long as the input-output relationship is kept the same.

Transfer Function Implementation

We emphasize to students that different controllers have different responses. Thus, adding or

removing a controller can be used to modify the input-output relationship of a system. In this

section, we discuss some different implementations of the same transfer function, specifically for

the PID controller.

To further emphasize the point that a controller can be implemented in a variety of methods

as long as the input-output relationship of the system is maintained, let us look at different

implementations of a PID Controller, or Proportional Integral Derivative Controller, which is

modeled in Figure 8.

Page 9: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 8 – Transfer Function for a PID Controller

We now show that the PID controller can be implemented in more ways than just a pure

electric circuit. For example, a controller can be implemented hydraulically, pneumatically,

electrically, digitally, and so forth (Figure 9).

Figure 9 – Some Implementations of a PID Controller

Page 10: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Pneumatic Implementation

PID controllers were originally made using a pneumatic approach.11

They were used in naval

ships during the World War I era as a form of error control for the rudder angle position. Figure

10 shows a diagram of a pneumatic PID Controller.

Figure 10 – Pneumatic PID Controller

12

Pneumatic Controllers work on the principle of the flapper-nozzle amplifier. The lever, as

seen in the figure above, changes position as air is input. This causes the bellows to introduce or

remove pressure in the system as the lever moves to and from the nozzle.11

This implementation

has relatively simple and cheap components (tubes, springs, and valves). However, the response

is slow due to the movement of air and mechanical components. In addition, it requires more

maintenance with the inspection of leaks and moving parts in the system. Lastly, as all of the

components are integrated with each other, changing the system parameters may require

replacing the whole controller.

Electrical Implementation

Electrical engineering students may be more familiar with the electronic implementation of

controllers. This can be achieved using op-amps as can be seen in the following PID controller

example (Figure 11). Note that there are many different designs that can achieve the same input

output relationship.

Page 11: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 11 – PID Controller Schematic

Compared to the pneumatic implementation, the electronic implementation uses less

expensive and smaller components, such as resistors, capacitors, and integrated chips. This

implementation also provides a much faster response than that of the pneumatic implementation.

In addition, it is practically maintenance free, and circuit components can be easily replaced as

needed to change the system parameters. However, as more complex controllers are needed, it

can become harder to implement the hardware necessary. Thus, a digital approach may be used.

Digital Implementation

A digital implementation means using a computer program (code) implemented in a multi-

purpose hardware (such as a microcontroller). This implementation may be easier to maintain

than analog implementations as code can easily be changed and uploaded into a microcontroller.

Different languages can be used to implement a digital controller. For example, when using an

Arduino microcontroller, one can program in C++.When using a Raspberry Pi microcontroller,

one might use Python. Lastly, when using a Personal Computer, MatLab can be used. For the

case of MatLab, the PID Controller can be approximated by:

Page 12: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 12 –MatLab Code for PID Controller

Later we provide a step-by-step approach as to how to achieve the code shown in Figure 12.

Again, we emphasize to students that the language in which the code is written makes no real

functional difference. Programming languages include: C++, MatLab, or even Machine Code.

What really matters is that the input-output relationship of the Controller is the same or

practically the same as the other implementations.

Issues with the digital implementation can lie in sampling, computational delay, and delays

when converting from digital to analog. Using approximation techniques to compensate for

conversion and computation delays, a digital system can function very close to an analog system.

In Observation 5, we elaborate on these issues.

%The PID Controller: %Kp*p(k) Kpk = Kp*ek; %Kp*e[k]

%Ki*i(k) Kik = ones(1,length(ek)); for x = 1:length(ek) if x == 1 %Ki*i(k-1) = 0 Kik(x) = Ki*ek(x)*Ts; %i[k] = Ki*(0+e[k]*T) else Kik(x) = Ki*(Kik(x-1)+ek(x)*Ts); %i[k] = Ki*(i[k-1]+e[k]*T) end end

%Kd*d(k) Kdk = ones(1,length(ek)); for x = 1:length(ek) if x == 1 %e(k-1) = 0 Kdk(x) = Kd*ek(x)/Ts; %d[k] = Kd*({e[k]-0}/T) else Kdk(x) = Kd*(ek(x)-ek(x-1))/Ts; %d[k] = Kd*({e[k]-e[k-1]}/T) end end

%Combine to form PID wk = Kpk + Kik + Kdk;

Page 13: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

3. Observation 2: Conceptual Understanding of Transitioning from Analog to Digital

Controllers

The Big Question

How can digital implementations (“software”) “replace” analog implementations

(“hardware”)? Some students may find this counter intuitive. Hardware implementation is

tangible where each component can be held unlike software implementation. Let us take a look

at an analog controller block diagram in Figure 13.

Figure 13 – An Analog Controller Block Diagram

In the case of an analog controller, the input and output waveforms are continuous. However,

when using a digital controller, the signal is discretized through sampling. Then, algorithms

programmed into a micro controller process the signal to produce a new digital signal. To make

the output signal continuous, or analog, a digital to analog converter is used. This process is

outlined in the following Figure 14.

Page 14: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 14 – An Open Loop Digital Control System

In Figure 14, the input signal is first discretized using an Analog to Digital converter. The

Code block also is a microprocessor implementation of an algorithm (code) that represents �̂�(𝑧).

After the signal is modified, it is converted back to an analog signal using a Digital to Analog

converter. A more practical model can be seen in Figure 15.

Figure 15 – A More Practical Model

Analog to Digital converters (ADC in Figure 15) yields a discretized signal as a set of bits

that are determined by the voltage of the analog input signal. At a certain time instant, the input

voltage is mapped to a specific set of bits. For example, 0.2V is mapped to 00110001. This data

is then processed by the CPU along with previous data and stored parameters. The output set of

bits is then converted back to voltage using a Digital to Analog converter.

The question then becomes, how can an algorithm “replace” an analog controller? We

present this to the students with an example. We start from the S-Domain (analog transfer

function) and with implementable code (digital implementation). One process is as follows

(Figure 16):

Page 15: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 16 – From S-Domain to Code

Step-By-Step Approach to Converting from Analog to Digital Controllers

We remind the students that there are multiple ways to convert a transfer function of an

analog controller to an implementable code. This section focuses on a discrete time approach

using the method outlined in Figure 16. We explain to the students in a later section about the

different approximations from the S-Domain to the Z-Domain using multiple approximations

graphical approaches. Afterwards, we introduce the exact S to Z transformation. Finally, we

show another method of obtaining the same S to Z transform approximations using

approximations of the Taylor Series. This helps the students gain a different perspective on how

to convert an analog controller to a digital controller.

For a detailed example, refer to Appendix A: From S-Domain to Code. It shows the

process of “translating” a controller in the S-Domain to actual code in MatLab, with a focus on

the PID controller. It breaks down the process into 4 steps as outlined in Figure 16. It also shows

approximation techniques, which are graphically justified, used to obtain the difference equation.

After obtaining the difference equation, it is then compared to a section of MatLab code that

Page 16: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

functions as a PID Controller. Lastly, a mathematical approach to justify the approximation

techniques of translating from the S to Z-domain is shown to provide a different perspective.

This section focuses on the discrete-time domain but there are other ways to “translate” a

transfer function in the S-domain to code. The next section discusses the Z-domain which can be

used to obtain the difference equation of a transfer function. Before further exploring the

approximations used to translate the S-domain transfer function to the Z-domain, we first show

how the S-Domain and Z-Domain are related.

4. Observation 3: Justification of the Exact Transformation from the S-Domain to the Z-

Domain

Converting from G(s) to �̂�(𝒛)

Assuming the transfer function is band limited and sampled “fast enough,” a relationship

between the S-Domain and Z-Domain can be obtained as shown in Figure 17. The outlined

transformation gives the same impulse responses at the sampling instants (up to a scale factor

based on the sampling rate). It also gives the same frequency response for the appropriate

frequencies (for the frequency range from -/τ to +/τ).

Figure 17 – Exact S to Z Transformation

The transformation above can also be described by the following:

Page 17: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

�̂�(𝑧) = 𝑍 {[𝐿−1(𝐺(𝑠))]𝑡=𝑘𝜏

}

Figure 18 – Equation Model for Exact S to Z Transform13

This is a point we emphasize to students: to move from the S-Domain to the Z-Domain

exactly, the first step is to obtain the impulse response, g(t) of the analog Transfer Function.

Then, the impulse response must be sampled fast enough so that there are no errors due to

aliasing. Sampling leads to the discrete time function g(kτ). Lastly, we obtain the Transfer

Function in Z,�̂�(𝑧), by performing the Z-Transform on g(kτ). S to Z tables show exactly this

process. By following this process, the exact Z-Transform equivalent can be achieved. How can

they be the same? Take a look at the following Figure 19.

Figure 19 – Continuous and Sampled Impulse Responses

From Figure 19, we show students that at the sample points, the impulse response of G(s) is

equal to that of �̂�(𝑧). We can tell that if the inputs are impulses at the same sample times t = kτ,

then the outputs are the same at t = kτ. Using linearity, if we apply the same many impulses to

both systems, we get the same outputs at the sampling times. This occurs when the exact S-

Domain to Z-Domain transformation,�̂�(𝑧) = 𝑍 {[𝐿−1(𝐺(𝑠))]𝑡=𝑘𝜏

}, is used. We can see in Figure

20 more general case with multiple different impulses in the input.

Page 18: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 20 – Responses to Multiple Impulses

Step-By-Step Example

To show students how one would implement the exact transformation, we provide an

example that shows the process step by step. Given the following Transfer Function in the S-

Domain, we will obtain the Z-Domain equivalent:

𝐺(𝑠) =1

(𝑠 + 5)2

Let:

𝜏 = 0.1𝑠𝑒𝑐

Recall that:

�̂�(𝑧) = 𝑍 {[𝐿−1(𝐺(𝑠))]𝑡=𝑘𝜏

}

�̂�(𝑧) = 𝑍 {[𝐿−1 (1

(𝑠 + 5)2)]

𝑡=𝑘(0.1)

}

Using a Fourier Transform Pair Table8, we obtain:

𝑔(𝑡) = 𝐿−1 (1

(𝑠 + 5)2) = 𝑡𝑒−5𝑡

�̂�(𝑧) = 𝑍{[𝑡𝑒−5𝑡]𝑡=𝑘(0.1)}

To discretize the signal, we let:

𝑡 = 𝑘𝜏 = 0.1𝑘

ℎ(0.1𝑘) = 0.1𝑘𝑒−0.5𝑘

�̂�(𝑧) = 𝑍{0.1𝑘𝑒−0.5𝑘}

Using a Z-Transform Table8, we obtain:

�̂�(𝑧) = 𝑍{0.1𝑘𝑒−0.5𝑘}

Page 19: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

�̂�(𝑧) =0.1𝑒0.5𝑧

(𝑒0.5𝑧 − 1)2

We now have the Z-Domain “equivalent” of 𝐺(𝑠) =1

(𝑠+5)2. To further explore this, MatLab

is used to plot the impulse response for both 𝐺(𝑠) and �̂�(𝑧).

Figure 21 – Impulse Response of 𝑮(𝒔) and �̂�(𝒛)

As Figure 21 shows, the impulse response of 𝐺(𝑠) and �̂�(𝑧) are indeed equal at the sampling

instants.

Page 20: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

What does “Replacing” 𝑮(𝒔) Transfer Function with �̂�(𝒛) Transfer Function Really

Mean?

Exact 𝑮(𝒔) to �̂�(𝒛)Transformation

The exact 𝐺(𝑠) to �̂�(𝑧)transform is obtained with the equation shown in Figure 18, which is

repeated in Figure 22.

�̂�(𝑧) = 𝑍 {[𝐿−1(𝐺(𝑠))]𝑡=𝑘𝜏

}

Figure 22 – Equation Model for Exact S to Z Transform13

Unfortunately, in practice, this exact transformation can become complicated to obtain for

some transfer functions. Therefore, we use approximation techniques to convert from the S-

Domain to the Z-Domain.

Approximation Techniques

In order to combat the issue of dealing with “harder” Transfer Functions, several

approximations can be made to convert from the S-Domain directly to the Z-Domain. Some of

the well-known techniques are:

1. Forward Difference

Let: 𝑠 =𝑧−1

𝜏

2. Backward Difference

Let: 𝑠 =𝑧−1

𝜏𝑧

3. Bilinear Transformation

Let: 𝑠 =2

𝜏

𝑧−1

𝑧+1

An Alternative Justification for the Approximation Techniques

In a previous section, we have shown how the approximations are obtained using a graphical

approach. In this section, we show an alternative method of obtaining the common

approximations from the S-Domain to the Z-Domain. We show that all of the discussed

approximations from the S-Domain to the Z-Domain can simply be obtained from the Taylor

Series Expansion of ln(z). We show step-by-step justifications of the Forward Difference,

Backward Difference, and Bilinear Transform through the Taylor Series Expansion:

Forward Difference:

We remind students that:

𝑒𝑠𝜏 = 𝑧

Page 21: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

𝜏𝑠 = 𝑙𝑛(𝑧)

𝑠 =1

𝜏𝑙𝑛(𝑧)

where τ is the sampling interval.

Recall from Calculus that the Taylor Expansion of ln(x) is:

𝑙𝑛(𝑥) = ∑(−1)𝑛(𝑥 − 1)𝑛

𝑛

𝑛=1

Using the Taylor Expansion of ln(z) around 1:

𝑙𝑛(𝑧) = ∑(−1)𝑛(𝑧 − 1)𝑛

𝑛

𝑛=1

= (𝑧 − 1) −(𝑧 − 1)2

2+

(𝑧 − 1)3

3− ⋯

By taking just the first term of the expansion, we approximate:

𝑙𝑛(𝑧) ≅ (𝑧 − 1)

By substitution we find:

𝑠 =1

𝜏𝑙𝑛(𝑧) ≅

1

𝜏(𝑧 − 1)

𝑠 ≅(𝑧 − 1)

𝜏

This is the previously mentioned Forward Difference. Now let us look at the case of the

Backward Difference and how it can be derived using the Taylor Expansion.

Backward Difference

First, we rewrite ln(z):

−𝑙𝑛(𝑧) = 𝑙𝑛(𝑧−1)

−𝑙𝑛(𝑧) = 𝑙𝑛(1 + (𝑧−1 − 1))

Again, we recall from Calculus that the Taylor Expansion of ln(1+x) is:

𝑙𝑛(1 + 𝑥) = ∑(−1)𝑛−1𝑥𝑛

𝑛

𝑛=1

By using this, we obtain that –ln(z) is:

Page 22: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

−𝑙𝑛(𝑧) = 𝑙𝑛(1 + (𝑧−1 − 1)) = ∑(−1)𝑛−1(𝑧−1 − 1)𝑛

𝑛

𝑛=1

−𝑙𝑛(𝑧) = (𝑧−1 − 1) −(𝑧−1 − 1)2

2+

(𝑧−1 − 1)3

3− ⋯

We then approximate this expansion with just the first term:

−𝑙𝑛(𝑧) = (𝑧−1 − 1)

Through substitution:

𝑠 = −1

𝜏(−𝑙𝑛(𝑧)) ≅ −

(𝑧−1 − 1)

𝜏

𝑠 ≅1 − 𝑧−1

𝜏

𝑠 ≅𝑧 − 1

𝜏𝑧

Again, we are able to use the Taylor Expansion to find another approximation of the

transformation to the Z-Domain from the S-Domain. Finally, take a look at the case of the

Bilinear Transform.

Bilinear Transform

By using another Taylor Expansion of ln(z) we find that14

:

𝑙𝑛(𝑧) = 2 [(𝑧 − 1

𝑧 + 1) +

(𝑧 − 1)3

3(𝑧 + 1)+

(𝑧 − 1)5

5(𝑧 + 1)+ ⋯ ]

When only the first term is used:

𝑙𝑛(𝑧) ≅ 2 (𝑧 − 1

𝑧 + 1)

Then, again, by substitution:

𝑠 =1

𝜏𝑙𝑛(𝑧) ≅

2

𝜏(

𝑧 − 1

𝑧 + 1)

Using approximations of the Taylor series, we are able to justify the Bilinear Transformation

approximation of the Z-Domain.

Through step–by-step substitution, we can see that the different approximations of the Z-

Transform are related through approximations of the Taylor Series Expansion of ln(z). However,

how do these approximations differ? Due to the slight difference in the procedure for each

Page 23: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

approximation technique, the performance of each approximation is also slightly different from

the other.

Differences in Approximations

In order to show the differences in approximation techniques, we show the impulse response

of the Z-Domain Transfer Function for each approximation. Previously, a step-by-step example

of the exact S-Domain to Z-Domain transformation is shown. Using the same example, we show

how to obtain the Z-Transform of the same system using the approximation techniques. From the

previous example, we have:

Transfer Function in S-Domain:

𝐺(𝑠) =1

(𝑠 + 5)2

Exact Transfer Function in Z-Domain:

�̂�(𝑧) =0.1𝑒0.5𝑧

(𝑒0.5𝑧 − 1)2

Where:

𝜏 = 0.1𝑠𝑒𝑐

Forward Difference Transfer Function:

�̂�(𝑧) ≅ 𝐺 (𝑧 − 1

𝜏) =

1

(𝑧−1

𝜏+ 5)

2

�̂�(𝑧) ≅1

(𝑧−1

0.1+ 5)

2

�̂�(𝑧) ≅1

(10𝑧 − 5)2

Backward Difference Transfer Function:

�̂�(𝑧) ≅ 𝐺 (𝑧 − 1

𝜏𝑧) =

1

(𝑧−1

𝜏𝑧+ 5)

2 =1

(1−𝑧−1

0.1+ 5)

2

�̂�(𝑧) ≅1

(−10𝑧−1 + 15)2

Bilinear Transformation Transfer Function:

�̂�(𝑧) ≅ 𝐺 (2

𝜏

𝑧 − 1

𝑧 + 1) =

1

(2

𝜏

𝑧−1

𝑧+1+ 5)

2 =1

(20𝑧−20

𝑧+1+

5𝑧+5

𝑧+1)

2

Page 24: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

�̂�(𝑧) ≅1

(25𝑧−15

𝑧+1)

2

�̂�(𝑧) ≅(𝑧 + 1)2

(25𝑧 − 15)2

After obtaining the S to Z Transform approximations, we can compare their impulse response

with the S-Domain and exact Z-Domain “equivalent” impulse response. This can be seen in

Figure 26.

Figure 23 – Comparison of Impulse Responses

Page 25: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

In Figure 23, we can see the impulse response of the different S to Z Transform methods.

Just like Figure 21 shows, the exact S to Z Transform yields the same impulse response at the

sampling instants. On the other hand, the approximations differ during the start of the impulse

response and are scaled by a factor of 0.1. However, the general shape of the impulse response of

the approximations is quite similar to the exact Z-Transform. This shows how we can achieve

similar performance using approximations but with slight error. Aside from having multiple

approximation techniques for the S to Z Transforms, digital controllers also have multiple

representations.

5. Observation 4: The Idea that a Digital Controller Can Have Different Representations

We have noticed that some students have trouble noticing the different forms the same

controller can take. We explain that a digital controller can be represented in different domains

which include the discrete-time domain, the state-space domain, and the Z-domain. We

emphasize that a single controller can be represented in multiple ways, all of which lead to the

same input and output relationships through examples approached in multiple ways. This is

illustrated in Figure 24.

Page 26: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 24 – Different Representations of the Same Discrete System

In Figure 24, the same digital controller is represented in three different ways: Discrete-Time

Domain, State-Space Domain, and the Z-Domain. Although the representations are different, the

same input, u(k), will still yield the same output, y(k). How can these different forms be the

same? To explain, a series of step-by-step conversion examples between domains are shown.

Discrete-Time Domain Representation

In the Discrete-Time domain, the output is represented by a function of the input sample, and

possibly prior output samples. We are using the same example as in Figure 27 above where:

𝑦(𝑘 + 2) = −1.3𝑦(𝑘 + 1) − 0.42𝑦(𝑘) + 0.2𝑢(𝑘)

We use this example to show the change from one domain to another.

Page 27: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Z-Domain Representation

The Z-Domain of discrete-time signals can be likened to the S-Domain of continuous-time

signals. The Z-Domain representation can be obtained from both the Discrete-Time and State-

Space domain representations. To obtain the Z-Domain from the discrete-time domain, we use

the example from Figure 24.

By taking the Z-Transform (and assuming initial conditions = 0) we have:

𝑧2𝑌(𝑧) = −1.3𝑧𝑌(𝑧) − 0.42𝑌(𝑧) + 0.2𝑈(𝑧)

𝑧2 𝑌(𝑧) + 1.3𝑧𝑌(𝑧) + 0.42𝑌(𝑧) = 0.2𝑈(𝑧)

(𝑧2 + 1.3𝑧 + 0.42)𝑌(𝑧) = 0.2𝑈(𝑧)

𝑌(𝑧)

𝑈(𝑧)= 𝐺(𝑧) =

0.2

𝑧2 + 1.3𝑧 + 0.42

This is the Z-Domain Transfer Function shown in Figure 24. Even in the Z-Domain, multiple

representations exist. We can also separate it into two terms. This form can be used to obtain

another version of its State-Space Domain representation. Through partial fractions we can

obtain:

𝑌(𝑧)

𝑈(𝑧)= �̂�(𝑧) =

0.2

𝑧2 + 1.3𝑧 + 0.42=

0.2

(𝑧 + 0.6)(𝑧 + 0.7)

𝑌(𝑧)

𝑈(𝑧)=

𝑎

(𝑧 + 0.6)+

𝑏

(𝑧 + 0.7)

𝑌(𝑧)

𝑈(𝑧)=

2

(𝑧 + 0.6)+

−2

(𝑧 + 0.7)

This shows students that multiple representations within a domain can have the same input-

output relationship. Using the two forms of Z-Domain obtained, we can show different State-

Space Domain representations.

State-Space Domain Representation

First, we show students that the State-Space domain represents the Digital Controller in

the form of matrices. A general form for a sing input single output (SISO) system can be seen in

Figure 25:

Page 28: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 25 – SISO Graphical State-Space Domain Representation

Figure 25 outlines the general form of the State-Space Domain and the dimensions of the

matrices. Using the two different forms of the Z-Domain, we show step-by-step processes of

obtaining two State-Space Domain representations. From the previous section:

𝑌(𝑧)

𝑈(𝑧)=

2

(𝑧 + 0.6)+

−2

(𝑧 + 0.7)

We then set each term to:

𝑊1(𝑧)

𝑈(𝑧)=

2

(𝑧 + 0.6)→ 𝑤1(𝑘 + 1) = −0.6𝑤1(𝑘) + 2𝑢(𝑘)

𝑊2(𝑧)

𝑈(𝑧)=

−2

(𝑧 + 0.7)→ 𝑤2(𝑘 + 1) = −0.7𝑤2(𝑘) − 2𝑢(𝑘)

Where:

𝑌(𝑧) = 𝑊1(𝑧) + 𝑊2(𝑧) → 𝑦(𝑘) = 𝑤1(𝑘) + 𝑤2(𝑘)

So, in matrix form, we have:

[𝑤1(𝑘 + 1)

𝑤2(𝑘 + 1)] = [

−0.6 00 −0.7

] [𝑤1(𝑘)

𝑤2(𝑘)] + [

2−2

] 𝑢(𝑘)

𝑦(𝑘) = [1 1] [𝑤1(𝑘)

𝑤2(𝑘)]

Page 29: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

This is one State-Space Domain representation. However, this is not the representation seen

in Figure 25. To obtain the representation seen in Figure 25, we use the expanded Z-Domain

representation:

𝑌(𝑧)

𝑈(𝑧)= �̂�(𝑧) =

0.2

𝑧2 + 1.3𝑧 + 0.42

In Discrete-Time Domain this is:

𝑦(𝑘 + 2) = −1.3𝑦(𝑘 + 1) − 0.42𝑦(𝑘) + 0.2𝑢(𝑘)

Let:

𝑥1(𝑘) = 𝑦(𝑘) → 𝑥1(𝑘 + 1) = 𝑦(𝑘 + 1) = 𝑥2(𝑘)

𝑥2(𝑘) = 𝑦(𝑘 + 1) → 𝑥2(𝑘 + 1) = 𝑦(𝑘 + 2)

Where:

𝑥2(𝑘 + 1) = 𝑦(𝑘 + 2) = −1.3𝑦(𝑘 + 1) − 0.42𝑦(𝑘) + 0.2𝑢(𝑘)

= −1.3𝑥2(𝑘) − 0.42𝑥1(𝑘) + 0.2𝑢(𝑘)

In matrix form we have:

[𝑥1(𝑘 + 1)

𝑥2(𝑘 + 1)] = [

0 1−0.42 −1.3

] [𝑥1(𝑘)

𝑥2(𝑘)] + [

00.2

] 𝑢(𝑘)

𝑦(𝑘) = [1 0] [𝑥1(𝑘)

𝑥2(𝑘)]

This is the State-Space Domain form as written in Figure 25. As we have shown, there are at

least 3 different forms of representation of a Digital Controller, some of which have more than

one option. For each domain, there exists a method to convert to another domain and back. In

addition to multiple representations, students need to be aware of effects of a practical system to

the performance of a Digital Controller.

6. Observation 5: Factors to Be Taken into Consideration when Dealing with Digital

Controllers

We emphasize to students that there are other factors that need to be taken into consideration

when dealing with digitized controllers. They include Analog to Digital Conversion (ADC or

simply A/D), Digital to Analog Conversion (DAC or simply D/A), and delays that are caused by

the D/A and by Computation Delays.13

We use the visual and intuitive approach detailed in

reference 9 to explain sampling and under sampling.

Page 30: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Analog to Digital Conversion

We remind students that analog data is continuous and contains an infinite amount of data.

On the other hand, digital data is discrete, and finite. For example, look at the two clocks in

Figure 26. The left clock is an analog clock while the right clock is a digital clock. In theory, the

analog clock can be used to tell time to as accurate as desired. For example, we can tell the time

to the seconds, milliseconds, microseconds, and so forth if we are able to zoom in and measure

the distance between each second mark. On the other hand, the digital clock can only display

what is measured at the specific sampling time, such as 5:53. This is because the digital clock’s

time display has been discretized. It should be noted that the display of 5:53 in the digital clock

covers a time period from 5:53:00 to 5:53:59, after which it changes to 5:54. This means that the

viewer has no idea about the more accurate time “in between” 5:53 and 5:54.

Figure 26 – Analog vs. Digital Clock9

As mentioned before, one needs to sample “fast enough” to be able to correctly use the

different S to Z Transformations. We explain to students the meaning of “fast enough” by

referring to a well-known phenomenon seen in some car commercials called the “Wagon-Wheel”

effect. This is where the wheels of a forward moving vehicle sometimes appear to spin

backwards (Figure 27).

Many movies or shows seen on television are a succession of images taken at a rate of 24

images, or frames, per second. Normally the human brain interprets the 24 frames per second

sequence as a continuous, “analog” movie. However, when a wheel rotation rate matches the

frame rate of the recording camera, the wheel completes a revolution and ends up in the same

position in the next frame. This results in a wheel that appears stationary. The difference between

the rotation rate and frame rate leads to the perception that the forward moving wheel is moving

backwards (or slowly forward). This is illustrated by Figure 27.

Page 31: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

(a)

(b)

Figure 27 – The Wagon Wheel Effect18

Figure 27a shows what appears to be a counterclockwise rotating wheel. However, this is

simply an illusion caused by the relationship of the rotation rate and frame rate. Figure 27b

shows the actual motion of the wheel. As the wheel rotates clockwise, a frame is taken.

However, since the rotation rate is higher than the frame rate, it appears as if the wheel moved

counter clockwise due to the positions of the spokes at each frame.

In class, we discuss the Nyquist Sampling rate in which the sampling frequency must be at

least twice as much as the highest frequency component in the analog system. This is necessary

to prevent under sampling issues such as aliasing, where frequency components begin to overlap

and distort the signal. This is also clarified by using a more common explanation where 2 signals

have the same samples and one of which is undersampled seen in Figure 28.

Page 32: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 28 – Undersampling Example19

In Figure 28, a higher frequency sinusoid overlaps a lower frequency sinusoid. Both signals

are sampled using the same sampling rate. However, it is clear that a tremendous amount of data

of the higher frequency sinusoid is lost in between sampling instants. Due to the lower sampling

rate, when attempting to reconstruct the higher frequency sinusoid, it will appear to be the lower

frequency sinusoid, which is a form of aliasing. We also clarify to students that practical

sampling is NOT instantaneous, and this can lead to incorrect samples. An example would be

taking a picture of a moving object. Since camera exposure takes time (for example 0.05

second), the resultant image appears partially blurred. This can be seen in Figure 29.

Figure 29 – Motion Blur17

In Figure 29 we see the effect of motion blur for a camera with a relatively high exposure

time, or sampling time. As we can see, the body of the ride in the left of the image looks clear as

it is not moving. However, those riding the attraction appear blurred in the image as data of each

pixel is integrated for the exposure time. Similarly, if the sampling time of the A/D Converter is

too high, distortion in the resulting signal can occur if there is a huge change in the analog signal

during the sampling time.

Page 33: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Digital to Analog Conversion

There are cases where the output of the Digital Controller must be returned to an analog

signal. However, digital signal is discretized and not continuous like an analog signal. To explain

Digital to Analog Conversion, we have the students perform an experiment using a pad of sticky

notes, a pen or pencil, and coloring items. We tell them to think of a story and continue to draw

the scenes on the sticky pad page per page similar to Figure 30.

Figure 30 – Sticky Pad Story9

Afterwards, they flip through the sticky pad to watch the story. If each scene is looks close

enough one after the other (high sampling frequency case), the resulting story will play

smoothly, as if watching a movie. However, if the scenes appear too different from one after the

other, there will be noticeable jumps in between pages and the resulting story will be

discontinuous and pulse like. In addition to proper sampling rate, there are also delays when

converting from Digital to Analog, and during Digital Computation.

Delay Compensation

We explain to students that there exist delays in the system due to Digital to Analog

conversion and Computations. We also explain one method of countering Digital to Analog

conversion. The Digital to Analog conversion delay can be seen in Figure 31.

Figure 31 – Digital to Analog Converter Output10

Page 34: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 31 shows the output of a Digital to Analog Converter for a system that has a Zero

Order Hold (ZOH). The original signal is shown by the solid curve. When sampled, the there is a

delay of about T/2, where T is the sampling time. This delay is seen when the sampled signal is

smoothed out which results in the smoothed signal represented by the dotted curve. To

compensate for this delay, a pole-zero compensation can be used10

:

𝐶(𝑧) =2𝑧

𝑧 + 1

This compensation causes a phase shift of 𝜔𝑇/2 which cancels the phase delay caused by the

ZOH. The phase shift of the compensation can be seen in the Z-domain pole-zero plot illustrated

in Figure 32.

Figure 32 – C(z) Pole-Zero Plot10

It is important to note to students that the compensation, C(z) does not guarantee stability for

a closed-loop system because it is unrelated to the discretization method and sampling rate.10

This means that other design techniques such as the root locus must be used to ensure stability.

In addition to the delay due to Digital to Analog Conversion, there is also a delay caused by

the computation of a digital controller. To further explore this topic, refer to reference [13].

7. Assessment

The effectiveness of the teaching approach outlined in this paper was tested on a Control

System class in Florida Atlantic University. The test involved using a 40-minute visual and

intuitive presentation to introduce material on Digital Controllers. The class then answered a

questionnaire made to evaluate the students’ desire for a visual and intuitive approach. Answers

Page 35: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

are based on a scale of 1 to 5, where 5 is “Strongly Agree,” 4 is “Agree,” 3 is “Neutral,” 2 is

“Disagree,” and 1 is “Strongly Disagree.”

20 students responded the questionnaire. The questions and the student responses are

included in Appendix B: Student Responses. We received mainly positive responses from the 20

students. However, we are aware that this sample space is quite small. In addition, we are not

able to have a control group due to having only few number of Control System classes available.

When asked about the students’ preference towards visual learning, they responded mainly

positive to visual learning. This can be seen in the Appendix Figures: B3, B6, and B7.In

appendix C, 95% of students responded positively with Agree or Strongly Agree to

“Visualization helped me understand the implementation of Analog Controllers.”

As mentioned in the paper, we have found that there are students who do not have a deeper

understanding of a controller in closed loop. We attempt to alleviate this by using a visual

approach with relatable analogies to teach concepts on the analog controller. We also used this

approach on the presentation shown to students. Afterwards, the questionnaire has questions such

as: “I feel that I better understand the meaning of Analog Controllers,” and “I feel that I better

understand the role of Analog Controllers in a Closed Loop.” We can see in Appendix Figures

B1 and B2 that students responded positively to such questions after the presentation.

Another observation we have found is that some students have difficulty understanding that

Analog Controllers can also be implemented with Digital Controllers. After the presentation, we

have received positive responses to “I feel that I better understand how a Controller in Hardware

translates to Software Code.” This can be seen in Appendix Figure B5 where 80% of the class

responded with Agree or Strongly Agree.

Even though our sample space is small, we received mainly positive responses towards a

visual approach to teaching. This is an indication that, at least for students at Florida Atlantic

University, the need for visualization is quite high. By teaching in a matter that suites the

students more, we are able to help them learn concepts related to Analog and Digital Controllers

better. A more rigorous assessment of learning is being worked on to further assess the students’

performance further.

8. Acknowledgement

We thank the Venturewell.org (formerly NCIIA.org), for the support of the development of

innovative and entrepreneurial teaching and learning methods. We also thank Michael R. Levine

and Last Best Chance, LLC, for the continuous support.

Page 36: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

9. References

[1.] C. Dede, “Planning for Neomillennial Learning Styles,”

https://net.educause.edu/ir/library/pdf/eqm0511.pdf, 2005, (Accessed November, 2015)

[2.] D. Raviv, and G. J. Roskovich, “An Alternative Method to Teaching Design of Control Systems,” in

2014 Twelfth LACCEI Latin American and Caribbean Conference for Engineering and Technology,

Guayaquil, Ecuador, July 2014

[3.] T. DeWitt, “TED Talks: Hey science teachers – make it fun,”

http://www.ted.com/talks/tyler_dewitt_hey_science_teachers_make_it_fun.html , 2012, (Accessed

January, 2016)

[4.] L. Holmes, “Neil DeGrass Tyson, The Epilogue: Why Educators Need A 'Cultural Utility Belt’”,

NPR,http://www.npr.org/blogs/monkeysee/2010/03/neil_degrasse_tyson_the_epilog.html, 2010,

(Accessed January, 2016)

[5.] D. Raviv, and G. J. Roskovich, “An Intuitive Approach to Teaching Key Concepts in Control

Systems,” in 2014 ASEE Annual Conference, Indianapolis, Indiana, June 2014

[6.] V.J. Rideout, “Media in the Lives of 8- to 18-Year-Olds”, pg 5-8, A Kaiser Family Foundation

Study, http://files.eric.ed.gov/fulltext/ED527859.pdf, 2010, (Accessed November, 2015)

[7.] R. C. Dorf, R. H. Bishop, Modern Control System, 10th ed., Pearson Prentice Hall, Upper Saddle

River, NJ, 2005.

[8.] C. L. Phillips, H. T. Nagle, Digital Control System, Analysis and Design, 3rd ed., Prentice-Hall,

Englewood Cliffs, New Jersey, 1995

[9.] D. Raviv, and J. D. Ramirez, “Experience-based Approach for Teaching and Learning Concepts in

Digital Signal Processing,” in 2015 ASEE Annual Conference and Exposition, Seattle, Washington,

June 2015.

[10.] D. Raviv, and E. W. Djaja, “Technique for Enhancing the Performance of Discretized Controllers,”

in Control Systems, IEEE, vol. 19, no.3, pp.52-57, June 1999

[11.] S. Bennett, “Development of the PID Controller,” IEEE Control Systems,

http://www.ieeecss.org/CSM/library/1993/dec1993/w05-HistoricalPerspectives.pdf,1993, (Accessed

January, 2016)

[12.] “Proportional-Integral-Dericative (PID) controller,”

http://nptel.ac.in/courses/112103174/module6/lec5/5.html, (Accessed January, 2016)

[13.] D. Raviv, “Digital Realization of Analog Transfer Functions,” MS Thesis, Technion - Israel Institute

of Technology, August 1982

[14.] B.C. Kuo, Discrete Data Control Systems, Prentice Hall, Eaglewood Cliffs, NJ, 1970

[15.] D.Raviv, J. Ramirez, Personal Communication

[16.] G.J. Roskovich

[17.] Motion Blur in Rides, http://cdn.digital-photo-

secrets.com/images/flickr/8924570105_d1a2944821.jpg, (Accessed January, 2016)

[18.] B. Olshausen, “Aliasing,”http://redwood.berkeley.edu/bruno/npb261/aliasing.pdf, 2000, (Accessed

January, 2016)

[19.] “Aliasing”, https://en.wikipedia.org/wiki/Aliasing, (Accessed January, 2016)

Page 37: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Appendix A: From S-Domain to Code

This Appendix provides an example of “translating” from the S-Domain to Code using the

process outlined in Figure 16, repeated below. Approximations of translating Differential

Equations to Difference Equations are first graphically justified. Then, these approximations are

used to show the S to Z-domain approximations, which are numerically obtained.

Figure 16 – From S-Domain to Code

From S-Domain to Differential Equation

Let us take a look at the PID Controller mentioned before in Figure 8. The transfer function

is as follows:

𝐶(𝑠) =𝑊(𝑠)

𝐸(𝑠)= 𝐾𝑝 + 𝑠𝐾𝑑 +

𝐾𝑖

𝑠

For a causal system with initial conditions equal to zero, the transfer function can be directly

transformed back into the time domain to obtain a first order differential equation:

𝑊(𝑠) = 𝐸(𝑠) (𝐾𝑝 + 𝑠𝐾𝑑 +𝐾𝑖

𝑠)

Page 38: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

𝑤(𝑡) = 𝐾𝑝𝑒(𝑡) + 𝐾𝑑

𝑑

𝑑𝑡𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝜏)𝑑𝜏

𝑡

−∞

From Differential Equation to Difference Equation

For this transformation, let us look at the derivative of a graph.

Figure A1 – Derivative Approximation

We can approximate the derivative of a point on the graph by using two close values

obtained at two time instants. The derivative at the point t=kT, where k is an integer, can be

approximated by the slope of the graph that connects the function values at t = (k-1)T and t = kT.

We can say then that the derivative, 𝑑

𝑑𝑡 (or “s” in the S-Domain), is approximated by the

difference of values:

𝑑(𝑘𝑇) =𝑑

𝑑𝑡𝑒(𝑡 = 𝑘𝑇) =̃

𝑒(𝑘𝑇) − 𝑒([𝑘 − 1]𝑇)

𝑇

Another derivative approximation can be obtained by adding 1 to k. This makes the interval

from kT to (k+1)T. Using this form, a new approximation of the derivative is obtained:

𝑑(𝑘𝑇) =𝑑

𝑑𝑡𝑒(𝑡 = 𝑘𝑇) =̃

𝑒([𝑘 + 1]𝑇) − 𝑒(𝑘𝑇)

𝑇

Let us then take a look at approximating the integral of the same graph.

Page 39: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure A2 – Integral Approximation

The integral of a graph is the area under the curve of the graph. For a small enough T, this

can be approximated by the area of a rectangle under the desired interval of the curve. From the

graph above, we can then approximate the integral under the interval from kT to (k+1)T by the

area of the rectangle, A=e(kT)T. So,∫ (or “1

𝑠 ” in the S-Domain) is approximated by the sum of

rectangle approximations. Each of the approximations can be written as:

∫ 𝑒(𝑡)𝑑𝑡[𝑘+1]𝑇

𝑘𝑇

=̃ 𝑒(𝑘𝑇)𝑇

Similarly,

∫ 𝑒(𝑡)𝑑𝑡𝑘𝑇

[𝑘−1]𝑇

=̃ 𝑒(𝑘𝑇)𝑇

Taking a step further, let:

𝑖(𝑘𝑇) = ∫ 𝑒(𝜏)𝑑𝜏𝑘𝑇

0

= ∫ 𝑒(𝜏)𝑑𝜏[𝑘−1]𝑇

0

+ ∫ 𝑒(𝜏)𝑑𝜏𝑘𝑇

[𝑘−1]𝑇

=̃ 𝑖([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)𝑇

After looking at the approximations for the derivative and integral, let us return to the PID-

Controller.

𝑤(𝑡) = 𝐾𝑝𝑒(𝑡) + 𝐾𝑑

𝑑

𝑑𝑡𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝜏)𝑑𝜏

𝑡

−∞

Page 40: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Assume e(t) = 0 for t<0. We then uniformly sample w(t) with t = kT, such that k is an integer

and T is the sampling time, so we have:

𝑤(𝑘𝑇) = 𝐾𝑝𝑒(𝑘𝑇) + 𝐾𝑑

𝑑

𝑑𝑡𝑒(𝑘𝑇) + 𝐾𝑖 ∫ 𝑒(𝑘𝑇)𝑑𝜏

𝑘𝑇

0

Using the above approximations, we know that:

𝑤(𝑘𝑇) =̃ 𝐾𝑝𝑒(𝑘𝑇) + 𝐾𝑖𝑖(𝑘𝑇) + 𝐾𝑑𝑑(𝑘𝑇)

Where,

𝑖(𝑘𝑇) = 𝑖([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)𝑇

𝑑(𝑘𝑇) =𝑒(𝑘) − 𝑒([𝑘 − 1]𝑇)

𝑇

This is a difference equation of a PID Controller.

The derivative and integral approximations show the graphical approach to the Forward

Difference and Backward Difference Z-Transform approximations. These approximations are

explained in a later section. Another approximation to take note of is the trapezoidal

approximation of integration which leads to the Bilinear Transform approximation. Let us

examine the graph in Figure A3.

Figure A3 – Trapezoidal Integral Approximation

In Figure A3, we use a trapezoid to approximate the area under the interval. The area is then

given by:

𝐴 =𝑒(𝑘𝑇) + 𝑒([𝑘 + 1]𝑇)

2𝑇

Page 41: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

∫ 𝑒(𝑡)𝑑𝑡[𝑘+1]𝑇

𝑘𝑇

=̃𝑒(𝑘𝑇) + 𝑒([𝑘 + 1]𝑇)

2𝑇

Similarly,

∫ 𝑒(𝑡)𝑑𝑡𝑘𝑇

[𝑘−1]𝑇

=̃𝑒([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)

2𝑇

Taking a step further, let:

𝑖(𝑘𝑇) = ∫ 𝑒(𝜏)𝑑𝜏𝑘𝑇

0

= ∫ 𝑒(𝜏)𝑑𝜏[𝑘−1]𝑇

0

+ ∫ 𝑒(𝜏)𝑑𝜏𝑘𝑇

[𝑘−1]𝑇

𝑖(𝑘𝑇) =̃ 𝑖([𝑘 − 1]𝑇) +𝑒([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)

2𝑇

This is the trapezoidal approximation of the integral of a discretized system. Later we show

how this is related to the Z-Transform.

From Difference Equation to Code

The difference equation of a function is closely related to the Code used to implement it.

Different programming languages may have different syntax. For this example, the code used is

compatible with MatLab. We can see the relationship of the code with the difference equation

from the comments in the code seen in Figure 12.

Page 42: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure 12 –MatLab Code for PID Controller

An Alternative Way to Obtain Difference Equations: Using the Z-Transform

There is another method for transforming from the S-Domain to code. This involves using

the Z-Transform then converting to difference equation, then to code. Using the graphical

approximations of the derivative and integral, we can obtain an approximation of the S to Z

transform. These approximations are discussed further and are justified in a different manner

using approximations on the Taylor Expansion of ln(z). The first approximation we will look at

is the Forward Difference approximation.

Forward Difference

The Forward Difference can be derived from the derivative approximation shown before.

Recall that for differentiation the difference equation can be approximated as:

𝑢(𝑘𝑇) =̃𝑒([𝑘 + 1]𝑇) − 𝑒(𝑘𝑇)

𝑇

We then take the Z-Transform of the derivative approximation:

𝑈(𝑧) =𝐸(𝑧)𝑧 − 𝐸(𝑧)

𝑇

𝑈(𝑧)

𝐸(𝑧)=

𝑧 − 1

𝑇

In the S-Domain, a derivative is equivalent to s for initial conditions of 0. Therefore:

%The PID Controller: %Kp*p(k) Kpk = Kp*ek; %Kp*e[k]

%Ki*i(k) Kik = ones(1,length(ek)); for x = 1:length(ek) if x == 1 %Ki*i(k-1) = 0 Kik(x) = Ki*ek(x)*Ts; %i[k] = Ki*(0+e[k]*T) else Kik(x) = Ki*(Kik(x-1)+ek(x)*Ts); %i[k] = Ki*(i[k-1]+e[k]*T) end end

%Kd*d(k) Kdk = ones(1,length(ek)); for x = 1:length(ek) if x == 1 %e(k-1) = 0 Kdk(x) = Kd*ek(x)/Ts; %d[k] = Kd*({e[k]-0}/T) else Kdk(x) = Kd*(ek(x)-ek(x-1))/Ts; %d[k] = Kd*({e[k]-e[k-1]}/T) end end

%Combine to form PID wk = Kpk + Kik + Kdk;

Page 43: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

𝑠 =𝑧 − 1

𝑇𝑭𝒐𝒓𝒘𝒂𝒓𝒅 𝑫𝒊𝒇𝒇𝒆𝒓𝒆𝒏𝒄𝒆

To approximate the Z-Domain equivalent of a transfer function, we can simply let s equal

this value. Afterwards, we can take the inverse Z-Transform to obtain the difference equation.

From here, we simply modify the difference equation to fit the syntax of the language we want to

program in. The next approximation is the Backward Difference approximation.

Backward Difference

The Backward Difference approximation can be obtained from the rectangular integral

approximation. As shown earlier, the rectangular integration approximation is:

𝑣(𝑘𝑇) =̃ 𝑣([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)𝑇

In the Z-Domain, this is:

𝑣(𝑘𝑇) − 𝑣([𝑘 − 1]𝑇) = 𝑒(𝑘𝑇)𝑇𝑉(𝑧) − 𝑉(𝑧)𝑧−1 = 𝐸(𝑧)𝑇

𝑉(𝑧)

𝐸(𝑧)=

𝑇

1 − 𝑧−1=

𝑇𝑧

𝑧 − 1

In the S-Domain, integration is represented by 1/s. Thus we have:

1

𝑠=

𝑇𝑧

𝑧 − 1

𝑠 =𝑧 − 1

𝑇𝑧 𝑩𝒂𝒄𝒌𝒘𝒂𝒓𝒅 𝑫𝒊𝒇𝒇𝒆𝒓𝒆𝒏𝒄𝒆

Again, we can simply substitute this approximation to be able to obtain the Z-Domain

equivalent of a Transfer Function in the S-Domain. The next approximation to be examined is

the Bilinear Transform.

Bilinear Transform

Let us examine the Bilinear Transform approximation using the trapezoidal integration

approximation.

Using the trapezoidal integration approximation:

𝑣(𝑘𝑇) =̃ 𝑣([𝑘 − 1]𝑇) +𝑒([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)

2𝑇

𝑣(𝑘𝑇) − 𝑣([𝑘 − 1]𝑇) =̃𝑒([𝑘 − 1]𝑇) + 𝑒(𝑘𝑇)

2𝑇

By taking the Z-Transform, we have:

𝑉(𝑧) − 𝑉(𝑧)𝑧−1 =𝐸(𝑧)𝑧−1 + 𝐸(𝑧)

2𝑇

𝑉(𝑧)

𝐸(𝑧)=

𝑇

2(

1 + 𝑧−1

1 − 𝑧−1)

Again, S-Transform of an integral is 1/s, so:

1

𝑠=

𝑇

2(

1 + 𝑧−1

1 − 𝑧−1)

Page 44: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

𝑠 =2

𝑇(

1 − 𝑧−1

1 + 𝑧−1)

𝑠 =2

𝑇(

𝑧 − 1

𝑧 + 1) 𝑩𝒊𝒍𝒊𝒏𝒆𝒂𝒓 𝑻𝒓𝒂𝒏𝒔𝒇𝒐𝒓𝒎

The three S to Z transform approximations are discussed in Section 4, Observation 3 and

obtained through a different method. Again, this is to show students multiple methods of

obtaining implementable code from an analog controller transfer function.

Page 45: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Appendix B: Student Responses

Figure B1 – I Feel That I Better Understand the Meaning of Analog Controllers

Figure B2 – I Feel That I Better Understand the Role of Analog Controllers in a Closed

Loop

Page 46: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure B3 – Visualization Helped Me Understand the Implementation of Analog

Controllers

Figure B4 - I Feel That I Better Understand How a Transfer Function in S-domain

Translates to Hardware

Figure B5 – I Feel That I Better Understand How a Controller in Hardware Translates to

Software Code

Page 47: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure B6 – Visualization Helped Me to Understand the Implementation of the Digital

Controllers

Figure B7 – I Prefer to Learn About Control Systems Using a Visual Approach

Figure B8 – I Prefer to Learn by Reading Textbook Chapters

Figure B9 – I Prefer to Learn by Reading PowerPoint or the Instructor’s Notes

Page 48: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure B10 – I Prefer to Study Myself. I Prefer Not to be Taught

Figure B11 - Gender

Figure B12 – Race/Ethnic Origin

Page 49: Visual and Intuitive Approach to Explaining Digitized ...A Visual and Intuitive Approach to Explaining Digitized Controllers Daniel Raviv, Paul Benedict Reyes, and George Roskovich

Figure B13 – Age Distribution