## 1.2 DISCRETE CONTROLLERS

• The system models we developed before allow us to predict how a system will behave. A separate, and important topic is computer control.

• With no controller we would set an input, and hope for an output. For example, push the gas pedal and hope for the right speed.

• A controller looks at the desired system condition, and the actual system condition, and then adjusts the input to bring the desired and actual closer. For example cruise control.

• The diagram below is a representation of a simple control system add to in the previous tank example, • We have already dealt with deriving an equation for the process. In this case it was the valve tank combination discussed before. By itself the tank is an open loop system, we set the valve angle and hope for a liquid level.

•Next, we need to find an equation for the controller. This equation can be highly dependent upon the control method to be used. If we are to use a computer it is best to have a simple equation, as shown below, (NOTE: the form of the equation, and the values of the coefficients change the nature of the control problem). • The controllers (equations) that follow will be put in the above form. These controllers can also be used individually, or combined to get more complex properties.

• Keep in mind that the typical objective of a control system is to minimize the error between the input and output. Another common goal is to do this as quickly, or efficiently as possible. One constraint we must observe is that the system should not become unstable.

### 1.2.1 A Proportional Controller

• One of the simplest controllers is the proportional control, • The magnitude of K will determine how fast the system responds. If the value is too large the system will oscillate and/or become unstable (i.e. flood or go empty). If too small the system error will be very large. (ie, the tank will never reach the right height.)

• This type of controller will always have a small error between the actual and desired values.

• For the water tank (from before) add a controller, and try varying ‘K’ values. • We could implement this controller using the Basic stamp chip. (Note: not a full implementation)  ### 1.2.2 Integral Control

• Integral controllers tend to respond slowly at first, but over a long period of time they tend to eliminate errors.

• The integral controller is based on a simple integration. • If the constant K is small, the longer term error will slowly drop off. If K is large the long term error will be reduced quickly. Too large a K value will result in a signal that grows out of control.

• Try controlling the water tank with the I controller, ### 1.2.3 Differential Control

• When there is a sudden change in the system the differential controller will be able to compensate. But in terms of long term effects the controller will allow huge steady state errors.

• The control equation can be derived as, • This larger the value of K the faster this controller will compensate for a change in the system.

• Try controlling the water tank level with the D controller, ### 1.2.4 Proportional, Integral, Derivative (PID) Control

• The functions of the individual proportional, integral and derivative controllers are complementary. When combined we get a system that responds quickly to change (derivative), generally track required positions (proportional), and will eventually reduce errors (integral).

• To get this we combine the expressions from the three individual controllers. Subscripts will be added to distinguish the ‘K’ gain values for each controller. • Quite often the three constants are made the same, giving us the simpler equation below. • This controller now allows us to vary the three different gains, and as a result we will change the performance of the system.

• Consider the examples below, 