The combination of the automatic control theory courses, simulation verification and practical implementation of the designed controller algorithms in real-time conditions is very important for training of the control engineers. This contribution present structure and usage of Self-tuning Controllers Simulink Library (STCSL) for real time control. The STCSL was created for design, simulation verification and especially realtime implementation of single input – single output (SISO) digital self-tuning controllers. The proposed adaptive controllers, which are included in the library, can be divided into three groups (PID controllers, controllers based on the polynomial approach and the controllers derived on the other approaches (minimum variance etc.). This Library is very successfully used in Adaptive Control Course in education practice for design and verification of self-tuning control systems in simulation and real-time conditions. It is suitable also for design and verification of industrial digital controllers. The highly nonlinear laboratory model, the DR300 Speed Control with Variable Load, has been chosen as example for real-time control. The STCSL is available free of charge at the Tomas Bata University internet site http://www.utb.cz/stctool/. INTRODUCTION One approach to adaptive control is based on recursive estimation of unknown system characteristics, gradually specifying them, and then monitoring possible changes. Using this knowledge, appropriate methods can be employed to design the optimal controller. This kind of controller, which identifies unknown processes and then synthesizes control (adaptive control with recursive identification), is referred to in the literature as a selftuning controller (STC). Self-tuning controllers use the combination of the recursive process identification based on a selected model process and a controller synthesis based on knowledge of parameter estimates of controlled process. In some STCs, the identification process does not serve to determine the estimates of the process model parameters ( ) ˆ k Θ ; rather, appropriate reparametrisation of the control loop can be used recursively to estimate the controller parameters directly. Therefore, it is necessary to find the relationship between the process input and output and define it straight from the controller parameters without recalculating them using the estimates of the process model parameters. These controllers are referred to as being implicit, whereas controllers using a synthesis from estimates of the process model parameters are called explicit (with direct identification). Presently, most of the explicit STCs are based on the Certainty Equivalence (CE) Principle. The basic principle of CE is that the model uncertainty is not considered. The parameter estimates of the process model, which are obtained by recursive identification, are used for the controller design. It is assumed that values of these estimates correspond to their actual values. The aim of this contribution is not only to inform potential users about Self-tuning Controllers Simulink Library STCSL (see Bobal and Chalupa, 2002) and to provide help for usage of the library in the simulation verification (see Bobal et al. 2008) but also to demonstrate the practical approach to a design of a control of the laboratory model in real-time conditions. RECURSIVE IDENTIFICATION The regression (ARX) model of the following form ( ) ( ) ( ) ( 1 T y k k k n k = − + Θ Φ ) (1) is used in the identification part of the designed controller algorithms, where ( ) 1 2 1 2, , ,..., , , ..., T na nb k a a a b b b ⎡ ⎤ = ⎣ ⎦ Θ (2) is the vector of the parameters and ( ) ( ) ( ) ( ( ) ( ) ( ) 1 1 , 2 , , 1 , 2 , , T k y k y k y k n u k u k u k nb − = − − − − − − ⎡⎣ − − − ⎤⎦ Φ ... ... ) , a (3) Proceedings 23rd European Conference on Modelling and Simulation ©ECMS Javier Otamendi, Andrzej Bargiela, Jose Luis Montes, Luis Miguel Doncel Pedrera (Editors) ISBN: 978-0-9553018-8-9 / ISBN: 978-0-9553018-9-6 (CD) is the regression vector (y(k) is the process output variable, u(k) is the controller output variable). The non-measurable random component n(k) is assumed to have zero mean value E[n(k)] = 0 and constant covariance (dispersion) R = E[n(k)]. The recursive least squares method for calculating of parameter estimates ( ) ˆ k Θ is utilized. Using the pure least squares method, the influence of all pairs of identified system inputs and outputs to the parameters estimates is the same. This property can be inconvenient for example when identifying a system with timevarying parameters. In this case, it is better to use least squares method with exponential forgetting where the influence of latter data to the calculation of the parameter estimates is greater then the influence of older data. The exponential forgetting method can be further improved by adaptive directional forgetting (Kulhavý, 1987) which changes forgetting coefficient with respect to changes of input and output signal. CONTROLLER ALGORITHMS The proposed self-tuning controllers which are included in the library are divided into three groups: • classical digital PI and PID controllers whose tuning is based on Ziegler-Nichols method, pole assignment method and its modifications, • controllers based on polynomial approach (deadbeat strong and weak version, pole assignment, controllers based on minimization of quadratic criterion), • controllers based on other approaches (minimum variance controllers, Dahlin’s controller, BanyaszKeviczky’s controller etc.). SELF-TUNING CONTROLLERS SIMULINK LIBRARY The Simulink is nowadays a word-wide standard in simulation, testing, and verification of behaviour of various dynamic systems. Simulink is a part of MATLAB system and supports linear or nonlinear systems modelled in continuous time, sampled time or a hybrid of the two. Systems can also be multirate, i.e. have different parts that are sampled or updated at different rates. Based on monograph Bobal, et al. (2005) a library of self-tuning controllers in MATLAB/Simulink environment was created. The purpose was to create a framework suitable for creating and testing of selftuning controllers. The library is available free of charge at internet site of Tomas Bata University in Zlin – www.utb.cz/stctool/ (see Bobal and Chalupa, 2002). The library was created using MATLAB version 6.5 (Release 13) and is compatible with all newer MATLAB versions. Controllers are implemented in the library as standalone Simulink blocks, which allows an easy incorporation into existing simulation schemes and an easy creation of new simulation circuits. Only standard techniques of Simulink environment were used when creating the controller blocks and thus just basic knowledge of this environment is required to start working with the library. Controllers can be implemented into simulation schemes just by the copy or drag & drop operation and their parameters are set using dialog windows. Another advantage of the used approach is a relatively easy implementation of userdefined controllers by modifying some suitable controller from the library. Nowadays the library contains over 30 simple single input single output discrete self-tuning controllers, which use discrete ARX models of second and third order for the on-line system identification. DESCRIPTION OF LABORATORY MODEL AMIRA DR300 Some of self-tuning algorithms were tested using a realtime laboratory model DR300 (Speed Control with Variable Load) by the Amira Company, Duisburg, Germany (see Fig. 1). Figure 1: Laboratory Model Amira DR300 A simplified scheme of the DR300 system is shown in Fig. 2.