MATLAB as Interface for Intelligent Digi
MATLAB as Interface for Intelligent Digi
4,800
Open access books available
123,000
International authors and editors
135M
Downloads
154
Countries delivered to
TOP 1%
most cited scientists
12.2%
Contributors from top 500 universities
1. Introduction
Digital control systems have shown to the developers the features and their applications in a
wide variety of plants. Tools that help the developer to promote a design methodology that
is efficient and at the same time reliable, has gained ground in the market and attributions
of control engineers. Tasks such as data acquisition system, control design and system
implementation can become arduous if there are prerequisites for sensitivity and complexity
of the controller for these tasks take time and performance of the developer which will entail
additional costs to the final product. These tools provide the designer with the scientist and
the smooth progress of their work role has important and necessary in many areas will be
subject to this study. The integration of technologies to speed and lower costs as it relates the
design phases can be observed with a proper exploration of the work tool and how knowledge
of plant and control techniques that meet in a less costly the goal of being achieved whatever
the difficulties of the project. The choice of a tool properly can be a deciding factor in a
world where time and efficiency of processes is become extremely important because the
applications are growing in scale and more complex, Moudgalya (2007), Andrade (2010).
Intelligent Systems has considerable performance in accordance with plans and small large
and its design encompasses more robustness to the system as well as ease of expansion. The
mathematical simplicity that fuzzy systems can present and adaptability of neural networks
are adopted more frequently in the academy and the industry.
An approach of intelligent systems requires a systematic and efficient operation because one
works with a data stream that needs a consistency so that the iterations will be where made
all the decisions may have minimal accounting. A tool that can assist in the design of this
requirement is most welcome in engineering projects for control system parameter becomes
constant with time,S. Sumathi (2010).
The MATLAB software designers can provide facilities for development and interface with
different technologies for data acquisition through its communication protocols such as Serial
Interface, OPC, Ethernet and others. This work is mainly focused on a methodology design
of digital control systems using as development platform and implementing in software
MATLAB.
www.intechopen.com
278
2 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 2793
however, approach of discrete variables on the process that encompasses the entire plant
worrying about sub stages.
In this work is explored a way to conceptualize these types of sound architecture in a way
such that the system can be modeled and represented whatever its complexity, thus using a
powerful tool when it comes to development concepts and analysis.
>> ident
will produce the screens shown in Figure 3, where you can begin the process of identification.
www.intechopen.com
280
4 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
The main tool for modeling dynamic systems to digital control is the MATLAB Identification
Tool Box of, a feature that helps the designer to seamlessly and generates discrete polynomial
transfer functions and the user without the need of programming the algorithms used for
system identification. The IDENT from MATLAB Graphical User Interface is shown in Figures 4
and 3 and in this figure that can be seen are located to the left set of data and the right answer,
ie the model to be obtained.
(a) Ident GUI (b) Data - Time Response (c) Model- Time Response
Still in Figure 4 can observe that the user can define various aspects modeling systems such as
filtering of data and type of modeling, as well as the analysis of response in time and frequency
of the system model, Gene F. Franklin (1998).
Through this tool we can get two different ID type models in the output. The model based on
parameters in the output shows a polynomial equation in discrete form
It should be added that among the numerous tools of identification, we will use polynomial
will be the identification, because it gives us a response in discrete time, which makes this
model implementable on digital computers. With the option to generate a polynomial model
identification as described in Eq.1.
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 2815
The bands system operation are separated for purposes of calculation of the parameters of a
model of second order. The band Operation of this plant is between 580 and 60 0 as observed
in Figure 5.
3.2.2 OE model
Using Identification Toolbox to estimate the parameters of the discrete model OE (Output-Error)
operated in the delay is given by
B(q)
T (t) = ω (t) + e(t) (2)
F (q)
where
Considering the transfer function of the deterministic signal from the ω input we have
T (t) B(q)
= (3)
ω (t) F (q)
www.intechopen.com
282
6 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
where
Data is the object containing the information input and output system;
nb is the order of the polynomial B(q) from Equation 1;
n f is the order of the polynomial F (q) from Equation 1;
nk is the input delay
We can also order the knowledge to perform analysis in continuous time by following the
identification commands
M = idproc(type,value)
Thereby generating a frequency domain model type
1 + Tz s
G (s) = Kp e−Td s (6)
(1 + Tp1 s)(1 + Tp2 s)(1 + Tp3 s)
Where the parameters of the function idproc are inherent in the system type, order and
constant delay.
The graphs in Figure 5 are constructed in accordance with the instructions from design
requirements . The first statement stores the vector medt values of temperature around the
heat source (resistor) and the actuator speed ω. The third instruction is didactic and for
implementation is not required to be codified.
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 2837
#device adc=10
#use delay(clock=4000000)
#fuses HS,NOWDT,PUT
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7)
#include <mod_lcd.c>
main()
{
long int value=0;
float temp=0;
int i=0;
lcd_ini();
setup_timer_2 (T2_DIV_BY_16, 61, 1);
setup_ADC_ports (RA0_analog);
setup_adc(ADC_CLOCK_INTERNAL );
setup_ccp1(ccp_pwm);
set_pwm1_duty ( 0 );
setup_ccp2(ccp_pwm);
set_pwm2_duty ( 0 );
set_adc_channel(0);
printf ("%%------------ DAQ - System ------------ \r\n");
printf ("%%Temperature (žC) \r\n");
while(true){
www.intechopen.com
284
8 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
set_pwm1_duty(1023);
delay_ms(100);
value = read_adc();
temp = ((5*(float) value)/(1024))*16.09;
printf (" %f \r\n",temp);
printf (lcd_write,"Temp = %f ",temp);
lcd_write (’\f’);
if(temp>=60){
set_pwm2_duty ( 1023 );
}
if(temp<=58){
set_pwm2_duty ( 0 );
}
delay_ms(500);
}
}
The code shown above is the implementation of a system that simulates the temperature, in
the form of Hardware a thermal system with relative temperature variation in responses to
time much smaller.
The dynamics of this system is well demonstrated in Figure 6
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 2859
function send_data_tohard(data_ctrl,setpoint_ctrl)
fprintf(Serial_Obj,data_ctrl));
fprintf(Serial_Obj,setpoint_ctrl));
Therefore the system receives the data for the implementation of intelligent digital control
system:
function receiv_data_fromhard(data_ctrl,data_error)
data_ctrl = fscanf(Serial_Obj,’data_ctrl’);
data_error = fscanf(Serial_Obj,’data_error’);
Always observing that the variable Dataa_crtl is used for timing and appropriateness of
real-time system.
www.intechopen.com
286
10 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
switch opcon{opcon2}
case ’COM1’
Serial_Obj.Port=’COM1’;
case ’COM2’
Serial_Obj.Port=’COM2’;
case ’COM3’
Serial_Obj.Port=’COM3’;
case ’COM4’
Serial_Obj.Port=’COM4’;
case ’COM5’
Serial_Obj.Port=’COM5’;
case ’COM6’
Serial_Obj.Port=’COM6’;
case ’COM7’
Serial_Obj.Port=’COM7’;
otherwise
errordlg(’Select a Valid Serial Port’,’Error’)
end
fopen(Serial_Obj);
if Serial_Obj.Status ==open
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 287
11
set(handles.con_text,’String’,’Connected’);
end
www.intechopen.com
288
12 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
experience acquired human with the process that can be transferred directly to the core of the
Fuzzy Logic Controller(FLC) with its implementation process described in Figure 9
error = data_ctrl;
NG(k) = trimf(error, [a_i b_i c_i]);
NS(k) = trimf(error, [a_i b_i c_i]);
ZR(k) = trimf(error, [a_i b_i c_i]);
PS(k) = trimf(error, [a_i b_i c_i]);
PB(k) = trimf(error, [a_i b_i c_i]);
chang_error = data_ctrl;
NL(k) = trimf(chang_error, [a_i b_i c_i]);
NS(k) = trimf(chang_error, [a_i b_i c_i]);
ZR(k) = trimf(chang_error, [a_i b_i c_i]);
PS(k) = trimf(chang_error, [a_i b_i c_i]);
PL(k) = trimf(chang_error, [a_i b_i c_i]);
www.intechopen.com
MATLAB as Interface
MATLAB as Interface for Control
for Intelligent Digital Intelligent Digital
of Dynamic Systems Control of Dynamic Systems 289
13
Where Negative Large, Negative Small, ZeRo, Positive Small and Positive Large are linguistics
vary based on experience. The system output can be given as shown in Figure 9 with a bank
of rules based on Table 1 decision-making as an example
5. Conclusion
With the aid of this important tool can facilitate the development of applications to interface
with and control devices industries. A overview of these tools has been shown here to that
may be developed to greater diversity of applications according to the need of the designer.
As an environment of the computational complex, MATLAB can provide solutions for
engineering, physics and mathematics with the use of its functions basic and therefore leaving
the search more efficient and less costly. This platform is an important and necessary tool, it
can lead a project, with integration between Software and Hardware, for a safe convergence of
results, thus integrating computational resources for simulation design and implementation
from a direct single platform.
www.intechopen.com
290
14 MATLAB – A Ubiquitous Tool for the Practical Engineer
Will-be-set-by-IN-TECH
6. References
Andrade, G.A. Neto, J. L. L. (2010). A framework for modeling, digital control design
and simulations of dynamic, Computer Modelling and Simulation (UKSim), 2010 12th
International Conference on, IEEE Computer Society Digital Library.
Charles L. Philips, H. T. N. (1995). Digital Control Systems: Analisys and Design, third edition
edn, Prentice Hall.
Gene F. Franklin, J. David Powell, M. L. W. (1998). Digital Control of Dynamic Systems, 3rd edn,
Prentice Hall.
Ibrahim, D. (2006). Microcontroller Based Applied Digital Control, John Wiley and Sons.
Lewis, C. S. (2001). Programming Microcontrollers in C, 2nd edn, LLH Publishing.
MathWorks, T. (2010). Fuzzy Logic Tool Box : User’s Guide.
Moudgalya, K. (2007). Digital Control, John Wiley and Sons.
Ross, T. J. (2004). Fuzzy Logic With Engineering Applications, 2nd edn, John Wiley and Sons.
S. Sumathi, S. P. (2010). Computational Intelligence Paradigms: Theory and Applications Using
MATLAB, CRC Press.
Wilmshurst, T. (2007). Designing Embedded Systems with PIC Microcontrollers, Newnes.
Zadeh, L. A. (1965). Fuzzy sets, Information and Control Proceedings .
www.intechopen.com
MATLAB - A Ubiquitous Tool for the Practical Engineer
Edited by Prof. Clara Ionescu
ISBN 978-953-307-907-3
Hard cover, 564 pages
Publisher InTech
Published online 13, October, 2011
Published in print edition October, 2011
A well-known statement says that the PID controller is the “bread and butter†of the control engineer. This
is indeed true, from a scientific standpoint. However, nowadays, in the era of computer science, when the
paper and pencil have been replaced by the keyboard and the display of computers, one may equally say that
MATLAB is the “bread†in the above statement. MATLAB has became a de facto tool for the modern
system engineer. This book is written for both engineering students, as well as for practicing engineers. The
wide range of applications in which MATLAB is the working framework, shows that it is a powerful,
comprehensive and easy-to-use environment for performing technical computations. The book includes
various excellent applications in which MATLAB is employed: from pure algebraic computations to data
acquisition in real-life experiments, from control strategies to image processing algorithms, from graphical user
interface design for educational purposes to Simulink embedded systems.
How to reference
In order to correctly reference this scholarly work, feel free to copy and paste the following:
João Viana da Fonseca Neto and Gustavo Araújo de Andrade (2011). MATLAB as Interface for Intelligent
Digital Control of Dynamic Systems, MATLAB - A Ubiquitous Tool for the Practical Engineer, Prof. Clara
Ionescu (Ed.), ISBN: 978-953-307-907-3, InTech, Available from: http://www.intechopen.com/books/matlab-a-
ubiquitous-tool-for-the-practical-engineer/matlab-as-interface-for-intelligent-digital-control-of-dynamic-systems