Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ELEC0021 2020

Answer ALL questions.

Section A

1. (a)        For the control scheme of Figure 1.1 with

R(s) = ,         P(s) = 

 

Figure 1.1 System block diagram

(i)  If the disturbance d(t) = 2 and the  input T (t) = 0 , find the output signal y  in time domain by using the partial fraction expansion.

[6 marks]

(ii) If the input of the closed loop system T (t) = 4 sin(2t) and the disturbance d(t) = 0 . Show the steady state output of the system.

[6 marks]

(b)        Consider an open-loop transfer function

L(s) = K 

with K > 0, z < 0 . Figure 1.2 shows two Nyquist diagrams of L(s). The left Nyquist plot corresponds to the gain value K = k1  and yields an unstable closed-loop system, the right Nyquist plot corresponds to the gain value K = k2  and yields a stable closed-loop system.

Determine the range of values K yields a stable closed-loop system. Show all your work.

 

Figure 1.2 Nyquist plots of L(s) .

[8 marks]

2.             Consider the plant:

P(s) = 

in a feedback loop with a gain K > 0 .

(a)       Find the range of K for which the system is stable.

[4 marks]

(b)      Add the phase-lead compensator

C(s) = 

to the feedback system. Find the range of K for which the system is stable. Compare the solutions from (a) and (b), comment on your findings.

[6 marks]

(c)       Remove the compensator C(s) provided in (b). Let K = 10, redesign a compensator, C(s) = 

such that the closed-loop system has 5% steady state error due to a unit step input.

[5 marks]

3.      Consider the vertical mechanical system shown in Figure 3.1. A force f(t) is applied downwards to the mass M . X1(t) and X2(t) represent the displacements of the mass and the  point  indicated  in  the  figure,  respectively.  The  system  is  excited  only  by  initial

conditions. Ignore gravity and any other external forces, such as air friction.

 

Figure 3.1 Vertical mechanical system

(a)       Find the transfer function from the applied force to the displacement, X2(t) .

[8 marks]

(b)       Given the transfer function

 = 

Convert it into state-space form given below:

 = Ax(t) + bu(t)

[4 marks]

(c)       If M = 10 kg, K1  = 100 N/m and B = 200 N ∙ s ∙ m- 1 , draw the pole zero diagram for X1(s) when f(t) = cos 2t .

[3 marks]

Section B

Questions should be answered using code in Java, where appropriate, as the relevant Object- Oriented Language.

4. (a)       Why do we say that random numbers in programming languages are effectively pseudo-

random? Write a piece of code that will print a number at random from the following set: 6, 10, 14, 18, 22.

[5 marks]

(b)       Why making instance variables public is not a good practice in object-oriented software

engineering? Which alternative approach does exist and what does it achieve? Give an example of a class that benefits from having its instance variables private or “hidden” .

[5 marks]

(c)       Implement a PowerCalculator class that provides methods to calculate baseexponent for a non-negative exponent in both an iterative and in a recursive manner. Write subsequently an excerpt of code to calculate recursively mn for integers m and n and to print out both the result and the time it has taken to calculate it.

[10 marks]

5.   (a)     Write first pseudo-code and then Java code for the insertAtBack method of the List class

which has a ListNode firstNode instance variable but NOT a lastNode one. What would be the key change if a ListNode lastNode instance variable was also available?

[9 marks]

(b)      Write an excerpt of code that creates a List which contains integer numbers 1 to 10 and

then, based exclusively on the first list, it creates a second one which is a precise copy of the first one but in the reverse order.

[6 marks]

6.     (a)    Explain the difference between a linked list and a stack data structure. When implementing

a stack through a linked list, which linked list instance variable remains unused and why? [3 marks]

(b)   We  would  like  to  store  telephone  directory  records  that  include  various  pieces  of

information for each person, ordered by their concatenated {surname, name, father’s name}. Comment on the advantages and disadvantages of using either a sorted array or an ordered linked list as the candidate data structure for this application. Consider finding a person’s record as the key operation but also consider insertion and removal.

[6 marks]

(c)    The Java code at the end of the question implements the selection sort method of a Sort class that includes a data array of integers instance variable. Assuming we have an initial array of the following 5 integers {7, 12, - 1, 5, 3}, show how the algorithm executes by stating the value of i, the range of j for this value of i, and also the value of smallest and the new content of the data array at the end of each execution of the inner loop.

[6 marks]

public void selectionSort () {

for (int i = 0; i < data.length- 1; i++) {

int smallest = i; // initialised to first index of remaining array

// loop to find smallest element in (i+1)..data.length

for (int j = i+1; j < data.length; j++)

if (data[j] < data[smallest])

smallest = j;

if (smallest != i)  {  // found a smaller element in the rest of the array

int tmp = data[i];

data[i] = data[smallest];  // swap data[i] with data[smallest]

data[smallest] = tmp;

}

}

}

Code Block 6.1 Selection sort method