### Unformatted Attachment Preview

UNIVERSITY COLLEGE DUBLIN
SCHOOL OF ELECTRICAL & ELECTRONIC ENG.
EEEN30150 MODELLING AND SIMULATION
Minor Project I
STATIC EQUATIONS
Solve one of the following problems or one of your own design (subject to approval by module
coordinator). Two of the problems involve relatively extensive visualisation. You should consult the
module notes SIM2 and experiment MS0_2 for useful information. You may submit a report on any
one of the problems. Note, the module is substantially concerned with methods for solving
equations numerically, accordingly a good portion of the grade steps are earned by writing and
reporting good MATLAB code (specifically in the form of a MATLAB function m-file) to solve the
equations arising by means of one (or more) of the methods outlined in the module notes. You will
not earn these grade steps if you employ an in-built MATLAB function (such as inv) or some other
package to solve the equations, nor will you earn them if you solve the equations analytically, in the
event that this is possible.
On the issue of reporting consult experiment MS1 for a description of requirements and consult also
partial sample report. Recall also the comments in introductory laboratory MS0_2 concerning the
development of MATLAB function M-files. A large component of your results, regardless of what
project you elect to do, is comprised of MATLAB function M-files. If you wish to obtain all of the
grade steps assigned to this portion of your work then you must adhere to the requirements that I
have previously imposed: (i) help files must be written, (ii) version information must be present,
(iii) error checking code should be included to ensure greater robustness and reliability, (iv) there
should be no “magic numbers” embedded in the code, (v) names of files and variables should be
well chosen, being descriptive of the function or meaning, (vi) comments should be extensive and
MATLAB function M-files should have greater rather than lesser functionality, meaning for
example that rather than making explicit assumptions concerning parameter values within the code
these might instead be input arguments, (vii) code should not be excessively inefficient or just plain
bad. So for example if a task can be performed with one MATLAB command or with a loop then
the single command should be employed. In general your loops should be few in number or none at
all. You also need to be very careful concerning what code goes into a loop. Commands should only
appear in loops if they absolutely have to. So for example if a parameter p is to be set to 3 then the
command p = 3 needs to be employed but, if this parameter is to stay unchanged throughout then the
assignment p = 3 should not appear inside a loop. If it does and if that loop is executed ten thousand
times then the assignment p = 3 will be executed ten thousand times, where it only needed to be
executed once. This is an example of excessively inefficient code. I do not expect code to the
highest standards from you. For some of you code is relatively new to you and for many others
MATLAB is new to you, hence my use of the word excessively. You will write code which could be
more efficient, that is beyond doubt. But the difference in efficiency between what you achieve and
what can be achieved should not be too high. A certain number of grade steps will be set aside for
the writing of MATLAB function M-files. You may expect to earn at most half of these assigned
grade steps should you ignore entirely the seven requirements listed above.
Where your major results are in the form of audio or video files these files should be included with
your electronic submission. Evaluation of these results will comprise a component of the
assessment.
I follow with some advice which is vague and as such will be of relatively little use to you.
The first step in any real engineering problem, i.e. relatively big problem, is to recognise that there
is no big problem there are in fact lots of smaller problems. Your initial task is to identify these
smaller problems. Some of them will, at the outset, not seem particularly small. Indeed I anticipate
an initial response from many of you that you cannot solve any of the problems listed below. This
response may even be confirmed by individuals whose opinion you respect. My response is, perhaps
you cannot solve any problem completely, but you can get much further than you think. When you
have made an initial breakdown of the problem into smaller problems you will find that there is
commonly an obvious order in which you will need to tackle these problems in the sense that later
sub-problems depend upon the resolution of earlier sub-problems. Actually, obvious or not, it is rare
for this order to be strictly true. Generally “later” sub-problems may depend on the resolution of
earlier problems for their complete solution, but you can sometimes (I hesitate to say often) make
significant progress without having solved the earlier sub-problems. This is because you will find
that the sub-problems themselves can almost always be broken down into smaller problems. So for
example if you are visualising the movement of the mechanical linkage below then you will need to
draw this linkage, which means you will need to draw some links. You can start by writing code to
draw just one link. You do not need to solve any earlier sub-problems to be in a position to take this
step and it is a step which you will clearly have to take in order to fully solve the problem. The subproblem which you should start with is probably the one which seems easiest to you. A lot of
success is down to sticking with it and it is easier to do this when you experience the occasional
minor success along the way. The key is to not panic and decide that it is impossible until you have
actually identified what it involves. Another key is to be aware that I do recognise that you are
learning. I do not expect perfection at this point. I will applaud effort and reward it in the only way
that matters to you, with grades.
Ultimately, to fully solve the problem there is an order of sub-tasks. The first task which will have
to be fully resolved before you can fully resolve the other tasks is to translate the problem as it has
been stated (in somewhat realistic engineering terms) into a mathematical problem. This further
reveals, as laboratory MS1 first revealed, why the term “Modelling” appears in the title of this
module. The task of acquiring a mathematical model of the system is called modelling. A great
difficulty of this module is that I will require you to model, but I will not tell you how. I may give a
few hints, but they will fall far short of a complete description of the process. The reason of course
is because this is exactly what a very large number of your previous modules are supposed to have
already done. My experience is that many of you will not be practiced in this vital first step of
essentially all engineering problems. Many of your previous modules may have focussed too much
on what you do once you have a model of a certain form and not enough on how to get that model
and determine appropriate values for all of the parameters appearing in it. I propose to begin to
rectify that inappropriate focus. Accordingly the practicing of this step will probably be your
greatest challenge. As I know this I am willing to support you in it. You may, without appointment,
ask me any number of questions you please in my office. To reduce queues and to improve
efficiency it would be well if students having similar questions could batch themselves and ask
those questions in groups of four or five, but I will not insist upon this and will do my best to answer
any and all questions that arise. I should observe that what I expect from the TAs assigned to this
module is that they can offer assistance on problems with MATLAB coding and the implementation
of numerical algorithms. I would be asking too much of them I feel were I to expect them to be able
to give support on the modelling task for all of the problems. Individual TAs may indeed be able to
help with this task for specific problems but I think it unlikely that any TA will be able to do so for
all of them. I hope that the majority of you can recognise that this module while challenging for you
is also challenging for the TAs and as such not make unreasonable demands on or have
unreasonable expectations of them. The TAs have been advised that should they feel unable to
respond to a question concerning the modelling task of a particular problem then they should refer
that question to myself. This is in your interests and I ask and expect you to respect a TA for making
such a determination.
Having translated the engineering problem into a purely mathematical problem you should find that
the nature of this problem is to solve a numbers of equations. This you may do by writing your own
code to implement the Regula Falsi, Newton-Raphson, Gaussian elimination or Gauss-Seidel
algorithms. This code should take the form of a number of MATLAB function M-files. The most
critical, core m-files should be submitted as part of your report, i.e. included within the report in
manner of sample report. All of the requirements of MATLAB function M-files noted above will
apply. The only advise here is “reuse, don’t rewrite”. If you have to solve a number of different
equations can you modify your code so that it can be applied to each of the equations so that instead
of writing four or five different but very similar MATLAB function M-files you can write just one
but use it four or five times.
The visualisation will form the last major sub-task. Again the key with regard to the code which
produces the visualisation is “reuse, don’t rewrite”. If you wish to draw a bridge for example write
code to draw a single link located wherever you please and at any chosen angle. Then reuse this
code over and over to produce the bridge. Failure to do this would certainly be counted as
excessively inefficient coding.
The division of grade steps will be roughly one third each (i.e. 7 grade steps each) for modelling,
numerical solution and visualisation/presentation of results. The first problem will of course differ
in this weighting. In reporting you should present the full argument by which you acquired the
mathematical model and present the full set of equations derived (with equations being presented in
proper format and notation). You will need to use a proper equation editor to present these
equations. I emphasise the word full. Partial arguments and partial models (i.e. partial sets of
equations) will earn partial grade steps. For the numerical part full MATLAB function M-files
should be presented along with tabulated data showing the performance of the algorithms. So for
example initial guesses should be reported. Number of steps taken should probably be reported.
Final value should be reported. In most cases a function is supposed to equal zero at this value,
accordingly an indication of what value the function takes at this value in comparison with what
value it had at the outset should also be presented. I emphasise that a table is assuredly the proper
way to present this data. For visualisation, if appropriate, stills of individual frames of an animation
should appear in the report. As both MATLAB function M-files and still frames will have colour
your report will need to be at least partially in colour.
Technical note:
Some versions of MATLAB and Windows do not work well together. For example Windows 7 and
MATLAB R2010b. There is an issue with regard to using the open software opengl. MATLAB
looks to employ opengl as its default rendering software for producing reasonable quality graphics.
Unfortunately Windows 7 will not let MATLAB use opengl properly. You can identify that you
have a problem when none of the graphics commands work the way I say they will. You may avoid
the problem entirely by executing at the outset one of the following commands:
opengl software
or
opengl neverselect
Problem 1: Simple Push-Pull Audio Amplifier.
The purpose of a power amplifier, unsurprisingly, is to amplify power. Given a relatively low power
source the amplifier must essentially replicate the source but at a much higher power level. A
typical application, and the one which we consider here, is in creating an audio amplifier. Audio
sources (such as antennas and microphones) generally provide a very low power, low voltage copy
of the audio signal. A preamplifier stage must be employed to significantly boost the voltage level
of the signal (but not of the noise) and it will be our assumption that this has already been achieved.
We are left with a relatively high voltage but very low power copy of the audio signal. The power
amplifier must produce another copy of the audio signal but with much higher power so that it can
be sent to a speaker with sufficient power to be audible. Although some reduction in the voltage
level can be tolerated, this should not be excessive.
To increase the power delivered to the load (i.e. the speaker) we will employ a complementary
symmetry, push-pull output stage fabricated from discrete components (namely bipolar junction
transistors). The circuit diagram for the amplifier is shown in Figure 1.1. The 25 resistor labelled
R3 models the speaker. The circuit diagram has been drawn with the circuit simulation package
CircuitMaker. Like many packages of its kind it does not show the units for the resistors although of
course these units are . The package also shows the units of micro farad with the symbol uF rather
than the correct symbol F. The input signal is denoted V2 in Figure 1.1, but we denote it v2(t) in
text. The diodes D1 and D2 (both IN4148 diodes) are included for the purposes of eliminating
crossover distortion which occurs if both transistors are off for some period of time. If you already
have sufficient knowledge you may wish to quickly employ a software package such as LTSpice to
get a feel for the performance of the circuit before you undertake this project. Take note however
that LTSpice will employ quite different models for nonlinear components and therefore yield quite
different quantitative descriptions of behaviour.
V1
9V
+V
R1
1k
R3
25
Q1
2N3904
C3
470uF
D1
1N4148
D2
1N4148
R2
100k
V2
-10m/10mV
C1
47uF
Q2
2N3906
Q3
2N3904
10kHz
Figure 1.1: Circuit diagram for complementary symmetry, push-pull power amplifier.
The assumed effect of the capacitors in this case is to block DC. In your analysis you should first
find the operating point, i.e. set the input signal v2(t) to zero, replace all capacitors by open circuits,
analyse resulting circuit and solve resulting equations to find quiescent values of all voltages and
currents. Subsequently you should perform an AC analysis and in this you may replace the
capacitors by short circuits. Justify this by evaluating the impedance of the capacitors at the signal
frequency of 10 kHz.
You may model the speaker by its Thévenin equivalent circuit, namely an input resistance. As
indicated in Figure 1.1 let this resistance equal 25 .
Typical DC input and output characteristics are shown for the 2N3904 and 2N3906 bipolar junction
transistors in Figures 1.2 – 1.5. I have cheated here, generating these characteristics by employing
circuit simulation software. Accordingly they are not experimentally derived and are therefore only
as good as the models incorporated into the software. The devices can handle moderately large
continuous collector currents up to about 200 mA and can safely handle power up to a few watts.
You must choose for yourself how to model these devices, but very simple piecewise linear models
may well be preferable at least for the DC output characteristics. In generating these models it is
useful to know that the quiescent values for the base currents in the transistors are approximately 2.7
mA (for transistor Q1), 3.9 mA (for transistor Q2) and 35 A (for transistor Q3).
The diodes should be modelled similarly. You may for example decide to model them by a
piecewise linear model. You should employ the data given below (or at least a portion of it) to make
sensible selections for values of model parameters. If you choose to employ a piecewise linear
model then it is useful to know that the quiescent current in each of the diodes is approximately 1.1
mA.
Write a MATLAB function M-file to find the operating point and also to find the signal components
of all of the voltages and currents for a given input voltage v2(t). Note that, although the capacitors
imply that the circuit is really described by differential equations, i.e. by dynamic equations, the
hypothesised simple effect of the capacitors permits description by static (or perhaps more
accurately pseudo-static) equations. For a number of input voltage values between -10 mV and 10
mV determine the power (i.e. instantaneous value of voltage multiplied by current) being drawn
from the audio source and the power being delivered to the speaker. Confirm that the circuit has
indeed affected a significant amplification of power. Determine also the power being drawn from
the DC voltage supply. Confirm that this is much greater than the power being drawn from the audio
source. By considering the ratio of the power delivered to the speaker to the power drawn from the
DC supply (which is essentially equal to the power input) estimate the efficiency of the amplifier.
DC characteristic data for IN4148 diode. Clearly you are given a large amount of data, but you do
not have to use it all.
V (mV)
-1000
-600
-400
-200
-150
-100
-50
-40
-30
-20
-10
0
I (pA)
-15.2
-14.79
-14.57
-14.2
-13.9
-12.8
-9.68
-8.27
-6.93
-5.07
-2.67
0
10
20
30
50
100
150
V (mV)
200
250
300
350
380
400
420
440
460
480
V (mV)
500
520
540
560
580
600
620
640
660
680
700
720
740
760
780
V (mV)
800
820
840
860
880
900
920
940
960
980
3.73
8.27
14
30
123
421
I (nA)
1.323
4.16
13.2
40.4
80
128
197
315
496
784
I (A)
1.24
1.94
3.0
4.8
7.56
12
18.88
29.65
46.4
73.6
116
180
284
440
672
I (mA)
1.024
1.547
2.240
3.200
4.480
6.133
8.053
10.29
12.8
15.52
Xa: 850.0m
Yc: 12.00m
A
Xb: 600.0m
Yd: 0.000
a-b: 250.0m
c-d: 12.00m
b
12m
a
c
10m
8m
6m
4m
2m
0
600m
642m
683m
Ref=Ground
Figure 1.2:
Xa: 5.000
Yc: 200.0m
A
Xb: 0.000
Yd:-40.00m
725m
767m
X=41.7m/Div Y=current
808m
d
850m
DC input characteristic (i.e. IB vs VBE) of 2N3904 npn BJT.
a-b: 5.000
c-d: 240.0m
b
200m
a
c
160m
120m
80m
40m
0
-40m
0
833m
1.67
Ref=Ground
2.5
3.33
X=833m/Div Y=current
4.17
5
d
Figure 1.3:
DC output characteristics (i.e. IC vs VCE) of 2N3904 npn BJT.
IB varying from 0.5 mA (lower characteristic) to 5.5 mA (upper characteristic) in steps of 0.5 mA.
Xa: 850.0m
Yc: 36.00m
Xb: 600.0m
Yd: 0.000
a-b: 250.0m
c-d: 36.00m
b
36m
A
a
c
30m
24m
18m
12m
6m
0
600m
642m
683m
Ref=Ground
Figure 1.4:
Xa: 5.000
Yc: 200.0m
A
Xb: 0.000
Yd:-40.00m
725m
767m
X=41.7m/Div Y=current
808m
d
850m
DC input characteristic (i.e. IB vs VEB) of 2N3906 pnp BJT.
a-b: 5.000
c-d: 240.0m
b
200m
a
c
160m
120m
80m
40m
0
-40m
0
833m
1.67
Ref=Ground
2.5
3.33
X=833m/Div Y=current
4.17
5
d
Figure 1.5:
DC output characteristics (i.e. IC vs VCE) of 2N3906 pnp BJT.
IB varying from 0.5 mA (lower characteristic) to 5.5 mA (upper characteristic) in steps of 0.5 mA.
Problem 2: Mechanical linkage for backhoe of Caterpillar (or similar) digger.
By consulting internet create a model for the mechanical linkage system of the backhoe of a
Caterpillar (or similar) backhoe loader.
Figure 2.1:
Figure 2.2:
Caterpillar backhoe.
Simplified schematic showing backhoe mechanism.
Analyse the system presenting equations to describe the performance as the backhoe goes through a
standard digging movement. You may ignore the dynamical effects of motors, pumps, etc and just
treat the problem as pseudo static. In mechanisms of this kind i ...