## ECE 758: Control System Implementation Laboratory

IMPORTANT: This web page provides additional support for particular lab sections of ECE 758. For information about general course content, see the instructor’s course web page.

### Spring 2009

 Lecture (all sections): T 12:30N–2:18PM, 808 Dreese Laboratories (Professor Kevin M. Passino) Tuesday lab section (10675-3): T 8:30AM–12:18N, 808 Dreese Laboratories (Ted Pavlic) Thursday lab section (22207-5): R 8:30AM–12:18N, 808 Dreese Laboratories (Ted Pavlic)

See instructor’s course web page for instructor and course information.

Lecturer/Course Instructor: Kevin M. Passino, 416 Dreese Laboratory, passino@ece.osu.edu
See instructor’s course web page for instructor and general course information.
Section Grader/Lab Instructor: Ted Pavlic, 351 Caldwell Laboratory, pavlic.3@osu.edu
Office Hours: E-mail me for an appointment.

To make sure I get your e-mail, begin the subject with ECE758: or at least put 758 somewhere in the subject. An automatic filter will make sure your mail gets to me ASAP (rather than being marked as spam).

Section Syllabus: PDF

Course Text:
None required to purchase. Necessary documents will be distributed on instructor’s course web page and in class. Students are encouraged to print out these documents before class. Auxiliary information may be posted on this web page.
Schedule:
NOTE: This quarter (Spring 2009), due to scheduling constraints, the order of labs 5 and 6 is swapped.

Week Lab Date (T or R) Topic
1 Mar 31 or Apr 2 Lab 1: Lab Overview, Overview of Plants/Challenges, Tutorial on dSPACE/Simulink
2 Apr 7 or Apr 9 Lab 2: Modeling and System Identification of a Thermal Process
3 Apr 14 or Apr 16 Lab 3: PID Control with Derivative Filtering and Integral Antiwindup for a DC Servo
4 Apr 21 or Apr 23 Lab 4: Linear Quadratic Regulator (LQR) and Observer Design for a Flexible Joint
6 Apr 28 or Apr 30 Lab 6: Distributed Dynamic Resource Allocation Strategies for Multizone Temperature Control
5 May 5 or May 7 Lab 5: Nonlinear Control for a Flexible Joint
7–10 Student projects (open lab to students; keycard access provided)
F June 11 Last day to give oral presentation of student project

### Lab Resources

SOURCE CODE: I use LaTeX to generate the digital documents that I use for this class. I also export a public slice of my source control (i.e., docs but no tests) to the web so that you can view the source directly. Check out http://hg.tedpavlic.com/ece758/ to see the source "code" for the lab resources.

• Click on the files link to get started browsing the most recent manifest. The "raw" links let you download a revision of each file rather than viewing it on-line.
• Use one of the bz2, zip, or gz links to download an archive of the most recent revision of the source.
• You can use Mercurial to "clone" the entire repository onto your own machine. You can "pull" updates later as I post them.
• You can subscribe to the RSS or Atom feeds to be notified of changes I make.

LICENSING AND REUSE: Unless otherwise expressly stated, all original material of whatever nature created by Theodore P. Pavlic and included in this website and any related pages, including its archives, is protected by copyright and licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License ("CCPL"). Use of this website is expressly conditioned upon the user’s acceptance of the terms and provisions of the CCPL. Use of this site and any of the materials thereon constitutes acceptance of the CCPL by the user. Students enrolled in ECE 758 may reuse or modify portions of the materials without attributing the content to its original author so long as it is being used to generate a submission to the original author (e.g., the use of a schematic on a lab report to be submitted to T. Pavlic); otherwise, this web page URL, the URL of the source document, or the author’s name can be cited as the source of the work.

• The syllabus and its source code are licensed to the public domain. All persons are permitted to use, copy, modify, distribute, and publicly display them without restriction. In other words, instructors may use my syllabus as a template for their syllabuses without having to give any credit to me.

LAB BENCHES: The banner posted at each table describing how to use the station and the DIO Pinout for the Quanser DS1104 interface board are provided here.

• Lab 1: Lab Overview, Overview of Plants/Challenges, Tutorial on dSPACE/Simulink
• Lab 2: Modeling and System Identification for a Thermal Process
• Rotary Electrodynamics of a DC Motor: Motor as Mechanical Capacitor ("Appendix A" from the pre-lab questions)

• System Identification of a Thermal Process (updated procedure for analog operation of Darlington driver circuit; includes modeling information for thermal process)

• Relevant resources from other classes that I’ve taught:
• You may want some MATLAB hints for this laboratory. Page 14 of the ECE557 lab text gives an example of working with dSPACE ControlDesk data in MATLAB using getfield.
load filename;                  % Loads file structure into filename
v = filename;                   % Copies filename structure to v
t = getfield(v.X(1), 'Data');   % Copies X time vector into t
y1 = getfield(v.Y(1), 'Data');  % Copies Y(1) vector into y1
y2 = getfield(v.Y(2), 'Data');  % Copies Y(2) vector into y2

mean( y1( find( t >= 4 ) ) )    % Average of Y(1) for time after 4 s

mean( y1( t >= 4 ) )            % Equivalent averaging statement

People who use this method like to do a lot of copying. There is no need to copy the whole file structure into v if you don’t want to. Additionally, those getfield calls are not necessary because Data is a simple field name. So an alternative is:
load filename;                  % Loads file into  filename
t = filename.X(1).Data;         % Copies X time vector into t
y1 = filename.Y(1).Data;        % Copies Y(1) vector into y1
y2 = filename.Y(2).Data;        % Copies Y(2) vector into y2

mean( y1( t >= 4 ) )            % Average of Y(1) for time after 4 s

In fact, we can get rid of all copying and a few lines.
load filename;                                         % Loads up filename
mean( filename.Y(1).Data( filename.X(1).Data >= 4 ) )  % A mean shortcut


• Lab 3: Proportional-Integral-Derivative (PID) Control with Derivative Filtering and Integral Antiwindup for a DC Servo
• IMPORTANT: Use radians in the pre- and post-laboratory assignments as well as during the lab experience.
• Any "360" in measurement gains (e.g., from encoder or tachometer sensors) should be replaced with 2π.
• Likewise, directions that are given in terms of "degrees" should be converted into radians for implementation.
• Otherwise, the system model (which uses radians) will appear to be grossly inaccurate.

• Correct gains for laboratory implementation:
• Encoder gain for θ: 2π*4/4096

• Relevant resources from other classes that I’ve taught:

• Lab 4: Linear Quadratic Regulator (LQR) and Observer Design for a Flexible Joint
• Major correction to pre-lab "Challenges" document: (PDF)

In the Laboratory Design Challenges document, the state-space model of the flexible joint has a typo, and so the state-space model will not produce the MATLAB results shown below it. To remedy this problem, replace every R with Rm. The effect of R is already included in the Kstiff parameter, and the typo omits any influence of the Rm parameter.

A = [ 0, 0, 1, 0;
0, 0, 0, 1;
0, Kstiff/J_hub, -Km^2*Kg^2/(Rm*J_hub), 0;

B = [ 0; 0; Km*Kg/(Rm*J_hub); -Km*Kg/(Rm*J_hub) ];

Then, if you do a
format short e; A, B

then you should get the same numerical A and B matrices as shown in the document.

• IN LAB, remember to multiply the encoder for the JOINT angle α by −1. The corresponding encoder is "upside down," and so expected positive rotation is negative without this change.

• Correct gains for laboratory implementation:
• Encoder gain for θ: 2π*4/4096
• ADC tachometer gain for dθ/dt: 10*(1000/1.5)*(2π/60)*(1/70)
• Encoder gain for α: −2π*4/4096

• IMPORTANT: Use radians in the pre- and post-laboratory assignments as well as during the lab experience.
• Any "360" in measurement gains (e.g., from encoder or tachometer sensors) should be replaced with 2π.
• Likewise, directions that are given in terms of "degrees" should be converted into radians for implementation.
• Otherwise, the system model (which uses radians) will appear to be grossly inaccurate.

• Lab 5: Nonlinear Control for a Flexible Joint
• IN LAB, remember to multiply the encoder for the JOINT angle α by −1. The corresponding encoder is "upside down," and so expected positive rotation is negative without this change.

• Correct gains for laboratory implementation:
• Encoder gain for θ: 2π*4/4096
• ADC tachometer gain for dθ/dt: 10*(1000/1.5)*(2π/60)*(1/70)
• Encoder gain for α: −2π*4/4096

• IMPORTANT: Use radians in the pre- and post-laboratory assignments as well as during the lab experience.
• Any "360" in measurement gains (e.g., from encoder or tachometer sensors) should be replaced with 2π.
• Likewise, directions that are given in terms of "degrees" should be converted into radians for implementation.
• Otherwise, the system model (which uses radians) will appear to be grossly inaccurate.

• Simple feedback linearization example: A ball in a tube – Hopefully this example illustrates the concept of feedback linearization for a much simpler plant with a much simpler nonlinearity.

• Lab 6: Distributed Dynamic Resource Allocation Strategies for Multizone Temperature Control

### Lab Writing Resources

• Borrowing Class Images
• Recent versions of Adobe Acrobat Reader have a "Snapshot Tool" that allows you to copy any image out of a PDF. To use images I’ve put in the supplementary text handouts, copy and paste them into your submissions.
• If you are using LaTeX, you will need images to be stored in separate files to be included in your source code (i.e., you will not be able to simply "paste" them into your document).
• The ECE computer labs have the full Adobe Acrobat installed (i.e., not just the reader), and so you can use the File->Create PDF->From clipboard feature to create PDF versions of your copied snapshots.
• While viewing the PDF snapshots, you can use the File->Save As feature to convert them to a better format.
• Choose the format that fits your LaTeX engine. Remember that:
• PDFLaTeX can include PDF, GIF, JPG, and PNG images.
• Classical LaTeX can include EPS images.
• Other PDF viewers (like OS X’s Preview or Skim) have equivalent snapshot and save features.

• Using TeX/LaTeX: Students are encouraged (but not required) to use TeX (in particular, LaTeX) for their assignment submissions. See the section on Help Getting Started Using TeX/LaTeX for more information.

### Help Getting Started Using TeX/LaTeX

[ Students are strongly encouraged (but not required) to use TeX (in particular, LaTeX) for their assignment submissions. ]

For myriad reasons, professional technical documents are rarely produced with popular programs like Microsoft Word. In areas that are highly influenced by mathematics (e.g., engineering), the free TeX typesetting system dominates. Many TeX (pronounced "tech") users prefer the LaTeX suite of macros to simplify common typesetting tasks.

TeX documents, like the source code for computer programs, start as text files that are later "compiled" into their final document form. A typical TeX workflow is

1. Edit document source code in a standard or specialized text editor. For example, a text file called "mydocument.tex" could contain the LaTeX code:
\documentclass{article}
\begin{document}
\textbf{Hello world!}
\end{document}

2. "Compile" source code to produce printable document. The "mydocument.tex" file would produce a "mydocument.pdf" that would contain the bold text:
Hello world!
A good editor will typically provide a quick way (e.g., a "LaTeX" button on the graphical user interface) to compile your code.

If you want to compile your code manually, you can use PDFLaTeX with the command
pdflatex mydocument.tex
or you can use LaTeX with the commands
latex mydocument.tex
dvips mydocument.dvi
ps2pdf mydocument.ps
The difference between these two methods has an impact on what type of figures you can include (i.e., EPS files versus PDF, GIF, JPG, or PNG files). See below for details.

3. View printable document and repeat process to make changes (e.g., you could change the \textbf{Hello world!} line to be simply Hello world! to get rid of the bold).

Thus, many people feel that TeX typesetting is more like programming than it is like using standard word processing tools. So it’s not surprising that you’ll need a "compiler", editor, and viewer (note: the ECE computer labs are already equipped with everything you need to get started).

1. If you want to submit lab reports or pre-lab homework assignments using TeX, you will need one of the free TeX distributions. These distributions contain TeX and the popular LaTeX macros.
• Alternatively, Windows users can try TeX Live. For the moment, I recommend that new users stick with MiKTeX.
• Mac OS X users should get MacTeX. Download the MacTeX Installer.
• Unix users should get TeX Live. Follow the quick installation directions.
These distributions contain programs that can "compile" TeX source files into a nice-looking printable form.

2. Once you have installed a TeX distribution, you will need an editor. Any text editor can be used to edit TeX files, but some are more friendly than others.
• TeXmaker is a popular free LaTeX editor for Windows, Mac OS X, and Unix.
• WinShell is the free LaTeX editor used in the ECE computer labs.
• TeXnicCenter is a popular free LaTeX editor for Windows.
• WinEdt is a popular commercial shareware LaTeX editor for Windows.
• The combination of Vim with the VIM-LaTeX suite makes for a powerful LaTeX editor for Windows, Mac OS X, and Unix.
• Mac users may want to check out MacVim.
• TeXShop is a free and minimal LaTeX editor and PDF previewer (with auto-refresh) for Mac OS X.
• TeXworks is a free and minimal LaTeX editor and auto-refreshing PDF previewer (based on TeXShop) that is still in development for Windows, Mac OS X, and Unix. It is available for download. It is based on Qt and Poppler.
• Kile is a popular free LaTeX editor for KDE (i.e., for Windows, Mac OS X, and Unix).
• iTeXMac is a popular free TeX editor and PDF previewer for Mac OS X.

3. You will probably also want a good PDF viewer. Some of the editors above include decent PDF previewers, but others depend on you to find one.
• Members of the Adobe Acrobat family (including the free reader) are sufficient so long as your editor knows how to kick them whenever your PDF is regenerated. Unfortunately, they are big and bloated and have a stagnant feature set.
• Mac users should check out the free Skim, which supports auto-refreshing and lots of other helpful features.
• Windows users might want to check out the free Sumatra PDF, which is a minimal PDF viewer that supports auto-refreshing and has some other nice features.

4. You may want some examples to get you started.
It might be helpful to see my old homework template page too.

5. You will often want to include figures in your documents. To make this process easier, make sure you have these two lines in your LaTeX preamble:
\usepackage{caption}
\usepackage{graphicx}

Then, in the main part of your document, you can choose whether to include your graphics as "floats" or not. Most figures in books are "floats." That is, they do not appear exactly where they are mentioned in the text. Instead, they "float" to a convenient place (e.g., the top of the next page). In lab reports, people sometimes prefer that their graphics do not float.

To include a graphic as a float, use lines like
\begin{figure}
\includegraphics[width=0.5\columnwidth]{my_graphics_file.png}
\caption{A nice caption for my figure.}
\label{fig:a_unique_fig_label}
\end{figure}

Alternatively, if you want the figure to be typeset EXACTLY where you place it within your source code, use lines like
\begin{center}
\includegraphics[width=0.5\columnwidth]{my_graphics_file.png}
\captionof{figure}{A nice caption for my figure.}
\label{fig:a_unique_fig_label}
\end{center}

That is, replace the figure environment with a center environment and replace the \caption line with a \captionof{figure} line.

A similar procedure exists for tables (i.e., tables can be included as floats as well).

In the \includegraphics lines above, a "width" parameter is set to half of the column width (i.e., 0.5\columnwidth). You can change this to an absolute dimension as well (e.g., [width=3in] for a three inch width). You can even use height instead (e.g., [height=3in] for three inch height). In either case, the image is scaled so it maintains the correct height:width ratio.

In the example above, a PNG file was included.
• If you want to include PNG, GIF, JPG, or PDF files, you must use PDFLaTeX.
• If you want to include EPS files, you must use LaTeX.
So when you export files from MATLAB, make sure you choose an appropriate file format.

6. Additional LaTeX examples (e.g., LaTeX code for electronic circuits, graphs, and block diagrams) can be found in my Mercurial repositories for
• ECE 209 (not too much here),
• ECE 327 (a circuits lab with lots of documents with lots of circuit diagrams),
• ECE 481 (not too much here),
• ECE 758 (a controls lab with lots of LaTeX and MATLAB generated figures).
Click on the files links and navigate the tree.

7. Some other terrific examples can be found on the web.
• PSTricks lets you harness the power of PostScript to draw great looking line drawings inside TeX.
• PGF/TikZ has been growing in popularity as a more portable alternative to PSTricks.
• The TeX Users Group (TUG) links to lots of helpful resources.
• The Comprehensive TeX Archive Network (CTAN) is a huge central store of useful TeX material.
• The LaTeX Community forum can be a great resource that can quickly answer some of your questions.
• The comp.text.tex (CTT) Usenet newsgroup has been a resource for TeX users for a long time. Search and participate.

### Course Policies

1. E-mail correspondence:

I am happy to assist students by e-mail. However, all e-mails to me must have "758" (without the quotes) in their subject. This step lets the e-mail to be filtered on delivery into a safe folder where it will be read ASAP by me. Otherwise, I cannot guarantee that the e-mail will not treated as spam.

I prefer that the subject starts with "ECE758: " (without the quotes).

2. Office hours (and walk-ins):
If the provided office hours do not work for you, please e-mail me to setup an appointment. Alternatively, you can stop by my office. I’m usually in the office, and I usually can spare a few minutes to help.
3. Labs
• Students are required to attend all six labs.
• Students will work in groups of two.
• Disk space has been prepared at each bench for storing laboratory results. However, for their lab reports, students should save their results either over the ECE network or on some other portable storage device.

4. Pre-lab and post-lab assignments:
Pre-lab and post-lab assignments should be completed INDIVIDUALLY by EACH STUDENT. These assignments are NOT group assignments.

• Pre-lab assignments: At the beginning of each lab, answers to questions from the corresponding pre-laboratory assignment (posted on the instructor’s course web page) should be submitted for a grade.
• Most of the theoretical work for each laboratory experience is completed in the pre-laboratory assignment, and so you should keep a copy of your results to assist you in class.

• Post-lab assignments: Post-lab assignments (posted as part of the lab procedures on the instructor’s course web page) are due at the beginning of the next lab session.

Assignments will be penalized 10% per day late.
2. the assignment name (e.g., "Lab 1 Pre-lab" or "Lab 2 Post-lab")
3. the class identifier (i.e., "ECE 758")
4. the section day and time (e.g., "Thursday 8:30")
5. the section’s instructor name (e.g., "Grader: Ted Pavlic")
6. your bench number from label on each table (i.e., 1, 2, 3, 4, or 5)
See the lab writing resources and the help getting started using TeX/LaTeX for help digitally composing your assignments. Students are encouraged (but not required) to use TeX (in particular, LaTeX) for assignment submissions.
5. Pop quizzes: Pop quizzes are used as necessary to keep students up to speed on all aspects of the laboratory.

6. Lab project (and final exam):
After the sixth week, each student will have open access to the laboratory to complete his or her class project (an interesting and modern control system implementation) before the end of the quarter. At the completion of the project, the student will complete an oral presentation of the control system to the instructor and the TA.
There is no separate final exam for the course.
The quarter project should be completed individually. Hence, during the quarter all students should become familiar with both the software and hardware used in the lab.
The percentage contribution of each assignment to the final grade is as follows.
 Lab 1 (Overview): 10% from post-lab submission Lab 2 (Modeling and System ID): 10% split 40:60 between pre- and post-lab submissions Lab 3 (PID Control): 10% split 50:50 between pre- and post-lab submissions Lab 4 (Linear Quadratic Regulator (LQR) and Observer): 10% split 50:50 between pre- and post-lab submissions Lab 5 (Nonlinear Control): 10% split 75:25 between pre- and post-lab submissions Lab 6 (Distributed Resource Allocation): 10% split 50:50 between pre- and post-lab submissions Lab project: 40% from oral presentation
8. Attendance:
You are responsible for all course materials. I can try to help you make-up work from an absence, but I will need to know about the absence as soon as possible (preferably well before the class).
9. Late policy:
I will not accept late assignments without penalty unless prior arrangements (at least 24 hours in advance) have been made.
10. Make-up lab work:
In the event that some of the in-class work in this lab requires more time, I will try to make arrangements to be available to open the lab for make-up work. However, I do not plan on doing this often, so students should try to finish the experiments during normal class time.
11. Honor code:

Although students may work together outside of class on assignments, all handed-in material must be unique. That is, each individual student should actually compose his or her assignment submissions separately. Assignment submissions should reflect individual work and not any sort of collaboration.

Any written material turned in to me falls under the purview of the University and the ECE Honor System rules. If an assignment submission does not represent an individual’s understanding of the material, I will consider it to be an honor code violation. In these cases, I must report the incident to the ECE department.

12. Disability services:
Students with disabilities that have been certified by the Office for Disability Services will be appropriately accommodated and should inform the instructor as soon as possible of their needs.
The Office for Disability Services
150 Pomerene Hall
1760 Neil Avenue
Telephone: 614-292-3307, TDD: 614-292-0901
http://www.ods.osu.edu/

### Course Information

From ECE Department ABET Syllabus for ECE 758:
Course supervisor: Professor Kevin M. Passino

#### Catalog Description:

Laboratory study of advanced feedback control techniques as applied to nonlinear and multi-output systems under computer or microprocessor control.

Course Prerequisites or Concurring: 557 or 755 or grad standing

Courses that require 758 as prerequisite: none

#### Prerequisites by Topic:

Control system design by classical and modern techniques.

#### Course Objectives:

1. Utilization of real-time code for digital control (Criteria 3(a),(b),(k)).
2. Introduction of advanced feedback control techniques as applies to nonlinear and multi-output systems under computer or microprocessor control (Criteria 3(a),(e)).
3. Implementation of design with accompanying analysis (Criteria 3(a),(c),(e),(k)).
4. Promote (interdisciplinary) team efforts via working with lab partner(s) (Criteria 3(d),(g)).
5. Improve written communication skills through laboratory and project reports (Criterion 3(g)).

#### Class Meeting Pattern

• 1 2-hour class
• 1 4-hour lab

### Related Courses

Other good control labs: ECE 757

Other good communications and signal processing (comm/SP) labs: ECE 508, ECE 609

[ Contents | Top ]

Website and original documents