Exercise 1a: Transfer functions

```EE4107 -&shy;β Cybernetics Advanced Exercise 1a: Transfer functions Transfer functions are a model form based on the Laplace transform. Transfer functions are very useful in analysis and design of linear dynamic systems. A general Transfer function is on the form: π» π =
π¦(π )
π’(π )
Where π¦ is the output and π’ is the input. A general transfer function can be written on the following general form: π» π  =
ππ’πππππ‘ππ(π )
π! π  ! + π!!! π  !!! + β― + π! π  + π!
=
πππππππππ‘ππ(π )
π! π  ! + π!!! π  !!! + β― + π! π  + π!
The Numerators of transfer function models describe the locations of the zeros of the system, while the Denominators of transfer function models describe the locations of the poles of the system. Differential Equations While the transfer function gives an external in-&shy;βout representation of a system, will the differential equations of a system give an internal representation of a system. We can find the transfer function from the differential equation by using Laplace and Laplace transformation pairs. Likewise, we can find the differential equation from the transfer function using inverse Laplace. The following transformation pair is much used: Differentiation: 1.order systems: π₯ βΊ π π₯(π ) For higher order systems: π₯ (!) βΊ π  ! π₯(π ) Integration: Faculty of Technology, Postboks 203, Kj&oslash;lnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01
2 π₯βΊ
1
π₯(π ) π
Time-&shy;βdelay: π’ π‘ − π βΊ π’(π )π !!&quot; Static Time-&shy;βresponse In some cases we want to find the constant value π¦! of the time response when the time π‘ → ∞. We can then use the final value theorem (“sluttverditeoremet”): π¦! = lim π¦ π‘ = lim π  β π¦(π ) !→!
!→!
MathScript MathScript has several functions for creating transfer functions: Function tf Sys_order1 Sys_order2 step Description Example Creates system model in transfer function form. You also can use this function to state-&shy;βspace models to transfer function form. Constructs the components of a first-&shy;βorder system model based on a gain, time constant, and delay that you specify. You can use this function to create either a state-&shy;βspace model or a transfer function model, depending on the output parameters you specify. Constructs the components of a second-&shy;βorder system model based on a damping ratio and natural frequency you specify. You can use this function to create either a state-&shy;βspace model or a transfer function model, depending on the output parameters you specify. Creates a step response plot of the system model. You also can use this function to return the step response of the model outputs. If the model is in state-&shy;βspace form, you also can use this function to return the step response of the model states. This function assumes the initial model states are zero. If you do not specify an output, this function creates a plot. Example: Given the following transfer function: π» π  =
1
π +1
In MathScript we will use the following code: % Define Transfer function
num = [1];
den = [1, 1];
&gt;den=[1, 1, 1];
&gt;H = tf(num, den)
&gt;K = 1;
&gt;tau = 1;
&gt;H = sys_order1(K, tau)
&gt;dr = 0.5
&gt;wn = 20
&gt;[num, den] = sys_order2(wn, dr)
&gt;SysTF = tf(num, den)
&gt;num=[1,1];
&gt;den=[1,-1,3];
&gt;H=tf(num,den);
&gt;t=[0:0.01:10];
&gt;step(H,t);
3 H = tf(num, den)
% Step Response
step(H)
This gives the following step response: A general transfer function can be written on the following general form: π» π  =
ππ’πππππ‘ππ(π )
π! π  ! + π!!! π  !!! + β― + π! π  + π!
=
πππππππππ‘ππ(π )
π! π  ! + π!!! π  !!! + β― + π! π  + π!
The Numerators of transfer function models describe the locations of the zeros of the system, while the Denominators of transfer function models describe the locations of the poles of the system. In MathScript we can define such a transfer function using the built-&shy;βin tf function as follows: num = [bm, bm_1, bm_2, … , b1, b0];
den = [an, an_1, an_2, … , a1, a0];
H = tf(num, den)
Task 1: Differential equations to Transfer functions Task 1.1 Given the following differential equation: π₯ = −0.5π₯ + 2π’ Find the following transfer function: EE4107 -&shy;β Cybernetics Advanced 4 π» π  =
π₯(π )
π’(π )
Task 1.2 Given the following 2.order differential equation: π¦ + π¦ + 5π¦ = 5π₯ Find the following transfer function: π» π  =
π¦(π )
π₯(π )
Task 2: Transfer functions to differential equatons Given the following system: π» π  =
π₯(π )
3
=
π’(π ) 0.5π  + 1
Task 2.1 Find the differential equation from the transfer function above. Task 2.2 Draw a block diagram of the system. Task 3: 2.order system Given the following transfer function: π» π  =
π¦(π )
2π  + 3
= !
π’(π ) π  + 4π  + 3
Task 3.1 Find the differential equation for the system. Task 4: Static Time-&shy;βresponse Task 4.1 Given the following system: π»(π ) =
π¦(π )
3
=
π’(π ) 2π  + 1
EE4107 -&shy;β Cybernetics Advanced 5 Find the static time-&shy;βresponse. We will use a step for the control signal (π’ π‘ = 1). Note! The Laplace Transformation pair for a step is as follows: 1
⇔ 1 π
Task 4.2 Given the following system: π»(π ) =
π¦(π )
6(π  + 1)
=
π’(π ) 9π  + 0.25
Find the static time-&shy;βresponse. We will use a step for the control signal (π’ π‘ = 1). Task 5: 1.order transfer functions Given the following system: π»(π ) =
π¦(π )
2
=
π’(π ) 4π  + 1
Task 5.1 What are the values for the gain πΎ and the time constant π for this system? Sketch the step response for the system using “pen and paper”. Find the step response using MathScript and compare the result with your sketch. Task 5.2 Find the differential equation from the transfer function above and draw a block diagram of the system (“pen and paper”). Task 5.3 From the block diagram in Task 1.2, find the transfer function π» (π ) =
(The answer shall of course be π» (π ) =
!(!)
!(!)
=
!
!!!!
!(!)
!(!)
) Task 5.4 Find the solution for the differential equation (π¦(π‘)) and plot it (“pen and paper”). EE4107 -&shy;β Cybernetics Advanced 6 We will use a step for the control signal (π’ π‘ = 1). Note! The Laplace Transformation pair for a step is as follows: 1
⇔ 1 π
Tip! You also need to use the following Laplace transform pair: πΎ
⇔ πΎ(1 − π !!/! ) ππ  + 1 π
Compare to the results from Task 1.1. Task 6: Transfer functions in MathScript Define the following transfer functions in MathScript. Task 6.1 Given the following transfer function: π»(π ) =
2π  ! + 3π  + 4
5π  + 9
π»(π ) =
4π  ! + 3π  + 4
5π  ! + 9
π»(π ) =
7 + 3π  + 2π  !
5π  + 6π  !
Task 6.2 Given the following transfer function: Task 6.3 Given the following transfer function: Task 7: Differential equations to Transfer functions Task 7.1 Given the following differential equation: π₯ = −0.5π₯ + 2π’ Find the following transfer function: EE4107 -&shy;β Cybernetics Advanced 7 π» π  =
π₯(π )
π’(π )
Task 8: PI Controller A PI controller is defined as: π’(π‘) = πΎ! π +
πΎ!
π!
!
!
πππ Where u is the controller output and π is the control error: π π‘ = π π‘ − π¦(π‘) Task 8.1 Find the transfer function for the PI Controller: π»! π  =
π’(π )
π(π )