Modeling of Control Systems

7 downloads 0 Views 6MB Size Report
Miguel Mora-González and Jesús Muñoz Maciel ... C ∫0 ti(τ)dτ. (2). In order to find a transfer function, the Laplace transform for both equations is applied.
Chapter 13

Modeling of Control Systems Roger Chiu, Francisco J. Casillas, Didier López-Mancilla, Francisco G. Peña-Lecona, Miguel Mora-González and Jesús Muñoz Maciel Additional information is available at the end of the chapter http://dx.doi.org/10.5772/58236

1. Introduction In studying control systems the reader must be able to model dynamical systems in mathe‐ matical terms and analyze their dynamic characteristics. This section provides an introduction to basic concepts and methodologies on modeling control systems. It also introduces some fundamentals to solve realistic models used basically in mechanical, electrical, thermal, economic, biological, and so on. A mathematical model is composed by a set of equations that describe a real system accurately, or at least fairly well. However a mathematical model is not unique for a given system, and the system under study can be represented in many different ways, in the same way a mathematical model can be used to represent different systems. Algorithms used to solve the set of equations that represent a control system require a great amount of programming instructions. Matlab is a tool that simplifies and accelerates such algorithms allowing to modeling a great variety of control systems in a very elegant way [1]. There are special Matlab toolbox useful to solve different control systems, in particular Control System Toolbox (included in MATLAB Version 7.8.0.347 (R2009a)): Creating linear models, data extraction, time-domain analysis, frequency-domain analysis, state space models, etc. Some of these are used throughout the chapter to facilitate algorithm development. This chapter is organized as follows; the section 1 is an introduction to modeling control systems. In section 2, some applications using electrical circuits for series and parallel circuits are given. Section 3, a second order analysis is presented. In section 4, control systems for mechanical vibrations are analyzed. Optical control systems are given in section 5, given a perspective with two basic systems: laser diode, and optical fiber. Some conclusions are presented in section 6.

© 2014 The Author(s). Licensee InTech. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

376

MATLAB Applications for the Practical Engineer

2. Electrical circuits Undoubtedly, the most classic circuit in literature is the RLC circuit. Due to its great usefulness in the study of linear systems, the model of the RLC circuit helps to understand some of the behaviors of an electrical control system. Thus, the next subsections will address to the modeling of series and parallel RLC circuits. Some behaviors will be analyzed using some tools from Matlab. Case I: RLC series circuit

Figure 1. RLC series circuit.

In Figure 1, a RLC series circuit is shown. The modeling consists in to express a number of equations such that all kinds of moves are expressed in those equations. Thus, the input equation is given by vi (t ) = Ri (t ) + L

di (t ) dt

+

1 t ( ) C ∫0 i τ dτ.

(1)

Let be v o (t ) the output in capacitor C. Then, the output equation is represented by vo (t ) =

1 t ( ) C ∫0 i τ dτ.

(2)

In order to find a transfer function, the Laplace transform for both equations is applied obtaining

Modeling of Control Systems http://dx.doi.org/10.5772/58236

V i (s ) = RI (s ) + LsI (s ) +

1 Cs

(3)

I (s ),

and V o (s ) =

1 Cs

(4)

I (s ).

The transfer function becomes V o (s ) V i (s )

=

1 LC s 2 + RCs + 1

(5)

.

In order to compute a general solution and to analyze the behavior of this RLC series circuit, consider an input constant force vi (t ) = V i . Then V i (s ) = V i / s, therefore the output signal in the Laplace domain is given by Vi

(6)

V o (s ) = s ( LC s 2 + RCs + 1) , therefore, the output signal results

(

vo (t ) = V i 1 - e

R

- 2L t

cos

4L + R 2C 4L

2

C

t-

R 2C 4L + R 2C

e

R

- 2L t

sin

4L + R 2C 4L

2

C

)

t .

(7)

Figure 2, shows the block diagram for the RLC series circuit.

Figure 2. Block diagram for the RLC series circuit.

Suppose a particular case for the block diagram with R = 2kΩ, L = 1mH and C = 1µF. An easy way to obtain a step response for a RLC series circuit is to draw a block diagram in Simulink, from Matlab, using a source Step and a Scope to observe the response as shown in Figure 3. In Figure 4, the step response for the RLC series circuit is plotted.

377

378

MATLAB Applications for the Practical Engineer

Figure 3. Block diagram using Simulink for a step response.

Figure 4. Step response for RLC series circuit using Simulink.

Case 2: RLC Parallel circuit

Figure 5. RLC parallel circuit.

Modeling of Control Systems http://dx.doi.org/10.5772/58236

In Figure 5, a RLC parallel circuit is shown. The equation of current could be represented by i (t ) =

vR (t )

+

R

1 t L ∫0 v L

(τ )dτ + C

d vC (t ) dt

(8)

.

The output voltage through capacitor C, establishes the equalities vo (t ) = vR (t ) = vL (t ) = vC (t ),

(9)

such that the mathematical model can be written in only one equation i (t ) =

vo (t ) R

+

1 t ( ) L ∫0 vo τ dτ

+C

d vo (t ) dt

(10)

.

In order to find the transfer function, the Laplace transform is I (s ) =

V o (s ) R

+

1 Ls

V o (s ) I (s )

=

RLC s 2 + Ls + R

(11)

V o (s ) + CsV o (s ).

Then, the transfer function results RLs

(12)

.

To compute a general solution and to analyze the behavior of this RLC parallel circuit, consider an input force of constant current i (t ) = I . Then I (s ) = I / s, therefore the output signal in the Laplace domain is given by V o (s ) =

RL RLC s 2 + Ls + R

(13)

I,

and the solution signal results vo (t ) = 2IR

L 4R 2C - L

e

1

- 2RC t

sin

4R 2C - L 4R 2 L C 2

t.

(14)

Figure 6, shows the corresponding block diagram for the RLC parallel circuit. In order to analyze the stability using Matlab, consider a RLC parallel circuit with R = 1kΩ, L = 1mH and C = 1µF. The aim is to obtain the transfer function, a state space representation, the eigenvalues, and the solution to state space equation. The coefficients of the transfer function are stored in two vectors num and den for the numerator and denominator, respectively. The following solution uses the instructions tf, tf2ss, from Control Systems Toolbox. Window a) shows this algorithm obtaining the transfer function

379

380

MATLAB Applications for the Practical Engineer

Figure 6. Block diagram for the RLC parallel circuit.

G (s ). Window b), uses the instruction tf2ss to convert from transfer function to state space, getting arrays A, B, C and D. Window c) illustrate the stability of the system, computing the eigenvalues from array A. Note that the eigenvalues from the system in state space is equiv‐ alent to compute the poles of transfer function G (s ). Thus, the poles are placed at the negative place of the complex plane, which means that the system is stable.

a) >> num=[1 0]; >> den=[0.000001 0.001 1000]; >> G=tf(num,den) Transfer function: s --------------------------1e-006 s^2 + 0.001 s + 1000 b) >> [A,B,C,D]=tf2ss(num,den) A= 1.0e+003 * -1 -1000000 0.001 0 B= 1 0 C = 1000000 D=0 c) >> eig(A) ans = 1.0e+004 * -0.0500 + 3.1619i -0.0500 - 3.1619i

0

Modeling of Control Systems http://dx.doi.org/10.5772/58236

To obtain the solution to the state space equation using Matlab, it is necessary to construct an 7. from brisi potpis object S, of classFigure 'sym', A, using the expression S=sym(A), in order of using the instruction ilaplace, from Symbolic Math Toolbox. It is well known that the solution to state equation is To obtain the solution to the state space equation using Matlab, it is necessary given by to construct an object S, of class 'sym', from A, using the expression S = sym(A), in order of using the instruction ilaplace, from Symbolic Math Toolbox. It is well known that the solution -1 to state equation is given by

x (t ) = L (sI - A)

  

ିଵ 0.

x (0).

(15)

(15)

Then, window d) gives a solution using symbolic mathematics and the instruction ilaplace, Then, window d) gives a solution using symbolic mathematics and the T . with x (0) = 1 1instruction ilaplace, with 0  1 1 ் .

d) >> s=sym('s'); >> f=ilaplace(inv(s*eye(2)-A)) f= [ (cos(500*3999^(1/2)*t) - (3999^(1/2)*sin(500*3999^(1/2)*t))/3999)/exp(500*t), -(2000000*3999^(1/2)*sin(500*3999^(1/2)*t))/(3999*exp(500*t))] [ (3999^(1/2)*sin(500*3999^(1/2)*t))/(1999500*exp(500*t)), (cos(500*3999^(1/2)*t) + (3999^(1/2)*sin(500*3999^(1/2)*t))/3999)/exp(500*t)]

Note that, all solutions a negative or they are as denomi‐ Note that, have all solutions have exponential a negative exponential or written they are explicitly written explicitlyexponential, as denominators with mean positivethat exponential, which that the kind of results nators with positive which the system is mean stable. This system is stable. This kind of results could be useful for the next sections for could be usefulmechanical for the next sections for mechanical vibrations and optical control systems. vibrations and optical control systems.

3. Second

3. Second Order Analysis In the Nature there are many examples that can be modeled with seconddegree equations. The general form is represented by a homogeneous linear differential equation with constant coefficients a, b and, c as shown below order analysis ଶ    ଶ     0, 16  

In the Nature there are many ofexamples that can be modeled with second-degree equations. Laplace transform the second-order equation is   differential  The general form is represented by a0 homogeneous linear  ଶ 

 0  

0    equation 0, 17 with constant    coefficients a, b and, c as shown below and solving for the dependent variable d 2x

dx

(16)

a d t 2 + b dt + cx = 0, Laplace transform of the second-order equation is b

s 2 X (s ) - sx (0) - x˙ (0) + a sX (s ) -

b a

x (0) +

c a

X (s ) = 0,

(17)

and solving for the dependent variable X (s ) =

sx (0) + s2+

b a

()

x (0) + x˙ 0 b a

s+

c a

.

(18)

381

382

MATLAB Applications for the Practical Engineer

The response for a unitary step input is given by the next equation

X (s ) =

s 2 x (0) + s 2

s +

b a b a

()

x (0) + x˙ 0 s+

c a



1 s

.

(19)

There are four possible behaviors of equation (19) [2]: overdamped, underdamped, undamped and critically damped. These results can be predicted by analyzing the characteristic equation, as shown below:

{

positive, overdamped negative, underdamped b 2 - 4ac = - 4ac, undamped zero, critically damped

(20)

Where the initial conditions x (0) and x˙ (0) represent the initial state and the point of conver‐ gence of the response signal, respectively. The next results uses a step signal as input signal, with the instruction step, from Control Systems Toolbox. Thus, the graphical representation of a second-order analysis using Matlab as shown in Figure 7, can be obtained with the next code:

clear all; x0=0.8; xp0=0.35; %%%% b*b>4*a*c a=1;b=5;c=1; num1=[x0 x0*b/a xp0];den1=[1 b/a c/a]; signal1=step(num1,den1); %%%% b*b> ωn the amplitude of the response approaches to zero and the phase angle to 180o. Dynamic analysis of a cantilever The schematic in Figure 9 is cantilever beam with a lumped mass at its free end and is used to detect mechanical resonances; the beam is fixed perpendicular to the support of a machine that can operate at different velocities, generating angular frequencies that move harmonically along the x direction. Ignoring the mass of the beam, consider the following model to calculate the amplitude and phase angle of the dynamic displacement for angular frequencies of 0