Sie sind auf Seite 1von 47

Embedded Control Systems Engineering

Name of the Student Student Registration No

: Kaushik Kariappa D.V : CHB0409015

Module Leader at MSRSAS : Dr. Chirag Jagadish ________________

PART TIME 2009 BATCH

M.S.Ramaiah School of Advanced Studies


New BEL Road, Gnanagangothri Campus, MSR Nagar, Bangalore-560 054 Tel/Fax: 23605539/23601983; website: http://www.msrsas.org

POSTGRADUATE ENGINEERING AND MANAGEMENT PROGRAMME (PEMP)

ASSIGNMENT Centre Name: Real Time Embedded Systems Course Name: M.Sc (Engg) in Real Time Embedded Systems

Declaration Sheet
Delegates Name Reg No Course Module Code Module Title Module Start Date Module Leader Kaushik Kariappa D.V

CHB0409015
RTES Batch PT09

ESD 527

Embedded Control Systems Engineering


14th November 2009

Submission Date

30th January 2010

Dr. Chirag Jagadish

Submission Arrangements This assignment must be submitted to Academic Records Office (ARO) by the submission date before 1730 hours for both Full-Time and Part-Time students. Extension requests Extensions can only be granted by the Head of the Department / Course Manager. Extensions granted by any other person will not be accepted and hence the assignment will incur a penalty. A copy of the extension approval must be attached to the assignment submitted. Late submission Penalties Unless you have submitted proof of Mitigating Circumstances or have been granted an extension, the penalties for a late submission of an assignment shall be as follows: Up to one week late: Penalty of one grade (5 marks) One-Two weeks late: Penalty of two grades (10 marks) More than Two weeks late: Fail - 0% recorded (F2) All late assignments must be submitted to Academic Records Office (ARO). It is your responsibility to ensure that the receipt of a late assignment is recorded in the ARO. If an extension was agreed, the authorization should be submitted to ARO during the submission of assignment. To ensure assignments are written concisely, the length should be restricted a limit indicated in the assignment questions. Each participant is required to retain a copy of the assignment in his or her record in case of any loss. Declaration The assignment submitted herewith is a result of my own investigations and that I have conformed to the guidelines against plagiarism as laid out in the PEMP Student Handbook. All sections of the text and results, which have been obtained from other sources, are fully referenced. I understand that cheating and plagiarism constitute a breach of University regulations and will be dealt with accordingly. Signature of the Delegate Date

Date stamp from ARO

Signature of ARO Staff

Signature of Module Leader

Signature of Course Manager

Contents
Title Page Declaration sheet Contents Abstract List of Tables List of Figures List of Symbols i ii iii iv v vi vii 1

Brief Introduction to control systems 1 CHAPTER -1


1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 Introduction Digital implementation of analog PID controller Advantages of Analog controller design Drawbacks of Analog controller design Design and implementation in discrete domain Advantages of Digital controller design Drawbacks of Digital controller design Conclusion between analog and digital PID controller Algorithms Comparison of Performance of Discrete and Analog PID Controllers

2 2 4 4 4 5 5 5 6

CHAPTER -2
2.1 2.2 2.3 2.4 2.5 Introduction Transfer Function of the passenger aircraft for open loop system Transfer Function of the passenger aircraft for closed loop system Discrete Model of the System Design of PI controller 7 8 13 15 17

CHAPTER -3
3.1 Introduction 3.2 Design Driver of loudspeaker 3.2.1 Voice coil and magnet 3.2.2 Diaphragm 3.2.3 Surround 3.2.4 Spider 3.2.5 Basket 3.2.6 Dust Cap and Air Vent 3.3 Free body diagram of the loudspeaker driver 3.4 Voltage and force relations 3.4.1 Lorentz force 3.4.2 Back Emf 22 22 22 23 23 23 23 23 23 24 24 25

3.5 3.6 3.7 3.8

Electrical model of the loudspeaker Mechanical Governing Equation Transfer Function Bode Plot 3.8.1 The observations made from bode plot are 3.9 Impulse Response 3.9.1 Following observation is made from the impulse response plot 3.10 State Space Model 3.11 Bode Plot using State Space model 3.12 Impulse response using state space model 3.13 Simulink Mathematical model 3.13.1 sinusoidal input with frequency 350Hz and peak amplitude 1 V 3.13.2 Output response with input frequency 350Hz and input peak amplitude 1 V 3.13.3 Output response with input frequency 756Hz and input peak amplitude 1V 3.13.4 Output response with input frequency 10KHz and input peak amplitude 1V 3.13.5 Output response with input frequency 100KHz and input peak amplitude 1V 3.14 Comparison of results of Simulink and Bode plot transfer function

25 25 26 27 27 28 28 29 30 31 32 32 33 34 34 34 36

4 5

References Appendix
5.1.1 Appendix-A Matlab code of aircraft model system 5.1.2 Appendix-B Matlab code of loudspeaker model system 38 39

Abstract
________________________________________________________________________________ This report presents an overview with examples for the design of embedded control systems involving an Aircraft model system and then a Loudspeaker electromechanical system and explains the strategies involved in designing these systems. Chapter 1 of this assignment deals with a digital controller, designing in analog form and then converting to its discrete equivalent compared to a controller converted to discrete first and then design of a digital controller. The design of an aircraft model in chapter 2 for stable takeoff involves a MIMO model being converted to SISO. The open loop analysis for the system is done for stability analysis. System behaviour is analysed for step input with unity feedback and root locus and frequency analysis is carried. The above open loop system is converted to its discrete equivalent with root locus plot and analysing frequency response. A PI controller is also designed and analysis on system stability is done. Chapter 3 consists of an electromechanical loudspeaker system whose schematic diagram is provided. Circuit diagram of the electrical portion and mechanical portion governing equations were derived. Bode plot analysis is made on the impulse response of the system. Impulse response is studied with State space model. Implementation and design of digital controllers are made using Matlab and simulink tools. After completion of this module, one will be able to determine the stability of the system, analyze its performance, and control the system using a P, PI, PID controller to achieve a certain specification requirement. Finally we propose an inexpensive and efficient manner of control system design.

List of Tables
________________________________________________________________________________

Table 3.1

Comparison chart of result of Transfer function and simulink

44

List of Figures
________________________________________________________________________________ Figure 1.1 Feedback Control System Block Diagram Figure 2.1: Aircraft model Figure 2.2: Root locus of open loop SISO system Figure 2.3: Open loop simulink model Figure 2.4: Step response of Open loop system using simulink Figure 2.5: Impulse response of Open loop system using simulink Figure 2.6: Step response of Open loop system using matlab Figure 2.7: Impulse response of Open loop system using matlab Figure 2.8: closed loop simulink model with unity negative feedback Figure 2.9: Step response of closed loop negative unity feedback system Figure 2.10: Root Locus of closed loop system with negative unity feedback Figure 2.11: Bode plot of closed loop system with negative feedback and unity gain Figure 2.12: SISO model with zero order hold Figure 2.13: Discrete open loop system simulink model Figure 2.14: Step response of discrete open loop system Figure 2.15: Root locus of discrete closed loop system Figure 2.16: Discrete closed loop system simulink model Figure 2.17: Step response of discrete closed loop system Figure 3.1: Components of loud speaker driver Figure 3.2: Electrical and mechanical schematic of a loudspeaker driver Figure 3.3: Electrical model of a loudspeaker Figure 3.4: Mechanical model of loud speaker driver. Figure 3.5: Bode plot for the Transfer function Figure 3.6: Impulse response for the Transfer function Figure 3.7: Bode plot for the State Space model Figure 3.8: Impulse response for the State Space model Figure 3.9: Simulink mathematical model of loudspeaker driver Figure 3.10: Sinusoidal input with frequency 350Hz and peak amplitude 1 V Figure 3.11: Output response with input frequency 350 Hz and input peak amplitude 1 V Figure 3.12: Output response with input frequency 756Hz and input peak amplitude 1 V Figure 3.13: Output response with input frequency 10 KHz and input peak amplitude 1 V Figure 3.14: Output response with input frequency 100 KHz and input peak amplitude 1 V

List of Symbols
________________________________________________________________________________

SYMBOLS fs Ts Wn

MEANING Sampling frequency Sampling Time Natural frequency of the system Magnetic field strength in Tesla pi Damping ratio of the system Pitch angle of the airplane

_______________________________________________________________________________

Brief Introduction to control systems


The study and design of automatic Control Systems, a field known as control engineering, is a large and expansive area of study. Control systems, and control engineering techniques have become a pervasive part of modern technical society. From devices as simple as a toaster or a toilet, to complex machines like space shuttles and power steering, control engineering is a part of our everyday life. Control systems are components that are added to other components, to increase functionality, or to meet a set of design criteria. Let's start off with an immediate example: We have a particular electric motor that is supposed to turn at a rate of 40 RPM. To achieve this speed, we must supply 10 Volts to the motor terminals. However, with 10 volts supplied to the motor at rest, it takes 30 seconds for our motor to get up to speed. This is valuable time lost. Now, we have a little bit of a problem that, while simplistic, can be a point of concern both to the people designing this motor system, and to the people who might potentially buy it. It would seem obvious that we should start the motor at a higher voltage, so that the motor accelerates faster, and then we can reduce the supply back down to 10 volts once it reaches speed. Now this is clearly a simplistic example, but it illustrates one important point: That we can add special "Controller units" to pre-existing systems, to increase performance, and to meet new system specifications. There are essentially two methods to approach the problem of designing a new control system: the Classical Approach, and the Modern Approach. Definition of the term "Control System", goes as, A Control System is a device, or a collection of devices that manage the behaviour of other devices. Some devices are not controllable. A control system is an interconnection of components connected or related in such a manner as to command, direct, or regulate itself or another system.

CHAPTER 1 ________________________________________________________________________________

1.1 Introduction
Discrete equivalents of analog controllers includes electronic controllers, which although discrete in nature, implements control by emulating the continuous nature of analog control strategies. A typical example is the electronic PI/PID algorithm. There are a number of ways by which this common and versatile controller can be implemented in discretised form ultimately. 1) Design the controller for the continuous domain, analyze the system and then convert the designed controller into its discrete equivalent. 2) Before designing convert the analog system to its discrete equivalent and then design the digital controller followed with the analysis of the closed loop system Figure 1.1 shows block diagram of a general control system with feedback.

Figure 1.1 Feedback Control System Block Diagram

1.2 Digital implementation of analog PID controller


The procedure for designing the controller is given as below 1) Controller for the analog system is designed to meet the desired design specifications. 2) Convert the analog controller to a digital controller by using a suitable transformation.

3) The gain of the transfer function is tuned with proportional Z- Domain design to meet the requirements 4) Make sure that the design specifications have been met by checking the responses of the digital system

Analog controller mapped to a digital controller using the transformation should satisfy the following requirements: 1) A stable analog controller must map to a stable digital controller. 2) The frequency response of the digital controller must closely resemble the analog controller frequency response in the frequency range of 0 to fs/2 where fs being the sampling frequency.

For large change in the output for a given change in the error, for accelerating the movement of the process towards set point and eliminates the residual steady-state error and to reduce the magnitude of the overshoot produced by the integral component and improve the combined controller-process stability a PID controller can be designed. Consider the ideal PID controller equation written in the continuous time domain form:

(1) To discretize the controller, we need to approximate the integral and the derivative terms to forms suitable for computation by a computer. From a purely numerical point of view, we can use:

And The discretized PID algorithm is therefore:

(2)

(3) which is now in the form of a difference equation, suitable for coding in an appropriate programming language. This particular form of the PID algorithm is known as the 'positional' PID controller, because the control signal is calculated with reference to a base level, uo.

1.3 Advantages of Analog controller design


The advantage of such a design method is that the systems which need to be controlled can be easily represented and visualized in continuous time domain and hence designing the controller in continuous time domain becomes easy.

1.4 Drawbacks of Analog controller design


The designing involves approximation of design in continuous domain to discrete domain. This approximation results in distortion in design. The approximation is valid only when the sampling time is very small compared to system response time. The location of poles and zeros are often restricted to subsets of unit circle. This restriction in poles and zeros limit designers ability to reshape the system root locus. Two or more poles in S domain will be mapped to same point in Z domain making the designing of controller difficult. Another complication in digital approximation of analog controller is the need to have a pole at 0 in place of the pole at 1, as obtained by direct digital transformation, to avoid an unbounded frequency response at the folding frequency. This may result in a significant difference between the digital and analog controllers and may complicate the design process considerably Once the design of the controller is converted from analog to digital retuning of controller gain is required.

1.5 Design and implementation in discrete domain


The controller design can be done directly in Z-plane. Because of similarity in Z-domain and Sdomain root locus the methods used to design controller from S-domain root locus can be applied for Z-domain root locus. We can also formulate discrete PID controllers directly from the Laplace domain. Here, the ideal PID algorithm is written as: (4)

Now we can apply either the backward difference or bilinear transformation methods to get an equivalent discrete PID controller. Say we apply the backward difference method. Then,

(5) Simplification yields:

(6) This PID controller is different in structure to that obtained from time-domain considerations and is known as the 'velocity' PID algorithm. As opposed to the fixed control reference used in the positional algorithm, here, the calculation of current control uses the previous control value as reference. In essence, the control is calculated as a change, hence the term 'velocity form'. Application of the Bilinear Transform will yield a similar velocity form algorithm, due to the presence of the term in the approximation.

1.6 Advantages of Digital controller design


The advantage of such a design procedure is that there will not be any errors due to approximation of models from one domain (Continuous) to another domain (Discrete), however the designing is not easy as it is difficult to visualize a system which is inherently analog in nature as a digital system. However it is possible to select any point within the unit circle in Z domain in controller design.

1.7 Drawbacks of Digital controller design


1) The stable region is now the unit circle in Z domain as opposed to the much larger left half of S-

Plane. The selection of pole locations in z domain directly is very difficult compared to the selection of Pole in S domain. However the selection of pole is simplified by the use of Matlab tools. 2) No integrity check: It is very difficult to remove noise waves from the desired signals. Digital control design eliminates this analog problem because value has status and error checking. 3) High power consumption: Analog designs need more power due to its inherent ampere consuming devices. Digital controllers consume less power compared to its analog counter parts. 4) Range limited: For an analog transmitter the range is usually set much narrower than the minimum and maximum sensor limits.

1.8 Conclusion between analog and digital PID controller Algorithms


Although the structures of the positional and velocity PID algorithms appear very different, they are in fact related. The positional algorithm derived is obtained from equation (1). Time shifting back one sampling interval, we obtain

(7) Subtracting this from the original, we end up with the velocity form, i.e.

(8)

1.9 Comparison of Performance of Discrete and Analog PID Controllers


1) Commissioning discrete PID Controllers To calculate control, the analog PID requires knowledge of u o, which is some steady-state control output level. This may have implications during commissioning. With the digital form however, the previous control can be set to any reasonable arbitrary level, and hence commissioning is simpler. 2) Integral Windup: A more important aspect is the use of a summation to calculate the contribution of the integral term. This can lead to problems leading to a phenomenon known as integral windup, causing long periods of overshoots in the controlled response. This can be caused by a poorly tuned controller or the controller output is overly constrained. With the digital PID algorithm, because it does not make use of a sum of errors to generate integral action, the problem of integral windup will not occur, even if the control signal is constrained. 3) Controller tuning: All the tuning procedures for continuous time PID controllers apply. These range from the empirical Ziegler-Nichol ultimate gain method, to the recipe based integral of error criteria. With recipe based methods, a factor of 0.5Ts is usually added to the process dead-time to account for the delay caused by the sampler.

CHAPTER 2
________________________________________________________________________________

2.1 Introduction
There are three primary ways for an aircraft to change its orientation relative to the passing air. Pitch (movement of the nose up or down), Roll (rotation around the longitudinal axis, that is, the axis which runs along the length of the aircraft) and Yaw (movement of the nose to left or right.) Turning the aircraft (change of heading) requires the aircraft firstly to roll to achieve an angle of bank; when the desired change of heading has been accomplished the aircraft must again be rolled in the opposite direction to reduce the angle of bank to zero. Pitch is controlled by the rear part of the tail planes horizontal stabilizer being hinged to create an elevator. By moving the elevator control backwards the pilot moves the elevator up (a position of negative camber) and the downwards force on the horizontal tail is increased. The angle of attack on the wings increased so the nose is pitched up and lift is generally increased. The elevator angle needs to be controlled for the aircraft pitch to be within permissible limits. The state space mathematical model of a passenger aircraft is given by,
H

. @ 0.313 56.7 L M L J q. K = J @ 0.0139 @ 0.426 0 56.7 .

0 0.232 ML M L M 0K J q K + J0.0203K [ ] 0 0
IH I H I

(1)

Figure 2.1: Aircraft model

2.2 Transfer Function of the passenger aircraft for open loop system
The state space model is represented as shown below X = A X + B U Y =CX+ DU Where X is state vector, U is input vector and Y is output vector. Therefore from equation (1)
@ 0.313 56.7 A= L @ 0.0139 @ 0.426 J 0 56.7
H I H I

0 M 0K 0

0.232 B=L0.0203M J K 0

The pitch angle is dependent on elevator angle . The pitch angle of the aircraft needs to be controlled here. The output Y dependent on . Y= Since we are interested in only , the above equation can be re-written as
Y = [0 0 1] L q M+ [0] [ ] J K
H I

(2)

From equation (2) C= [0 0 1] D = [0]

The transfer function of the above system can be obtained using matlab. The above operation is performed by ss2tf command in matlab. The matlab commands used are mentioned below: >> A=[ -0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0] >> B=[0.232; 0.0203; 0] >> C=[0 0 1] >> D=0 >> [NUM, DEN]=ss2tf(A,B,C,D) >> aircraft_pitch =tf(NUM,DEN) The transfer function obtained by matlab is as given below H(s) = -7.772e-016 s2 + 1.151 s + 0.1774 -----------------------------------------s + 0.739 s
3 2+

(3)

0.9215 s

Here since the coefficients of s2 for Zeros is very small (-7.772e-016). This coefficient can be removed from the transfer function. >> aircraft_pitch =tf([1.151 0.1774],[1 0.739 0.9215 0])

I.e. H(s) =

1.151 s + 0.1774 -----------------------------------------s + 0.739 s + 0.9215 s


3 2

(4)

The Zeros of the system can be obtained by equating the numerator of transfer function to Zero. Likewise, the poles of the system can be obtained by equating the denominator of transfer function to Zero. s3+ 0.739 s2 + 0.9215 s =0 Solving above equation the poles of the system are found to be at s=0, s = -0.3695 + 0.8860i and s = -0.3695 - 0.8860i. This system consists of pair of complex conjugate poles in the left half of SDomain and a pole at the origin of S-Domain.

A system is stable if the poles of this transfer function lie strictly in the closed left half of the complex plane (i.e. the real part of all the poles is less than zero). When the appropriate conditions above are satisfied a system is said to be asymptotically stable. The variables of an asymptotically stable control system always decrease from their initial value and do not show permanent oscillations. Permanent oscillations appear when a pole has a real part exactly equal to zero (in the continuous time case) or a modulus equal to one (in the discrete time case). If a simply stable system response neither decays nor grows over time, and has no oscillations, it is marginally stable as in this case. In this case the system transfer function has non-repeated poles at complex plane origin (i.e. their real and complex component is zero in the continuous time case). Oscillations are present when poles with real part equal to zero have an imaginary part not equal to zero.

Figure 2.2: Root locus of open loop SISO system

The root locus of closed loop system can be obtained using the matlab command rlocus. >> rlocus(aircraft_pitch) The root locus of open loop system is as shown in figure 2.2

The simulink model of the system(step and impulse input) is as shown in figure 2.3

Figure 2.3: Open loop simulink model For step response keep the initial value 0 and final value 1. In contrary for impulse response keep the initial value 1 and final value 0. For a step input of 1v the output appears to be increasing without bound, hence the system is unstable. The output of the system for step input is as shown in figure 2.4

Figure 2.4: Step response of Open loop system using simulink For an impulse input, a constant output is seen after initial impulse response. The output of the system for impulse input is as shown in figure 2.5

Figure 2.5: Impulse response of Open loop system using simulink The step response of the open loop system can also be obtained by using the matlab command step. >> step (aircraft_pitch) The impulse response of the open loop system can also be obtained by using the matlab command impulse. >> impulse(aircraft_pitch)

Figure 2.6: Step response of Open loop system using matlab

Figure 2.7: Impulse response of Open loop system using matlab

Even though the system has a pair of complex conjugate poles in left half of S Plane, the pole at the origin of S plane place a very significant in the instability of the system. Complex conjugate poles are associated with an oscillatory response that decays exponentially for LHP poles and increases exponentially for RHP poles. A pole at the origin of the s-plane implies an infinite gain at zero frequency. The pole at origin affects the transient response causing instability and can be negated by introducing zero close to the pole.

2.3 Transfer Function of the passenger aircraft for closed loop system
The formula for transfer function for the closed loop system with unity proportional controller is given by: H(s)closed = H(s)open -------------------1 + H(s) open Where H(s) closed corresponds to transfer function of closed loop system with unity proportional controller. H(s)open corresponds to transfer function of open loop system and is given by equation (4). The transfer function of closed loop system with unity proportional controller can also be obtained using the matlab function feedback (5)

>> aircraft_closedloop_tf=feedback (aircraft_pitch, 1) Transfer function of closed loop system with unity proportional controller is given by

H(s)closed =

1.151 s + 0.1774 -----------------------------------------s + 0.739 s + 2.072 s + 0.1774


3 2

(6)

Equating the denominator of closed loop transfer function to Zero, the poles of the transfer function can be found. s3 + 0.739 s2 + 2.072 s + 0.1774 = 0 Poles of the closed loop system are situated at s= -0.0881, s = -0.3255 + 1.3816i and s = -0.3255 1.3816i. The closed loop system rigged up in the simulink is as shown in figure 2.8

Figure 2.8: closed loop simulink model with unity negative feedback For a step input of 1v the output of the closed loop unity negative feedback system is as shown in figure 2.9.

Figure 2.9: Step response of closed loop negative unity feedback system The system is stable as all the poles of the system lie on the left half of S Plane (Pole at origin is shifted to Left half of S plane due to the feedback). From the step response it is clear that the system is stable and has a settling time of around 36 seconds to reach 98% of maximum amplitude. The first

peak is observed at 3.3sec and magnitude is around 0.9v. The second peak is observed at 8sec and a magnitude of 0.82..

The root locus of closed loop system can be obtained using the matlab command rlocus. >> rlocus(aircraft_closedloop_tf)

The root locus plot obtained is as shown in fig 2.10

Figure 2.10: Root Locus of closed loop system with negative unity feedback

From the root locus it is observed that the system is stable for any value of the proportional gain. The frequency response of closed loop system i.e. bode plot can be obtained by using the matlab command bode. >>bode(aircraft_closedloop_tf) The bode plot obtained is as shown in figure 2.11

The observations made from bode plot are listed below a) The bandwidth of the closed loop system is around 0.0267 Hz. b) Maximum response is obtained at 0.214Hz and gain is 2.13db. c) The system is stable as absolute gain is less than one when absolute phase is greater than or equal to 180 o.

Figure 2.11: Bode plot of closed loop system with negative feedback and unity gain

2.4 Discrete Model of the System


The controller (PD, PI, and PID) which is used to control the system is implemented on a digital microcontroller which operates at a certain frequency. In order to design and implement the controller and also to understand the behavior, it is required to discretize the continuous time domain system and analyze the response of the discretized model to various inputs. The discrete model of the system is represented by transfer function in Z-Domain. Zero order hold is commonly used data reconstruction device. It can be mathematically described as en(t) = e(nT), Where T is the sampling time. The Laplace transform of zero order hold system is given by Go(s) = 1 - e-Ts --------s Zero order hold is combined with system to form the overall mathematical model of the discrete system. The discrete model of the airplane SISO model with zero-order hold can be represented as shown below. (7) nT <(n+1) T

Figure 2.12: SISO model with zero order hold Where G(s) = transfer function of the Zero-Order Hold and SISO model = (1 - -Ts) Gp(s) ----------------s Gp(s) = transfer function of SISO model represented by equation (4) The output can be now represented as C(s) = E*(s) G(s) Taking z transform the above equation is represented as C(z) = E(z) G(z) The transfer function of the discrete model is given by H(z) = C(z)/E(z) = G(z) (11) (10) (9)

(8)

The Z-transform of G(s) i.e. G (z) can be obtained using residue theorem or using matlab command c2d with zoh as parameter for conversion. >> c2d(aircraft_pitch,0.1,'zoh') Output Transfer function: 0.005641 z^2 - 2.268e-005 z - 0.005447 -------------------------------------z^3 - 2.92 z^2 + 2.849 z - 0.9288 >> air_dis_num=[0.005641 -2.267e-005 -0.005447] >> air_dis_den = [1 -2.92 2.849 -0.9288] >> H= tf(air_dis_num,air_dis_den,0.1)

The transfer function of the discrete system is given by Transfer function: H(z) = 0.005641 z^2 - 2.267e-005 z - 0.005447 -------------------------------------(12)

z^3 - 2.92 z^2 + 2.849 z - 0.9288 The simulink model of the discrete system is as shown in figure 2.13

Figure 2.13: Discrete open loop system simulink model

The response of the system to a step input of 1 v is shown in figure 2.14

Figure 2.14: Step response of discrete open loop system

From the response it is clear that the system is stable however it have steady state error of around (1 0.8) = 0.2 = 20 %. This is unacceptable and should be reduced, this can be achieved by introducing PI controller in feedback.

2.5 Design of PI controller


A PI controller is used to ensure that the system has a zero steady state error. This is achieved by increases the type of the system by one (i.e. adding a pole). However the addition of a pole affects

the transient response and might cause the system to become unstable. Hence the affect of this pole must be negated by having a Zero very close to the pole (pole Zero cancellation).

D(z) = Ki z / (z -1) + Kp

(13)

D(z) = [(Ki+Kp)z Kp] /[z-1]

(14)

Where Ki corresponds to the gain of the integrator and Kp corresponds to the gain of the proportional controller.

From equation (12), the transfer function of discrete open loop system is given by H(z) = 0.005641 z^2 - 2.268e-005 z - 0.005447 -----------------------------------------------z^3 - 2.92 z^2 + 2.849 z - 0.9288 Representing the above equation in Zero-Pole form H(z) = (z (0.0020 + 0.9827i)) (z (0.0020 - 0.9827i)) -------------------------------------------------------(z-(0.9732 + 0.0829i)) (z-(0.9732 - 0.0829i)) (z 0.9736) (15)

From the above equation it is clear that all poles lie with the region of stability i.e. unit circle in Zdomain. Hence the system is stable.

The PI controller adds a pole at Zp = 1 and a zero at Zo = (Kp/ (Ki+Kp)). The overall gain K is given by K=Ki+Kp

From equation (8) we find that there is already a pole at z = 0.97936. The poles at z=1 and z = 0.97936 can be negated by having a zero such that 1 > Zo > 0.96. As the zero approaches 1 the effect of integrator reduces and the time taken to reach zero steady state error increases, However. When zero is moved away from pole at 1 the time taken to reach zero steady state error decreases, However the transient response appears to become unstable.

Assuming the zero to be at 0.96, the transfer function of controller is given by D(z) = [K(z 0.96)]/[z-1] where K = (Ki + Kp) and 0.96 = Kp/(Ki + Kp) (16)

The transfer function of the closed loop system with controller in forward path is given by Hcl(z) = D(z) H(z) -------------1 + D(z) H(z) The transfer function of closed loop system can be obtained using the matlab command feedback >> aircraft_PI = tf( [1 -0.96],[1 -1],0.1) >> aircraft_closed_H = feedback(H* aircraft_PI,1) The closed loop transfer function obtained is Transfer function: Hcl(z) = 0.005641 z^3 - 0.005438 z^2 - 0.005425 z + 0.005229 --------------------------------------------------z^4 - 3.914 z^3 + 5.764 z^2 - 3.783 z + 0.934

The root locus of the closed loop system is as shown in figure 2.15.

Figure 2.15: Root locus of discrete closed loop system

From the root locus it is clear that the system is stable only for a small range of gain. This range is as given below 3 > K > 0.01 3 > (Ki + Kp) > 0.01

But 0.96 = Kp/ (Ki + Kp) 3 > Kp/0.96 > 0.01 The value of K can be selected based on the required damping ratio and natural frequency. Lets us assume that the controller needs to be designed for a damping ration of =0.00348 and wn = 2.23 rad/s. Then the value of gain obtained from root locus for =0.078 and wn = 1.2 rad/s is 0.278 K = 0.909 (Ki + Kp) = 0.909 But 0.96 = Kp/ (Ki + Kp) Kp = 0.87264 Ki = 0.03636 Hence the transfer function of controller is given by D(z) = [0.909*(z -0.96)]/ [z-1] The simulink model of the designed system is as shown below

Figure 2.16: Discrete closed loop system simulink model

The output of the model for a unit input of 1v is as shown below fig 20

From the figure it is clear that the steady state error has become zero and the system settling time is around 45s which confirms to the theoretical value of Ts = 4/ wn = 42.73s.

Figure 2.17: Step response of discrete closed loop system

CHAPTER 3
________________________________________________________________________________

3.1 Introduction
A loudspeaker (or "speaker") is an electro acoustic transducer that converts an electrical signal into sound. The speaker pulses in accordance with the variations of an electrical signal and causes sound waves to propagate through a medium such as air or water. The main components in a loudspeaker are voice coil, magnet, diaphragm, surround, spider basket, dust and air vent. When a time varying current is applied to the voice coil, which is placed in a permanent magnetic field, Lorentz force is produced. Due to this Lorentz force the cone and coil vibrate at the frequency of the applied electrical signal. This is the principle behind generation of audio signals.

3.2 Design Driver of loudspeaker

Figure 3.1: Components of loud speaker driver The various components of the loudspeaker are described below.

3.2.1 Voice coil and magnet

The voice coil is a lightweight tube usually made of plastic or cardboard. A specified length of copper or silver wire is wrapped tightly around the tube. The voice coil is suspended inside the magnet. The voice coil is attached to the speaker diaphragm at one end. When a current is applied to the voice coil, the resulting Lorentz force causes mechanical motion of the diaphragm.

3.2.2 Diaphragm
The diaphragm, or cone, is used to improve the acoustic efficiency. It is an extension of the voice coil. The cone is made of materials such as paper, plastic, aluminum, magnesium, or titanium have very different mechanical resonance properties, and each has a unique "sound". The cone introduces mass, stiffness and mechanical damping.

3.2.3 Surround
The surround connects the diaphragm to the frame, or basket, of the loudspeaker. It is a compliant material, usually rubber or foam, which allows the cone to move a specified displacement. The surround adds additional mechanical damping to the cone.

3.2.4 Spider
The spider is a compliant damping material connected to the diaphragm just above the voice coil. It adds stiffness and damping to the diaphragm.

3.2.5 Basket
The basket is the frame, usually constructed of metal. It holds the diaphragm onto the magnet. The design objective is to keep the mechanical resonance of the basket outside the bandwidth the speaker drives.

3.2.6 Dust Cap and Air Vent


The dust cap is an inverted dome placed over the voice coil to keep the environment out of the magnet chamber. To improve sound dispersion at high frequencies, cone-shaped dust caps, known as "phase plugs" are employed. The air vent is located on the bottom of the magnet. It cools the voice coil by allowing airflow in and out of the magnet chamber.

3.3 Free body diagram of the loudspeaker driver


The schematic diagram of the loudspeaker, indicating the electrical and mechanical portions is shown in Fig 3.2

Figure 3.2: Electrical and mechanical schematic of a loudspeaker driver

The loudspeaker driver is an consists of both an electrical portion and mechanical portion a) The electrical portion consists of a voltage source and a coil of wire in a magnetic field. The coil has a resistance, R and inductance, L. The motion of the coil in the magnetic field generates a back electromotive force (back emf), which needs to be taken into consideration. b) The mechanical portion consists of the spider and surround. They are rigidly attached to the basket in a manner that permits movement of the cone only in the axial direction. The mechanical suspension can be modeled as a nonlinear spring and a linear damper connected in parallel. The mechanical system therefore consists of the mass, m of the speaker cone connected to the rest of the speaker by a spring constant k and damper with coefficient b.

3.4 Voltage and force relations


3.4.1 Lorentz force When an electric current passes through the voice coil placed in a magnetic field, Lorentz force is produced. Due to the Lorentz force, the cone and the voice coil move. Let the Lorentz force be represented by Let Radius of voice coil = r Number of coil turns = N Current through the coil = i

Magnetic field strength = Length of the coil = circumference * number of turns = 2rN The Lorentz force is equal to the product of the length of the wire coil, magnetic field strength, and the current through the coil. So the equation for Lorentz force would be, 3.4.2 Back Emf The movement of voice coil in the magnetic field generates a voltage called Back Emf. Let the velocity with which the coil moves be denoted by v. The Back Emf is then equal to product of magnetic field strength (), length of the coil (2rN) and the velocity of the coil (v). Let the Back Emf be represented by
= (2rN) v (2) = (2rN) i (1)

Since velocity is the rate of change of distance v=dx/dt (where x is the displacement of the coil)
= (2rN) (dx/dt)

(3)

3.5 Electrical model of the loudspeaker


The circuit diagram of the electrical portion is as shown below in fig 3.3.The electric part of the loudspeaker driver would consists of the input voltage source, coil resistance (R), coil inductance (L) and the back Emf created due to movement of voice coil.

Figure 3.3: Electrical model of a loudspeaker From Kirchhoffs voltage law, the sum total of all voltage drops in a closed loop electrical circuit is zero. Hence,

-ei + iR+

+ L(di/dt)

(4)

Substituting for

from equation (3) we get,


(5)

ei = iR+ (2rN) dx/dt)+ L(di/dt)


3.6 Mechanical Governing Equation

The mechanical system consists of mass, spring, damper and Lorentz force that acts on the voice coil. The Lorentz force and Back Emf provide the link between electric and mechanical parts of the speaker. From Newtons second law, the sum of all force acting on a body must be Zero. Force applied = Mass * Acceleration + Spring Constant * Displacement of spring + Damping factor * velocity. i.e.
= mx + kx + bx (6)

The inertial force, spring force, and damping force act in opposition to the Lorentz force. The Free body diagram is as shown below.

Figure 3.4: Mechanical model of loud speaker driver. Substituting equation (1) in (6) we get, (2rN) .i = mx + kx + bx Above equation represents the mechanical model. (7)

3.7 Transfer Function


Transfer function of the speaker system refers to the ratio of Laplace transform of displacement output to the Laplace transform of the voltage input, assuming all initial conditions to be zero. Taking the Laplace transform of equation (5) E(s) = RI(s) + (2rN) [sX(s) x(0)] + L[sI(s) i(0)] Assuming initial conditions to be zero i.e. i(0) = x(0) = 0. E(s) = (R + Ls)I(s) + (2rN) sX(s) Taking the Laplace transform of equation (7) (2rN) I(s) = m [ X(s)-sx(0)-x(0)] + b[sX(s) x(0)] + k X(s) (10) (9) (8)

Assuming Zero initial conditions i.e. x(0) = 0; x(0) = 0 (2rN) I(s) = m I(s) = [m X(s)+b sX(s) + k X(s) (11) (12)

X(s)+b sX(s) + k X(s)] / (2rN)

Substituting equation (12) in equation (9) we get, E(s) = (R + Ls) [m X(s)+b sX(s) + k X(s)] / (2rN) + (2rN) sX(s) (13) (14) (15)

E(s)=X(s)[ (R+Ls) (m +bs+ k)/ (2rN) + (2rN) s] E(s) = X(s)[ (R+Ls) (m +bs+ k) + 2rN s] / (2rN)

Therefore transfer function is got by Laplace transform of displacement (x) to the Laplace transform of input voltage (ei). X(s) / E(s) = (2rN) / ((R+Ls) (ms2+bs+ k) + X(s) / E(s) = (2rN) / (mL + (mR + bL) 2rN )s + (bR + kL+ 2rN )) s + kR) (16) (17)

Equation (17) represents the transfer function of the loudspeaker system. The numerical values for the parameters are mentioned below: Coil Resistance R = 5 ohms Coil Impedance L = 0.05mH Spring Constant k = 2e5N/m Damper Co-efficient b = 50 Ns/m Mass of the coil m = 4e-3kg Radius of the coil r = 0.04 m Number of turns in the coil N = 50 Magnetic field strength = 0.25 Tesla Substituting the above parameter values in equation (17) we get X(s)/E(s) = 3.1416 / (2*10 + 0.0225 + 269.869 s + 10 )

The transfer function in Matlab is computed using tf function.


>> Num = [ 3.1416];
>> Den = [ 2e-7 0.0225 269.869 1e6]; >> speaker_transf = tf (Num, Den);

Transfer function:

3.142 ----------------------------------------------------2e-007 s^3 + 0.0225 s^2 + 269.9 s + 1e006 (18)

3.8 Bode Plot


Bode plot gives Magnitude and phase versus the frequency. The Bode plot of the loudspeaker can be obtained by using the Matlab bode command. >> bode (speaker_transf) The obtained Bode plot is as shown below in figure 3.5

3.8.1 The observations made from bode plot are: a) It is observed that the high frequency response rolls off by -3b at approximately 756Hz. b) Maximum response is obtained at Zero Hz and remains at the value till a frequency of approximately 461 Hz is reached.

c) From the magnitude plot, it is seen that the magnitude is 218dB at 1MHz, while it is 278 dB at 10MHz. The difference in magnitude is approximately 60dB/decade. Thus system is of the order 3. d) The phase plot shows a drop from ~0 to ~270. This also indicates that this system is of third order.

Figure 3.5: Bode plot for the Transfer function

3.9 Impulse Response


Impulse response is used to determine how the system behaves for an impulse. Consider an impulse input Ei(t) governed by equation, Ei(t) = 1 v for t=0 and 0 v for t>0 The Laplace transform of Ei(t) is Ei(s) = 1. The matlab command used to obtain the impulse response is impulse function. >> impulse(speaker_transf) The impulse response obtained is as shown in figure 3.6 (19)

3.9.1 Following observation is made from the impulse response plot. a) The maximum displacement of voice coil is x=8.62 mm for an impulse input of 1v. b) A delay of 0.15 ms is observed from the time when the impulse is applied to the system to reach maximum displacement. c) The setting time is around 0.95 ms

Figure 3.6: Impulse response for the Transfer function

3.10 State Space Model


The state space model representation is as shown below X = A X + B U Y=CX+DU Where X is state vector, U is input vector and Y is output vector. In loudspeaker driver, the state variables are the current that flows through the voice coil i, and the displacement of the voice coil due to Lorentz force x and the rate of change of displacement is velocity v. We know Rate of change of displacement is given by. x = v Substituting equation (20) in Equation (7) we get (2rN) i = mv + kx + bv or (21) (22) (20)

v = [(2rN) i kx bv] / m substituting (dx/dt) as x and (di/dt) as i in Equation (5) we get, ei = iR+ (2rN) x+ Li Substituting equation (20) in the above equation (23) we get, ei = iR+ (2rN) v+ Li i = [ei iR (2rN) v]/L The output equation is Y = x The state vector X is defined as or

(23)

(24) (25) (26)

X = J iK

H I

x v

(27)

Equations (20), (22), (25) can be re-written in matrix form as shown below
H I 0 1 a ` H I L M H I 0 2rNfff Rf x. L ff f f ffffffff x L M ` aC fffffffM fffffff ffff b M B L M @ f f L M L 0 M J i K L 1f +L fM ei t J i. K=L M L L L M L M ` a JLK v . L kf ffffffff 2rNfff J bf M v ff ff fffffff f fffffff ffff b ff K ff f 0 @ @ @ m m m

(28)

Re-Writing Equation Y=x we get,


H I x @ AB ` aC A Y= 1 0 0 J i K+ 0 ei t @

(29)

Therefore, 0 1 a ` L M L 2rNfffM Rf ff f f ffffffff fffffff fffffff ffff b M L 0 @ M A= L L M L L L M ` a L 2rNfff bf J kf bf M ff ffffffff ff fffffff f ffffff ffff ff K ff f @ @ @ m m m
H

0 L M L 1f M @ A f f B=L fM C= 1 0 0 L M JLK 0

D= 0

@ A

(30)

Matlab commands: >> A= [0 0 1; 0 -R/L -(2rN)/L; -K/M (2rN)/M -b/M]; >>B= [0; 1/L ; 0]; >>C= [1 0 0]; >>D= [0]; >>speaker_transf_ss = ss(A,B,C,D)

3.11 Bode Plot using State Space model


The matlab command bode can be used to obtain the bode plot using the state space model. >> bode (speaker_transf_ss) The plot obtained is as shown in fig 3.7

The observations made in Bode plot for state space model are same as bode plot using transfer function method.

Figure 3.7: Bode plot for the State Space model

3.12 Impulse response using state space model

Figure 3.8: Impulse response for the State Space model

The Matlab command impulse can be used to obtain the impulse response using the state space model. The plot obtained is as shown in fig 3.8. >> impulse (transfer_func_ss) The observations made in impulse response plot for state space model are same as impulse response plot using transfer function method.

3.13 Simulink Mathematical model


From the state space mode we get the three governing equations: equation 20, equation 22 and equation 25 Here since value of r, N and is fixed let (2rN) be a constant C; i.e. C=3.14 The simulink model representing the above equation is as given in figure 3.9:

Figure 3.9: Simulink mathematical model of loudspeaker driver

Using the above simulink mathematical model shown in figure 3.9, the response of the electromechanical system to sinusoidal input voltages of different frequencies can be studied for input signal of amplitude 1v. The resulting outputs can be compared with the bode plot obtained using Transfer function/ state space model derived earlier. The bode plot obtained from transfer function is as shown in figure 3.5. From the bode plot it is clear that till 350 Hz maximum gain is observed. At a frequency of 756 Hz the gain reduces by 3db and this corresponds to bandwidth. At 5 KHz and 10 KHz, high frequency roll-off is observed. In order to compare the results of simulink with the results obtained from transfer function, let us consider the two important input frequencies 350Hz, 756 Hz.

3.13.1 Sinusoidal input with frequency 350Hz and peak amplitude 1 V

Figure 3.10: Sinusoidal input with frequency 350Hz and peak amplitude 1 V

3.13.2 Output response with input frequency 350Hz and input peak amplitude 1 V

Figure 3.11: Output response with input frequency 350Hz and input peak amplitude 1 V

It is clear from the output that the peak amplitude of the output is around 2.9*10-6. this corresponds to a gain of 20log10[2.9*10-6] = -110.75db. Also it can be observed that the first cycle of the output is completed in 3.13 ms, which corresponds to a time delay of 0.273 ms with respect to

the input because 1/350s=2.857ms. i.e. phase lag = (0.273/2.857)*360 = 34.39. From the above both the magnitude and phase lag is in concurrence with the result obtained from transfer function.

3.13.3 Output response with input frequency 756Hz and input peak amplitude 1V

Figure 3.12: Output response with input frequency 756Hz and input peak amplitude 1 V

It is clear from the output that the peak amplitude of the output is around 2.35*10-6. This corresponds to a gain of 20log10[2.35*10-6] = -112.570db. Also it can be observed that the first cycle of the output is completed in 1.469 ms, which corresponds to a time delay of 0.147 ms with respect to the input. i.e. phase lag = (0.147/1.322)*360 = 69.6. From the above both the magnitude and phase lag is in concurrence with the result obtained from transfer function.
3.13.4 Output response with input frequency 10KHz and input peak amplitude 1V

It is clear from the output that the peak amplitude of the output is around 3.35*10-8. This corresponds to a gain of 20log10[3.35*10-8] = -149.49db. From the above both the magnitude and phase lag is in concurrence with the result obtained from transfer function.

Figure 3.13: Output response with input frequency 10KHz and input peak amplitude 1 V

3.13.5 Output response with input frequency 100KHz and input peak amplitude 1V

Figure 3.14: Output response with input frequency 100KHz and input peak amplitude 1 V

It is clear from the output that the peak amplitude of the output is around 1.4*10-10. this

corresponds to a gain of 20log10[1.4*10-10] = -197.077db. From the above both the magnitude and phase lag is in concurrence with the result obtained from transfer function.

3.14 Comparison of results of Simulink and Bode plot transfer function


Frequency in radian (rad/sec) Input Frequency (HZ) Result from TF / SS model (Bode Plot) Result from SIMULINK

2198

350

Gain is -110 dB Output lags input by 34 degrees

Gain is -110.75 dB Output lags input by 34.39 degrees Gain is -112.570 dB Output lags input by 69.6 degrees Gain is -149 dB Gain is -197 dB

4750

756

Gain is -113 dB Output lags input by 66.8 degrees

62800 628000

10K 100K

Gain is -150 dB Gain is -205 dB

Table 3.1 Comparison chart of result of Transfer function and simulink

References
________________________________________________________________________________ http://lorien.ncl.ac.uk/ming/digicont/digimath/dpid1.htm http://en.wikipedia.org/wiki/Control_theory http://en.wikipedia.org/wiki/Control_Systems http://en.wikibooks.org/wiki/Control_Systems/Introduction http://www.tpub.com/content/doe/h1013v2/css/h1013v2_117.htm http://en.wikipedia.org/wiki/PID_controller#Proportional_term http://books.google.co.in/books?id=s0k9kGs5bHYC&pg=PA553&lpg=PA553&dq=design+continu ous+time+controller+and+then+convert+it+discrete+equivalent+or+design+discrete+controller&sou rce=bl&ots=kBbypkRWIH&sig=C1ox5rdkZHr9DmUAzyOlUZatbOo&hl=en&ei=LcRhS9Ef16CR BeyorOcL&sa=X&oi=book_result&ct=result&resnum=8&ved=0CC0Q6AEwBw#v=onepage&q=d esign%20continuous%20time%20controller%20and%20then%20convert%20it%20discrete%20equi valent%20or%20design%20discrete%20controller&f=false
Benjamin C Kuo, Automatic Control Systems, Princeton Hall Co., Seventh Edition, 2003.

Appendix-A
________________________________________________________________________________

Matlab code of chapter 2- Aeroplane model


A=[ -0.313 56.7 0; -0.0139 -0.426 0; 0 56.7 0] B=[0.232;0.0203;0] C=[0 0 1] D=0 [NUM,DEN]=ss2tf(A,B,C,D) aircraft_pitch =tf(NUM,DEN) aircraft_pitch =tf([1.151 0.1774],[1 0.739 0.9215 0]) rlocus(aircraft_pitch) step (aircraft_pitch) impulse(aircraft_pitch) aircraft_closedloop_tf=feedback (aircraft_pitch, 1) rlocus(aircraft_closedloop_tf) bode(aircraft_closedloop_tf) c2d(aircraft_pitch,0.1,'zoh') air_dis_num=[0.005641 -2.267e-005 -0.005447] air_dis_den = [1 -2.92 2.849 -0.9288] H= tf(air_dis_num,air_dis_den,0.1) aircraft_PI = tf( [1 -0.96],[1 -1],0.1) aircraft_closed_H = feedback(H* aircraft_PI,1)

Appendix-B
________________________________________________________________________________

Matlab code of chapter 3- Loudspeaker model


Num = [ 3.1416]; Den = [ 2e-7 0.0225 269.869 1e6]; speaker_transf = tf (Num, Den); bode (speaker_transf) impulse(speaker_transf) A= [0 0 1; 0 -R/L -(2rN)/L; -K/M (2rN)/M -b/M]; B= [0; 1/L ; 0]; C= [1 0 0]; D= [0]; speaker_transf_ss = ss(A,B,C,D) bode (speaker_transf_ss) impulse (transfer_func_ss)

Das könnte Ihnen auch gefallen