Tek merkezden denetlenen çok PLC'li bir sistemin tekstil boyama prosesinin otomasyonunda kullanımı
Application of a central controlled multi PLC system to the textile dyeing process
Yazar: MUVAFFAK AMASYA
Danışman: DOÇ. DR. MEHMET BÜLENT ÖRENCİK
İstanbul Teknik Üniversitesi / Fen Bilimleri Enstitüsü
Derece: Yüksek Lisans, 1995
Konu: Elektrik ve Elektronik Mühendisliği = Electrical and Electronics Engineering
Dizin: Boyama işlemleri = Dyeing process ; PLC = Programmable logic controller

Özet:
Bu çalışmada öncelikle kumaş boyama sürecinin otomasyona geçirilmesi amacıyla tasarlanmış programlanabilir lojik kontrolörün (PLC) yapısı incelenmiştir. Bütün boyama işlemi, makinanın defalarca su alıp belirli sıcaklıklara ısıtılıp, çeşitli kimyasal ve boya maddelerinin belirli eğrilere göre makinaya verilmesidir. Bir boyama prosesi boya programının adımlarının ardışıl olarak yürütülmesi ile gerçekleşir. Boya programı, belirli bir boyama prosesinin adımlarının bir dizi fonksiyon kullanılarak tarif edilmesidir. Boyama programı oluşturan fonksiyonlar merdiven diagramla gerçekleştirilmiştir ve böylece fonksiyonların özellikleri, kullanıcı isteklerine veya makinanın özelliklerine göre rahatlıkla değiştirilebilmektedir. Çalışmada daha sonra kumaş boyama makinelerini kontrol eden PLC'lerin PC ile haberleşmesini sağlayacak, bir haberleşme protokolü tasarlanmış ve gerçeklenmiştir. Kullanıcı, kontrolörlerden toplanan verileri grafikler yardımıyla incelerken veya planlama yaparken veya bilgisayarda boya reçeteleri hazırlarken, bilgisayar ile kontrolörlerin haberleşmesinin sürmesi gerekir.Bu nedenle haberleşme programı DOS işletim sisteminde iki görevli çalışmayı düzenleyecek şekilde yazılmıştır. Bunu sağlamak amacıyla görevler arası anahtarlamalarde gerekli olan kesmeler kontrol edilmiş ve yeni yazılım kesme hizmet programlan yazılmıştır. Programlanabilir lojik kontrolörlerde genellikle kapalı çevrim kontrolü geleneksel PID (oransal,integral,türevsel) ile gerçekleştirilir. Bu çalışmada ise kapalı çevrim kontrolü bulanık algoritma ile gerçeklenmiştir. Bu amaçla NLX230 bulanık mikrokontrolöre sahip bir elektronik kontrol kartı tasarlanmıştır. Bir uygulama olarak da boyama prosesinde istenen rengi ve kaliteyi tutturabilmek için çok önemli bir yeri olan sıcaklık kontrolü ve dozajlama fonksiyonlanndaki kontroller bulanık algoritma ile başarıyla yapılmıştır. ix

Abstract:
In this study, a designed Programmable Logic Controller (PLC) was analysed, a communication protocol between the PLC and personal computer(PC) and then closed loop control was implemented by fuzzy logic instead of PID controllers. The design criteria for the fırst PLCs were specified in 1968. The primary goal was to eliminate the high cost associated with inflexible, relay- controlled systems. The specifications required a fbced system with computer flexibility, to survive the industrial environment, to be easily programmed and maintained by plant engineers and technicians. The PLC is now a mature control system offering much more than was ever anticipated. it is now capable of communicating with other control systems, providing production reports, scheduling production, and diagnosing its own failures and those of the machine ör process. These enhancements have made the PLC an important contributor in meeting today's demands of higher quality and productivity. in spite of the fact that the PLC has become much more capable, it stili has the simplicity of operation that was originally intended. PLCs can be used in many modern industrial systems. Furthermore, the PLC,that is explained in this study, is especially used in dye-houses. The PLC monitors and controls dye processing in textile industry. Thus, it provide accurate color blending and matching process to predetermined values. A programmable controller is composed of two basic sections: the central processing unit (CPU) and İnput/output (I/O) interface. These sections are illustrated in Figüre 1. /N/x fN T.Central" nPut^ Processing -* OutPutinterfaceUnit °interface NJ VJ\./ Fiğ. 1. Block Diagram of a PLC The CPU reads the input data from various sensing devices, executes the stored user program from memory and sends appropriate output commands to control devices. This process is done continuosly and is called scanning. The I/O system forms the interface by which fîeld devices are connected to the controller, Signal sources such as push buttons, limit svvitches, analog sensors, are wired to terminals on the input interfaces. Controlled systems such as motor starters, solenoid valves and position valves are connected to the terminals of the output interfaces. A dye program defines a certain dying process' steps and each step corresponds to a function such as filling water, heating, dosing. A dye process is implemented by executing its program's steps in sequence. Ali functions are implemented by ladder diagrams independently. While a step of dye program is being executed, only its small ladder diagrams seans, in addition to this, ali necessary parameters for the process i.e., water level in filling water function, temperature hı heating function are asked to user during loading the dye programs to the PLC, Then these parameters are passed to the ladder diagrams automatically by the PLC. Thus, a very user fiiendly environment is provided. A standard PLC, hovvever, has a large ladder diagram block and it always seans the same block continuously. Furthermore, user must change parameters on the ladder diagram block at every dying process because standard PLCs do not pass any parameters automatically. The ladder instruction symbols can be formatted to obtain the desired control logic. The ladder instruction symbols that PLC has is as follows: -Relay type instructions (normally öpen contact, normally closed contact, coil) -Tüner and counter instructions (normally öpen timer, normally closed timer, normally öpen counter, normally closed counter) -Data manipulation operation (compare less than, compare greater than) -Loop control functions (temperature control function, dosing function) These ladder instruction symbols are used either individually ör hı combination to form instructions deteraıining whether a device is to be svvitched on ör off. During a dye program's step execution, the process of reading the analog and digital inputs, executing the step's flınction and updating the outputs takes less than 5 ms. As control systems become more complex, they require more effective communication schemes among various system components. Some machine and process control systems require PLC's to be interlocked so that data can be passed among them to accomplish the control task effîciently. A communication protocol is implemented in order to enable communication betvveen PLC and PC. Öne of the biggest advantages of the communication scheme is that PC monitors status of PLCs. This feature provides the user with the means to control ali operations of ali controllers at the same time. The user also sends dye programs to the controllers very easily and examine the completed process from graphics. in this confıguration master slave bus topology is used. There are several slaves (PLCs) and a controller (PC) which acts as a master. There are three states in this protocol: 1-Polling 2-Sending data to PLC 3-Getting data from PLC Polling is a technique by which each slave (controller) is polled, ör interrogated in sequence by the master (PC) to see its status. The PLC allots 500 ms for each controller and mis period is divided into 4 time intervals. in the fîrst time interval, the PC sends a message to a specific controller and waits for a certain time for the controller to respond. The controller should respond by sending data. If the PC actually receives a response, it waits until the end of the interval. Othenvise, PC tries to poll the same controller at the second and third time intervals. If the controller does not respond to the PC, PC assumes that this controller has lost the connection and polis the next öne and, ete. While the PC is only interrogating the controllers, numbers of idle time intervals is betvveen l and 3. When the PC sends data to a PLC ör gets data from a PLC, ali idle time intervals are used to complete data transfer as soon as possible. The message format looks like byte count oriented message format. Fiğ. 2 shows the message format. STX header user data ETX trailer destination Legends: STX : start of the text(55h) ETX : end of the text(AAh) checksum Fig 2. Message Format The flow control protocol is similar to the Ping-Pong protocol with timeouts Only the PC is able to initiate transmissions and only it is responsible for yhe safe of the communication. The PC sends a message and waits for acknowledge messages from the PLC. This Protocol is shown in Fig. 3. İ Personal Computer PLC ts(a):calculated check sum by PC ts(v):caiculated check sum by PLC Fig 3. Sending data to PLC from PC Xlll X. Personal. Computer PLC { receive J ^>mes:> preparing the message "p" <^mes: ts(a):calculated check sum by PLC ts(v):calculated check sum by PC Fig 4. Getting data from PLC When the PC polls a specific PLC, PLC sends its status to the PC. All analog values such as temperature, machine water level, side tank water level, executing program no and step no and etc; are indicated in the status message. PC collects these information in files for each controller on a continuos basis. The user can use this data,stored on the hard disk, to examine the completed processes by application programs. For example, while the user examines a time-temperature diagram or a dosing diagram of a process on the PC, the PC must still continue to communicate and collect data from controllers. So two tasks must be executed on the PC simultaneously and this is called multiprogranuning in the literature. This program executes on the MSDOS operating system and mul%rogramming on the MSDOS is not an easy and well defined task. Many software interrupts must be controlled while switching from one task to another. Conceptually two tasks (communication program and application program) have their own virtual CPU. In fact what happens is, the CPU switches back and forth from task to task. Switching from a task to another task is achieved by real time clock interrupt. While switching from one task to another task, we must control several aspects. It is more informative to look at this via an example, when user wants to print a character on the screen or access hard disk, intllh software interrupt is called and int21h is a non-reentrant interrupt service routine. Let's assume that a task wants a service from int2 lh while the service is continuing. Switching from a task to another task occurs but the new task also wants a service from int21h and int21h service program is interrupted so that all variables and registers are destroyed. Therefore, we must prevent int21 service routine from being called if it is busy. In this program, int21h moves a free software interrupt int90h in order to control int21. The new int21h software interrupt service routine is shown as follows: Set int21h busy flag Call int90h (original int21) Clear int2 lh busy flag Before switching from one task to another task, it is controlled whether int21h is busy using int21 busy flag. If intllh is busy, switching is not allowed. Thus, int21h service does not call simultaneously. The communication program uses only int21 software interrupt so that controlling only int2 1 is sufficient. The source code of the communication program that was written in C language and is given in Appendix A. In modern industrial automation systems, closed loop control functions, mostly based on PID control, are standard. PH>, the proportional derivative integral process, is an industry standard and well understood by control engineers. An improvement, however, over the more traditional PID methods is to use of fuzzy logic having demonstrated superior performance in closed loop control. Furthermore, fuzzy logic offers the additional advantage of faster design. One important application of fuzzy logic is closed loop control. The combination of conventional closed loop control functions with fuzzy control gives good results. In this study, a closed loop control is implemented by using NLX230 fuzzy microcontroller. Fuzzy control was applied at dosing and temperature control functions. Dosing function and temperature control function are most important functions in dying process. In dosing function, dyes and chemicals are transferred from side tank to machine according to a dosing graph. Dosing graph percentage changes according to dying process. A 70% dosiag graph shows in Fig 4. This figure shows how 100 litres of chemicals is transferred from side tank to machine in 10 min. Temperature control is also very important in dying process. Fig. 5 shows a typical time- temperature diagram for a dye process. Dosing Curve (70%) Amount (1) Duration (min) Fig. 5. Dosing Curve(70%) Temp. (C) 10 30 50 70 90 110 130 150 170 Duration (min) Fig 6. Time Temperature Diagram The device principles of fuzzy logic is to calculate an optimum output action based on input conditions. Rules are used to determine the set of conditions present at the inputs. Each rule consists of up to sixteen term input/ fuzzy membership function, and an action value, which is the user defined, amount modifying the output value for that rule accordingly. The rule which best fits the given set of input conditions determines what modification will be made at the output. The rule processing is performed in parallel for all inputs and outputs. Up to 64 rules can be stored in the on chip 24 bit wide rule memory. These rules are shared across all of the outputs. The designed electronic circuit is shown in fig. 7. Fuzzy PCB has 5 inputs and 3 outputs. NLX230 reads rules from 93C56 EEPROM (Electrical Erasable Programmable Read Only Memory). The master microprocessor 80C51FA sends error and error rate to the fuzzy PCB and then NLX230 decides for the outputs. After that master processor reads the outputs from NLX230. Thus, master processor controls heating, dosing and cooling valves based on fuzzy microcontroller's output. The block diagram is shown in fig. 8. temperaturer side tank level ADC Board 1 error Supervisor | error rate outputs of NLX230 NLX230 Connection Board 2'v - *^D*3- *- Pneumatic valve Fig 8. Block Diagram The simplest method of handling an action value is through immediate defuzzication. This method takes the action value of the wining rule and sends it directly to the actuator being controlled. M other words, the immediate defuzzication is a type of look up table. Therefore, ifan application requires only on/off control or even stepped control the immediate mode is an efficient solution. However, when analog response is required or when the actuator has too many levels that the look up approach is not practical. The accumulating method of defuzzication provides the designer with a scheme for driving outputs with integrator functions. By making an output a function of its previous output, smoother and higher resolution changes can be affected. If the fuzzy microcontroller (previous output + action value) mode is used, the solution is not successful because the fuzzy microcontroller can process its rules faster than the actual can respond. In this study, the accumulating method of defuzzication is used, but adding the action value of the wining rule to the previous output is implemented by the master processor. Thus, sampling period can be changed easily. The membership functions for dosing and temperature control functions are shown in Fig. 8 and fuzzy rule matrix is shown in Table 1. Degree of Membership j L i o o 5 0 Small Positive Big Positive -2-1 0 1 error Degree of Big Small Membership Negative Negative Zero Small Big Positive Positive i o o 5 o 345 error rate Fig. 9. Membership Functions Table 1. Fuzzy Rules Matrix In conclusion, both communication program implementation and closed loop control implementation by NLX230 gives good results. In many dye houses, the status of all machines can be observed using this communication program and thus, the productivity and quality increase noteworthy. In addition to that, the manager of dye house can observe machines' status remotely by using a modem. Moreover, during the installation of controllers, all ladder functions, parameters etc.; can be send easily, quickly and correctly. Although PID fundamentals are well understood, designing an actual system invokes a detailed understanding of the mathematical models of the actuators in a system. Even with this understanding, it is usually necessary to tune a PID based system to realize an optimum response. The fuzzy approach is simple and can be constructed using only two inputs,error and error rate. Furthermore table 2 summarizes performance comparison based on multiple tests against conventional discrete PID system. For every parameter the Fuzzy approach proved to be superior. For instance during dosing and heating functions, NLX230 calculates all outputs by performing parallel operations, instead of using PID algorithms executed sequentially to control outputs. Another drawback of PID algorithms is that they take to much processing time. On the other hand, when NLX230 is used, processor sends only the error and error rate to NLX230 and reads outputs consequently, the processor does not need to calculate a lot of multiplication and divisions. We have observed that fuzzy microcontroEers are much better than the conventional techniques i.e., PID techniques in terms of performance.