A Microcontrolled System Applied to Process Control Analysis and Design

A Microcontrolled System Applied to Process Control Analysis and Design

Copyright ~ IFAC Intelligent Components and Instruments for Control Applications, Annecy, France, 1997 A MICROCONTROLLED SYSTEM APPLIED TO PROCESS CO...

1MB Sizes 42 Downloads 169 Views

Copyright ~ IFAC Intelligent Components and Instruments for Control Applications, Annecy, France, 1997

A MICROCONTROLLED SYSTEM APPLIED TO PROCESS CONTROL ANALYSIS AND DESIGN

Mu-cio G. Faccin, Julio C. S. Vicente, Moises M. B. Pontremoli and Romeu Reginatto { mg£: julio, moisesbp, romeu } @iee.ufrgs.br

Laboratory ofElectro-Eletronic instrumentation Electrical Engineering Department - UFRGS Federal University ofRio Grande do SuI - Porto Alegre, Brasil

Abstract: This work describes a Microcontrolled System which allows simultaneous (or single use) operation of fuzzy logic control, PID control and system simulation. The software is dynamically reconfigurable, to allow on-line changes in the system structure. The main idea is to have a software-hardware system which allows the implementation of many different test patterns related to control systems, such as the performance comparison of control algorithms. The proposed approach supports process simulation as well as real-time interfacing to real processes. Results are presented showing the main features of the system.

Keywords: Microcomputer based control, Simulators, Fuzzy control, PID control, Monitored control systems

control option. However a microcontrolled system is a smaller and lower cost equipment choice, with analog interface directly on the same board, and is a widely applied hardware for controllers implementation. The system descnbed in this paper was designed for applications with PID control and fuzzy logic control. Despite that, many other kinds of control algorithms may be added to provide new control design tools to the user. PID control is one of the most used in industrial applications. It is a linear control, based on the effect of proportional, integral and derivative feedback gains. On the other hand, fuzzy logic control is a nonlinear control, based on multivalued logic, developed by Jan Lukasiewicz in the beginning of the 30's (Kosko, 1992). This logic was an extension of conventional logic, in that only two states (true or false, 0 or 1) are acceptable. In multivalued logic, a real interval [0 ; I] sho'ws that, perhaps, an event is not false, but is also not true. In short, multivalued

l. INTRODUCTION Simulation has been extensively used in the development of control systems in order to prevent failures at a much lower cost than while in operation. In addition, the control implementation on the real process requires more time than performing simulations, since simulation allows analysis of process variations and abnormal conditions immediately. However, from simulation to implementation there is usually a wide gap and errors can be introduced in performing such task. So there is the need for a quick transformation from the design, based on simulation, to the implementation of the real control. In addition, this procedure must keep the signals unchanged. The best way to get this is running the simulation and the control algorithms on the same hardware, with the same software. A good hardware for simulation is a PC computer, and there are many commercial simulators for it, some of them with a real-time 463

which has an analog interface with the real process and a communication interface with the Master System.

logic describes an event which may happens partially.

Although the multivalued logic was dated of 30's, fuzzy logic only appeared in Zadeh (1965). Zadeh proposed a linguistic and intuitive model, expressed by words, not by equations, to descnbe and control a system. Then, the control problem was reduced to the construction of behavioral rules and characteriiation of linguistic variables, by the construction of fuzzy sets. In the Laboratory of Electro-Eletronic Instrumentation (lEE), of Federal University of Rio Grande do Sul, research work with fuzzy logic was developed on simulation and control, in the way described by Driankov et al. (1993) called PID-like FKBC (Fuzzy Knowledge Based Controller). This controller is a fuzzy logic controller, with linguistic description of inputs and outputs, which inherits PID characteristics, due to rule antecedents - consequents relations. As a first result of this research, a PC program for simulation of a closed loop process control system with a PID-like FKBC was developed. This simulator was called FuzzyCAD (Vicente et al., 1997) and a briefing of it is presented in the Appendi..'X. Based on this simulator, optimization techniques were developed (Vicente et al., 1996), as well as a microcontrolled implementation of fuzzy logic based control of a real process. This microcontrolled implementation consists of a software that operates on a data structure which contains the system description - the fuzzy sets and the rules. This description is extracted from the same tex't file simulated by FuzzyCAD. This paper intends to descn1>e a general system, implemented on a microcontrolled low cost board, which can be used to analyze and design process control systems based on either PID control or fuzzy logic control using the same software and hardware tools for both simulation and implementation. This paper is organjzed as follows. First the whole system, including human interface, is described. Then software and hardware characteristics are detailed. Finally, some preliminary results are shown.

/

Slave SysttIn

/

Real Process /

7

Analog SinaIs

Communication

Human Interface

Protocol

Master System Fig. I - The proposed system description The exchanging of data between the two parts of the system (Master and Slave) is done

through a serial communication channel and a specially developed protocol. It allows the Master to send commands to and receive data from the Slave.

2.1 Microcontroller 's Software

To implement the proposed system, the software was divided into 3 modules: the communication module, the timing module and the application module. The communication module implements the communication protocol which allows the exchange of commands and data between the Master and the Slave. To perform such task, this module is implemented on both the Master and the Slave parts. In the Slave, it consists of an interrupt function which receives bytes, interprets them, and sends a response to the Master System. In the Master, it consists of a collection of functions to reprogram the Slave System operations in real-time and to acquire internal variables of the Slave System. The timing module is responsible for the scheduling and timing of the system. It consists of a timer interruption, which updates a clock register, and an event loop, which starts the application module at each sample. The application module implements both the control algorithm and either the process simulation or real-time interface to a real process. This module executes a sequence of operations described by a data structure which, by its turn, describes the control algorithm, the process simulation and other operations as a flux diagram. Then, each variable, or node, of the described process is the result of a function evaluation, with some known parameters, applied to other nodes.

2. SYSTEM DESCRIPTION The whole system consists of two parts: the Master System and the Slave System (see fig. 1). The Master System is responsible for the user-machine interface, and was implemented on a PC computer. Through the Master System, the user programs the experiments to be done and visualizes the obtained results. The Slaye System is the main part of the global system. It is responsible for running the control and/or simulation algorithms. The Slave System is implemented on a microcontrolled board 464

This module implements many usual functions, such as sum of two nodes, an Euler's improved integration method (Zill, 1979), a PID and a PIDlike FKBC controllers, besides AID and DIA functions, standard signal generators (square, triangular, sinusoidal and white noise) and nonlinear functions (dead zone, saturation, etc.). A text file encloses the description of the complete experiment, by listing the nodes of the flux diagram sequentially. This file is read by the Master System and sent to the Slave wich receives such description as a data structure and executes it in the application module. Such strategy allows real-time reprogramming since the evaluation of each node is done by the calling of a function pointed by a particular data of the same structure.

EIA485 interfaces and both digital and analog inputs and outputs). This system contains 3 PWM outputs and 8 AID inputs, which are conditioned by a low-pass filter, and an amplifier with manual adjustment of gains and off-sets.

3. Case Study Fig. 2 shows the control system used in the experiments. Two experiments were conducted using a PID controller in the first and a fuzzy logic based controller in the second. In both experiments, the testing device (the plant) consists of a simple two poles process with a transfer function given by T(s)=(0.256) 1 ( S2 + 0.516s + 0.038675 ). This control system is excited by a square signal in the reference input (ref), and sampled at lOOms.

2.2 Hardware Description

+

Since the implemented software is written in C language, theoretically, it is portable to many different hardware platforms. However, control of real processes needs AID and DIA converters, whose programming is hardware dependent. Also the communication system and the timing of the process are hardware dependent, and must be reprogrammed to allow multiple platforms running. The actual implementation runs on an Intel~ 80C 196KC microcontroller (INTEL HANDBOOKS, 1991), on a board developed by the Laboratory of ElectroEletronic Instrumentation of Federal University of Rio Grande do Sul - called IEE96 (Zuccolotto et al., 1995); which contains the basic 110 for the simulation and control system (like RS232 or Plant output

.1 • .19

PID output

0.28

Controller )!::...t rl .E:40

Plant

Output .. r

j

Fig. 2 - The closed-loop system In the experiment with PID control the process was simulated together with the controller. For this case, Fig. 3 shows the plant output signal, the reference signal, and the control signal.

:---_ _ 1.00

Fig. 3 - A simulation of PID conventional control for a variable system seconds of simulation, they were moved instantaneously to (s = -0.15 ± 0.1272 i ). This is a procedure that can be used to measure robustness of the control algorithm.

To show the features of the developed system, a change of the pole plant location was introduced during the simulation. The poles were initialy at (s = -0.425) and (s = -0.091) and, after 15

465

The digitallanalog interface was used in the experiment with PID-like FKBC, to control a real plant, an opamp electronic circuit, during 30 seconds. The acquisition starts when the reference

;: ~ '; 1ijr,l .•• :!!Ir

signal changes from -5 to +5 V. Fig. 4 shows the plant output, the reference step signal, the error and the control signals, respectively.

n

'r r}

~ r.

Fig. 4 - Signals of fuzzy control experiment.

4. CONCLUSIONS

5. REFERENCES A microcontroUed system intended to facilitate analysis and design of process control systems by shrinking the gap between the design and the implementation procedures was presented. This is achieved by running ·the same software for simulation and control and using a description of the system with a generic data structure, which may be dynamically changed. The proposed system is a simple programming emironment, which allows many different control experiments. For example, the change of the plant pole, shown in Fig. 3, which is a possible test panern used to measure the robustness of the control system, is easily implemented due to the dynamic parameter change feature. In the same way, after simulation testing samples, the same board may be used for control of real processes, through the AID and DfA functions, in substitution., or simultaneously to the process simulation. This system description also provides a simple platform for processing identification experiments, adaptive control and many other modem techniques of analysis and control of systems.

Driankov, D.; HeUendoorn. R ; Reinfrank, M.

(1993) . An Introduction to Fuzzy Control. Springer-Verlag, New York. INTEL HANDBOOKS (1991). i6 - Bit Embedded

Controller Handbook . Kosko, B. (1992). Neural Networks and Fuzzy

Systems. Prentice-Hall, New Jersey. Vicente,

J.C.S.,

M.G.

Faccin

and

M.M.B.

Pontremoli (1996). Simulation as an Aid to Fuzzy

Controllers

Development.

In:

11 th

instrumentation Seminary. pp. 242 - 252. IBP, Salvador, Brazil - in Portuguese. Vicente,

J.C.S.,

M.G.

Faccin

and

M.M.B.

Pontremoli (1997). "User Guide - FuzzyCAD in Portuguese", Technical Report 01197, ElectroElectronic Instrumentation - lEE f UFRGS. Porto Alegre, Brazil. 466

Zadeh, L. A. (1965). Fuzzy Sets. Information and

The 'description language' is modular, which allows not only to declare the linguistic variables, but also all other input, output, excitation, etc. variables used in the system. To each variable it is poss1ole to associate an input or output reference signal or operations like addition, subtraction, or multiplication between variables. The reference signals could be either triangular, rectangular or sinusoidal, with off-set and noise levels, if desired. The membership functions are descn1>ed by straight lines, like the usual ones: left, lambda and right All other programming steps like inference rules, defuzzyfication etc. are implemented in the literal way, using appropriate operators. A rather unusual application is the direct relation of FuzzyCAD with the conventional digital control systems which are implemented directly for the Z domain, using a transfer function like T(z) = k ( ao + al Zl + ... + a" i'") / (bo + bl Z-I + ... b.n z-nl) to describe a generic plant. The visualization of the graphics is divided into windows, in which membership functions and membership degrees of all linguistic variables are shown, besides the time response of some variables. During the simulation process the graphics can be copied to the memory for further use. This allows the comparison between systems, after a change in a parameter or in membership functions, or in any other variable of the object in simulation. Finally, the same text file used by FuzzyCAD with information of desired control may be used to program real application, in microcontroller.

Control voL8, p.338-353. Zill, Dennis G. (1979). A first course in differential

equations with applications. pp. 423 - 449. Prindle,

Weber

&

Schmidt,

Boston,

Massachusetts. Zuccolotto, M et all. (1995). Development System for

Intelligent

Instruments.

In:

COBISAICINISA - ISA-SHOW BRASIL '95.

3rd

sao

Paulo, Brazil - in Portuguese.

6. APPENDIX - A BRIEF DESCRIPTION OF FUZZYCAD FuzzyCAD is a simulation tool developed to teach concepts of Fuzzy Logic controllers. The program, written in C, consists of the following parts: an interpreter of the input descriptive variables, a simulation part, and a graphical user interface to show the results. The descriptive input language uses "reserved words" which initialize the simulation and visualization modules. In the first block the kind of defuzzyfication, the inference and the simulation steps are declared. The declaration of the linguistic variables is always related to its numeric range and its membership functions.

467