INTRODUCTION TO COMPUTER IN THE LOOP

COMPUTER IN THE LOOP

Most control engineering applications nowadays are computer based, where a digital computer or a microcontroller is used as the controller. Figure 1.3 shows a typical computer controlled system. Here, it is assumed that the error signal is analog and an A/D converter is used to convert the signal into digital form so that it can be read by the computer. The A/D converter

Digital Control-0012

samples the signal periodically and then converts these samples into a digital word suitable for processing by the digital computer. The computer runs a controller algorithm (a piece of software) to implement the required actions so that the output of the plant responds as desired. The output of a digital computer is a digital signal, and this is normally converted into analog form by using a digital-to-analog (D/A) converter. The operation of a D/A converter is usually approximated by a zero-order hold transfer function.

There are many microcontrollers that incorporate built-in A/D and D/A converter circuits. These microcontrollers can be connected directly to analog signals, and to the plant.

In Figure 1.3 the reference set-point, sensor output, and the plant input and output are all assumed to be analog. Figure 1.4 shows the block diagram of the system in Figure 1.3 where the A/D converter is shown as a sampler. Most modern microcontrollers include built-in A/D and D/A converters, and these have been incorporated into the microcontroller in Figure 1.4. There are other variations of the basic digital control system. In Figure 1.5 another type of digital control system is shown where the reference set-point is read from the keyboard or is hard-coded into the control algorithm. Since the sensor output is analog, it is converted into digital form using an A/D converter and the resulting digital signal is fed to the computer

where the error signal is calculated and is used to implement the control algorithm.

Digital Control-0013

Digital Control-0014

The purpose of developing the digital control theory is to be able to understand, design and build control systems where a computer is used as the controller in the system. In addition to the normal control task, a computer can perform supervisory functions, such as reading data from a keyboard, displaying data on a screen or liquid crystal display, turning a light or a buzzer on or off and so on.

Figure 1.6 shows a typical closed-loop analog speed control system where the desired speed of the motor is set using a potentiometer. A tachogenerator produces a voltage proportional to the speed of the motor, and this signal is used in a feedback loop and is subtracted from the desired value in order to generate the error signal. Based on this error signal the power amplifier drives the motor to obtain the desired speed. The motor will rotate at the desired speed as long as the error signal is zero.

The equivalent digital speed control system is shown in Figure 1.7. Here, the desired speed is entered from the keyboard into the digital controller. The controller also receives the con- verted output signal of the tachogenerator. The error signal is calculated by the controller by subtracting the tachogenerator reading from the desired speed. A D/A converter is then used to convert the signal into analog form and feed the power amplifier. The power amplifier then drives the motor.

Since the speed control can be achieved by using an analog approach, one is tempted to ask why use digital computers. Digital computers in 1960s were very large and very expensive devices and their use as controllers was not justified. They could only be used in very large

Digital Control-0015

and expensive plants, such as large chemical processing plants or oil refineries. Since the introduction of microprocessors in the early 1970s the cost and size of digital computers have been greatly reduced. Early microprocessors, such as the Intel 8085 or the Mostek Z80, were very limited and required several chips before they could be used as processing elements. The required chips were read-only memory (ROM) to store the user program, random-access memory (RAM) to store the user data, input–output (I/O) circuitry, A/D and D/A converters, interrupt logic, and timer circuits. By the time all these chips were put together the chip count, power consumption, and complexity of the basic hardware were considerable. These controllers were in the form of microcomputers which could be used in many medium and large digital control applications.

Interest in digital control has grown rapidly in the last several decades since the introduc- tion of microcontrollers. A microcontroller is a single-chip computer, including most of a computer’s features, but in limited sizes. Today, there are hundreds of different types of mi- crocontrollers, ranging from 8-pin devices to 40-pin, or even 64- or higher pin devices. For example, the PIC16F877 is an 8-bit, 40-pin microcontroller with the following features:

• operation up to 20 MHz;

• 8K flash program memory;

• 368 bytes RAM memory;

• 256 bytes electrically erasable programmable read-only memory (EEPROM) memory;

• 15 types of interrupts;

• 33 bits of parallel I/O capability;

• 2 timers;

• universal synchronous–asynchronous receiver/transmitter (USART) serial communications;

• 10-bit, 8-channel A/D converter;

• 2 analog comparators;

• 33 instructions;

• programming in assembly or high-level languages;

• low cost (approximately $10 each).

Flash memory is nonvolatile and is used to store the user program. This memory can be erased and reprogrammed electrically. EEPROM memory is used to store nonvolatile user data and can be written to or read from under program control. The microcontroller has 8K program memory, which is quite large for control based applications. In addition, the RAM memory is 368 bytes, which again is quite large for control based applications.

Leave a comment

Your email address will not be published. Required fields are marked *