EGH167 Hands-on Lab

Lab 6: Control Systems

 

Introduction

Background

The concept of control is often taken for granted by engineers. The cruise control on a car, for instance, is very familiar and easy to overlook. Though, the exact method by which the car is able to maintain a constant (or nearly constant) speed involves many steps. Similarly, a refrigerator keeps food at a constant cold temperature, regardless of the house temperature, using a control system. Radio receivers lock onto radio stations and adjust the tuning in a mobile vehicle using a control system as well. Control systems are therefore quite involved in maintaining many variables that affect daily life within an acceptable range.

Purpose

The purpose of this lab is to familiarize you with the properties of some basic control types, and to give you hands-on experience with some control settings.

Basic Principles

In this lab write-up, we will cover some basic principles behind:

1)            On/Off Control,

2)            Proportional Control,

3)            Proportional-Integral Control (PI), and

4)            Proportional-Integral-Derivative Control (PID)

Lab Experience

The lab experience will encompass:

1)            A PID Controller and Heat Exchanger,

2)            A Simulation using Matlab with Simulink,

3)            The Handyboard with one DC motor and a CdS cell, and

4)            The Handyboard with a DC motor and two microswitches.

 

 

 

 

 

 

CONTROL TYPES

On/Off Control

A basic control mechanism is the on/off control. An example of which is the furnace in a household. The thermostat is connected to the furnace and acts as a switch. If the temperature set in the thermostat is less than the actual temperature reading, the thermostat turns the furnace on to generate heat When the temperature in the house reaches the desired temperature setting, the thermostat automatically shuts off the furnace. The cycle then repeats itself as needed while trying to maintain the temperature of the house as close as possible to the desired temperature setting.

 

This type of control is called On/Off control. It works by adjusting a controlled variable (in our example the furnace changing the air temperature) to achieve a setpoint. The following graph illustrates the nature of the on/off control. The desired temperature in this case is 70F.

 

Note that the temperature DOES NOT HOLD PRECISELY AT 70F, but rather oscillates around that value. While it is acceptable for the temperature in a household to oscillate, this type of oscillations causes great concerns in other applications using on/off control.

 

Proportional Control

A slightly more complex type of control is proportional control. An automobile cruise control is an instance where proportional control is used. If we were to design a cruise control (A cruise control will attempt to keep a car driving at a constant speed automatically) using the On/Off control scheme, the car would be continually surging and going through a cycle of accelerating (full throttle) and decelerating (no throttle).

 

A cruise control would benefit from the ability to adjust the throttle throughout the full throttle range. Based on the set speed, the control system reads the throttle and keeps the throttle steady while the speed remains the same. If the speed drops, the system increases the throttle by an amount proportional to that reflecting the decrease in speed. On the other hand, if the speed increases, the throttle is proportionally lowered.

 

For further illustration, let us suppose that we set the cruise control at 50 mph, and the throttle was 50%. If the speed drops to 45 mph, the system might be set to increase the throttle proportionally, say to 55%. If the speed drops to 40 mph, the throttle would be increased to 60%.

 

Let the difference between the set speed and the actual speed be the error (E). The throttle percentage (T) is related to the error using the following equation:

 

 

Where K is a proportionality constant and Ts is the initial throttle setpoint (Ts which was 50% in our example).

 

There are two problems with a proportional control scheme. Firstly, a proportional control system might not actually reach the desired setpoint. For example, if the car started up a hill and slowed to 45 mph, 55% throttle might not be enough for the car to actually speed up. Secondly, a proportional controller can still vary some even when it is working well (although is should work much better than On/Off control).

Proportional-Integral Control (PI)

In order to make our cruise control more adherent to the set speed, we need to find a way to make it "smarter." For example, if the car starts up a hill and reduces speed to 45 mph, we'd like the car to adjust the throttle enough so that the car returns to 50 mph. What we really want the control system to do is make an initial adjustment (for example 55% as before), but then make further adjustments if the speed doesn't change. For example, if after a few seconds the speed has still not returned to 50 mph, we'd like the cruise control to raise the throttle even further (say to 60%).

 

Proportional-Integral (PI) control can make the desired adjustments. The controller uses the proportional control , and adds the integral of the error signal to the throttle as in the following equation:

 

Where Ki is the integral constant.

 

For further illustrations, suppose that the speed was set at 50 mph, and the throttle was 50%. Let's also assume K and Ki are both equal to 1. If the speed reduces to 45 mph, and has been there for 5 seconds, then:

 

T = 50% + 1 * (50mph - 45mph) + 1 * (50mph - 45mph) * 5sec

 

T = 50% + 5 + 25 = 80%

 

And as time passes, the throttle will just keep on increasing. Eventually the throttle should start to affect the car and it will return to 50 mph.

Proportional-Integral-Derivative Control (PID)

PID control comes in handy when the car crests the hill and starts to gain speed. If the hill is very steep, the PI controller may not be able to adjust the speed fast enough to keep the car from running away. In this case, we prefer the cruise control to be "alert" to how fast the car is accelerating. If the car starts accelerating too fast, the cruise control ought to lower the throttle in a timely manner.

 

The derivative of velocity over time (dv/dt) is acceleration. Thus, when we include the derivative of the velocity (the error in speed will work just as well) we can adjust the throttle accordingly. The control equation would then be :

 

 

Where Kd is the derivative constant.

 

For further illustration, suppose that the speed was set at 50 mph, and the throttle was 50%. Let us also assume K, Ki, and Kd are all equal to 1. If the speed increases to 55 mph, and has been there for 2 seconds, and the car is accelerating at 5 mph/sec then:

 

 

As more time passes and/or the car keeps accelerating, the throttle will just keep on decreasing. Eventually the throttle should start to affect the car and it will return to 50 mph.

Optimal Choice for K

The choice of K values depends on the desired performance. Firstly, we'd like it to be able to handle most speed changes without surging. Secondly, it is important that the system be stable, which means that is does not start accelerating/decelerating in ever increasing waves. Lastly, we just want it to be able to adjust the speed in a conservative manner.

 

In the early 40's, two engineers named Ziegler and Nichols came up with a method of finding the proportionality constants (which is called tuning the controller) in a standardized way. It consists of two steps.

 

q          STEP1: Control the system in a proportional only system and adjust the K value such that the output (in our case the car's speed) begins to oscillate. Record the K value (Ku) and the period of the oscillations (Pu).

 

q          STEP2: Set your K values according to these equations:

 

 

These values may not be the best one could find, but they will make a stable controller that will adjust fairly well.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

LAB EXPERIENCE

 

Make sketches of equipment used in class; include them in your lab write-up.

The PID Controller and the Heat Exchanger

The objective of this part of the lab is to observe a real life application of a control system using a PID controller. The output temperature of water running through a water pipe system is controlled to achieve the desired temperature.

 

q          Observe the control system running and write a paragraph or two describing its operation.

 

q          Sketch a diagram of the system including:

 

o       1.The Controller.

o       2.The Sensor(s).

o       3.The Plant.

o       4.The Actuator.

o       5.The Output Display.

 

q          What safety considerations should be observed when using this heat exchanger? Under what conditions will it work properly? Come up with two scenarios that are possible ways it could be used that would not be safe or recommended.

 

q          Describe how the control system is able to maintain a constant temperature even when the water flow is changed. What would happen if the water flow were shut off?

Simulation using Matlab with Simulink

The objective of this part of the lab is to use Matlab in conjunction with Simulink to achieve the task of controlling the cruise speed of a vehicle using a PID controller. We will use the Ziegler-Nichols tuning method to fine-tune the parameters.

 

  1. Use Matlab with Simulink to run the program pidctrl1.mdl.

 

q          Run Matlab and from the main menu choose Open and select pidctrl1.mdl.

 

q          Select Start or Stop from Simulation in the main menu to run or stop the program.

 

  1. Identify and describe every component of the control system shown.
  2. Determine the settings of the PID controller using the Ziegler-Nichols' method (see additional diagrams). The reference speed is 65mph.
  3. Plot and print the system response using the obtained settings (use appropriate scaling so that the steady state can be seen).
  4. Compute the time domain specifications: Peak time (tp), settling time (ts), and overshoot (Mp).
  5. Modify the settings of the PID controller in order to improve (or cancel, if possible) the oscillations and minimize the overshoot in the system response. Indicate the settings of the PID controller and repeat parts 4 and 5.

The Handyboard with one DC motor and a CdS cell

The objective of this part of the lab is to get insight into how light information from a CdS cell can be used not only to control the speed, but also the direction of rotation of a DC motor.

 

q          Examine the Handyboard, the sensor, and the DC motor. Make note of the ports being used. Sketch a diagram of the system.

 

q          Run IC to download the given code (cdsmotor.c) to the Handyboard.

 

q          Vary the light intensity being applied to the CdS cell and observe the response. Modify the given code to allow the motor to switch direction of rotation at a specific value of light intensity. Choose an appropriate threshold value for this experiment.

 

q          Write a paragraph describing this control system.

 

q          Include the sketch of the system diagram and include a copy of both, the original and the modified codes.

 

The Handyboard with a DC motor and two microswitches

The objective of this part of the lab is to observe how the direction of rotation of a DC motor can be changed by using two microswitches and a Handyboard.

 

q          Remove the CdS cell from the Handyboard and connect two microswitches to digital ports 7 and 8, respectively. Sketch a diagram for the system.

 

q          Run IC to download the given code (swmotor.c) to the Handyboard. Change the status of the switches, observe the response, and write a paragraph describing this control system.

 

q          Include the sketch of the system diagram and include a copy of the code.

 

 

LAB REPORT

Format

  Lab reports must be done in Teams.

  Follow given lab report format.

  Maximum 4-5 pages (including figures and tables)

 

General Guidelines

  Cover page

  Description of Experimental Apparatus

  Introduction/Background

  Description of tests. Sketch test setups.

  Analysis of results/Summary.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

APPENDIX: Ziegler-Nichols tuning method

 

  Increase proportional gain Ku until continuous oscillations are obtained.

 

  Obtain the period Pu of the oscillations

 

  Compute P, I, and D for a PID controller:

 

 

P = 0.6*Ku I = 2*P/Pu D = P*Pu/8

 

 

Ziegler-Nichols Tuning for the Regulator D(s) = K(1+1/T1s+TDs), based on a stability boundary:

 

Type of Controller

Optimum Gain 

Proportional

K = 0.5*Ku

 

 

PI

K = 0.45*Ku

 

T1 = 1/1.2*Pu

 

 

PID

K = 0.6*Ku

 

T1 = (1/2)*Pu

 

TD = (1/8)*Pu