Neural network modeling and control using programmable logic controller

21. December, 2011, Autor článku: Körösi Ladislav, Elektrotechnika
Ročník 4, číslo 12 This page as PDF Pridať príspevok

The article deals with the modeling and control of real hydraulic system using artificial neural network (ANN) perceptron. Modeling and control was implemented using Matlab and CompactLogix programmable logic controller (PLC). Article has the objective to demonstrate the real deployment of neural networks in industrial practice.

Modeling and Control of nonlinear processes using artificial neural networks in practice can be solved in two ways. The first way is the deployment of modeling and control algorithm in the master system (SCADA, Application running on the PC, local HMI, …). In this case, the algorithm is separated from the control system and therefore it is important to ensure trouble-free communication between these parts of control as well as fixed sampling time. In the event of a failure of communication, must take control the local control system.

The second solution is the implementation of intelligent algorithms directly to the control system. Most commonly used control systems are programmable logic controllers (PLC’s). PLC is a digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, etc. PLC’s are used in many industries and machines. For the programming of such control systems have been introduced IEC 61131-3, which unifies the programming languages of PLC’s from different manufacturers. PLC programmer has a choice of three graphical and two textual programming languages (IEC). They are:

  • Function block diagram (FBD) – suitable for sequence control.
  • Structured text (ST) – suitable for applications in writing, where the tasks are often repeated.
  • Ladder diagram (LD) – Suitable for event systems.
  • Instruction list (IL) – Suitable for timing and performance critical operations.
  • Sequential function chart (SFC) – Suitable for a higher level of control with regard to well established branching and parallel implementation of the programs.

Besides these programming languages, there are others, depending on the vendor-specific PLC’s, but the standard doesn’t define them.

For the purposes of the implementation of the ANN appears to be the best language ST, which is similar to the Pascal programming language. Of course there are differences in them because this language was developed for PLC programming. The program is written in free style, making it clearer and more readable. It is particularly useful for the expression of different data types, structures and complex mathematical calculations. Most PLC’s do not support matrix operations or dynamic allocation of one-dimensional or multidimensional vectors, therefore, the implementation phase of the ANN learning and processing can be difficult.

Variables must be pre-allocated, i.e. in the case of smaller ANN structures consumes unnecessarily PLC memory. Matrix operations can be programmed accordingly, but in this case they are not parallel operations, but sequential, decreasing the computing power of ANN. That does not mean that affects the quality of modeling and control. Implementation of optimal ANN structures in the PLC is possible in two ways. The first way is to implement the general algorithm, which can dynamically adapt to new structures depending on given parameters. The second is the fixed structure of the ANN implemented in the PLC. The block diagram of the hydraulic system is in Fig. 1.


Fig. 1 Block diagram of the hydraulic system

Short description of used components:

CompactLogix (1769-L32E) – Programmable logic controller from Allen-Bradley is used to control the hydraulic system’s level. The level is measured with pressure transmitter connected to analog input module (using unified 4-20mA signal). The control signal from analog output module is connected via 4-20mA to the inverter sending 0-100% (0-50Hz) signal.

PowerFlex 40 – Inverter from Allen-Bradley is designed for drives with power output from 0.4 kW to 11kW. It is connected to pump which pumps water from buffer situated under the tank to the upper part of the tank.

ST 3000 S900 – A smart pressure transmitter from Honeywell is used to measure the water level in tank with free drainage.

Calpeda NM 2/AE 400V 0.75kW – Monoblock centrifugal pump from the Calpeda company.

Measurement of input-output data for identification of the real system can be implemented in two ways. The first way is to backup data using visualization (RSView32 or RSView Studio), but this method does not guarantee accurate sampling period – loading data from the PLC. The second way is to backup data directly in the PLC and their export using the Tag Upload Download after measurement. In our case we used a second approach for data collection to identify and record values during the process control. Measured data (level – depending on the pressure sensing and control variable) are shown in Fig. 2 and Fig. 3.


Fig. 2 Time response of the control variable.


Fig. 3 Time response of controlled variable (level).

For the modeling of real physical system, we used the 4-6-1 ANN perceptron structure (Fig. 4). Inputs to the ANN were values u(k), u(k-1), y(k) and y(k-1). The output value was predicted level y(k+1).


Fig. 4 ANN structure for modeling the real system (linear activation functions in the input and otuput layers and sigmoid activation functions in hidden layer)

Structure of an ANN was created in Matlab (using newff function) and trained with back-propagation learning method and tested for over-learning. Comparison of time responses of the real plant level and ANN output is shown in Fig. 5.


Fig. 5 Comparison of time responses

Structure of the ANN control algorithm was implemented in RSLogix5000 for CompactLogix PLC. Weights and biases of ANN have been exported from Matlab to RSLogix5000. The chosen control algorithm was gradient-descent.

J_r = \frac{1}{2} \alpha (u(k)-u(k-1))^2 + \frac{1}{2} [r(k+1)-y_M(k+1)]^2

where ym represents the ANN model output

u(k)_{new} = u(k)_{old} - \beta \frac{\partial J_r'}{\partial u(k)_{old}}

The results for different parameters (affecting different control quality) are shown in the following figures (for sampling time 100ms):


Fig. 6 Time responses of the controlled hydraulic system for different prediction horizons 1, 5 and 10 (α=0,01)


Fig. 7 Time responses of the control variable for different prediction horizons 1, 5 and 10 (α=0,01)


Fig. 8 Time responses of the controlled hydraulic system for different prediction horizons 15, 20, 25. 30 and 35 (α=0,01)


Fig. 9 Time responses of the control variable for different prediction horizons 15, 20, 25, 30 and 35 (α=0,01)


Fig. 10 Comparison of time responses of the controlled hydraulic system for different α and constant prediction horizon 15


Fig. 11 Comparison of time responses of the controlled hydraulic system for different β and constant prediction horizon 35 and α=0.1

Conclusion

Intelligent control is class of control techniques like artificial neural networks, fuzzy logic, evolutionary algorithms, etc. In the proposed paper was presented a practical application using artificial neural network to identify and control the hydraulic system. The control algorithm was implemented on an industrial programmable logic controller to present the possibility to use intelligent algorithms in everyday practice.

Acknowledgement

This paper was supported by the Slovak Scientific Grant Agency VEGA, Grant no.1/1105/11

References

  1. Oravec M., Polec J., Marchevský S.: Neurónové siete pre číslicové spracovanie signálov. Vydavateľstvo FABER, Bratislava, 1998
  2. Sinčák P., Andrejková G.: Neurónové siete – Inžiniersky prístup I, Technická univerzita, Košice,
    http://www.ai-cit.sk/source/publications/books/NS1/html/index.html
  3. Körösi, L., Kozák, Š.: Optimal Self Tuning Neural Network Controller Design. 16th IFAC world congress, Praha, Česká republika, 3.-8.7.2005.
  4. Dideková, Zuzana – Kajan, Slavomír: Riadenie nelineárnych systémov pomocou neurónových sietí optimalizovaných genetickými algoritmami. In: Kybernetika a informatika : Medzinárodná konferencia SSKI SAV, Vyšná Boca, SR, 10.-13.2.2010. – Bratislava : Vydavateľstvo STU, 2010. – ISBN 978-80-227-3241-3. – CD-Rom
  5. Körösi, L.: Príspevok k problémom optimalizácie štruktúr umelých neurónových sietí. Dizertačná práca. Ústav riadenia a priemyselnej informatiky FEI STU, Bratislava, 2010, 126s
  6. Logix5000 Controllers General Instructions – Reference Manual
  7. Logix5000 Controllers I/O and Tag Data – I/O and Tag Data – Programming Manual
  8. Logix5000 Controllers Ladder Diagram – Programming: Relay Ladder – Programming Manual
  9. Logix5000 Controllers Tasks, Programs, and Routines – Tasks, Programs, and Routines – Programming Manual

Napísať príspevok