1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Kỹ thuật lập trình >

2 Model Generation: State-Space and Transfer Function Representation

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (4.66 MB, 453 trang )


An Engineer’s Guide to Mathematica®



360



where v = v(t) is the input voltage to the motor windings, i = i(t) is the current in the motor coil,

𝜃 = 𝜃(t) is the angular position of the rotor, R is the motor resistance, L is the inductance of the

winding, km is the conversion coefficient from current to torque, kg is the back electromotive

force generator constant, 𝜁 represents the motor friction, and J is the mass moment of inertia

of the system and its load.



10.2.2



State-Space Models: StateSpaceModel[]



Equation (10.1) can be converted to a system of first-order differential equations with the

definitions

x1 (t) = 𝜃(t)

d𝜃

x2 (t) =

dt

x3 (t) = i(t)

Then Eq. (10.1) becomes the following system of first-order equations

dx1

= x2

dt

kg

dx

𝜁

ẋ 2 = 2 = − x2 + x3

dt

J

J

dx3

km

R

v

ẋ 3 =

= − x2 − x3 +

dt

L

L

L



ẋ 1 =



which can be written in matrix form as

̇ = [A] {x} + {B} {u}

{x}

where {x} is the state vector, {u} is the input vector, and

⎧ x1 ⎫

⎪ ⎪

{x} = ⎨ x2 ⎬ ,

⎪x ⎪

⎩ 3⎭



⎧ ẋ 1 ⎫

⎪ ⎪

̇ = ⎨ ẋ 2 ⎬ ,

{x}

⎪ ẋ ⎪

⎩ 3⎭



⎡0

1



[A] = ⎢ 0 −𝜁 ∕J

⎢ 0 k ∕L

m





0 ⎤



kg ∕J ⎥ ,

−R∕L ⎥⎦



⎧0⎫

⎪ ⎪

{u} = ⎨ 0 ⎬

⎪v⎪

⎩ ⎭

⎧ 0 ⎫





[B] = ⎨ 0 ⎬

⎪ 1∕L ⎪







The matrix [A] is called the state matrix and the matrix [B] the input matrix.

In addition, we define an output vector {y} as follows

{y} = [C] {x} + {D} {u}



Control Systems and Signal Processing



361



where, for the system under consideration,

[C] = {1



0



0},



{D} = {0}



It is recalled that x1 = 𝜃. The equations

̇ = [A] {x} + {B} {u}

{x}

{y} = [C] {x} + {D} {u}

are the state-space equations for a linear time-invariant system.

The state-space representation for this linear system for the formulation given above is

obtained with

StateSpaceModel[{a,b,c,d}]

where a, b, c, and d are the matrices and vectors as defined above. Then, for the system

represented by Eq. (10.1),

a={{0,1,0},{0,-ζ/J,kg /J},{0,-km /L,-R/L}};

b={{0},{0},{1/L}};

c={{1,0,0}};

d={{0}};

ssM=StateSpaceModel[{a,b,c,d}]

which displays

1

⎛0

⎜ 0 -ζ∕J

⎜ 0 -k ∕L

m



0

⎝1



0

kg ∕J

-; R∕L

0



0 ⎞

0 ⎟

1∕L ⎟



0 ⎠



s



(10.2)



The state-space model can also be obtained directly from Eq. (10.1) by using

StateSpaceModel[eqs,x,u,t]

where eqs is a list of the differential equations, x is a list of the dependent variables and

their derivatives up to the n − 1 derivative in each dependent variable, u is a list of the input

functions, and t is the independent variable. Then, for Eq. (10.1), the state-space equations

can be obtained from

StateSpaceModel[{L i’[t]+km θ’[t]+R i[t]==v[t],

J θ”[t]+ζ θ ’[t]-kg i[t]==0},{θ[t],θ’[t],i[t]},{v[t]},

{θ[t]},t]

which produces Eq. (10.2).



An Engineer’s Guide to Mathematica®



362



10.2.3



Transfer Function Models: TransferFunctionModel[]



Equation (10.1) can be converted to a transfer function model by first taking the Laplace

transform of these equations assuming zero initial conditions and then solving for the ratio of

the Laplace transform of the output variable and the Laplace transform of the input function.

Thus, the Laplace transform of Eq. (10.1) with zero initial conditions yields

km sΘ(s) + (Ls + R) I(s) = V(s)

)

( 2

Js + 𝜁 s Θ(s) − kg I(s) = 0



(10.3)



Θ(s) kg

=

V(s) sD

Js + 𝜁

I(s)

=

V(s)

D

D = (Ls + R) (Js + 𝜁) + km kg



(10.4)



The solution to Eq. (10.3) is



The transfer function model is created with

TransferFunctionModel[tf,s]

where tf is the transfer function in terms of the variable s. Thus, for the transfer function

Θ(s)/V(s) given above,

tfM=TransferFunctionModel[kg /(s ((R+L s) (J s+ζ)+kg km )),s]

which displays

(



kg

(

(

)

)

s (L s + R) J s + 𝜻 + km kg



)𝝉

(10.5)



This transfer function representation can also be obtained from the state-space representation

obtained previously. In this case, the command argument is

TransferFunctionModel[ssMod]

where ssMod is the state-space model obtained from StateSpaceModel. Thus, for the

system under consideration,

Simplify[TransferFunctionModel[ssM]]

creates the same result as that shown in Eq. (10.5).



Control Systems and Signal Processing



363



It is seen that a direct way to arrive at the transfer function is to use the sequence

tfMod=TransferFunctionModel[StateSpaceModel[eqs,x,u,t]]

Thus, for the system given by Eq. (10.1), we have

tfM=TransferFunctionModel[StateSpaceModel[

{L i’[t]+km θ’[t]+R i[t]==v[t],

J θ”[t]+ζ θ’[t]-kg i[t]==0},{θ[t],θ’[t],i[t]},

{v[t]},{θ[t]},t]]//Simplify

which yields Eq. (10.5).

The transfer function model can be converted to a state-space model with

StateSpaceModel[tfMod]

where tfMod is a transfer function model. Thus, using our previous results,

ssM1=StateSpaceModel[tfM]

displays

⎛ 0

⎜ 0





⎜ 0



⎜ k

⎜ g

⎝JL



-



1



0



0

R ζ + kg km



1



JL

0



-



R ζ

L J

0



s



0⎞

0 ⎟⎟



1⎟





0 ⎟⎠



which is in a different form than that given by Eq. (10.2) and is a result of the state-space

representation not being unique. However, TransferFunctionModel[ssM1] recovers

Eq. (10.5).



10.3



Model Connections – Closed-Loop Systems and System Response:

SystemsModelFeedbackConnect[] and

SystemsModelSeriesConnect[]



There are several commands that allow one to connect transfer function objects to form a

closed-loop transfer function model. Two of the most commonly used are as follows. Consider

two systems sy1 and sy2 that are transfer function objects. If sy2 is in a feedback loop with

sy1, then this system is represented by

SystemsModelFeedbackConnect[sy1,sy2,fbk]



An Engineer’s Guide to Mathematica®



364



H2

+



R(s) +



G1





+



G2



+



G3



C(s)





H3



H1

Figure 10.1 Block diagram of interconnected transfer function elements representing a control system



where fbk = −1 is used to indicate negative feedback and fbk = 1 is used for positive

feedback. When omitted, the default value is −1. If, in addition, sy2 is omitted, then it is

assumed that unity negative feedback is being used.

When these two systems are cascaded, that is, they are in series, then the systems are

combined using

SystemsModelSeriesConnect[sy1,sy2]

To illustrate the use of these two commands, we consider the system block diagram shown in

Figure 10.1. The transfer function representing the ratio C(s)/R(s) is obtained from

TF[h_]:=TransferFunctionModel[h]

sy1=SystemsModelFeedbackConnect[TF[G3 ],TF[H3 ]];

sy2=SystemsModelSeriesConnect[TF[G2 ],sy1];

sy3=SystemsModelFeedbackConnect[sy2,TF[H2 ],1];

sy4=SystemsModelSeriesConnect[sy3,TF[G1 ]];

CR=SystemsModelFeedbackConnect[sy4,TF[H1 ]]//Simplify

where we have created the function TF to improve the readability of the program. The execution

of the program gives

G1 G2 G3

1 + G1 G2 G3 H1 - G2 G3 H2 + G3 H3

To further illustrate the use of SystemsModelFeedbackConnect, we examine the

transfer function given by Eq. (10.5) and make it into a closed-loop system with unity feedback.

However, before doing so, we shall introduce a function that can be used to obtain the output

response of a system when the input v is specified. The command is

OutputResponse[systfss,v,{t,tmin,tmax}]

when an interpolating function is desired and

OutputResponse[systfss,v,t]



Xem Thêm
Tải bản đầy đủ (.pdf) (453 trang)

×