Вы находитесь на странице: 1из 17

Frequency Response Analysis of a Single Board Heater System by the application of Sine Wave

AIM: Performing Frequency Response Analysis of a Single Board Heater System by the application of Sine Wave. Target group: Anyone who has basic knowledge of Control Engineering. About this Experiment Figure1shows the single board heater system on which this experiment will be performed. The setup consists of a heater assembly, fan, temperature sensor, microcontroller and associated circuitry. Heater assembly consists of an iron plate placed at a distance of about 3.5 mm from the nichrome coil. A 12 V computer fan positioned below this heater assembly is meant for cooling the assembly. The temperature sensed by the temperature sensor, AD 590, after suitable processing, is fed to the microcontroller. The microcontroller ATmega16 is the heart of the setup. It provides an interface between the process and the computer. The LCD display mounted above the microcontroller displays the heated plate temperature, heater and fan inputs and also the commands communicated via serial port. 1

Figure 1: Single board heater system The setup is powered by 12 V, 8 A SMPS. We have used LabVIEW as an interface for sending and receiving data. This interface is shown in Fig.2.

Figure 2: Lab VIEW interface for this experiment Heater currentand Fan speedare the two inputs to the system. The Heater current is varied sinusoidally. A provision is made to set the parameters related to it, like Frequency,Amplitudeand O set. The temperature profile thus obtained is the output. In this experiment we are applying a sine change in the heater current by keeping the Fan speed constant. After application of sine change, wait for su cient amount of time to allow the temperature to reach a steady-state.

Theory Frequency Response of a system means its steady-state response to a sinusoidal input. For obtaining a Frequency Response of a system, we vary the frequency of the input signal over a spectrum of interest. The analysis is actually quite useful and also simple because it can be carried out with the available signal generators and measuring devices. Consider a sinusoidal input U(t) = Asin t (1) The Laplace Transform of the above equation yields U (s) = A (2)
s2 + 2

Consider the standard first order transfer function given below G(s) = Y (s) (3) U (s) = K ts + 1 Putting the value of U(s) from equation 2, we get Y (s) = K A (4)
(t s + 1)( s2 + 2) t2

=KA ts + 1 - ts
2t2 + 1 s2 + 2 + s2 + 2 (5)

Taking Laplace Inverse, we get


t - tcos( t) + sin( t) (6)

y(t) = K A
2t2 + 1 te- t

t . Hence, for large value of time,


The above equation has an exponential term e - t

its value will approach to zero and the equation will yield a pure sine wave. One can also use trigonometric identities to make the equation look more simple. y(t) = K A sin( t) + f (7)
v 2 t2 + 1

where, (8)
f = -tan-1 ( t)

By observing the above equation one can easily make out that for a sinusoidal input the output is also sinusoidal but has some phase di erence. Also, the amplitude of the output signal, A, has become a function of the input signal frequency, . A = K A (9)
v 2t2 + 1

The amplitude ratio (AR) can be calculated by dividing both sides by the input signal amplitude A. A AR = (10)
v 2 t2 + 1

A=K Dividing the above equation by the process gain K yields the normalized amplitude ratio ( ARn )

(11)
ARn = AR v 2t2 + 1

K=1 Because the process steady state gain is constant, the normalized amplitude ratio often is used for frequency response analysis. [2]

Step by step procedure to perform Sine Test Initiate a sine input to the system with some value of the frequency (here 0.04H z). Note that at high frequencies the plant output is not sinusoidal,which is not of any use. Hence,avoid choosing frequencies above 0.04Hz.

Figure 3: Performing Sine Test

The data thus obtained is data7=[ 0.000 20.000 100.000 0.000 0.079 20.000 100.000 22.300 0.157 21.000 100.000 22.300 0.235 21.000 100.000 22.300 . . . 403.125 27.000 100.000 35.400 403.204 27.000 100.000 35.300 403.282 27.000 100.000 35.300 403.375 28.000 100.000 35.300 ] The first column represents time. The second column represents heater current. Here, it is sinusoidally varied. The third column represents fan speed. Note that its value is 100 throughout the experiment. The fourth column represents the output temperature. It should be taken in to consideration that all the values mentioned in the data file are in PWM (Pulse Width Modulation) units, except for the temperature which is in C.

Calculating Amplitude Ratio and Phase Di erence Input the arguments f and data width on line 5 and 7 respectively in the scilab code sine.sce for the calculation of the above said parameters. Here f means input frequency and data width means the range of data
th part of the whole
to be used for calculation. If data width is 5, then last 1
5

data is used.

Figure 4: Scilab Output It could be seen that the Amplitude Ratio turns out to be 0.4 and phase di erence to be -146.2464. The decible value of Amplitude Ratio is also displayed. Note:- The associated Scilab codes are given at the end of this Document. 8

The plot thus obtained is

Figure 5: Plot of Input and Output vs time

Repeat this calculation over a range of frequencies and note down the values of Amplitude Ratio in dBand Phase Di erence. Input these values for the appropriate frequencies in to the Scilab code BodePlotand execute it to get a Bode Plot of the plant.

Figure 6: Bode Plot obtained from the plant

10

Bode Plot can be obtained directly from the plants Second order Transfer function [1] with the help of scilab code TFbode.sce, as shown in figure 7. A visual comparison of the two bode plots can be done to validate the bode diagram obtained from the plant.

Figure 7: Bode Plot obtained through plants Transfer function

11

Scilab Codes Scilab code sine.sce


1 c l e a r d a t a 7 ; ex ec ( s i n u s o i d a l t . t x t ) ; g e t f (

labelbode.sci);
2T=data7(:,1);fan=data7(:,3);//Tistime,fan isfanspeed 3u=data7(:,2)-20;y=data7(:,4)-32.2;//uis current,yistemperature

4globalf
5f=0.04;//inputfrequency 6 p= l e n g t h ( u ) ; / / c a l c u l a t i n g l e n g t h o f u 7datawidth=5;//

8p2=(p/datawidth); 9 p 1=ro u nd ( p 2 ) ;
1 0 [ q , k ] =max ( u ( ( p- p1 ) : p , 1 ) ) ; / / q i s m a x i m u m v a l u e & k istheindex 1 1 x 1 = ( p -p 1 ) +k ; / / c a l c u l a t i n g k i n t e r m s o f s a m p l e n o .(firstdatapointer)

12v=(x1+((1/T(2,1))*(1/f))); 1 3 v=ro un d ( v ) ; 1 4 [ e , k 1 ] =max ( y ( x 1 : v , 1 ) ) ; 1 5 L=x 1 +k 1 ; 1 6 t 1 =T( x1 , 1 ) ; 1 7 t 2 =T( L , 1 ) ; 1 8 d e l t =( t 2 - t 1 ) ; 19Amplituderatio=(e/q) 2 0 Ar= A m p l i t u d e r a t i o ; 21AmplituderatioindB=20*log10(Ar) 22Phasedifference=-((delt)/(1/f))*360
23//s1=[Amplituderatio]; 24//s2=[Phasedifference];

25ord=[uy];x=[TT];//uandyareplottedvs. timeandtime

2 6 x ba sc ( ) ; p l o t 2 d ( x , o r d ) ; x g ri d ( ) ; 2 7 t i t l e = S t e p ch an g e i n c u r r e n t an d t h e r e s u l t i n g

12

temperature
2 8 l a b e l ( t i t l e , 4 , t i m e ( s ) , C u r r e n t , Te m p e r a tu r e ( C )

,4);

Scilab code label.sci


1//Updated(9-12-06),writtenbyInderpreetArora 2//Inputarguments:title,xlabel,ylabelandtheir

fontsizes

3 f u n c t i o n l a b e l ( tn ame , t f o n t , l a b e l x , l a b e l y , x y f o n t ) 4a=get(currentaxes) 5 x t i t l e ( t na me , l a b e l x , l a b e l y ) 6xgrid 7t=a.title;


8t.fontsize=tfont;//Titlefontsize 9t.fontstyle=2;//Titlefontstyle

1 0 t . t e x t = tn a me ; 11u=a.xlabel;
12u.fontsize=xyfont;//Labelfontsize 13u.fontstyle=2;//Labelfontstyle

14v=a.ylabel;
15v.fontsize=xyfont;//Labelfontsize 16v.fontstyle=2;//Labelfontstyle
17//a.labelfontsize=3;

1 8 en d f u n c t io n ;

13

Scilab code bodeplotHz.sce


1//bodeplot

2getf(labelbode.sci); 3f=[0.001,0.0035,0.004,0.005,0.006,0.007,0.008,
0.009,0.01,0.02,0.03,0.04];//Inputfrequency(Hz )

4 AR = [ - 3 . 8 7 , - 5 . 6 7 , - 7 . 5 3 , - 7 . 5 3 , - 8 . 1 7 , - 8 . 6 4 , - 8 . 8 7 ,
-8.90,-9.11,-13.55,-15.39,-16.47];//Amplitude ratio(dB)

5subplot(2,1,1); 6 p l o t 2 d ( f , AR , r e c t = [ 0 . 0 0 1 , - 2 0 , 0 . 0 4 , 0 ] , l o g f l a g = l n ) ; 7xgrid(); 8Phi=[-25.2,-28.98,-33.11,-41.4,-60.48,-70.56,


-77.76,-87.48,-90,-129.6,-151.2,-172.8];//Phase difference

9title=; 1 0 l a b e l ( t i t l e , 4 , Hz , A m p l it u d e r a t i o i n dB , 4 ) ; 11subplot(2,1,2); 1 2 p l o t 2 d ( f , P h i , r e c t = [ 0 . 0 0 1 , - 1 8 0 , 0 . 0 4 , - 2 5 ] , l o g f l a g =

ln);
1 3 l a b e l ( t i t l e , 4 , , P h as e d i f f e r e n c e , 4 ) ; 14subplot(2,1,2); 15xgrid();

14

Scilab code labelbode.sci


1//Updated(9-12-06),writtenbyInderpreetArora 2//Inputarguments:title,xlabel,ylabelandtheir

fontsizes

3 f u n c t i o n l a b e l ( tn ame , t f o n t , l a b e l x , l a b e l y , x y f o n t ) 4a=get(currentaxes) 5 x t i t l e ( t na me , l a b e l x , l a b e l y ) 6xgrid 7t=a.title;


8t.fontsize=tfont;//Titlefontsize 9t.fontstyle=2;//Titlefontstyle

1 0 t . t e x t = tn a me ; 11u=a.xlabel;
12u.fontsize=xyfont;//Labelfontsize 13u.fontstyle=2;//Labelfontstyle

14v=a.ylabel;
15v.fontsize=xyfont;//Labelfontsize 16v.fontstyle=2;//Labelfontstyle
17//a.labelfontsize=3;

1 8 en d f u n c t io n ;

Scilab code TFbode.sce


1//Scilabcodetoplotbodediagramfromtransfer

function

2s=poly(0,s)
3 h= s y s l i n ( c , ( 0 . 4 7 5 / ( 1 2 4 . 8 2 7 * s 2 + 5 7 . 2 6 * s + 1 ) ) ) / / secondordertransferfunction 4 bo d e ( h , 0 . 0 0 1 , 1 0 ) ; / / B o d e f r e q u e n c y r a n g e ( 0 . 0 0 1 t o 10)inHz

15

References
[1] Kannan M. Moudgalya. Identification of transfer function of a single board heater system through step response experiments. 2009. [2] Dale E. Seborg, Thomas F. Edgar, and Duncan A. Mellichamp. Process Dynamics and Control. John Wiley and Sons, 2nd edition, 2004.

c l e a r data7 ; exec ( s i n u s o i d a l t . t x t ) ; 2 T = data7 ( : , 1 ) ; fan = data7 ( : , 3 ) ; / / T i s t i m e , f a n isfanspeed 3 u = data7 ( : , 2 ) 20; y = data7 ( : , 4 ) 32.2; / / u i s current,yistemperature 4globalf 5 f = 0.04; / / i n p u t f r e q u e n c y 6 p = length ( u ) ; / / c a l c u l a t i n g l e n g t h o f u 7 d a t a w i d t h = 5; / / 8 p2 = (p / d a t a w i d t h ) ; 9 p1 = round ( p2 ) ; 10 [ q , k] = max( u ( ( pp1 ) : p , 1 ) ) ; / / q i s m a x i m u m v a l u e

&k istheindex 11 x1 = (pp1 ) + k ; / / c a l c u l a t i n g k i n t e r m s o f s a m p l e n o .(firstdatapointer) 12 v = ( x1 + ( ( 1 / T ( 2 , 1 ) ) * (1/f))); 13 v = round ( v ) ; 14 [ e , k1 ] = max( y ( x1 : v , 1 ) ) ; 15 L = x1 + k1 ; 16 t 1 = T( x1 , 1 ) ; 17 t 2 = T(L , 1 ) ; 18 d e l t = ( t2 t 1 ) ; 19 A m p l i t u d e r a t i o = ( e / q ) 20 Ar = A m p l i t u d e r a t i o ; 21 A m p l i t u d e r a t i o i n d B = 20 * log10 ( Ar ) 22 P h a s e d i f f e r e n c e = (( d e l t ) / ( 1 / f ) ) * 360 23 / / s 1 = [ A m p l i t u d e r a t i o ] ; 24 / / s 2 = [ P h a s e d i f f e r e n c e ] ;

16

Вам также может понравиться